- 论坛徽章:
- 0
|
项目就要到期了,结果,别人的代码还没有看懂,请各位大虾帮帮忙:
下面的代码中,我对汇编部分不懂。请你们指点,在线等:
再 laio_api.c中:
int
laio_syscall(int number, ...)
{
if (!_setjmp(sched_data.env)) {
assert(current_thread);
sched_data.mb.km_curthread = current_thread;
thread_desc = current_thread;
//rv = syscall(number, arg_list);
//the asm code here
{asm (
" \
pop %ecx; \
pop %eax; \
push %ecx; \
int $0x80; \
push %ecx; \
jb 1f; \
jmp 2f; \
1: \
pushl %ebx; \
call 1f; \
1: \
popl %ebx; \
addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx; \
jmp .cerror@PLT; \
2: \
");
}
sched_data.mb.km_curthread = NULL;
thread_desc = (void *) 0;
asm("ret");
assert(0);
}
else {
laio_desc_bg = thread_desc;
errno = EINPROGRESS;
return (-1);
}
/* does not come here */
assert(0);
return (0);
}
在 laio_syscall.S中
/* $Id: laio_syscall.S,v 1.4 2004/01/13 00:18:26 anupamc Exp $ */
/*
.LC0:
.string "env = %p\n"
*/
.text
.p2align 2,,3
.globl laio_syscall
.type laio_syscall, @function
laio_syscall:
/*
pushl $sched_data+96
pushl $.LC0
call printf
addl $8, %esp
*/
pushl $sched_data+96
call _setjmp
addl $4, %esp
testl %eax, %eax
jne .L2
movl current_thread, %eax
movl %eax, sched_data+4
movl (%esp), %eax
movl %eax, foo
movl $.L1, (%esp)
jmp syscall
.L1:
movl $0, sched_data+4
.L3:
jmp *foo
.L2:
call __error
movl $36, (%eax)
movl $-1, %eax
jmp .L3
.size laio_syscall, .-laio_syscall
很着急,多谢了。
[ 本帖最后由 ericazhangjun 于 2006-11-21 13:05 编辑 ] |
|