mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-01-26 15:27:16 -05:00
temp: add define to toggle the use of fw RAM
This commit is contained in:
parent
a57178f9d9
commit
a65eddbb00
@ -10,11 +10,14 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define USE_FW_RAM_IN_SYSCALL
|
||||||
|
|
||||||
void inner_syscall(volatile syscall_t *ctx);
|
void inner_syscall(volatile syscall_t *ctx);
|
||||||
|
|
||||||
void syscall(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
|
asm volatile("addi x5, sp, 0;" // Save current SP value in x5
|
||||||
"li sp, 0xd0000800;" // Change SP to top of FW_RAM
|
"li sp, 0xd0000800;" // Change SP to top of FW_RAM
|
||||||
"addi sp, sp, -4;" // Adjust SP to make space
|
"addi sp, sp, -4;" // Adjust SP to make space
|
||||||
@ -23,9 +26,11 @@ void syscall(syscall_t *ctx)
|
|||||||
: // No outputs
|
: // No outputs
|
||||||
: // No inputs
|
: // No inputs
|
||||||
: "x5", "memory"); // Clobbers
|
: "x5", "memory"); // Clobbers
|
||||||
|
#endif //USE_FW_RAM_IN_SYSCALL
|
||||||
|
|
||||||
inner_syscall(ctx);
|
inner_syscall(ctx);
|
||||||
|
|
||||||
|
#ifdef USE_FW_RAM_IN_SYSCALL
|
||||||
asm volatile("lui t0, 0xd0000;" // Load the upper 20 bits
|
asm volatile("lui t0, 0xd0000;" // Load the upper 20 bits
|
||||||
"addi t0, t0, 0x7fc;" // Add the lower 12 bits for full
|
"addi t0, t0, 0x7fc;" // Add the lower 12 bits for full
|
||||||
"lw t1, 0(t0);" // Load the word at address in t0 to t1
|
"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 outputs
|
||||||
: // No inputs
|
: // No inputs
|
||||||
: "t0", "t1", "memory"); // Clobbers
|
: "t0", "t1", "memory"); // Clobbers
|
||||||
|
#endif //USE_FW_RAM_IN_SYSCALL
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user