Commit db01b38c authored by Damien George's avatar Damien George
Browse files

leon: In sparcisr, get location to install TA 3 handler from TBR.

The base location of TBR may be different from 0x40000000.
parent 730865d2
......@@ -6,13 +6,25 @@
#include <stdint.h>
#include "leon-common/sparcisr.h"
// This function retrieves the value of the Trap Base Register, to be used
// to install a window flushing trap handler next.
static void TRAP_read_TBR(volatile uint32_t* const tbrPtr) {
asm("mov %0, %%o1" : : "r" (tbrPtr) : "%o1");
asm("rd %%tbr, %%o0" : : : "%o0");
asm("st %o0, [%o1]");
// This function installs the "ta 3" ISR which handles window flushing.
// It is only needed for Edisoft RTEMS 4.8 because the trap handler is not
// included in that version, but it is needed by MicroPython to implement
// setjmp/longjmp calls for exception handling.
void sparc_install_ta_3_window_flush_isr(void) {
extern int sparc_window_flush_trap_handler(void);
uint32_t *m = (uint32_t*)0x40000830;
volatile uint32_t tbr = 0;
tbr &= 0xfffff000;
tbr |= 0x830;
uint32_t *m = (uint32_t*)tbr;
uint32_t addr = (uint32_t)sparc_window_flush_trap_handler;
m[0] = 0xa1480000; // rd %psr, %l0
m[1] = 0x29100000 | (addr >> 10); // sethi %hi(addr), %l4
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment