Skip to content
Snippets Groups Projects
Select Git revision
  • 48e5f8abe4da9c3e6cb2b7efe6558bc466b4ea09
  • master default protected
2 results

jupyter-cpu.def

Blame
  • stack.h 2.86 KiB
    #ifndef _SPARC_STACK_H_
    #define _SPARC_STACK_H_
    
    #ifndef __ASSEMBLY__
    #include <kernel/types.h>
    #endif /* !(__ASSEMBLY__) */
    
    #include <asm/win.h>
    
    
    /* stack frame offsets */
    #define SF_L0     0x00
    #define SF_L1     0x04
    #define SF_L2     0x08
    #define SF_L3     0x0c
    #define SF_L4     0x10
    #define SF_L5     0x14
    #define SF_L6     0x18
    #define SF_L7     0x1c
    #define SF_I0     0x20
    #define SF_I1     0x24
    #define SF_I2     0x28
    #define SF_I3     0x2c
    #define SF_I4     0x30
    #define SF_I5     0x34
    #define SF_FP     0x38
    #define SF_PC     0x3c
    #define SF_RETP   0x40
    #define SF_XARG0  0x44
    #define SF_XARG1  0x48
    #define SF_XARG2  0x4c
    #define SF_XARG3  0x50
    #define SF_XARG4  0x54
    #define SF_XARG5  0x58
    #define SF_XXARG  0x5c
    
    #define UREG_G0        0
    #define UREG_G1        1
    #define UREG_G2        2
    #define UREG_G3        3
    #define UREG_G4        4
    #define UREG_G5        5
    #define UREG_G6        6
    #define UREG_G7        7
    #define UREG_I0        8
    #define UREG_I1        9
    #define UREG_I2        10
    #define UREG_I3        11
    #define UREG_I4        12
    #define UREG_I5        13
    #define UREG_I6        14
    #define UREG_I7        15
    #define UREG_FP        UREG_I6
    #define UREG_RETPC     UREG_I7
    
    /* These for pt_regs. */
    #define PT_PSR    0x0
    #define PT_PC     0x4
    #define PT_NPC    0x8
    #define PT_Y      0xc
    #define PT_G0     0x10
    #define PT_WIM    PT_G0
    #define PT_G1     0x14
    #define PT_G2     0x18
    #define PT_G3     0x1c
    #define PT_G4     0x20
    #define PT_G5     0x24
    #define PT_G6     0x28
    #define PT_G7     0x2c
    #define PT_I0     0x30
    #define PT_I1     0x34
    #define PT_I2     0x38
    #define PT_I3     0x3c
    #define PT_I4     0x40
    #define PT_I5     0x44
    #define PT_I6     0x48
    #define PT_FP     PT_I6
    #define PT_I7     0x4c
    
    
    
    #define STACK_ALIGN 8
    #define STACKFRAME_SZ	96
    #define PTREG_SZ	80
    
    #ifndef __ASSEMBLY__
    
    /* SPARC v8 cpu registers not part of a regular stack frame that we need in
     * a trap frame to store the state of the CPU at the time of the trap.
     */
    struct pt_regs {
            uint32_t psr;
            uint32_t pc;
            uint32_t npc;
            uint32_t y;
            uint32_t u_regs[16]; /* globals and outs */
    };
    
    compile_time_assert(sizeof(struct pt_regs) == PTREG_SZ,
    		    SPARC__CPU_REG_SIZE_INVALID);
    
    struct leon_reg_win {
            uint32_t locals[8];
            uint32_t ins[8];
    };
    
    /* a stack frame */
    struct sparc_stackf {
            uint32_t             locals[8];
            uint32_t             ins[6];
            struct sparc_stackf *fp;	 /* %i6 == %fp */
            uint32_t             callers_pc; /* %i7 == return %pc */
            uint8_t             *structptr;
            uint32_t             xargs[6];
            uint32_t             xxargs[1];
    	/* everyting allocated on the stack follows here */
    };
    
    compile_time_assert(sizeof(struct sparc_stackf) == STACKFRAME_SZ,
    		    SPARC__STACK_FRAME_SIZE_INVALID);
    
    
    int stack_migrate(void *sp, void *stack_top_new);
    
    #endif /* !(__ASSEMBLY__) */
    
    
    #endif /* _SPARC_STACK_H_ */