lidt.S 584 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. # lidt
  3. TODO get working:
  4. - http://wiki.osdev.org/Real_Mode
  5. Sets the IDTR through a from a descriptor in memory, and tells the CPU where the IDT is on memory.
  6. Expected outcome: 'ab' gets printed to the screen.
  7. osdev says this is not compatible with older CPUs.
  8. # sidt
  9. Read the descriptor register to memory.
  10. */
  11. #include "common.h"
  12. BEGIN
  13. CLEAR
  14. lidt idt_descriptor
  15. movw $handler, 0x04
  16. mov %cs, 0x06
  17. int $0
  18. PUTC $'b
  19. hlt
  20. idt:
  21. .word 2
  22. .word 4
  23. idt_end:
  24. idt_descriptor:
  25. .word idt_end - idt
  26. .long idt
  27. handler:
  28. PUTC $'a
  29. iret