cynix

x86 UNIX-like OS
git clone git://git.2f30.org/cynix
Log | Files | Refs | README | LICENSE

gdt.c (471B)


      1 /*
      2  *  core/gdt.c
      3  *
      4  *  Copyright (C) 2009 stateless
      5  */
      6 
      7 #include <gdt.h>
      8 #include <common.h>
      9 
     10 extern void gdt_flush(addr_t);
     11 
     12 static uint64_t gdt[] = {
     13 	0x0000000000000000llu,
     14 	0x00cf9a000000ffffllu,
     15 	0x00cf92000000ffffllu,
     16 	0x00cffa000000ffffllu,
     17 	0x00cff2000000ffffllu
     18 };
     19 static struct gdt_selector_t gdt_sel;
     20 
     21 void
     22 initialize_gdt(void)
     23 {
     24 	gdt_sel.limit = (sizeof(struct gdt_selector_t) * len(gdt)) - 1;
     25 	gdt_sel.base = (addr_t)gdt;
     26 	gdt_flush((addr_t)&gdt_sel);
     27 }
     28