NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: MarisO on February 09, 2010, 03:10:13 PM

Title: sysenter vs int 80h
Post by: MarisO on February 09, 2010, 03:10:13 PM
hi

I'd like to use sysenter instead of int 80h but I couldn't find any information on how to do it.  Can you help me ?
Title: Re: sysenter vs int 80h
Post by: Bryant Keller on February 09, 2010, 04:34:43 PM
Here is a decent document I found through Galileo:

http://www.cs.auckland.ac.nz/compsci215s2c/lectures/robert/lecture15.pdf
Title: Re: sysenter vs int 80h
Post by: Keith Kanios on February 09, 2010, 07:44:28 PM
Is this with/for a 32-bit or 64-bit system?
Title: Re: sysenter vs int 80h
Post by: MarisO on February 10, 2010, 02:44:48 PM
32 bit
Title: Re: sysenter vs int 80h
Post by: MarisO on February 10, 2010, 05:12:34 PM
Here is a decent document I found through Galileo:

thanks  that's what I need :-)
Title: Re: sysenter vs int 80h
Post by: MarisO on February 16, 2010, 12:13:59 PM
Still I don't get how to use SYSENTER. Can I use it in my code (in 32 bit Linux)?
I tried to use SYSENTER and the programm segfaults.   I guess it is because CPU doesn't know where to return.  Linux needs to set EDX and ECX before returning (via SYSEXIT), but what does it put in these registers ?

I can't set EDX and ECX myself because it would conflict with , for example, write file syscall.
Code: [Select]
mov eax,4           
mov ebx,1           
mov ecx,msgAddress
mov edx,msgLen
int 80h   ;  SYSENTER here segfaults
Title: Re: sysenter vs int 80h
Post by: Keith Kanios on February 16, 2010, 08:53:05 PM
Read Sysenter Based System Call Mechanism in Linux 2.6 (http://articles.manugarg.com/systemcallinlinux2_6.html).