|
@@ -26,7 +26,7 @@ page_directory_t *current_directory;
|
|
|
/*
|
|
|
* Clone a page directory and its contents.
|
|
|
* (If you do not intend to clone the contents, do it yourself!)
|
|
|
- *
|
|
|
+ *
|
|
|
* @param src Pointer to source directory to clone from.
|
|
|
* @return A pointer to a new directory.
|
|
|
*/
|
|
@@ -485,6 +485,8 @@ void switch_next(void) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+extern void enter_userspace(uintptr_t location, uintptr_t stack);
|
|
|
+
|
|
|
/*
|
|
|
* Enter ring 3 and jump to `location`.
|
|
|
*
|
|
@@ -500,26 +502,7 @@ enter_user_jmp(uintptr_t location, int argc, char ** argv, uintptr_t stack) {
|
|
|
|
|
|
PUSH(stack, uintptr_t, (uintptr_t)argv);
|
|
|
PUSH(stack, int, argc);
|
|
|
-
|
|
|
- asm volatile(
|
|
|
- "mov %1, %%esp\n"
|
|
|
- "pushl $0xDECADE21\n" /* Magic */
|
|
|
- "mov $0x23, %%ax\n" /* Segment selector */
|
|
|
- "mov %%ax, %%ds\n"
|
|
|
- "mov %%ax, %%es\n"
|
|
|
- "mov %%ax, %%fs\n"
|
|
|
- "mov %%ax, %%gs\n"
|
|
|
- "mov %%esp, %%eax\n" /* Stack -> EAX */
|
|
|
- "pushl $0x23\n" /* Segment selector again */
|
|
|
- "pushl %%eax\n"
|
|
|
- "pushf\n" /* Push flags */
|
|
|
- "popl %%eax\n" /* Fix the Interrupt flag */
|
|
|
- "orl $0x200, %%eax\n"
|
|
|
- "pushl %%eax\n"
|
|
|
- "pushl $0x1B\n"
|
|
|
- "pushl %0\n" /* Push the entry point */
|
|
|
- "iret\n"
|
|
|
- : : "m"(location), "r"(stack) : "%ax", "%esp", "%eax");
|
|
|
+ enter_userspace(location, stack);
|
|
|
}
|
|
|
|
|
|
/*
|