From 5c292b3d7167022e765c7228b0748cb50ab7d7f1 Mon Sep 17 00:00:00 2001
From: Robert Morris <rtm@csail.mit.edu>
Date: Wed, 31 Aug 2011 05:38:05 -0400
Subject: [PATCH] simplify the end of entry.S

---
 entry.S | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/entry.S b/entry.S
index d228e88..f814aeb 100644
--- a/entry.S
+++ b/entry.S
@@ -51,15 +51,14 @@ entry:
   orl     $(CR0_PG|CR0_WP), %eax
   movl    %eax, %cr0
 
-  # now switch to using addresses above KERNBASE
-  # call addresses are pc-relative so we jump though this hoop:
-  mov     $relocated, %eax
-  jmp     *%eax
-relocated:
-  # Set up the stack pointer and call into C.
+  # Set up the stack pointer.
   movl $(stack + STACK), %esp
-  call main
-spin:
-  jmp spin
+
+  # Call main(), which switches to executing at
+  # high addresses. The indirect call is needed because
+  # the assembler produces a PC-relative instruction
+  # for a direct call. 
+  mov $main, %eax
+  jmp *%eax
 
 .comm stack, STACK
-- 
GitLab