1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:07:44 +00:00

Kernel/riscv64: Make the kernel compile

This commits inserts TODOs into all necessary places to make the kernel
compile on riscv64!
This commit is contained in:
Sönke Holz 2023-11-02 23:21:09 +01:00 committed by Andrew Kaster
parent b6ac2ed34d
commit da88d766b2
37 changed files with 633 additions and 5 deletions

View file

@ -120,7 +120,7 @@ ErrorOr<void> Coredump::write_elf_header()
elf_file_header.e_ident[EI_MAG1] = 'E';
elf_file_header.e_ident[EI_MAG2] = 'L';
elf_file_header.e_ident[EI_MAG3] = 'F';
#if ARCH(X86_64) || ARCH(AARCH64)
#if ARCH(X86_64) || ARCH(AARCH64) || ARCH(RISCV64)
elf_file_header.e_ident[EI_CLASS] = ELFCLASS64;
#else
# error Unknown architecture
@ -140,6 +140,8 @@ ErrorOr<void> Coredump::write_elf_header()
elf_file_header.e_machine = EM_X86_64;
#elif ARCH(AARCH64)
elf_file_header.e_machine = EM_AARCH64;
#elif ARCH(RISCV64)
elf_file_header.e_machine = EM_RISCV;
#else
# error Unknown architecture
#endif

View file

@ -457,6 +457,20 @@ void signal_trampoline_dummy()
".global asm_signal_trampoline_end\n"
"asm_signal_trampoline_end: \n" ::[sigreturn_syscall_number] "i"(Syscall::SC_sigreturn),
[offset_to_first_register_slot] "i"(offset_to_first_register_slot));
#elif ARCH(RISCV64)
constexpr static auto offset_to_a0_slot = align_up_to(sizeof(__ucontext) + sizeof(siginfo) + sizeof(FPUState) + 3 * sizeof(FlatPtr), 16);
asm(
".global asm_signal_trampoline\n"
"asm_signal_trampoline:\n"
// stack state: 0, ucontext, signal_info (alignment = 16), fpu_state (alignment = 16), ucontext*, siginfo*, signal, handler
// FIXME: Implement this
"unimp\n"
"\n"
".global asm_signal_trampoline_end\n"
"asm_signal_trampoline_end: \n" ::[sigreturn_syscall_number] "i"(Syscall::SC_sigreturn),
[offset_to_first_register_slot] "i"(offset_to_a0_slot));
#else
# error Unknown architecture
#endif
@ -500,6 +514,8 @@ void Process::crash(int signal, Optional<RegisterState const&> regs, bool out_of
constexpr bool userspace_backtrace = false;
#elif ARCH(AARCH64)
constexpr bool userspace_backtrace = true;
#elif ARCH(RISCV64)
constexpr bool userspace_backtrace = true;
#else
# error "Unknown architecture"
#endif