4e8dee51e3
Make GDT a separate table and don't reuse GDT descriptor as unused first field of GDT. Required for separate x86_64 GDT descriptor, pointing to the same GDT. Tested on qemu. Change-Id: I513329b67d49ade1055bc07cf7b93ff2e0131e0b Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/31769 Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
47 lines
1.2 KiB
ArmAsm
47 lines
1.2 KiB
ArmAsm
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
.code32
|
|
.section ".text._gdt_", "ax", @progbits
|
|
|
|
.globl gdt_init
|
|
gdt_init:
|
|
lgdt %cs:gdtptr
|
|
ret
|
|
|
|
.previous
|
|
.align 4
|
|
.globl gdtptr
|
|
gdtptr:
|
|
.word gdt_end - gdt -1 /* compute the table limit */
|
|
.long gdt /* we know the offset */
|
|
|
|
.align 4
|
|
gdt:
|
|
/* selgdt 0, unused */
|
|
.word 0x0000, 0x0000 /* dummy */
|
|
.byte 0x00, 0x00, 0x00, 0x00
|
|
|
|
/* selgdt 0x08, flat code segment */
|
|
.word 0xffff, 0x0000
|
|
.byte 0x00, 0x9b, 0xcf, 0x00 /* G=1 and 0x0f, So we get 4Gbytes
|
|
for limit */
|
|
|
|
/* selgdt 0x10,flat data segment */
|
|
.word 0xffff, 0x0000
|
|
.byte 0x00, 0x93, 0xcf, 0x00
|
|
|
|
/* selgdt 0x18, flat code segment (64-bit) */
|
|
.word 0xffff, 0x0000
|
|
.byte 0x00, 0x9b, 0xaf, 0x00
|
|
|
|
gdt_end:
|