1 #ifndef PPC_CONTEXT_H 2 #define PPC_CONTEXT_H 3 4 struct context { 5 #define SP_LOC(ctx) (&(ctx)->sp) 6 unsigned long _sp; 7 unsigned long return_addr; 8 unsigned long sp; 9 unsigned long pc; 10 /* General registers */ 11 unsigned long regs[34]; 12 #define REG_R3 3 13 #define REG_R4 7 14 #define REG_R5 8 15 #define REG_R6 9 16 #define REG_R7 10 17 /* Flags */ 18 /* Optional stack contents */ 19 unsigned long param[0]; 20 }; 21 22 /* Create a new context in the given stack */ 23 struct context * 24 init_context(uint8_t *stack, uint32_t stack_size, int num_param); 25 26 /* Switch context */ 27 struct context *switch_to(struct context *); 28 29 /* Holds physical address of boot context */ 30 extern unsigned long __boot_ctx; 31 32 /* This can always be safely used to refer to the boot context */ 33 #define boot_ctx ((struct context *) phys_to_virt(__boot_ctx)) 34 35 #endif /* PPC_CONTEXT_H */ 36