【自作】 プログラミング 【してみた】

121081a9 :Anonymous 2011-01-01 21:54
コピペしておく。Linux/i386系用syscallルーチン。dietlibcより。GPLv2だそーな。

.text
.globl syscall
.type syscall,@function

syscall:
movl %esp, %eax
pushl %edi
pushl %esi
pushl %ebx
pushl %ebp
movl 0x08(%eax), %ebx
movl 0x0c(%eax), %ecx
movl 0x10(%eax), %edx
movl 0x14(%eax), %esi
movl 0x18(%eax), %edi
movl 0x1c(%eax), %ebp
movl 0x04(%eax), %eax
int $0x80
cmpl $-255, %eax
jbe .Lret
negl %eax
#mov %eax, errno
sbb %eax, %eax
.Lret:
pop %ebp
pop %ebx
pop %esi
pop %edi
ret
.size syscall, . - syscall
Powered by shinGETsu.