#ifndef _POWERPC_FRAME_H_
#define _POWERPC_FRAME_H_
#include <machine/types.h>
#ifdef _KERNEL_OPT
#include "opt_ppcarch.h"
#endif
struct reg_sans_pc {
__register_t r_fixreg[32];
__register_t r_lr;
uint32_t r_cr;
uint32_t r_xer;
__register_t r_ctr;
};
#ifdef _LP64
struct reg_sans_pc32 {
__register32_t r_fixreg[32];
__register32_t r_lr;
uint32_t r_cr;
uint32_t r_xer;
__register32_t r_ctr;
};
#endif
struct utrapframe {
__register_t fixreg[32];
__register_t lr;
int cr;
int xer;
__register_t ctr;
__register_t srr0;
__register_t srr1;
int vrsave;
int mq;
int spare;
};
struct clockframe {
__register_t cf_srr0;
__register_t cf_srr1;
int cf_idepth;
};
#ifdef _LP64
struct clockframe32 {
__register32_t cf_srr0;
__register32_t cf_srr1;
int cf_idepth;
};
#endif
struct trapframe {
struct reg_sans_pc tf_ureg;
struct clockframe tf_cf;
uint32_t tf_exc;
#if defined(PPC_OEA) || defined(PPC_OEA64) || defined(PPC_OEA64_BRIDGE)
__register_t tf_dar;
__register_t tf_pad0[2];
uint32_t tf_dsisr;
uint32_t tf_vrsave;
uint32_t tf_mq;
uint32_t tf_pad1[1];
#endif
#if defined(PPC_BOOKE) || defined(PPC_IBM4XX)
__register_t tf_dear;
__register_t tf_mcar;
__register_t tf_sprg1;
uint32_t tf_esr;
uint32_t tf_mcsr;
uint32_t tf_pid;
uint32_t tf_spefscr;
#endif
};
#ifdef _LP64
struct trapframe32 {
struct reg_sans_pc32 tf_ureg;
struct clockframe32 tf_cf;
uint32_t tf_exc;
#if defined(PPC_OEA) || defined(PPC_OEA64) || defined(PPC_OEA64_BRIDGE)
__register32_t tf_dar;
__register32_t tf_pad0[2];
uint32_t tf_dsisr;
uint32_t tf_vrsave;
uint32_t tf_mq;
uint32_t tf_pad1[1];
#endif
#if defined(PPC_BOOKE) || defined(PPC_IBM4XX)
__register32_t tf_dear;
__register32_t tf_mcar;
__register32_t tf_sprg1;
uint32_t tf_esr;
uint32_t tf_mcsr;
uint32_t tf_pid;
uint32_t tf_spefscr;
#endif
};
#endif
#define tf_fixreg tf_ureg.r_fixreg
#define tf_lr tf_ureg.r_lr
#define tf_cr tf_ureg.r_cr
#define tf_xer tf_ureg.r_xer
#define tf_ctr tf_ureg.r_ctr
#define tf_srr0 tf_cf.cf_srr0
#define tf_srr1 tf_cf.cf_srr1
#define tf_idepth tf_cf.cf_idepth
struct ktrapframe {
__register_t ktf_sp;
__register_t ktf_lr;
struct trapframe ktf_tf;
__register_t ktf_cframe_lr;
};
#if defined(_KERNEL)
#ifdef _LP64
struct utrapframe32 {
__register32_t fixreg[32];
__register32_t lr;
int cr;
int xer;
__register32_t ctr;
__register32_t srr0;
__register32_t srr1;
int vrsave;
int mq;
int spare;
};
#endif
#endif
#define FRAMELEN roundup(sizeof(struct ktrapframe), CALLFRAMELEN)
#define ktrapframe(l) ((struct ktrapframe *)(uvm_lwp_getuarea(l) + USPACE - CALLFRAMELEN - FRAMELEN))
#define trapframe(l) (&(ktrapframe(l)->ktf_tf))
#define SFRAMELEN roundup(sizeof(struct switchframe), CALLFRAMELEN)
struct switchframe {
__register_t sf_sp;
__register_t sf_lr;
__register_t sf_user_sr;
__register_t sf_cr;
__register_t sf_fixreg2;
__register_t sf_fixreg[19];
};
#define CALLFRAMELEN sizeof(struct callframe)
struct callframe {
__register_t cf_sp;
__register_t cf_lr;
__register_t cf_r30;
__register_t cf_r31;
};
#endif