xref: /freebsd/sys/powerpc/include/reg.h (revision 458b591fb0ccbeaf80f7116cd145fe896cbf7421)
1 /* $NetBSD: reg.h,v 1.4 2000/06/04 09:30:44 tsubai Exp $	*/
2 /* $FreeBSD$	*/
3 
4 #ifndef _POWERPC_REG_H_
5 #define	_POWERPC_REG_H_
6 
7 #if defined(_KERNEL) && !defined(KLD_MODULE) && !defined(_STANDALONE)
8 #include "opt_compat.h"
9 #endif
10 
11 /* Must match struct trapframe */
12 struct reg {
13 	register_t fixreg[32];
14 	register_t lr;
15 	register_t cr;
16 	register_t xer;
17 	register_t ctr;
18 	register_t pc;
19 };
20 
21 /* Must match pcb.pcb_fpu */
22 struct fpreg {
23 	union {
24 		double fpr;
25 		uint64_t vsr[2];
26 	} fpreg[32];
27 	double fpscr;
28 };
29 
30 /* Must match pcb.pcb_vec */
31 struct vmxreg {
32 	uint32_t vr[32][4];
33 	uint32_t pad[2];
34 	uint32_t vrsave;
35 	uint32_t vscr;
36 };
37 
38 struct dbreg {
39 	unsigned int	junk;
40 };
41 
42 #ifdef __LP64__
43 /* Must match struct trapframe */
44 struct reg32 {
45 	int32_t fixreg[32];
46 	int32_t lr;
47 	int32_t cr;
48 	int32_t xer;
49 	int32_t ctr;
50 	int32_t pc;
51 };
52 
53 struct fpreg32 {
54 	struct fpreg data;
55 };
56 
57 struct vmxreg32 {
58 	struct vmxreg data;
59 };
60 
61 struct dbreg32 {
62 	struct dbreg data;
63 };
64 
65 #define __HAVE_REG32
66 #endif
67 
68 #ifdef _KERNEL
69 /*
70  * XXX these interfaces are MI, so they should be declared in a MI place.
71  */
72 int	fill_regs(struct thread *, struct reg *);
73 int	set_regs(struct thread *, struct reg *);
74 int	fill_fpregs(struct thread *, struct fpreg *);
75 int	set_fpregs(struct thread *, struct fpreg *);
76 int	fill_dbregs(struct thread *, struct dbreg *);
77 int	set_dbregs(struct thread *, struct dbreg *);
78 
79 #ifdef COMPAT_FREEBSD32
80 struct image_params;
81 
82 int	fill_regs32(struct thread *, struct reg32 *);
83 int	set_regs32(struct thread *, struct reg32 *);
84 void	ppc32_setregs(struct thread *, struct image_params *, u_long);
85 
86 #define	fill_fpregs32(td, reg)	fill_fpregs(td,(struct fpreg *)reg)
87 #define	set_fpregs32(td, reg)	set_fpregs(td,(struct fpreg *)reg)
88 #define	fill_dbregs32(td, reg)	fill_dbregs(td,(struct dbreg *)reg)
89 #define	set_dbregs32(td, reg)	set_dbregs(td,(struct dbreg *)reg)
90 #endif
91 
92 #endif
93 
94 #endif /* _POWERPC_REG_H_ */
95