Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 04 Mar 2000 05:48:51 -0500
From:      "Thomas M. Sommers" <tms2@mail.ptd.net>
To:        freebsd-hackers@freebsd.org
Subject:   Can't write to stdout in assembly
Message-ID:  <38C0EA12.A4252C20@mail.ptd.net>

next in thread | raw e-mail | index | archive | help
From what I understand, the following should print "Hello, world." on
stdout. I stole the code from the Linux HOWTO, but I think it should
work on FreeBSD as well. Instead, the call to write returns 9 (EBADF).

.data
msg:		.string "Hello, world.\n"
		len = . - msg - 1
.text
		global _start
_start:	
		movl	$4, %eax
		movl	$1, %ebx
		movl	$msg, %ecx
		movl	$len, %edx
		int	$0x80

		movl	$1, %eax
		xorl	%ebx, %ebx
		int	$0x80

Can anyone explain what I've done wrong?

As a related question, can anyone point me to the source for the int
0x80 handler? I've looked all over but can't find it.

Thanks.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38C0EA12.A4252C20>