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