Guest User

Untitled

a guest
Oct 15th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; xandu - a unix like kernel
  2. ; written by Aaron "Dark_Aaron" Blakely, Michael "OoO" Raines, and Daniel "Yay" Heinrichs
  3. ;
  4. ; glue assembly - for
  5.  
  6. global loader               ; make entry point visable to linker
  7. extern kernel_start         ; defined in kernel.c
  8.  
  9. ; setup Multiboot headers for GRUB
  10. MODULEALGIN     equ     1<<0                        ; align loaded modules on page boundaries
  11. MEMINFO         equ     1<<1                        ; provide memory map
  12. FLAGS           equ     MODULEALIGN | MEMINFO       ; this is the Multiboot 'flag' field
  13. MAGIC           equ     0x1BADB002                  ; 'magic number' lets bootloader find the header
  14. CHECKSUM        equ     -(MAGIC + FLAGS)            ; checksum
  15.  
  16. section .text
  17. align 4
  18.  
  19. MultiBootHeader:
  20.     dd  MAGIC
  21.     dd  FLAGS
  22.     dd  CHECKSUM
  23.    
  24. ; reserver inital kernel stack space
  25. STACKSIZE       equ     0x4000          ; 16k
  26.  
  27. loader:
  28.     mov     esp, stack+STACKSIZE        ; setup the stack
  29.     push    eax                         ; pass Multiboot magic number
  30.     push    ebx                         ; pass Multiboot info structure
  31.    
  32.     call    kernel_start                ; call the kernel_start function
  33.     cli
  34.  
  35. hang:
  36.     hlt                                 ; hault the machine, if the kernel returns
  37.     jmp     hang
  38.  
  39. section .bss
  40. align 4
  41. stack:
  42.     resb STACKSTIZE                     ; reserve the kernel stack memory
Add Comment
Please, Sign In to add comment