kernel: add aarch64 architecture support

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
2025-01-10 17:26:26 +02:00
parent 07abdd9f6c
commit e6933acfb0
62 changed files with 1009 additions and 299 deletions

View File

@@ -182,6 +182,13 @@ enum RelocationTypes
R_X86_64_REX_GOTPCRELX = 42,
R_X86_64_NUM = 43,
R_AARCH64_NONE = 0,
R_AARCH64_COPY = 1024,
R_AARCH64_GLOB_DAT = 1025,
R_AARCH64_JUMP_SLOT = 1026,
R_AARCH64_RELATIVE = 1027,
R_AARCH64_TLS_DTPMOD64 = 1028,
#if defined(__x86_64__)
R_NONE = R_X86_64_NONE,
R_COPY = R_X86_64_COPY,
@@ -200,6 +207,15 @@ enum RelocationTypes
R_DTPMOD64 = R_386_NONE,
R_DTPOFF64 = R_386_NONE,
R_TPOFF64 = R_386_NONE,
#elif defined(__aarch64__)
R_NONE = R_AARCH64_NONE,
R_COPY = R_AARCH64_COPY,
R_GLOB_DAT = R_AARCH64_GLOB_DAT,
R_JMP_SLOT = R_AARCH64_JUMP_SLOT,
R_RELATIVE = R_AARCH64_RELATIVE,
R_DTPMOD64 = R_AARCH64_TLS_DTPMOD64,
R_DTPOFF64 = R_AARCH64_NONE,
R_TPOFF64 = R_AARCH64_NONE,
#endif
};

View File

@@ -151,8 +151,8 @@ __attribute__((naked, used, no_stack_protector)) void _dl_runtime_resolve()
"jmp *%r11\n"); /* Jump to the return value */
#elif defined(__i386__)
#warning "i386 _dl_runtime_resolve not implemented"
#else
#error "Unsupported architecture"
#elif defined(__aarch64__)
#warning "aarch64 not implemented"
#endif
}
@@ -817,6 +817,7 @@ int RelocateHelper(ElfInfo *Info, Elf_Rela *Rela, short IsRel, void **Relocated)
reloc = Info->BaseAddress;
break;
}
#if defined(__amd64__)
case R_DTPOFF64:
{
printf("dl: i don't know what to do with DTPOFF64\n");
@@ -829,6 +830,7 @@ int RelocateHelper(ElfInfo *Info, Elf_Rela *Rela, short IsRel, void **Relocated)
reloc = symAddress + Rela->r_addend;
break;
}
#endif
#endif // __LP64__
default:
{

View File

@@ -128,6 +128,8 @@ __attribute__((naked, used, no_stack_protector)) void _start()
"call _exit\n"); /* Call _exit */
#elif defined(__i386__)
#warning "i386 _start not implemented"
#elif defined(__aarch64__)
#warning "aarch64 _start not implemented"
#else
#error "Unsupported architecture"
#endif