Hi all,

I am having trouble wrapping my head around chapter 5.
 Every time I write a program that opens files, I get
a segmentation fault.  I am trying to keep it as
simple as possible with the following code:

Note: the program is named test.s and you give the
name of the file you wish to create like so:  ./test.s
create.txt

###########################
..section .data
..section .bss
..lcomm BUFFER, 500
..section .text
..globl _start
_start:
  
  movl %esp, %ebp  #setup for referencing the stack
  
  #Open/Create the file we are writing to
  movl $5, %eax
  movl 8( %ebp ), %ebx
  movl $03101, %ecx
  movl $0666, %edx
  int $0x80
  movl ( %eax ), %ebx    #save the fd

  #close the file
  movl $6, %eax
  int $0x80
########################

The file gets created, however, I get a segmentation
fault.  If anyone could tell me why I am getting these
segmentation faults, it would be greatly appreciated.

Liam




      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs



_______________________________________________
Pgubook-readers mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/pgubook-readers

Reply via email to