fw: simplify switch to FW_RAM

This commit is contained in:
Daniel Jobson 2024-10-16 16:02:27 +02:00
parent dd60b7c0ab
commit 9b17edff99
No known key found for this signature in database
GPG key ID: 3707A9DBF4BB8F1A
2 changed files with 10 additions and 24 deletions

View file

@ -12,7 +12,7 @@
void inner_syscall(volatile syscall_t *ctx); void inner_syscall(volatile syscall_t *ctx);
void syscall(volatile syscall_t *ctx) void syscall(syscall_t *ctx)
{ {
asm volatile("addi x5, sp, 0;" // Save current SP value in x5 asm volatile("addi x5, sp, 0;" // Save current SP value in x5
@ -20,33 +20,19 @@ void syscall(volatile syscall_t *ctx)
"addi sp, sp, -4;" // Adjust SP to make space "addi sp, sp, -4;" // Adjust SP to make space
"sw x5, 0(sp);" // Store originally saved SP value "sw x5, 0(sp);" // Store originally saved SP value
// in new stack // in new stack
"addi sp, sp, -4;" // Adjust SP to make space : // No outputs
"sw a0, 0(sp);" // Store the address of *ctx on : // No inputs
// new stack : "x5", "memory"); // Clobbers
::
: "memory");
syscall_t **ctx_local_p = (syscall_t **)0xd00007f8; inner_syscall(ctx);
syscall_t *ctx_local = *ctx_local_p;
htif_puts("Syscall\n");
htif_putinthex((uint32_t)*ctx_local_p);
htif_lf();
htif_putinthex((uint32_t)ctx_local_p);
htif_lf();
htif_hexdump(ctx_local, sizeof(syscall_t));
htif_lf();
inner_syscall(ctx_local);
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
"addi sp,t1, 0;" // Copy the value from t1 to sp "addi sp,t1, 0;" // Copy the value from t1 to sp
:: : // No outputs
: "memory"); : // No inputs
: "t0", "t1", "memory"); // Clobbers
return; return;
} }

View file

@ -33,7 +33,7 @@ enum syscall_cmd {
MGMT_APP_UNREGISTER, MGMT_APP_UNREGISTER,
}; };
void syscall(volatile syscall_t *ctx); void syscall(syscall_t *ctx);
/*int syscall(syscall_t *ctx);*/ /*int syscall(syscall_t *ctx);*/
#endif #endif