Advertisement
MichaelPetch

simple protected mode code runner qemu-system-i386

Nov 8th, 2020 (edited)
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. ; File: kernel.asm
  2.  
  3. ; Assemble and link to a Mulitboot ELF executable using:
  4. ; nasm -felf32 kernel.asm -o kernel.o
  5. ; ld -Ttext=0x100000 -melf_i386 kernel.o -o kernel.elf
  6. ;
  7. ; Run in QEMU with:
  8. ; qemu-system-i386 -kernel kernel.elf
  9.  
  10. bits 32
  11. global _start
  12.  
  13. MB1_MAGIC equ 0x1badb002
  14. MB1_FLAGS equ 0x0
  15. MB1_CHECKSUM equ -MB1_MAGIC
  16.  
  17. section .text
  18. align 4
  19. dd MB1_MAGIC
  20. dd MB1_FLAGS
  21. dd MB1_CHECKSUM
  22.  
  23. _start:
  24. ; Insert code here
  25. mov dword [0xb8000], 0x2f4b2f4f
  26.  
  27. ; End with infinite loop
  28. cli
  29. hltloop:
  30. hlt
  31. jmp hltloop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement