_int_restore:
/* pop the page directory from the stack */
- popl %eax
+ popl %edi
/*
* Check if the destination of the iret is in the kernel or user-space.
* In the former case, we can skip rebasing the stack and restoring the
* page directory.
*/
- cmpl %eax, (_kernel_cr3)
+ cmpl %edi, (_kernel_cr3)
je _return_to_kernel
- /* switch page directory first since we'll need the register */
- movl %eax, %cr3
-
cpuidx %ecx
movl $_cpu, %eax
0: subl $1, %ecx
subl OFFSET_TASK_KSTACK(%eax), %ebp
addl $CONFIG_KERNEL_STACK_BASE, %ebp
+ /*
+ * Restore the page directory last since the .bss segement where the _cpu
+ * structure resides is not mapped into the process address space
+ */
+ movl %edi, %cr3
+
_return_to_kernel:
popl %eax
movw %ax, %ds