h_mem_assist_asm.S revision 1.1.2.3 1 1.1.2.2 pgoyette /*
2 1.1.2.2 pgoyette * Copyright (c) 2018 The NetBSD Foundation, Inc.
3 1.1.2.2 pgoyette * All rights reserved.
4 1.1.2.2 pgoyette *
5 1.1.2.2 pgoyette * This code is derived from software contributed to The NetBSD Foundation
6 1.1.2.2 pgoyette * by Maxime Villard.
7 1.1.2.2 pgoyette *
8 1.1.2.2 pgoyette * Redistribution and use in source and binary forms, with or without
9 1.1.2.2 pgoyette * modification, are permitted provided that the following conditions
10 1.1.2.2 pgoyette * are met:
11 1.1.2.2 pgoyette * 1. Redistributions of source code must retain the above copyright
12 1.1.2.2 pgoyette * notice, this list of conditions and the following disclaimer.
13 1.1.2.2 pgoyette * 2. Redistributions in binary form must reproduce the above copyright
14 1.1.2.2 pgoyette * notice, this list of conditions and the following disclaimer in the
15 1.1.2.2 pgoyette * documentation and/or other materials provided with the distribution.
16 1.1.2.2 pgoyette *
17 1.1.2.2 pgoyette * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 1.1.2.2 pgoyette * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 1.1.2.2 pgoyette * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 1.1.2.2 pgoyette * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 1.1.2.2 pgoyette * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 1.1.2.2 pgoyette * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 1.1.2.2 pgoyette * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 1.1.2.2 pgoyette * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 1.1.2.2 pgoyette * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 1.1.2.2 pgoyette * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 1.1.2.2 pgoyette * POSSIBILITY OF SUCH DAMAGE.
28 1.1.2.2 pgoyette */
29 1.1.2.2 pgoyette
30 1.1.2.2 pgoyette .globl test1_begin, test1_end
31 1.1.2.2 pgoyette .globl test2_begin, test2_end
32 1.1.2.2 pgoyette .globl test3_begin, test3_end
33 1.1.2.2 pgoyette .globl test4_begin, test4_end
34 1.1.2.2 pgoyette .globl test5_begin, test5_end
35 1.1.2.2 pgoyette .globl test6_begin, test6_end
36 1.1.2.2 pgoyette .globl test7_begin, test7_end
37 1.1.2.2 pgoyette .globl test8_begin, test8_end
38 1.1.2.3 pgoyette .globl test9_begin, test9_end
39 1.1.2.2 pgoyette .text
40 1.1.2.2 pgoyette .code64
41 1.1.2.2 pgoyette
42 1.1.2.2 pgoyette #define TEST_END \
43 1.1.2.2 pgoyette movq $0xFFFFFFFFFFFFFFFF,%rcx; \
44 1.1.2.2 pgoyette rdmsr ;
45 1.1.2.2 pgoyette
46 1.1.2.2 pgoyette .align 64
47 1.1.2.2 pgoyette test1_begin:
48 1.1.2.2 pgoyette movq $0x1000,%rax
49 1.1.2.2 pgoyette movq $0x1000,%rbp
50 1.1.2.2 pgoyette
51 1.1.2.2 pgoyette movq $0x1000,(%rax)
52 1.1.2.2 pgoyette
53 1.1.2.2 pgoyette movq $1,%r11
54 1.1.2.2 pgoyette movq $0x2000,(%rax,%r11,8)
55 1.1.2.2 pgoyette
56 1.1.2.2 pgoyette movq (%rbp),%r8
57 1.1.2.2 pgoyette movq 8(%rbp),%rbx
58 1.1.2.2 pgoyette addq %rbx,%r8
59 1.1.2.2 pgoyette movq %r8,(%rbp)
60 1.1.2.2 pgoyette movb $4,(%rbp)
61 1.1.2.2 pgoyette
62 1.1.2.2 pgoyette TEST_END
63 1.1.2.2 pgoyette test1_end:
64 1.1.2.2 pgoyette
65 1.1.2.2 pgoyette .align 64
66 1.1.2.2 pgoyette test2_begin:
67 1.1.2.2 pgoyette movq $0x1000,%rax
68 1.1.2.2 pgoyette
69 1.1.2.2 pgoyette movq $0x1000,(%rax)
70 1.1.2.2 pgoyette movq $0x00FF,%rbx
71 1.1.2.2 pgoyette orb %bl,(%rax)
72 1.1.2.2 pgoyette movq $0x0400,%rcx
73 1.1.2.2 pgoyette orw %cx,(%rax)
74 1.1.2.2 pgoyette
75 1.1.2.2 pgoyette TEST_END
76 1.1.2.2 pgoyette test2_end:
77 1.1.2.2 pgoyette
78 1.1.2.2 pgoyette .align 64
79 1.1.2.2 pgoyette test3_begin:
80 1.1.2.2 pgoyette movq $0x1000,%rax
81 1.1.2.2 pgoyette
82 1.1.2.2 pgoyette movq $0x1FFF,(%rax)
83 1.1.2.2 pgoyette movq $0x1FF0,%rbx
84 1.1.2.2 pgoyette andq %rbx,(%rax)
85 1.1.2.2 pgoyette movq $0x10C1,%rcx
86 1.1.2.2 pgoyette andb %cl,(%rax)
87 1.1.2.2 pgoyette
88 1.1.2.2 pgoyette TEST_END
89 1.1.2.2 pgoyette test3_end:
90 1.1.2.2 pgoyette
91 1.1.2.2 pgoyette .align 64
92 1.1.2.2 pgoyette test4_begin:
93 1.1.2.2 pgoyette movq $0x1000,%rax
94 1.1.2.2 pgoyette
95 1.1.2.2 pgoyette movq $0x1FFF,(%rax)
96 1.1.2.2 pgoyette movq $0x1FF0,%rbx
97 1.1.2.2 pgoyette xorq %rbx,(%rax)
98 1.1.2.2 pgoyette movq $0x10C0,%rcx
99 1.1.2.2 pgoyette xorw %cx,(%rax)
100 1.1.2.2 pgoyette
101 1.1.2.2 pgoyette TEST_END
102 1.1.2.2 pgoyette test4_end:
103 1.1.2.2 pgoyette
104 1.1.2.2 pgoyette .align 64
105 1.1.2.2 pgoyette test5_begin:
106 1.1.2.2 pgoyette movq $0xFFFFFFFF00001000,%rax
107 1.1.2.2 pgoyette
108 1.1.2.2 pgoyette movq $0x1FFF,(%eax)
109 1.1.2.2 pgoyette movb $0,(%eax,%ebx,1)
110 1.1.2.2 pgoyette
111 1.1.2.2 pgoyette TEST_END
112 1.1.2.2 pgoyette test5_end:
113 1.1.2.2 pgoyette
114 1.1.2.2 pgoyette .align 64
115 1.1.2.2 pgoyette test6_begin:
116 1.1.2.2 pgoyette movq $0xFFA0,%rax
117 1.1.2.2 pgoyette movabs %rax,0x1000
118 1.1.2.2 pgoyette
119 1.1.2.2 pgoyette movabs 0x1000,%al
120 1.1.2.2 pgoyette orb $0x0B,%al
121 1.1.2.2 pgoyette movabs %al,0x1000
122 1.1.2.2 pgoyette
123 1.1.2.2 pgoyette TEST_END
124 1.1.2.2 pgoyette test6_end:
125 1.1.2.2 pgoyette
126 1.1.2.2 pgoyette .align 64
127 1.1.2.2 pgoyette test7_begin:
128 1.1.2.2 pgoyette movq $0x56,%rax
129 1.1.2.2 pgoyette
130 1.1.2.2 pgoyette movq $1,%rcx
131 1.1.2.2 pgoyette movq $0x1000,%rdi
132 1.1.2.2 pgoyette rep stosb
133 1.1.2.2 pgoyette
134 1.1.2.2 pgoyette movq $0x1234,%rax
135 1.1.2.2 pgoyette stosw
136 1.1.2.2 pgoyette
137 1.1.2.2 pgoyette TEST_END
138 1.1.2.2 pgoyette test7_end:
139 1.1.2.2 pgoyette
140 1.1.2.2 pgoyette .align 64
141 1.1.2.2 pgoyette test8_begin:
142 1.1.2.2 pgoyette movq $0x1008,%rsi
143 1.1.2.2 pgoyette movq $0x12345678,(%rsi)
144 1.1.2.2 pgoyette
145 1.1.2.2 pgoyette movq $0x1000,%rdi
146 1.1.2.2 pgoyette
147 1.1.2.2 pgoyette lodsw
148 1.1.2.2 pgoyette movw %ax,(%rdi)
149 1.1.2.2 pgoyette addq $2,%rdi
150 1.1.2.2 pgoyette
151 1.1.2.2 pgoyette lodsb
152 1.1.2.2 pgoyette movb %al,(%rdi)
153 1.1.2.2 pgoyette addq $1,%rdi
154 1.1.2.2 pgoyette
155 1.1.2.2 pgoyette lodsb
156 1.1.2.2 pgoyette movb %al,(%rdi)
157 1.1.2.2 pgoyette addq $2,%rdi
158 1.1.2.2 pgoyette
159 1.1.2.2 pgoyette TEST_END
160 1.1.2.2 pgoyette test8_end:
161 1.1.2.3 pgoyette
162 1.1.2.3 pgoyette .align 64
163 1.1.2.3 pgoyette test9_begin:
164 1.1.2.3 pgoyette movq $0x1000,%rax
165 1.1.2.3 pgoyette
166 1.1.2.3 pgoyette movq $0x12345678,8(%rax)
167 1.1.2.3 pgoyette
168 1.1.2.3 pgoyette movq $0x1008,%rsi
169 1.1.2.3 pgoyette movq $0x1000,%rdi
170 1.1.2.3 pgoyette
171 1.1.2.3 pgoyette movq $4,%rcx
172 1.1.2.3 pgoyette rep movsb
173 1.1.2.3 pgoyette
174 1.1.2.3 pgoyette movq $2,%rcx
175 1.1.2.3 pgoyette rep movsw
176 1.1.2.3 pgoyette
177 1.1.2.3 pgoyette TEST_END
178 1.1.2.3 pgoyette test9_end:
179 1.1.2.3 pgoyette
180