A Total Overhaul on the Lunaix's Virtual Memory Model (#26)
[lunaix-os.git] / lunaix-os / arch / i386 / boot / prologue.S
index ff77ef591def5bb8ab39693a162d87197abde829..f8d59ce14e24ee27045f81efca2fb261eb142ab5 100644 (file)
@@ -3,12 +3,24 @@
 #define __ASM__
 #include <sys/abi.h>
 
 #define __ASM__
 #include <sys/abi.h>
 
+.section .bss
+    .align 16
+    .skip 2048, 0
+    __kinit_stack_top:
+    # TODO 
+    # This stack was too small that corrupt the ambient kernel structures.
+    #  (took me days to figure this out!)
+    # We should spent more time to implement a good strategy to detect such
+    #  run-over (we can check these invariants when we trapped in some non-recoverable
+    #  state and provide good feedback to user)
+
 .section .text
     .global hhk_entry_
     hhk_entry_:
         /*
             欢迎来到虚拟内存的世界! :D
          */
 .section .text
     .global hhk_entry_
     hhk_entry_:
         /*
             欢迎来到虚拟内存的世界! :D
          */
+        movl $__kinit_stack_top, %esp
         andl $stack_alignment, %esp
         subl $16, %esp
         /* 
         andl $stack_alignment, %esp
         subl $16, %esp
         /*