Skip to content

Commit

Permalink
crash: Add RISC-V implementations for all architecture-specific tests
Browse files Browse the repository at this point in the history
Co-authored-by: Sönke Holz <[email protected]>
  • Loading branch information
2 people authored and nico committed Jun 29, 2024
1 parent e11f84f commit 7337ad4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Tests/Kernel/crash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ int main(int argc, char** argv)
(void)makeshift_stack_pointer;
TODO_AARCH64();
#elif ARCH(RISCV64)
(void)makeshift_esp;
TODO_RISCV64();
asm volatile("mv sp, %0" :: "r"(makeshift_stack_pointer));
#else
# error Unknown architecture
#endif
Expand All @@ -237,8 +236,7 @@ int main(int argc, char** argv)
(void)bad_stack_pointer;
TODO_AARCH64();
#elif ARCH(RISCV64)
(void)bad_esp;
TODO_RISCV64();
asm volatile("mv sp, %0" :: "r"(bad_stack_pointer));
#else
# error Unknown architecture
#endif
Expand All @@ -261,8 +259,8 @@ int main(int argc, char** argv)
(void)bad_stack_pointer;
TODO_AARCH64();
#elif ARCH(RISCV64)
(void)bad_esp;
TODO_RISCV64();
asm volatile("mv sp, %0" :: "r"(bad_stack_pointer));
asm volatile("sd zero, (sp)");
#else
# error Unknown architecture
#endif
Expand Down Expand Up @@ -299,8 +297,11 @@ int main(int argc, char** argv)
(void)ptr;
TODO_AARCH64();
#elif ARCH(RISCV64)
(void)ptr;
TODO_RISCV64();
// ret / jalr x0, 0(x1)
ptr[0] = 0x67;
ptr[1] = 0x80;
ptr[2] = 0x00;
ptr[3] = 0x00;
#else
# error Unknown architecture
#endif
Expand All @@ -317,7 +318,7 @@ int main(int argc, char** argv)
#elif ARCH(AARCH64)
TODO_AARCH64();
#elif ARCH(RISCV64)
TODO_RISCV64();
asm volatile("sret");
#else
# error Unknown architecture
#endif
Expand Down

0 comments on commit 7337ad4

Please sign in to comment.