sk.h 1.71 KB
#ifndef __SK_CONSTANTS_H
#define __SK_CONSTANTS_H

#include <regdef.h>
#include <asm.h>
#include <PR/R4300.h>

#include <PR/rcp.h>

/* This is ugly, but I can't get the pre-processor to take
 * the '\' char to break up this line. So, for now...
 */
#define SK_ENTRY_AND_RETURN li t0, PHYS_TO_K1(MI_SEC_MODE_REG); .set noreorder; lw t1, (t0); nop; .set reorder; j ra

/* registers saved to stack during NMI */
#define NMI_K0
#define NMI_K1
#define NMI_T0

#define PTR        .word
#define PTRSIZE    4
#define PTRLOG     2
#define NUMSKCALLS 5

/* physical addresses for internal SK */
#define SK_HEAP_INIT_ADDR    0x1fc40000
/* XXX: don't know why the address below won't work for
 *   KSEG0 (didn't try KSEG1). For now lets try temporary
 *   value that works.
 */
// #define SK_STACK_INIT_ADDR   0x1fc50000
#define SK_STACK_INIT_ADDR 0x02000000

/* register saving for SK */
#define SK_API_CONTEXT_SIZE  (14*4)  /* double-word aligned */
#define SK_SP_S0  0
#define SK_SP_S1  4
#define SK_SP_S2  8
#define SK_SP_S3 16
#define SK_SP_S4 20
#define SK_SP_S5 24
#define SK_SP_S6 28
#define SK_SP_S7 32
#define SK_SP_FP 36
#define SK_SP_SP 40
#define SK_SP_GP 44
#define SK_SP_SR 48
#define SK_SP_RA 52

/*
#define SK_API_SAVE        \	
sw	s0, SK_SP_S0(sp);  \
sw	s1, SK_SP_S0(sp);  \
sw	s2, SK_SP_S0(sp);  \
sw	s3, SK_SP_S0(sp);  \
sw	s4, SK_SP_S0(sp);  \
sw	s5, SK_SP_S0(sp);  \
sw	s6, SK_SP_S0(sp);  \
sw	s7, SK_SP_S0(sp);  \
sw	fp, SK_SP_GP(sp);  \
sw	gp, SK_SP_FP(sp);

#define SK_API_RESTORE     \	
lw	s0, SK_SP_S0(sp);  \
lw	s1, SK_SP_S0(sp);  \
lw	s2, SK_SP_S0(sp);  \
lw	s3, SK_SP_S0(sp);  \
lw	s4, SK_SP_S0(sp);  \
lw	s5, SK_SP_S0(sp);  \
lw	s6, SK_SP_S0(sp);  \
lw	s7, SK_SP_S0(sp);  \
lw	fp, SK_SP_GP(sp);  \
lw	gp, SK_SP_FP(sp);
*/

#endif