1f9bac91bSBenno Rice /* $NetBSD: reg.h,v 1.4 2000/06/04 09:30:44 tsubai Exp $ */ 2f9bac91bSBenno Rice /* $FreeBSD$ */ 3f9bac91bSBenno Rice 4f9bac91bSBenno Rice #ifndef _POWERPC_REG_H_ 5f9bac91bSBenno Rice #define _POWERPC_REG_H_ 6f9bac91bSBenno Rice 7c3e289e1SNathan Whitehorn #if defined(_KERNEL) && !defined(KLD_MODULE) && !defined(_STANDALONE) 8c3e289e1SNathan Whitehorn #include "opt_compat.h" 9c3e289e1SNathan Whitehorn #endif 10c3e289e1SNathan Whitehorn 11a6e340aaSSuleiman Souhlal /* Must match struct trapframe */ 12f9bac91bSBenno Rice struct reg { 13f9bac91bSBenno Rice register_t fixreg[32]; 14f9bac91bSBenno Rice register_t lr; 15c3e289e1SNathan Whitehorn register_t cr; 16c3e289e1SNathan Whitehorn register_t xer; 17f9bac91bSBenno Rice register_t ctr; 18f9bac91bSBenno Rice register_t pc; 19f9bac91bSBenno Rice }; 20f9bac91bSBenno Rice 21a6e340aaSSuleiman Souhlal /* Must match pcb.pcb_fpu */ 22f9bac91bSBenno Rice struct fpreg { 23f9bac91bSBenno Rice double fpreg[32]; 24f9bac91bSBenno Rice double fpscr; 25f9bac91bSBenno Rice }; 26f9bac91bSBenno Rice 27*64b83a05SJustin Hibbits /* Must match pcb.pcb_vec */ 28*64b83a05SJustin Hibbits struct vmxreg { 29*64b83a05SJustin Hibbits uint32_t vr[32][4]; 30*64b83a05SJustin Hibbits uint32_t pad[2]; 31*64b83a05SJustin Hibbits uint32_t vrsave; 32*64b83a05SJustin Hibbits uint32_t vscr; 33*64b83a05SJustin Hibbits }; 34*64b83a05SJustin Hibbits 35f9bac91bSBenno Rice struct dbreg { 36c3e289e1SNathan Whitehorn unsigned int junk; 37f9bac91bSBenno Rice }; 38f9bac91bSBenno Rice 39c3e289e1SNathan Whitehorn #ifdef COMPAT_FREEBSD32 40c3e289e1SNathan Whitehorn /* Must match struct trapframe */ 41c3e289e1SNathan Whitehorn struct reg32 { 42c3e289e1SNathan Whitehorn int32_t fixreg[32]; 43c3e289e1SNathan Whitehorn int32_t lr; 44c3e289e1SNathan Whitehorn int32_t cr; 45c3e289e1SNathan Whitehorn int32_t xer; 46c3e289e1SNathan Whitehorn int32_t ctr; 47c3e289e1SNathan Whitehorn int32_t pc; 48c3e289e1SNathan Whitehorn }; 49c3e289e1SNathan Whitehorn 50c3e289e1SNathan Whitehorn struct fpreg32 { 51c3e289e1SNathan Whitehorn struct fpreg data; 52c3e289e1SNathan Whitehorn }; 53c3e289e1SNathan Whitehorn 54*64b83a05SJustin Hibbits struct vmxreg32 { 55*64b83a05SJustin Hibbits struct vmxreg data; 56*64b83a05SJustin Hibbits }; 57*64b83a05SJustin Hibbits 58c3e289e1SNathan Whitehorn struct dbreg32 { 59c3e289e1SNathan Whitehorn struct dbreg data; 60c3e289e1SNathan Whitehorn }; 61c3e289e1SNathan Whitehorn #endif 62c3e289e1SNathan Whitehorn 631f042619SDag-Erling Smørgrav #ifdef _KERNEL 641f042619SDag-Erling Smørgrav /* 651f042619SDag-Erling Smørgrav * XXX these interfaces are MI, so they should be declared in a MI place. 661f042619SDag-Erling Smørgrav */ 67812344bcSAlfred Perlstein int fill_regs(struct thread *, struct reg *); 68812344bcSAlfred Perlstein int set_regs(struct thread *, struct reg *); 69812344bcSAlfred Perlstein int fill_fpregs(struct thread *, struct fpreg *); 70812344bcSAlfred Perlstein int set_fpregs(struct thread *, struct fpreg *); 71812344bcSAlfred Perlstein int fill_dbregs(struct thread *, struct dbreg *); 72812344bcSAlfred Perlstein int set_dbregs(struct thread *, struct dbreg *); 73c3e289e1SNathan Whitehorn 74c3e289e1SNathan Whitehorn #ifdef COMPAT_FREEBSD32 75c3e289e1SNathan Whitehorn struct image_params; 76c3e289e1SNathan Whitehorn 77c3e289e1SNathan Whitehorn int fill_regs32(struct thread *, struct reg32 *); 78c3e289e1SNathan Whitehorn int set_regs32(struct thread *, struct reg32 *); 79c3e289e1SNathan Whitehorn void ppc32_setregs(struct thread *, struct image_params *, u_long); 80c3e289e1SNathan Whitehorn 81c3e289e1SNathan Whitehorn #define fill_fpregs32(td, reg) fill_fpregs(td,(struct fpreg *)reg) 82c3e289e1SNathan Whitehorn #define set_fpregs32(td, reg) set_fpregs(td,(struct fpreg *)reg) 83c3e289e1SNathan Whitehorn #define fill_dbregs32(td, reg) fill_dbregs(td,(struct dbreg *)reg) 84c3e289e1SNathan Whitehorn #define set_dbregs32(td, reg) set_dbregs(td,(struct dbreg *)reg) 85c3e289e1SNathan Whitehorn #endif 86c3e289e1SNathan Whitehorn 871f042619SDag-Erling Smørgrav #endif 88f9bac91bSBenno Rice 89f9bac91bSBenno Rice #endif /* _POWERPC_REG_H_ */ 90