xref: /freebsd/sys/powerpc/include/reg.h (revision e6e746bfb086d563bf0ad454a33ecbcab8836dbf)
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 COMPAT_FREEBSD32
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 #endif
65 
66 #ifdef _KERNEL
67 /*
68  * XXX these interfaces are MI, so they should be declared in a MI place.
69  */
70 int	fill_regs(struct thread *, struct reg *);
71 int	set_regs(struct thread *, struct reg *);
72 int	fill_fpregs(struct thread *, struct fpreg *);
73 int	set_fpregs(struct thread *, struct fpreg *);
74 int	fill_dbregs(struct thread *, struct dbreg *);
75 int	set_dbregs(struct thread *, struct dbreg *);
76 
77 #ifdef COMPAT_FREEBSD32
78 struct image_params;
79 
80 int	fill_regs32(struct thread *, struct reg32 *);
81 int	set_regs32(struct thread *, struct reg32 *);
82 void	ppc32_setregs(struct thread *, struct image_params *, u_long);
83 
84 #define	fill_fpregs32(td, reg)	fill_fpregs(td,(struct fpreg *)reg)
85 #define	set_fpregs32(td, reg)	set_fpregs(td,(struct fpreg *)reg)
86 #define	fill_dbregs32(td, reg)	fill_dbregs(td,(struct dbreg *)reg)
87 #define	set_dbregs32(td, reg)	set_dbregs(td,(struct dbreg *)reg)
88 #endif
89 
90 #endif
91 
92 #endif /* _POWERPC_REG_H_ */
93