1/*	$OpenBSD: fpregs.S,v 1.1 2003/07/12 04:08:33 jason Exp $	*/
2
3/*
4 * Copyright (c) 2003 Jason L. Wright (jason@thought.net)
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <machine/asm.h>
30#include <machine/trap.h>
31#include <machine/frame.h>
32
33ENTRY(loadfpregs)
34	ldd	[%o0 + 0 * 8], %f0
35	ldd	[%o0 + 1 * 8], %f2
36	ldd	[%o0 + 2 * 8], %f4
37	ldd	[%o0 + 3 * 8], %f6
38	ldd	[%o0 + 4 * 8], %f8
39	ldd	[%o0 + 5 * 8], %f10
40	ldd	[%o0 + 6 * 8], %f12
41	ldd	[%o0 + 7 * 8], %f14
42	ldd	[%o0 + 8 * 8], %f16
43	ldd	[%o0 + 9 * 8], %f18
44	ldd	[%o0 + 10 * 8], %f20
45	ldd	[%o0 + 11 * 8], %f22
46	ldd	[%o0 + 12 * 8], %f24
47	ldd	[%o0 + 13 * 8], %f26
48	ldd	[%o0 + 14 * 8], %f28
49	ldd	[%o0 + 15 * 8], %f30
50	ldd	[%o0 + 16 * 8], %f32
51	ldd	[%o0 + 17 * 8], %f34
52	ldd	[%o0 + 18 * 8], %f36
53	ldd	[%o0 + 19 * 8], %f38
54	ldd	[%o0 + 20 * 8], %f40
55	ldd	[%o0 + 21 * 8], %f42
56	ldd	[%o0 + 22 * 8], %f44
57	ldd	[%o0 + 23 * 8], %f46
58	ldd	[%o0 + 24 * 8], %f48
59	ldd	[%o0 + 25 * 8], %f50
60	ldd	[%o0 + 26 * 8], %f52
61	ldd	[%o0 + 27 * 8], %f54
62	ldd	[%o0 + 28 * 8], %f56
63	ldd	[%o0 + 29 * 8], %f58
64	ldd	[%o0 + 30 * 8], %f60
65	retl
66	 ldd	[%o0 + 31 * 8], %f62
67
68ENTRY(savefpregs)
69	std	%f0, [%o0 + 0 * 8]
70	std	%f2, [%o0 + 1 * 8]
71	std	%f4, [%o0 + 2 * 8]
72	std	%f6, [%o0 + 3 * 8]
73	std	%f8, [%o0 + 4 * 8]
74	std	%f10, [%o0 + 5 * 8]
75	std	%f12, [%o0 + 6 * 8]
76	std	%f14, [%o0 + 7 * 8]
77	std	%f16, [%o0 + 8 * 8]
78	std	%f18, [%o0 + 9 * 8]
79	std	%f20, [%o0 + 10 * 8]
80	std	%f22, [%o0 + 11 * 8]
81	std	%f24, [%o0 + 12 * 8]
82	std	%f26, [%o0 + 13 * 8]
83	std	%f28, [%o0 + 14 * 8]
84	std	%f30, [%o0 + 15 * 8]
85	std	%f32, [%o0 + 16 * 8]
86	std	%f34, [%o0 + 17 * 8]
87	std	%f36, [%o0 + 18 * 8]
88	std	%f38, [%o0 + 19 * 8]
89	std	%f40, [%o0 + 20 * 8]
90	std	%f42, [%o0 + 21 * 8]
91	std	%f44, [%o0 + 22 * 8]
92	std	%f46, [%o0 + 23 * 8]
93	std	%f48, [%o0 + 24 * 8]
94	std	%f50, [%o0 + 25 * 8]
95	std	%f52, [%o0 + 26 * 8]
96	std	%f54, [%o0 + 27 * 8]
97	std	%f56, [%o0 + 28 * 8]
98	std	%f58, [%o0 + 29 * 8]
99	std	%f60, [%o0 + 30 * 8]
100	retl
101	 std	%f62, [%o0 + 31 * 8]
102
103ENTRY(initfpregs)
104	not	%g0, %o1
105	stx	%o1, [%o0 + 0 * 8]
106	stx	%o1, [%o0 + 1 * 8]
107	stx	%o1, [%o0 + 2 * 8]
108	stx	%o1, [%o0 + 3 * 8]
109	stx	%o1, [%o0 + 4 * 8]
110	stx	%o1, [%o0 + 5 * 8]
111	stx	%o1, [%o0 + 6 * 8]
112	stx	%o1, [%o0 + 7 * 8]
113	stx	%o1, [%o0 + 8 * 8]
114	stx	%o1, [%o0 + 9 * 8]
115	stx	%o1, [%o0 + 10 * 8]
116	stx	%o1, [%o0 + 11 * 8]
117	stx	%o1, [%o0 + 12 * 8]
118	stx	%o1, [%o0 + 13 * 8]
119	stx	%o1, [%o0 + 14 * 8]
120	stx	%o1, [%o0 + 15 * 8]
121	stx	%o1, [%o0 + 16 * 8]
122	stx	%o1, [%o0 + 17 * 8]
123	stx	%o1, [%o0 + 18 * 8]
124	stx	%o1, [%o0 + 19 * 8]
125	stx	%o1, [%o0 + 20 * 8]
126	stx	%o1, [%o0 + 21 * 8]
127	stx	%o1, [%o0 + 22 * 8]
128	stx	%o1, [%o0 + 23 * 8]
129	stx	%o1, [%o0 + 24 * 8]
130	stx	%o1, [%o0 + 25 * 8]
131	stx	%o1, [%o0 + 26 * 8]
132	stx	%o1, [%o0 + 27 * 8]
133	stx	%o1, [%o0 + 28 * 8]
134	stx	%o1, [%o0 + 29 * 8]
135	stx	%o1, [%o0 + 30 * 8]
136	retl
137	 stx	%o1, [%o0 + 31 * 8]
138