mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-15 02:52:38 +03:00
e1f6ac8860
* Initial aarch64 port * Enable chainload on aarch64 No changes necessary since it's all UEFI anyway. * Add specification for Limine protocol for aarch64 * PROTOCOL: Specify state of information in DT /chosen node * common: Add spinup code for aarch64 * common: Port elf and term to aarch64 * common: Port vmm to aarch64 Also prepare to drop VMM_FLAG_PRESENT on x86. * protos: Port limine boot protocol to aarch64 Also drop VMM_FLAG_PRESENT since we never unmap pages anyway. * test: Add DTB request * PROTOCOL: Port SMP request to aarch64 * cpu: Add cache maintenance functions for aarch64 * protos/limine, sys: Port SMP to aarch64 Also move common asm macros into a header file. * test: Start up APs * vmm: Unify get_next_level and implement large page splitting * protos/limine: Map framebuffer using correct caching mode on AArch64 * CI: Fix GCC build for aarch64 * entry, menu: Replace uses of naked attribute with separate asm file GCC does not understand the naked attribute on aarch64, and didn't understand it for x86 in older versions.
86 lines
1.7 KiB
C
86 lines
1.7 KiB
C
#if defined (__x86_64__) || defined (__i386__)
|
|
|
|
#include <stdint.h>
|
|
#include <sys/gdt.h>
|
|
#include <mm/pmm.h>
|
|
#include <lib/libc.h>
|
|
|
|
static struct gdt_desc gdt_descs[] = {
|
|
{0},
|
|
|
|
{
|
|
.limit = 0xffff,
|
|
.base_low = 0x0000,
|
|
.base_mid = 0x00,
|
|
.access = 0b10011010,
|
|
.granularity = 0b00000000,
|
|
.base_hi = 0x00
|
|
},
|
|
|
|
{
|
|
.limit = 0xffff,
|
|
.base_low = 0x0000,
|
|
.base_mid = 0x00,
|
|
.access = 0b10010010,
|
|
.granularity = 0b00000000,
|
|
.base_hi = 0x00
|
|
},
|
|
|
|
{
|
|
.limit = 0xffff,
|
|
.base_low = 0x0000,
|
|
.base_mid = 0x00,
|
|
.access = 0b10011010,
|
|
.granularity = 0b11001111,
|
|
.base_hi = 0x00
|
|
},
|
|
|
|
{
|
|
.limit = 0xffff,
|
|
.base_low = 0x0000,
|
|
.base_mid = 0x00,
|
|
.access = 0b10010010,
|
|
.granularity = 0b11001111,
|
|
.base_hi = 0x00
|
|
},
|
|
|
|
{
|
|
.limit = 0x0000,
|
|
.base_low = 0x0000,
|
|
.base_mid = 0x00,
|
|
.access = 0b10011010,
|
|
.granularity = 0b00100000,
|
|
.base_hi = 0x00
|
|
},
|
|
|
|
{
|
|
.limit = 0x0000,
|
|
.base_low = 0x0000,
|
|
.base_mid = 0x00,
|
|
.access = 0b10010010,
|
|
.granularity = 0b00000000,
|
|
.base_hi = 0x00
|
|
}
|
|
};
|
|
|
|
#if bios == 1
|
|
__attribute__((section(".realmode")))
|
|
#endif
|
|
struct gdtr gdt = {
|
|
sizeof(gdt_descs) - 1,
|
|
(uintptr_t)gdt_descs,
|
|
#if defined (__i386__)
|
|
0
|
|
#endif
|
|
};
|
|
|
|
#if uefi == 1
|
|
void init_gdt(void) {
|
|
struct gdt_desc *gdt_copy = ext_mem_alloc(sizeof(gdt_descs));
|
|
memcpy(gdt_copy, gdt_descs, sizeof(gdt_descs));
|
|
gdt.ptr = (uintptr_t)gdt_copy;
|
|
}
|
|
#endif
|
|
|
|
#endif
|