xref: /freebsd/sys/powerpc/include/reg.h (revision 64de80195bba295c961a4cdf96dbe0e4979bdf2a)
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 	double fpreg[32];
24 	double fpscr;
25 };
26 
27 /* Must match pcb.pcb_vec */
28 struct vmxreg {
29 	uint32_t vr[32][4];
30 	uint32_t pad[2];
31 	uint32_t vrsave;
32 	uint32_t vscr;
33 };
34 
35 struct dbreg {
36 	unsigned int	junk;
37 };
38 
39 #ifdef COMPAT_FREEBSD32
40 /* Must match struct trapframe */
41 struct reg32 {
42 	int32_t fixreg[32];
43 	int32_t lr;
44 	int32_t cr;
45 	int32_t xer;
46 	int32_t ctr;
47 	int32_t pc;
48 };
49 
50 struct fpreg32 {
51 	struct fpreg data;
52 };
53 
54 struct vmxreg32 {
55 	struct vmxreg data;
56 };
57 
58 struct dbreg32 {
59 	struct dbreg data;
60 };
61 #endif
62 
63 #ifdef _KERNEL
64 /*
65  * XXX these interfaces are MI, so they should be declared in a MI place.
66  */
67 int	fill_regs(struct thread *, struct reg *);
68 int	set_regs(struct thread *, struct reg *);
69 int	fill_fpregs(struct thread *, struct fpreg *);
70 int	set_fpregs(struct thread *, struct fpreg *);
71 int	fill_dbregs(struct thread *, struct dbreg *);
72 int	set_dbregs(struct thread *, struct dbreg *);
73 
74 #ifdef COMPAT_FREEBSD32
75 struct image_params;
76 
77 int	fill_regs32(struct thread *, struct reg32 *);
78 int	set_regs32(struct thread *, struct reg32 *);
79 void	ppc32_setregs(struct thread *, struct image_params *, u_long);
80 
81 #define	fill_fpregs32(td, reg)	fill_fpregs(td,(struct fpreg *)reg)
82 #define	set_fpregs32(td, reg)	set_fpregs(td,(struct fpreg *)reg)
83 #define	fill_dbregs32(td, reg)	fill_dbregs(td,(struct dbreg *)reg)
84 #define	set_dbregs32(td, reg)	set_dbregs(td,(struct dbreg *)reg)
85 #endif
86 
87 #endif
88 
89 #endif /* _POWERPC_REG_H_ */
90