mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-22 05:59:15 +01:00
small exception changes
This commit is contained in:
parent
a22f2efa87
commit
20b23b7f7f
@ -8,6 +8,4 @@ void error_display (const char *fmt, ...) {
|
||||
va_start(args, fmt);
|
||||
EXCEPTION_TRIGGER(TRIGGER_CODE_ERROR);
|
||||
va_end(args);
|
||||
|
||||
while (1);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
#define K1_OFFSET (216)
|
||||
#define GP_OFFSET (224)
|
||||
#define SP_OFFSET (232)
|
||||
#define FP_OFFSET (240)
|
||||
#define S8_OFFSET (240)
|
||||
#define RA_OFFSET (248)
|
||||
#define C0_STATUS_OFFSET (256)
|
||||
#define C0_CAUSE_OFFSET (260)
|
||||
@ -75,7 +75,7 @@ exception_handler:
|
||||
sd $t9, T9_OFFSET($k0)
|
||||
sd $gp, GP_OFFSET($k0)
|
||||
sd $sp, SP_OFFSET($k0)
|
||||
sd $fp, FP_OFFSET($k0)
|
||||
sd $s8, S8_OFFSET($k0)
|
||||
sd $ra, RA_OFFSET($k0)
|
||||
.set at
|
||||
|
||||
@ -141,7 +141,7 @@ exception_restore:
|
||||
ld $t9, T9_OFFSET($k0)
|
||||
ld $gp, GP_OFFSET($k0)
|
||||
ld $sp, SP_OFFSET($k0)
|
||||
ld $fp, FP_OFFSET($k0)
|
||||
ld $s8, S8_OFFSET($k0)
|
||||
ld $ra, RA_OFFSET($k0)
|
||||
.set at
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include "exception.h"
|
||||
#include "exception_regs.h"
|
||||
#include "font.h"
|
||||
#include "io.h"
|
||||
#include "sc64.h"
|
||||
@ -8,53 +9,6 @@
|
||||
#include "vr4300.h"
|
||||
|
||||
|
||||
typedef union {
|
||||
uint64_t u64;
|
||||
struct {
|
||||
uint32_t u32_h;
|
||||
uint32_t u32;
|
||||
};
|
||||
} uint64_32_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_32_t zr;
|
||||
uint64_32_t at;
|
||||
uint64_32_t v0;
|
||||
uint64_32_t v1;
|
||||
uint64_32_t a0;
|
||||
uint64_32_t a1;
|
||||
uint64_32_t a2;
|
||||
uint64_32_t a3;
|
||||
uint64_32_t t0;
|
||||
uint64_32_t t1;
|
||||
uint64_32_t t2;
|
||||
uint64_32_t t3;
|
||||
uint64_32_t t4;
|
||||
uint64_32_t t5;
|
||||
uint64_32_t t6;
|
||||
uint64_32_t t7;
|
||||
uint64_32_t s0;
|
||||
uint64_32_t s1;
|
||||
uint64_32_t s2;
|
||||
uint64_32_t s3;
|
||||
uint64_32_t s4;
|
||||
uint64_32_t s5;
|
||||
uint64_32_t s6;
|
||||
uint64_32_t s7;
|
||||
uint64_32_t t8;
|
||||
uint64_32_t t9;
|
||||
uint64_32_t k0;
|
||||
uint64_32_t k1;
|
||||
uint64_32_t gp;
|
||||
uint64_32_t sp;
|
||||
uint64_32_t fp;
|
||||
uint64_32_t ra;
|
||||
uint32_t sr;
|
||||
uint32_t cr;
|
||||
uint64_32_t epc;
|
||||
} exception_t;
|
||||
|
||||
|
||||
#define EXCEPTION_INTERRUPT (0)
|
||||
#define EXCEPTION_SYSCALL (8)
|
||||
|
||||
@ -271,7 +225,7 @@ void exception_fatal_handler (uint32_t exception_code, uint32_t interrupt_mask,
|
||||
exception_print("s0: 0x%08lX s1: 0x%08lX s2: 0x%08lX s3: 0x%08lX\n", e->s0.u32, e->s1.u32, e->s2.u32, e->s3.u32);
|
||||
exception_print("s4: 0x%08lX s5: 0x%08lX s6: 0x%08lX s7: 0x%08lX\n", e->s4.u32, e->s5.u32, e->s6.u32, e->s7.u32);
|
||||
exception_print("t8: 0x%08lX t9: 0x%08lX k0: 0x%08lX k1: 0x%08lX\n", e->t8.u32, e->t9.u32, e->k0.u32, e->k1.u32);
|
||||
exception_print("gp: 0x%08lX sp: 0x%08lX fp: 0x%08lX ra: 0x%08lX\n\n", e->gp.u32, e->sp.u32, e->fp.u32, e->ra.u32);
|
||||
exception_print("gp: 0x%08lX sp: 0x%08lX s8: 0x%08lX ra: 0x%08lX\n\n", e->gp.u32, e->sp.u32, e->s8.u32, e->ra.u32);
|
||||
|
||||
if (exception_code == EXCEPTION_INTERRUPT) {
|
||||
if (interrupt_mask & INTERRUPT_MASK_TIMER) {
|
||||
|
55
sw/n64/src/exception_regs.h
Normal file
55
sw/n64/src/exception_regs.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef EXCEPTION_REGS_H__
|
||||
#define EXCEPTION_REGS_H__
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
typedef union {
|
||||
uint64_t u64;
|
||||
struct {
|
||||
uint32_t u32_h;
|
||||
uint32_t u32;
|
||||
};
|
||||
} uint64_32_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_32_t zr;
|
||||
uint64_32_t at;
|
||||
uint64_32_t v0;
|
||||
uint64_32_t v1;
|
||||
uint64_32_t a0;
|
||||
uint64_32_t a1;
|
||||
uint64_32_t a2;
|
||||
uint64_32_t a3;
|
||||
uint64_32_t t0;
|
||||
uint64_32_t t1;
|
||||
uint64_32_t t2;
|
||||
uint64_32_t t3;
|
||||
uint64_32_t t4;
|
||||
uint64_32_t t5;
|
||||
uint64_32_t t6;
|
||||
uint64_32_t t7;
|
||||
uint64_32_t s0;
|
||||
uint64_32_t s1;
|
||||
uint64_32_t s2;
|
||||
uint64_32_t s3;
|
||||
uint64_32_t s4;
|
||||
uint64_32_t s5;
|
||||
uint64_32_t s6;
|
||||
uint64_32_t s7;
|
||||
uint64_32_t t8;
|
||||
uint64_32_t t9;
|
||||
uint64_32_t k0;
|
||||
uint64_32_t k1;
|
||||
uint64_32_t gp;
|
||||
uint64_32_t sp;
|
||||
uint64_32_t s8;
|
||||
uint64_32_t ra;
|
||||
uint32_t sr;
|
||||
uint32_t cr;
|
||||
uint64_32_t epc;
|
||||
} exception_t;
|
||||
|
||||
|
||||
#endif
|
@ -1,6 +1,6 @@
|
||||
#include "io.h"
|
||||
#include "exception_regs.h"
|
||||
|
||||
|
||||
void exception_interrupt_handler (uint32_t exception_code, uint32_t interrupt_mask) {
|
||||
void exception_interrupt_handler (uint32_t exception_code, uint32_t interrupt_mask, exception_t *e) {
|
||||
while (1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user