|
发表于 2005-5-11 17:40:56
|
显示全部楼层
84 #define SAVE_ALL \
85 cld; \
86 pushl %es; \
87 pushl %ds; \
88 pushl %eax; \
89 pushl %ebp; \
90 pushl %edi; \
91 pushl %esi; \
92 pushl %edx; \
93 pushl %ecx; \
94 pushl %ebx; \
95 movl $(__USER_DS), %edx; \
96 movl %edx, %ds; \
97 movl %edx, %es;
如果是一个参数,应该放在ebx,如果有两个,应该放在ecx和ebx,......
如下:
324 #define _syscall1(type,name,type1,arg1) \
325 type name(type1 arg1) \
326 { \
327 long __res; \
328 __asm__ volatile ("int $0x80" \
329 : "=a" (__res) \
330 : "0" (__NR_##name),"b" ((long)(arg1))); \
331 __syscall_return(type,__res); \
332 }
333
334 #define _syscall2(type,name,type1,arg1,type2,arg2) \
335 type name(type1 arg1,type2 arg2) \
336 { \
337 long __res; \
338 __asm__ volatile ("int $0x80" \
339 : "=a" (__res) \
340 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \
341 __syscall_return(type,__res); \
342 } |
|