开发者

How to force gcc use int for system calls, not sysenter?

Is it possible to force gcc use int instruction for all the system calls, but not sysenter? This question may sound strange but I have to compile some projects like Python and Firefox this way.

Summary

Thanks to jbcreix, I've downloaded glibc 2.9 source code, and modified the lines in sysdeps/unix/sysv/linux/i386/sysdep.h, to dis开发者_如何学JAVAable use of sysenter by #undef I386_USE_SYSENTER, and it works.


Recompile your C library after replacing sysenter by int 0x80 in syscall.s and link again.

This is not compiler generated code which means you are lucky.

The ultimate origin of the actual syscall is here, as the OP says:

http://cvs.savannah.gnu.org/viewvc/libc/sysdeps/unix/sysv/linux/i386/sysdep.h?root=libc&view=markup

And as I suspected there really was a syscall.S it's just that the glibc sources are a labyrinth.

http://cvs.savannah.gnu.org/viewvc/libc/sysdeps/unix/sysv/linux/i386/syscall.S?root=libc&view=markup

So I think he got it right, asveikau.


You don't modify gcc; you modify libc (or more accurately, recompile it) and the kernel. gcc doesn't emit sysenter instructions; it generates calls to the generic syscall(2) interface, which presents a unified front end to system call entry and exit.

Or, you could use a Pentium; SYSENTER wasn't introduced until PII =]. Note the following KernelTrap link for the interesting methods used by Linux: http://kerneltrap.org/node/531

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜