freebsd assembly; lseek?

Doing a bit of assembly language programming. For some reason i cant get lseek(2) to function without setting the carry flag. Looking at syscalls.master in freebsd 8.0, it seems syscall 478 is the standard lseek. My program works fine for opening, reading, and writing to the file off the command line, but if i use to following code it sets the carry flag on lseek. Any ideas?


Code:
_start:

pop     eax             ; argc
pop     eax             ; program name
pop     ecx             ; filename to open
jecxz   .titled
pop     eax
or      eax, eax        ; Too many arguments?
jne     .titled

push    dword 2         ; read/write
push    ecx             ; filename
mov     eax,5           ; sycall open
push    eax
int     0x80
jc      .failed

mov     ebp, eax        ; save file descriptor

push    dword 2         ; end of file
push    dword 0         ; from offset 0
push    ebp             l file descriptor
mov     eax,478         ; syscall lseek
push    eax
int     0x80
jc      .failedseek
 
Back
Top