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