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