1 1.3 maxv /* $NetBSD: h_io_assist_asm.S,v 1.3 2020/09/05 07:22:26 maxv Exp $ */ 2 1.2 maxv 3 1.1 maxv /* 4 1.3 maxv * Copyright (c) 2019-2020 Maxime Villard, m00nbsd.net 5 1.1 maxv * All rights reserved. 6 1.1 maxv * 7 1.3 maxv * This code is part of the NVMM hypervisor. 8 1.1 maxv * 9 1.1 maxv * Redistribution and use in source and binary forms, with or without 10 1.1 maxv * modification, are permitted provided that the following conditions 11 1.1 maxv * are met: 12 1.1 maxv * 1. Redistributions of source code must retain the above copyright 13 1.1 maxv * notice, this list of conditions and the following disclaimer. 14 1.1 maxv * 2. Redistributions in binary form must reproduce the above copyright 15 1.1 maxv * notice, this list of conditions and the following disclaimer in the 16 1.1 maxv * documentation and/or other materials provided with the distribution. 17 1.1 maxv * 18 1.3 maxv * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 1.3 maxv * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 1.3 maxv * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 1.3 maxv * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 1.3 maxv * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 1.3 maxv * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 1.3 maxv * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 25 1.3 maxv * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 1.3 maxv * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 1.3 maxv * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 1.3 maxv * SUCH DAMAGE. 29 1.1 maxv */ 30 1.1 maxv 31 1.1 maxv .globl test1_begin, test1_end 32 1.1 maxv .globl test2_begin, test2_end 33 1.1 maxv .globl test3_begin, test3_end 34 1.1 maxv .globl test4_begin, test4_end 35 1.1 maxv .globl test5_begin, test5_end 36 1.1 maxv .globl test6_begin, test6_end 37 1.1 maxv .globl test7_begin, test7_end 38 1.1 maxv .globl test8_begin, test8_end 39 1.1 maxv .globl test9_begin, test9_end 40 1.1 maxv .globl test10_begin, test10_end 41 1.1 maxv .globl test11_begin, test11_end 42 1.1 maxv .globl test12_begin, test12_end 43 1.1 maxv .text 44 1.1 maxv .code64 45 1.1 maxv 46 1.1 maxv #define TEST_END \ 47 1.1 maxv movq $0xFFFFFFFFFFFFFFFF,%rcx; \ 48 1.1 maxv rdmsr ; 49 1.1 maxv 50 1.1 maxv /* 51 1.1 maxv * IN 52 1.1 maxv */ 53 1.1 maxv 54 1.1 maxv .align 64 55 1.1 maxv test1_begin: 56 1.1 maxv movq $0x1000,%rbx 57 1.1 maxv 58 1.1 maxv inb $123 59 1.1 maxv movb %al,(%rbx) 60 1.1 maxv incq %rbx 61 1.1 maxv 62 1.1 maxv movq $123,%rdx 63 1.1 maxv inb %dx 64 1.1 maxv movb %al,(%rbx) 65 1.1 maxv 66 1.1 maxv TEST_END 67 1.1 maxv test1_end: 68 1.1 maxv 69 1.1 maxv .align 64 70 1.1 maxv test2_begin: 71 1.1 maxv movq $0x1000,%rbx 72 1.1 maxv 73 1.1 maxv inw $123 74 1.1 maxv movw %ax,(%rbx) 75 1.1 maxv addq $2,%rbx 76 1.1 maxv 77 1.1 maxv movq $123,%rdx 78 1.1 maxv inw %dx 79 1.1 maxv movw %ax,(%rbx) 80 1.1 maxv 81 1.1 maxv TEST_END 82 1.1 maxv test2_end: 83 1.1 maxv 84 1.1 maxv .align 64 85 1.1 maxv test3_begin: 86 1.1 maxv movq $0x1000,%rbx 87 1.1 maxv 88 1.1 maxv inl $123 89 1.1 maxv movl %eax,(%rbx) 90 1.1 maxv addq $4,%rbx 91 1.1 maxv 92 1.1 maxv movq $123,%rdx 93 1.1 maxv inl %dx 94 1.1 maxv movl %eax,(%rbx) 95 1.1 maxv 96 1.1 maxv TEST_END 97 1.1 maxv test3_end: 98 1.1 maxv 99 1.1 maxv .align 64 100 1.1 maxv test4_begin: 101 1.1 maxv movq $0x1000,%rdi 102 1.1 maxv movq $5,%rcx 103 1.1 maxv 104 1.1 maxv movq $123,%rdx 105 1.1 maxv rep 106 1.1 maxv insb 107 1.1 maxv 108 1.1 maxv TEST_END 109 1.1 maxv test4_end: 110 1.1 maxv 111 1.1 maxv .align 64 112 1.1 maxv test5_begin: 113 1.1 maxv movq $0x1000,%rdi 114 1.1 maxv movq $14,%rcx 115 1.1 maxv 116 1.1 maxv movq $123,%rdx 117 1.1 maxv rep 118 1.1 maxv insw 119 1.1 maxv 120 1.1 maxv TEST_END 121 1.1 maxv test5_end: 122 1.1 maxv 123 1.1 maxv .align 64 124 1.1 maxv test6_begin: 125 1.1 maxv movq $0x1000,%rdi 126 1.1 maxv movq $7,%rcx 127 1.1 maxv 128 1.1 maxv movq $123,%rdx 129 1.1 maxv rep 130 1.1 maxv insl 131 1.1 maxv 132 1.1 maxv TEST_END 133 1.1 maxv test6_end: 134 1.1 maxv 135 1.1 maxv /* 136 1.1 maxv * OUT 137 1.1 maxv */ 138 1.1 maxv 139 1.1 maxv .align 64 140 1.1 maxv test7_begin: 141 1.1 maxv movq $0x1000,%rbx 142 1.1 maxv 143 1.1 maxv movb (%rbx),%al 144 1.1 maxv outb $123 145 1.1 maxv incq %rbx 146 1.1 maxv 147 1.1 maxv movb (%rbx),%al 148 1.1 maxv movq $123,%rdx 149 1.1 maxv outb %dx 150 1.1 maxv 151 1.1 maxv TEST_END 152 1.1 maxv test7_end: 153 1.1 maxv 154 1.1 maxv .align 64 155 1.1 maxv test8_begin: 156 1.1 maxv movq $0x1000,%rbx 157 1.1 maxv 158 1.1 maxv movw (%rbx),%ax 159 1.1 maxv outw $123 160 1.1 maxv addq $2,%rbx 161 1.1 maxv 162 1.1 maxv movw (%rbx),%ax 163 1.1 maxv movq $123,%rdx 164 1.1 maxv outw %dx 165 1.1 maxv 166 1.1 maxv TEST_END 167 1.1 maxv test8_end: 168 1.1 maxv 169 1.1 maxv .align 64 170 1.1 maxv test9_begin: 171 1.1 maxv movq $0x1000,%rbx 172 1.1 maxv 173 1.1 maxv movl (%rbx),%eax 174 1.1 maxv outl $123 175 1.1 maxv addq $4,%rbx 176 1.1 maxv 177 1.1 maxv movl (%rbx),%eax 178 1.1 maxv movq $123,%rdx 179 1.1 maxv outl %dx 180 1.1 maxv 181 1.1 maxv TEST_END 182 1.1 maxv test9_end: 183 1.1 maxv 184 1.1 maxv .align 64 185 1.1 maxv test10_begin: 186 1.1 maxv movq $0x1000,%rsi 187 1.1 maxv movq $5,%rcx 188 1.1 maxv 189 1.1 maxv movq $123,%rdx 190 1.1 maxv rep 191 1.1 maxv outsb 192 1.1 maxv 193 1.1 maxv TEST_END 194 1.1 maxv test10_end: 195 1.1 maxv 196 1.1 maxv .align 64 197 1.1 maxv test11_begin: 198 1.1 maxv movq $0x1000,%rsi 199 1.1 maxv movq $8,%rcx 200 1.1 maxv 201 1.1 maxv movq $123,%rdx 202 1.1 maxv rep 203 1.1 maxv outsw 204 1.1 maxv 205 1.1 maxv TEST_END 206 1.1 maxv test11_end: 207 1.1 maxv 208 1.1 maxv .align 64 209 1.1 maxv test12_begin: 210 1.1 maxv movq $0x1000,%rsi 211 1.1 maxv movq $7,%rcx 212 1.1 maxv 213 1.1 maxv movq $123,%rdx 214 1.1 maxv rep 215 1.1 maxv outsl 216 1.1 maxv 217 1.1 maxv TEST_END 218 1.1 maxv test12_end: 219