temp: add define to toggle the use of fw RAM

This commit is contained in:
Daniel Jobson 2024-11-11 12:39:36 +01:00
parent a57178f9d9
commit a65eddbb00
No known key found for this signature in database
GPG Key ID: 3707A9DBF4BB8F1A

View File

@ -10,11 +10,14 @@
#include <stdint.h>
#define USE_FW_RAM_IN_SYSCALL
void inner_syscall(volatile syscall_t *ctx);
void syscall(syscall_t *ctx)
{
#ifdef USE_FW_RAM_IN_SYSCALL
asm volatile("addi x5, sp, 0;" // Save current SP value in x5
"li sp, 0xd0000800;" // Change SP to top of FW_RAM
"addi sp, sp, -4;" // Adjust SP to make space
@ -23,9 +26,11 @@ void syscall(syscall_t *ctx)
: // No outputs
: // No inputs
: "x5", "memory"); // Clobbers
#endif //USE_FW_RAM_IN_SYSCALL
inner_syscall(ctx);
#ifdef USE_FW_RAM_IN_SYSCALL
asm volatile("lui t0, 0xd0000;" // Load the upper 20 bits
"addi t0, t0, 0x7fc;" // Add the lower 12 bits for full
"lw t1, 0(t0);" // Load the word at address in t0 to t1
@ -33,6 +38,7 @@ void syscall(syscall_t *ctx)
: // No outputs
: // No inputs
: "t0", "t1", "memory"); // Clobbers
#endif //USE_FW_RAM_IN_SYSCALL
return;
}