Assembly executing a long jump with an offset with different syntax

后端 未结 2 2124
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 17:46

I am writing a GDT for a Kernel and all is going well, I\'m following this tutorial.

http://www.osdever.net/bkerndev/Docs/gdt.htm

When link the C code to the

2条回答
  •  一整个雨季
    2020-12-10 18:11

    In addition to Michael's answer, which definitely out-informs mine, this would be my translation:

    .global gdt_flush
    
    gdt_flush:
       movl 4(%esp),%eax
       lgdt (%eax)
    
       movw $0x10, %ax
       movw %ax, %ds
       movw %ax, %es
       movw %ax, %fs
       movw %ax, %gs
       movw %ax, %ss
       jmp  $0x08,$flush
    
    flush:
       ret
    

提交回复
热议问题