Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Nov 2009 22:29:24 +0200
From:      Mihai =?utf-8?q?Don=C8=9Bu?= <mihai.dontu@gmail.com>
To:        freebsd-questions@freebsd.org
Cc:        David Jackson <norstar39@gmail.com>
Subject:   Re: Problems with FreeBSD assembly
Message-ID:  <200911112229.24468.mihai.dontu@gmail.com>
In-Reply-To: <4AFB13D9.9050507@gmail.com>
References:  <4AFB13D9.9050507@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 11 November 2009 21:43:21 David Jackson wrote:
> I am having great difficulty running a very simple assembler program on
> FreeBSD on x86 in my efforts to learn some assembly programming on
> FreeBSD.  I have tried to compile the following with nasm, however i get
> nothing in response when I attempt to run this program:
> 
>         section .data
>         hello   db      'Hello, World!', 0xa
>         hbytes  equ     $ - hello
> 
>         section .text
>         global  _start
>         _start:
>         push    dword hbytes
>         push    dword hello
>         push    dword 1
>         mov eax,0x4
>         int 0x80
>         add esp,12
> 
>         push    dword 0
>         mov eax,0x1
>         int 0x80
> 
> nasm -f elf -o hello1s.o hello1.s
> ld -s -o hello1s hello1s.o
> 
> ./hello1s prints nothing.
> 

I don't think the kernel is the one that initializes the 0, 1 and 2 file 
descriptors (stdin, stdout and stderr). I think you have to open them 
yourself. I will know for sure when my nasm port finishes installing. :)

-- 
Mihai Donțu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911112229.24468.mihai.dontu>