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