我有以下C代码:
/* ctsw.c : context switcher
*/
#include <xeroskernel.h>
void _ISREntryPoint();
static void *k_stack;
static unsigned long *P_ESP;
static unsigned long *ARGS;
void contextinit() {
set_evec(59, (long) _ISREntryPoint);
}
int contextswitch( pcb *p ) {
P_ESP = p->esp;
int retval = p->retval;
__asm __volatile("pushf\n\t"
"pusha\n\t"
"movl %%esp, k_stack\n\t"
"movl P_ESP, %%esp\n\t"
"movl retval, 28(%%esp)\n\t"
"popa\n\t"
"iret\n\t"
"_ISREntryPoint:\n\t"
" pusha\n\t"
" movl %%esp, P_ESP\n\t"
" movl 44(%%esp), ARGS\n\t"
" movl k_stack, %%esp\n\t"
" popa\n\t"
" popf\n\t"
:
:
: "%eax"
);
p->esp = P_ESP;
p->args = ARGS + 1;
return *ARGS;
}
它给了我以下编译错误:
../c/ctsw.c: Assembler messages:
../c/ctsw.c:21: Error: too many memory references for `mov'
../c/ctsw.c:26: Error: too many memory references for `mov'
我做错了什么? mov如何将值注册到静态变量,反之亦然?感谢