Assembly Syscall Question
From: Ryan Sommers (ryans_at_gamersimpact.com)
Date: 07/31/03
- Previous message: Tony Maher: "isp/ispfw"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: freebsd-hackers@freebsd.org Date: Thu, 31 Jul 2003 16:12:27 -0400
When making a system call to the kernel why is it necessary to push the
syscall value onto the stack when you don't call another function?
Example:
access.the.bsd.kernel:
int 80h
ret
func:
mov eax, 4 ; Write
call access.the.bsd.kernel
; End
Works. However:
func:
mov eax, 4 ; Write
int 80h
; End
Doesn't.
Now, if you change it to:
func:
mov eax, 4 ; Write
push eax
int 80h
; End
It does work. I was able to find, "By default, the FreeBSD kernel uses the C
calling convention. Further, although the kernel is accessed using int 80h,
it is assumed the program will call a function that issues int 80h, rather
than issuing int 80h directly," in the developer's handbook. But I can't
figure out why the second example doesn't work. Is the call instruction
pushing the value onto the stack in addition to pushing the instruction
pointer on?
Thank you in advance.
PS I'm not on the list.
--
Ryan "leadZERO" Sommers
Gamer's Impact President
ryans@gamersimpact.com
ICQ: 1019590
AIM/MSN: leadZERO
-= http://www.gamersimpact.com =-
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
- Previous message: Tony Maher: "isp/ispfw"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|