/*
* Initialize kernel GDT.
* Copyright (c) 2001,2004 David H. Hovemeyer <daveho@cs.umd.edu>
- * $Revision: 1.1 $
+ * $Revision: 1.4 $
*
* This is free software. You are permitted to use,
* redistribute, and modify it as specified in the file "COPYING".
#include <geekos/gdt.h>
#include <libc/string.h>
+#include <geekos/debug.h>
/*
* This is defined in lowlevel.asm.
/*
* This is the kernel's global descriptor table.
*/
-struct Segment_Descriptor *s_GDT=(struct Segment_Descriptor *)GDT_LOCATION;
-
+struct Segment_Descriptor s_GDT[NUM_GDT_ENTRIES];
/*
* Number of allocated GDT entries.
*/
void DumpGDT()
{
int i;
- Print("GDT Contents:\n");
+ PrintBoth("GDT Contents:\n");
for (i=0;i<NUM_GDT_ENTRIES;i++) {
if (s_GDT[i].present) {
- Print("%d: base=%u, limit=%u, sizeLow=%u, baseLow=%u, type=%u, system=%u, dpl=%u, preent=%u, sizeHigh=%u, avail=%u, reserved=%u, dbBit=%u, granularity=%u, baseHigh=%u\n",
+ PrintBoth("%d: base=%u, limit=%u, sizeLow=%u, baseLow=%u, type=%u, system=%u, dpl=%u, preent=%u, sizeHigh=%u, avail=%u, reserved=%u, dbBit=%u, granularity=%u, baseHigh=%u\n",
i,
(s_GDT[i].baseHigh<<24) + s_GDT[i].baseLow,
(s_GDT[i].sizeHigh<<16) + s_GDT[i].sizeLow,
s_GDT[i].granularity,
s_GDT[i].baseHigh );
} else {
- Print("%d: Not Present\n",i);
+ PrintBoth("%d: Not Present\n",i);
}
}
}
struct Segment_Descriptor* desc;
int i;
- Print("GDT Placed at %x, %d entries\n",GDT_LOCATION,NUM_GDT_ENTRIES);
KASSERT(sizeof(struct Segment_Descriptor) == 8);
);
KASSERT(Get_Descriptor_Index(desc) == (KERNEL_DS >> 3));
+ Print("GDT: Base=0x%.8x, limit=%d\n", (uint_t)gdtBaseAddr, (uint_t)(sizeof(struct Segment_Descriptor) * NUM_GDT_ENTRIES));
+
/* Activate the kernel GDT. */
limitAndBase[0] = sizeof(struct Segment_Descriptor) * NUM_GDT_ENTRIES;
limitAndBase[1] = gdtBaseAddr & 0xffff;