1/*	$OpenBSD: asi_asm.S,v 1.2 2003/07/12 07:09:25 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/ctlreg.h>
31
32/* void asm_ldq_asi(int asi, struct fpquad *r)	%f0 = *r */
33ENTRY(asm_ldqa_asi)
34	rd	%asi, %o2
35	wr	%o0, 0, %asi
36	ldqa	[%o1] %asi, %f0
37	retl
38	 wr	%o2, 0, %asi
39
40/* void asm_ldq_asi(int asi, struct fpquad *)	*r = %f0 */
41ENTRY(asm_stqa_asi)
42	rd	%asi, %o2
43	wr	%o0, 0, %asi
44	stqa	%f0, [%o1] %asi
45	retl
46	 wr	%o2, 0, %asi
47
48ENTRY(asm_stqa_primary)
49	retl
50	 stqa %f0, [%o0] ASI_PRIMARY
51
52ENTRY(asm_ldqa_primary)
53	retl
54	 ldqa [%o0] ASI_PRIMARY, %f0
55
56ENTRY(asm_stqa_secondary)
57	retl
58	 stqa %f0, [%o0] ASI_SECONDARY
59
60ENTRY(asm_ldqa_secondary)
61	retl
62	 ldqa [%o0] ASI_SECONDARY, %f0
63
64ENTRY(asm_stqa_primary_nofault)
65	retl
66	 stqa %f0, [%o0] ASI_PRIMARY_NOFAULT
67
68ENTRY(asm_ldqa_primary_nofault)
69	retl
70	 ldqa [%o0] ASI_PRIMARY_NOFAULT, %f0
71
72ENTRY(asm_stqa_secondary_nofault)
73	retl
74	 stqa %f0, [%o0] ASI_SECONDARY_NOFAULT
75
76ENTRY(asm_ldqa_secondary_nofault)
77	retl
78	 ldqa [%o0] ASI_SECONDARY_NOFAULT, %f0
79
80ENTRY(asm_stqa_primary_little)
81	retl
82	 stqa %f0, [%o0] ASI_PRIMARY_LITTLE
83
84ENTRY(asm_ldqa_primary_little)
85	retl
86	 ldqa [%o0] ASI_PRIMARY_LITTLE, %f0
87
88ENTRY(asm_stqa_secondary_little)
89	retl
90	 stqa %f0, [%o0] ASI_SECONDARY_LITTLE
91
92ENTRY(asm_ldqa_secondary_little)
93	retl
94	 ldqa [%o0] ASI_SECONDARY_LITTLE, %f0
95
96ENTRY(asm_stqa_primary_nofault_little)
97	retl
98	 stqa %f0, [%o0] ASI_PRIMARY_NOFAULT_LITTLE
99
100ENTRY(asm_ldqa_primary_nofault_little)
101	retl
102	 ldqa [%o0] ASI_PRIMARY_NOFAULT_LITTLE, %f0
103
104ENTRY(asm_stqa_secondary_nofault_little)
105	retl
106	 stqa %f0, [%o0] ASI_SECONDARY_NOFAULT_LITTLE
107
108ENTRY(asm_ldqa_secondary_nofault_little)
109	retl
110	 ldqa [%o0] ASI_SECONDARY_NOFAULT_LITTLE, %f0
111
112