1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-11-05 15:24:38 +02:00
iris/mips.hhp

84 lines
2.1 KiB
Plaintext
Raw Normal View History

2009-05-18 10:30:27 +03:00
#pypp 0
#ifndef _ARCH_HH
#define _ARCH_HH
2009-05-22 23:48:49 +03:00
#ifdef ARCH
#define reg_hack(x...) #x
#define cp0_get(reg, target) do { __asm__ volatile ("mfc0 %0, $" reg_hack(reg) : "=r" (target)); } while (0)
#define cp0_set(reg, value) do { __asm__ volatile ("mtc0 %0, $" reg_hack(reg) :: "r" (value)); } while (0)
#define cp0_set0(reg) do { __asm__ volatile ("mtc0 $zero, $" reg_hack(reg)); } while (0)
// cp0 registers.
#define CP0_INDEX 0
#define CP0_RANDOM 1
#define CP0_ENTRY_LO0 2
#define CP0_ENTRY_LO1 3
#define CP0_CONTEXT 4
#define CP0_PAGE_MASK 5
#define CP0_WIRED 6
#define CP0_BAD_V_ADDR 8
#define CP0_COUNT 9
#define CP0_ENTRY_HI 10
#define CP0_COMPARE 11
#define CP0_STATUS 12
#define CP0_CAUSE 13
#define CP0_EPC 14
#define CP0_P_R_ID 15
#define CP0_CONFIG 16
#define CP0_CONFIG1 16, 1
#define CP0_CONFIG2 16, 2
#define CP0_CONFIG3 16, 3
#define CP0_L_L_ADDR 17
#define CP0_WATCH_LO 18
#define CP0_WATCH_HI 19
#define CP0_DEBUG 23
#define CP0_DEPC 24
#define CP0_PERF_CNT 25
#define CP0_ERR_CTL 26
#define CP0_CACHE_ERR 27
#define CP0_TAG_LO 28, 0
#define CP0_DATA_LO 28, 1
#define CP0_TAG_HI 29, 0
#define CP0_DATA_HI 29, 1
#define CP0_ERROR_EPC 30
#define CP0_DESAVE 31
#endif
2009-05-19 00:18:23 +03:00
#define PAGE_BITS (12)
#define PAGE_SIZE (1 << PAGE_BITS)
#define PAGE_MASK (~(PAGE_SIZE - 1))
2009-05-18 10:30:27 +03:00
struct Thread_arch:
unsigned at, v0, v1, a0, a1, a2, a3
unsigned t0, t1, t2, t3, t4, t5, t6, t7, t8, t9
2009-05-22 23:48:49 +03:00
unsigned s0, s1, s2, s3, s4, s5, s6, s7
2009-05-18 10:30:27 +03:00
unsigned gp, fp, ra, hi, lo, k0, k1
struct Memory_arch:
unsigned asid
2009-05-20 23:07:56 +03:00
unsigned **directory
2009-05-19 00:18:23 +03:00
2009-05-18 10:30:27 +03:00
EXTERN unsigned g_asid
// Functions which can be called from assembly must not be mangled.
extern "C":
// Kernel entry points, called from entry.S.
Thread *interrupt (Thread *current)
Thread *cache_error (Thread *current)
Thread *exception (Thread *current)
Thread *tlb_refill (Thread *current, unsigned EntryHi)
#ifdef INIT
// Initialize most things (the rest is done in boot.S)
void init ()
// Start running the idle task for the first time.
void run_idle (Thread *self)
#endif
2009-05-22 23:48:49 +03:00
#ifdef INIT
// This is "extern", not "EXTERN", because it really is defined elsewhere.
extern unsigned thread_start[NUM_THREADS + 1]
#endif
2009-05-20 23:07:56 +03:00
#endif