h_mem_assist_asm.S revision 1.1.2.2 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.2 pgoyette .text
39 1.1.2.2 pgoyette .code64
40 1.1.2.2 pgoyette
41 1.1.2.2 pgoyette #define TEST_END \
42 1.1.2.2 pgoyette movq $0xFFFFFFFFFFFFFFFF,%rcx; \
43 1.1.2.2 pgoyette rdmsr ;
44 1.1.2.2 pgoyette
45 1.1.2.2 pgoyette .align 64
46 1.1.2.2 pgoyette test1_begin:
47 1.1.2.2 pgoyette movq $0x1000,%rax
48 1.1.2.2 pgoyette movq $0x1000,%rbp
49 1.1.2.2 pgoyette
50 1.1.2.2 pgoyette movq $0x1000,(%rax)
51 1.1.2.2 pgoyette
52 1.1.2.2 pgoyette movq $1,%r11
53 1.1.2.2 pgoyette movq $0x2000,(%rax,%r11,8)
54 1.1.2.2 pgoyette
55 1.1.2.2 pgoyette movq (%rbp),%r8
56 1.1.2.2 pgoyette movq 8(%rbp),%rbx
57 1.1.2.2 pgoyette addq %rbx,%r8
58 1.1.2.2 pgoyette movq %r8,(%rbp)
59 1.1.2.2 pgoyette movb $4,(%rbp)
60 1.1.2.2 pgoyette
61 1.1.2.2 pgoyette TEST_END
62 1.1.2.2 pgoyette test1_end:
63 1.1.2.2 pgoyette
64 1.1.2.2 pgoyette .align 64
65 1.1.2.2 pgoyette test2_begin:
66 1.1.2.2 pgoyette movq $0x1000,%rax
67 1.1.2.2 pgoyette
68 1.1.2.2 pgoyette movq $0x1000,(%rax)
69 1.1.2.2 pgoyette movq $0x00FF,%rbx
70 1.1.2.2 pgoyette orb %bl,(%rax)
71 1.1.2.2 pgoyette movq $0x0400,%rcx
72 1.1.2.2 pgoyette orw %cx,(%rax)
73 1.1.2.2 pgoyette
74 1.1.2.2 pgoyette TEST_END
75 1.1.2.2 pgoyette test2_end:
76 1.1.2.2 pgoyette
77 1.1.2.2 pgoyette .align 64
78 1.1.2.2 pgoyette test3_begin:
79 1.1.2.2 pgoyette movq $0x1000,%rax
80 1.1.2.2 pgoyette
81 1.1.2.2 pgoyette movq $0x1FFF,(%rax)
82 1.1.2.2 pgoyette movq $0x1FF0,%rbx
83 1.1.2.2 pgoyette andq %rbx,(%rax)
84 1.1.2.2 pgoyette movq $0x10C1,%rcx
85 1.1.2.2 pgoyette andb %cl,(%rax)
86 1.1.2.2 pgoyette
87 1.1.2.2 pgoyette TEST_END
88 1.1.2.2 pgoyette test3_end:
89 1.1.2.2 pgoyette
90 1.1.2.2 pgoyette .align 64
91 1.1.2.2 pgoyette test4_begin:
92 1.1.2.2 pgoyette movq $0x1000,%rax
93 1.1.2.2 pgoyette
94 1.1.2.2 pgoyette movq $0x1FFF,(%rax)
95 1.1.2.2 pgoyette movq $0x1FF0,%rbx
96 1.1.2.2 pgoyette xorq %rbx,(%rax)
97 1.1.2.2 pgoyette movq $0x10C0,%rcx
98 1.1.2.2 pgoyette xorw %cx,(%rax)
99 1.1.2.2 pgoyette
100 1.1.2.2 pgoyette TEST_END
101 1.1.2.2 pgoyette test4_end:
102 1.1.2.2 pgoyette
103 1.1.2.2 pgoyette .align 64
104 1.1.2.2 pgoyette test5_begin:
105 1.1.2.2 pgoyette movq $0xFFFFFFFF00001000,%rax
106 1.1.2.2 pgoyette
107 1.1.2.2 pgoyette movq $0x1FFF,(%eax)
108 1.1.2.2 pgoyette movb $0,(%eax,%ebx,1)
109 1.1.2.2 pgoyette
110 1.1.2.2 pgoyette TEST_END
111 1.1.2.2 pgoyette test5_end:
112 1.1.2.2 pgoyette
113 1.1.2.2 pgoyette .align 64
114 1.1.2.2 pgoyette test6_begin:
115 1.1.2.2 pgoyette movq $0xFFA0,%rax
116 1.1.2.2 pgoyette movabs %rax,0x1000
117 1.1.2.2 pgoyette
118 1.1.2.2 pgoyette movabs 0x1000,%al
119 1.1.2.2 pgoyette orb $0x0B,%al
120 1.1.2.2 pgoyette movabs %al,0x1000
121 1.1.2.2 pgoyette
122 1.1.2.2 pgoyette TEST_END
123 1.1.2.2 pgoyette test6_end:
124 1.1.2.2 pgoyette
125 1.1.2.2 pgoyette .align 64
126 1.1.2.2 pgoyette test7_begin:
127 1.1.2.2 pgoyette movq $0x56,%rax
128 1.1.2.2 pgoyette
129 1.1.2.2 pgoyette movq $1,%rcx
130 1.1.2.2 pgoyette movq $0x1000,%rdi
131 1.1.2.2 pgoyette rep stosb
132 1.1.2.2 pgoyette
133 1.1.2.2 pgoyette movq $0x1234,%rax
134 1.1.2.2 pgoyette stosw
135 1.1.2.2 pgoyette
136 1.1.2.2 pgoyette TEST_END
137 1.1.2.2 pgoyette test7_end:
138 1.1.2.2 pgoyette
139 1.1.2.2 pgoyette .align 64
140 1.1.2.2 pgoyette test8_begin:
141 1.1.2.2 pgoyette movq $0x1008,%rsi
142 1.1.2.2 pgoyette movq $0x12345678,(%rsi)
143 1.1.2.2 pgoyette
144 1.1.2.2 pgoyette movq $0x1000,%rdi
145 1.1.2.2 pgoyette
146 1.1.2.2 pgoyette lodsw
147 1.1.2.2 pgoyette movw %ax,(%rdi)
148 1.1.2.2 pgoyette addq $2,%rdi
149 1.1.2.2 pgoyette
150 1.1.2.2 pgoyette lodsb
151 1.1.2.2 pgoyette movb %al,(%rdi)
152 1.1.2.2 pgoyette addq $1,%rdi
153 1.1.2.2 pgoyette
154 1.1.2.2 pgoyette lodsb
155 1.1.2.2 pgoyette movb %al,(%rdi)
156 1.1.2.2 pgoyette addq $2,%rdi
157 1.1.2.2 pgoyette
158 1.1.2.2 pgoyette TEST_END
159 1.1.2.2 pgoyette test8_end:
160