hw_x86_64: Declare Global Descriptor Table (GDT) in .data

The table specifies a 64-bit code segment descriptor at index 1, a
64-bit data segment descriptor at index 2 and a task segment descriptor
at index 3.
This commit is contained in:
Reto Buerki 2015-02-11 16:29:06 +01:00 committed by Christian Helmuth
parent 59bba7624f
commit 27191b17ce

View File

@ -117,3 +117,35 @@
.quad 0
.quad 0x20018f
.fill 510, 8, 0x0
/*******************************************
** Global Descriptor Table **
** See Intel SDM Vol. 3A, section 3.5.1. **
*******************************************/
.align 4
.space 2
_gdt_ptr:
.word _gdt_end - _gdt_start - 1 /* limit */
.long _gdt_start /* base address */
.align 8
_gdt_start:
/* Null descriptor */
.quad 0
/* 64-bit code segment descriptor */
.long 0
/* GDTE_LONG | GDTE_PRESENT | GDTE_CODE | GDTE_NON_SYSTEM */
.long 0x209800
/* 64-bit data segment descriptor */
.long 0
/* GDTE_LONG | GDTE_PRESENT | GDTE_TYPE_DATA_A | GDTE_TYPE_DATA_W | GDTE_NON_SYSTEM */
.long 0x209300
/* Task segment descriptor */
.long 0
/* GDTE_PRESENT | GDTE_SYS_TSS */
.long 0x8900
.long 0
.long 0
_gdt_end: