kernel

hobby kernel
git clone git://git.evenfri.duckdns.org/kernel.git
Log | Files | Refs | README | LICENSE

gdt.s (460B)


      1 .global gdt_init
      2 .section .data
      3 .align 4
      4 
      5 gdt_desc:
      6   .word gdt_end - gdt - 1 # limit
      7   .long gdt # start
      8 
      9 gdt:
     10 gdt_null:
     11   .long 0x00000000
     12   .long 0x00000000
     13 
     14 gdt_code:
     15   .long 0x0000ffff
     16   .long 0x00cf9a00
     17 
     18 gdt_data:
     19   .long 0x0000ffff
     20   .long 0x00cf9200
     21 
     22 gdt_end:
     23 
     24 .section .text
     25 
     26 gdt_init:
     27   lgdt (gdt_desc)
     28 
     29   movw $0x10, %ax
     30   movw %ax, %ds
     31   movw %ax, %es
     32   movw %ax, %fs
     33   movw %ax, %gs
     34   movw %ax, %ss
     35 
     36   ljmp $0x08, $.clean_pipe
     37 
     38 .clean_pipe:
     39   ret