xref: /freebsd/sys/powerpc/include/reg.h (revision edf8578117e8844e02c0121147f45e4609b30680)
1 /* $NetBSD: reg.h,v 1.4 2000/06/04 09:30:44 tsubai Exp $	*/
2 
3 #ifndef _POWERPC_REG_H_
4 #define	_POWERPC_REG_H_
5 
6 #include <sys/_types.h>
7 
8 /* Must match struct trapframe */
9 struct reg {
10 	__register_t fixreg[32];
11 	__register_t lr;
12 	__register_t cr;
13 	__register_t xer;
14 	__register_t ctr;
15 	__register_t pc;
16 };
17 
18 struct fpreg {
19 	double fpreg[32];
20 	double fpscr;
21 };
22 
23 /* Must match pcb.pcb_vec */
24 struct vmxreg {
25 	__uint32_t vr[32][4];
26 	__uint32_t pad[2];
27 	__uint32_t vrsave;
28 	__uint32_t vscr;
29 };
30 
31 struct dbreg {
32 	unsigned int	junk;
33 };
34 
35 #ifdef __LP64__
36 /* Must match struct trapframe */
37 struct reg32 {
38 	__int32_t fixreg[32];
39 	__int32_t lr;
40 	__int32_t cr;
41 	__int32_t xer;
42 	__int32_t ctr;
43 	__int32_t pc;
44 };
45 
46 struct fpreg32 {
47 	struct fpreg data;
48 };
49 
50 struct vmxreg32 {
51 	struct vmxreg data;
52 };
53 
54 struct dbreg32 {
55 	struct dbreg data;
56 };
57 
58 #define __HAVE_REG32
59 #endif
60 
61 #ifdef _KERNEL
62 /*
63  * XXX these interfaces are MI, so they should be declared in a MI place.
64  */
65 int	fill_regs(struct thread *, struct reg *);
66 int	set_regs(struct thread *, struct reg *);
67 int	fill_fpregs(struct thread *, struct fpreg *);
68 int	set_fpregs(struct thread *, struct fpreg *);
69 int	fill_dbregs(struct thread *, struct dbreg *);
70 int	set_dbregs(struct thread *, struct dbreg *);
71 
72 /*
73  * MD interfaces.
74  */
75 void	cpu_save_thread_regs(struct thread *);
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 *, uintptr_t);
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