[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pgubook-readers] Problems with Chapter5 Concepts
From: |
Liam |
Subject: |
[Pgubook-readers] Problems with Chapter5 Concepts |
Date: |
Tue, 13 Nov 2007 07:29:21 -0800 (PST) |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pgubook-readers] Problems with Chapter5 Concepts,
Liam <=