Change cpu_switch to explicitly popl the callers program counter and
pushl that of the new process, rather than doing a movl (%esp) and assuming that the stack has been setup right. This make the initial stack setup slightly more sane, and will make it easier to stick an interrupted process onto the run queue without its knowing.
This commit is contained in:
parent
f7e4c19113
commit
d33c1d168c
@ -103,8 +103,7 @@ ENTRY(cpu_switch)
|
||||
|
||||
movl P_ADDR(%ecx),%edx
|
||||
|
||||
movl (%esp),%eax /* Hardware registers */
|
||||
movl %eax,PCB_EIP(%edx)
|
||||
popl PCB_EIP(%edx) /* Hardware registers */
|
||||
movl %ebx,PCB_EBX(%edx)
|
||||
movl %esp,PCB_ESP(%edx)
|
||||
movl %ebp,PCB_EBP(%edx)
|
||||
@ -254,8 +253,7 @@ sw1b:
|
||||
movl PCB_EBP(%edx),%ebp
|
||||
movl PCB_ESI(%edx),%esi
|
||||
movl PCB_EDI(%edx),%edi
|
||||
movl PCB_EIP(%edx),%eax
|
||||
movl %eax,(%esp)
|
||||
pushl PCB_EIP(%edx)
|
||||
|
||||
#ifdef SMP
|
||||
#ifdef GRAB_LOPRIO /* hold LOPRIO for INTs */
|
||||
|
@ -103,8 +103,7 @@ ENTRY(cpu_switch)
|
||||
|
||||
movl P_ADDR(%ecx),%edx
|
||||
|
||||
movl (%esp),%eax /* Hardware registers */
|
||||
movl %eax,PCB_EIP(%edx)
|
||||
popl PCB_EIP(%edx) /* Hardware registers */
|
||||
movl %ebx,PCB_EBX(%edx)
|
||||
movl %esp,PCB_ESP(%edx)
|
||||
movl %ebp,PCB_EBP(%edx)
|
||||
@ -254,8 +253,7 @@ sw1b:
|
||||
movl PCB_EBP(%edx),%ebp
|
||||
movl PCB_ESI(%edx),%esi
|
||||
movl PCB_EDI(%edx),%edi
|
||||
movl PCB_EIP(%edx),%eax
|
||||
movl %eax,(%esp)
|
||||
pushl PCB_EIP(%edx)
|
||||
|
||||
#ifdef SMP
|
||||
#ifdef GRAB_LOPRIO /* hold LOPRIO for INTs */
|
||||
|
@ -168,7 +168,7 @@ cpu_fork(p1, p2, flags)
|
||||
pcb2->pcb_edi = 0;
|
||||
pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */
|
||||
pcb2->pcb_ebp = 0;
|
||||
pcb2->pcb_esp = (int)p2->p_md.md_regs - sizeof(void *);
|
||||
pcb2->pcb_esp = (int)p2->p_md.md_regs;
|
||||
pcb2->pcb_ebx = (int)p2; /* fork_trampoline argument */
|
||||
pcb2->pcb_eip = (int)fork_trampoline;
|
||||
/*
|
||||
|
@ -103,8 +103,7 @@ ENTRY(cpu_switch)
|
||||
|
||||
movl P_ADDR(%ecx),%edx
|
||||
|
||||
movl (%esp),%eax /* Hardware registers */
|
||||
movl %eax,PCB_EIP(%edx)
|
||||
popl PCB_EIP(%edx) /* Hardware registers */
|
||||
movl %ebx,PCB_EBX(%edx)
|
||||
movl %esp,PCB_ESP(%edx)
|
||||
movl %ebp,PCB_EBP(%edx)
|
||||
@ -254,8 +253,7 @@ sw1b:
|
||||
movl PCB_EBP(%edx),%ebp
|
||||
movl PCB_ESI(%edx),%esi
|
||||
movl PCB_EDI(%edx),%edi
|
||||
movl PCB_EIP(%edx),%eax
|
||||
movl %eax,(%esp)
|
||||
pushl PCB_EIP(%edx)
|
||||
|
||||
#ifdef SMP
|
||||
#ifdef GRAB_LOPRIO /* hold LOPRIO for INTs */
|
||||
|
@ -168,7 +168,7 @@ cpu_fork(p1, p2, flags)
|
||||
pcb2->pcb_edi = 0;
|
||||
pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */
|
||||
pcb2->pcb_ebp = 0;
|
||||
pcb2->pcb_esp = (int)p2->p_md.md_regs - sizeof(void *);
|
||||
pcb2->pcb_esp = (int)p2->p_md.md_regs;
|
||||
pcb2->pcb_ebx = (int)p2; /* fork_trampoline argument */
|
||||
pcb2->pcb_eip = (int)fork_trampoline;
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user