[361635c] | 1 | /*
|
---|
[df4ed85] | 2 | * Copyright (c) 2005 Jakub Jermar
|
---|
[361635c] | 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
[5bda2f3e] | 29 | /** @addtogroup ia64
|
---|
[b45c443] | 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /** @file
|
---|
| 33 | */
|
---|
| 34 |
|
---|
[06e1e95] | 35 | #ifndef KERN_ia64_ASM_H_
|
---|
| 36 | #define KERN_ia64_ASM_H_
|
---|
[361635c] | 37 |
|
---|
| 38 | #include <config.h>
|
---|
[c22e964] | 39 | #include <typedefs.h>
|
---|
[d99c1d2] | 40 | #include <typedefs.h>
|
---|
[0259524] | 41 | #include <arch/register.h>
|
---|
[7a0359b] | 42 | #include <trace.h>
|
---|
[361635c] | 43 |
|
---|
[5bda2f3e] | 44 | #define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL
|
---|
[2a06e2f] | 45 |
|
---|
[7a0359b] | 46 | NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
|
---|
[2a06e2f] | 47 | {
|
---|
[7d60cf5] | 48 | uintptr_t prt = (uintptr_t) port;
|
---|
[5bda2f3e] | 49 |
|
---|
| 50 | *((ioport8_t *) (IA64_IOSPACE_ADDRESS +
|
---|
[7d60cf5] | 51 | ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
|
---|
[5bda2f3e] | 52 |
|
---|
| 53 | asm volatile (
|
---|
| 54 | "mf\n"
|
---|
| 55 | ::: "memory"
|
---|
| 56 | );
|
---|
[2a06e2f] | 57 | }
|
---|
| 58 |
|
---|
[7a0359b] | 59 | NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v)
|
---|
[756f475] | 60 | {
|
---|
[7d60cf5] | 61 | uintptr_t prt = (uintptr_t) port;
|
---|
[5bda2f3e] | 62 |
|
---|
| 63 | *((ioport16_t *) (IA64_IOSPACE_ADDRESS +
|
---|
[7d60cf5] | 64 | ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
|
---|
[5bda2f3e] | 65 |
|
---|
| 66 | asm volatile (
|
---|
| 67 | "mf\n"
|
---|
| 68 | ::: "memory"
|
---|
| 69 | );
|
---|
[756f475] | 70 | }
|
---|
| 71 |
|
---|
[7a0359b] | 72 | NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v)
|
---|
[756f475] | 73 | {
|
---|
[7d60cf5] | 74 | uintptr_t prt = (uintptr_t) port;
|
---|
[5bda2f3e] | 75 |
|
---|
| 76 | *((ioport32_t *) (IA64_IOSPACE_ADDRESS +
|
---|
[7d60cf5] | 77 | ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
|
---|
[5bda2f3e] | 78 |
|
---|
| 79 | asm volatile (
|
---|
| 80 | "mf\n"
|
---|
| 81 | ::: "memory"
|
---|
| 82 | );
|
---|
[756f475] | 83 | }
|
---|
| 84 |
|
---|
[7a0359b] | 85 | NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
|
---|
[2a06e2f] | 86 | {
|
---|
[7d60cf5] | 87 | uintptr_t prt = (uintptr_t) port;
|
---|
[5bda2f3e] | 88 |
|
---|
| 89 | asm volatile (
|
---|
| 90 | "mf\n"
|
---|
| 91 | ::: "memory"
|
---|
| 92 | );
|
---|
| 93 |
|
---|
| 94 | return *((ioport8_t *) (IA64_IOSPACE_ADDRESS +
|
---|
[7d60cf5] | 95 | ((prt & 0xfff) | ((prt >> 2) << 12))));
|
---|
[756f475] | 96 | }
|
---|
| 97 |
|
---|
[7a0359b] | 98 | NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
|
---|
[756f475] | 99 | {
|
---|
[7d60cf5] | 100 | uintptr_t prt = (uintptr_t) port;
|
---|
[5bda2f3e] | 101 |
|
---|
| 102 | asm volatile (
|
---|
| 103 | "mf\n"
|
---|
| 104 | ::: "memory"
|
---|
| 105 | );
|
---|
| 106 |
|
---|
| 107 | return *((ioport16_t *) (IA64_IOSPACE_ADDRESS +
|
---|
[63d1ebd] | 108 | ((prt & 0xfff) | ((prt >> 2) << 12))));
|
---|
[756f475] | 109 | }
|
---|
| 110 |
|
---|
[7a0359b] | 111 | NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
|
---|
[756f475] | 112 | {
|
---|
[7d60cf5] | 113 | uintptr_t prt = (uintptr_t) port;
|
---|
[5bda2f3e] | 114 |
|
---|
| 115 | asm volatile (
|
---|
| 116 | "mf\n"
|
---|
| 117 | ::: "memory"
|
---|
| 118 | );
|
---|
| 119 |
|
---|
| 120 | return *((ioport32_t *) (IA64_IOSPACE_ADDRESS +
|
---|
[7d60cf5] | 121 | ((prt & 0xfff) | ((prt >> 2) << 12))));
|
---|
[2a06e2f] | 122 | }
|
---|
| 123 |
|
---|
[1fbbcd6] | 124 | /** Return base address of current stack
|
---|
| 125 | *
|
---|
| 126 | * Return the base address of the current stack.
|
---|
| 127 | * The stack is assumed to be STACK_SIZE long.
|
---|
| 128 | * The stack must start on page boundary.
|
---|
[7a0359b] | 129 | *
|
---|
[1fbbcd6] | 130 | */
|
---|
[7a0359b] | 131 | NO_TRACE static inline uintptr_t get_stack_base(void)
|
---|
[361635c] | 132 | {
|
---|
[7f1c620] | 133 | uint64_t v;
|
---|
[1fbbcd6] | 134 |
|
---|
[7a0359b] | 135 | /*
|
---|
| 136 | * I'm not sure why but this code inlines badly
|
---|
| 137 | * in scheduler, resulting in THE shifting about
|
---|
| 138 | * 16B and causing kernel panic.
|
---|
| 139 | *
|
---|
| 140 | * asm volatile (
|
---|
| 141 | * "and %[value] = %[mask], r12"
|
---|
| 142 | * : [value] "=r" (v)
|
---|
| 143 | * : [mask] "r" (~(STACK_SIZE - 1))
|
---|
| 144 | * );
|
---|
| 145 | * return v;
|
---|
| 146 | *
|
---|
| 147 | * The following code has the same semantics but
|
---|
| 148 | * inlines correctly.
|
---|
| 149 | *
|
---|
| 150 | */
|
---|
[5bda2f3e] | 151 |
|
---|
| 152 | asm volatile (
|
---|
| 153 | "mov %[value] = r12"
|
---|
| 154 | : [value] "=r" (v)
|
---|
| 155 | );
|
---|
| 156 |
|
---|
| 157 | return (v & (~(STACK_SIZE - 1)));
|
---|
[361635c] | 158 | }
|
---|
| 159 |
|
---|
[b994a60] | 160 | /** Return Processor State Register.
|
---|
| 161 | *
|
---|
| 162 | * @return PSR.
|
---|
[7a0359b] | 163 | *
|
---|
[b994a60] | 164 | */
|
---|
[7a0359b] | 165 | NO_TRACE static inline uint64_t psr_read(void)
|
---|
[b994a60] | 166 | {
|
---|
[7f1c620] | 167 | uint64_t v;
|
---|
[b994a60] | 168 |
|
---|
[5bda2f3e] | 169 | asm volatile (
|
---|
| 170 | "mov %[value] = psr\n"
|
---|
| 171 | : [value] "=r" (v)
|
---|
| 172 | );
|
---|
[b994a60] | 173 |
|
---|
| 174 | return v;
|
---|
| 175 | }
|
---|
| 176 |
|
---|
[e2ec980f] | 177 | /** Read IVA (Interruption Vector Address).
|
---|
| 178 | *
|
---|
| 179 | * @return Return location of interruption vector table.
|
---|
[7a0359b] | 180 | *
|
---|
[e2ec980f] | 181 | */
|
---|
[7a0359b] | 182 | NO_TRACE static inline uint64_t iva_read(void)
|
---|
[e2ec980f] | 183 | {
|
---|
[7f1c620] | 184 | uint64_t v;
|
---|
[e2ec980f] | 185 |
|
---|
[5bda2f3e] | 186 | asm volatile (
|
---|
| 187 | "mov %[value] = cr.iva\n"
|
---|
| 188 | : [value] "=r" (v)
|
---|
| 189 | );
|
---|
[e2ec980f] | 190 |
|
---|
| 191 | return v;
|
---|
| 192 | }
|
---|
| 193 |
|
---|
| 194 | /** Write IVA (Interruption Vector Address) register.
|
---|
| 195 | *
|
---|
[abbc16e] | 196 | * @param v New location of interruption vector table.
|
---|
[7a0359b] | 197 | *
|
---|
[e2ec980f] | 198 | */
|
---|
[7a0359b] | 199 | NO_TRACE static inline void iva_write(uint64_t v)
|
---|
[e2ec980f] | 200 | {
|
---|
[5bda2f3e] | 201 | asm volatile (
|
---|
| 202 | "mov cr.iva = %[value]\n"
|
---|
| 203 | :: [value] "r" (v)
|
---|
| 204 | );
|
---|
[e2ec980f] | 205 | }
|
---|
| 206 |
|
---|
[0259524] | 207 | /** Read IVR (External Interrupt Vector Register).
|
---|
[dbd1059] | 208 | *
|
---|
[7a0359b] | 209 | * @return Highest priority, pending, unmasked external
|
---|
| 210 | * interrupt vector.
|
---|
| 211 | *
|
---|
[dbd1059] | 212 | */
|
---|
[7a0359b] | 213 | NO_TRACE static inline uint64_t ivr_read(void)
|
---|
[dbd1059] | 214 | {
|
---|
[7f1c620] | 215 | uint64_t v;
|
---|
[dbd1059] | 216 |
|
---|
[5bda2f3e] | 217 | asm volatile (
|
---|
| 218 | "mov %[value] = cr.ivr\n"
|
---|
| 219 | : [value] "=r" (v)
|
---|
| 220 | );
|
---|
[dbd1059] | 221 |
|
---|
[0259524] | 222 | return v;
|
---|
| 223 | }
|
---|
| 224 |
|
---|
[7a0359b] | 225 | NO_TRACE static inline uint64_t cr64_read(void)
|
---|
[a2a5529] | 226 | {
|
---|
| 227 | uint64_t v;
|
---|
| 228 |
|
---|
[5bda2f3e] | 229 | asm volatile (
|
---|
| 230 | "mov %[value] = cr64\n"
|
---|
| 231 | : [value] "=r" (v)
|
---|
| 232 | );
|
---|
[a2a5529] | 233 |
|
---|
| 234 | return v;
|
---|
| 235 | }
|
---|
| 236 |
|
---|
[0259524] | 237 | /** Write ITC (Interval Timer Counter) register.
|
---|
| 238 | *
|
---|
[abbc16e] | 239 | * @param v New counter value.
|
---|
[7a0359b] | 240 | *
|
---|
[0259524] | 241 | */
|
---|
[7a0359b] | 242 | NO_TRACE static inline void itc_write(uint64_t v)
|
---|
[0259524] | 243 | {
|
---|
[5bda2f3e] | 244 | asm volatile (
|
---|
| 245 | "mov ar.itc = %[value]\n"
|
---|
| 246 | :: [value] "r" (v)
|
---|
| 247 | );
|
---|
[0259524] | 248 | }
|
---|
| 249 |
|
---|
| 250 | /** Read ITC (Interval Timer Counter) register.
|
---|
| 251 | *
|
---|
| 252 | * @return Current counter value.
|
---|
[7a0359b] | 253 | *
|
---|
[0259524] | 254 | */
|
---|
[7a0359b] | 255 | NO_TRACE static inline uint64_t itc_read(void)
|
---|
[0259524] | 256 | {
|
---|
[7f1c620] | 257 | uint64_t v;
|
---|
[0259524] | 258 |
|
---|
[5bda2f3e] | 259 | asm volatile (
|
---|
| 260 | "mov %[value] = ar.itc\n"
|
---|
| 261 | : [value] "=r" (v)
|
---|
| 262 | );
|
---|
[0259524] | 263 |
|
---|
| 264 | return v;
|
---|
| 265 | }
|
---|
| 266 |
|
---|
| 267 | /** Write ITM (Interval Timer Match) register.
|
---|
| 268 | *
|
---|
[abbc16e] | 269 | * @param v New match value.
|
---|
[7a0359b] | 270 | *
|
---|
[0259524] | 271 | */
|
---|
[7a0359b] | 272 | NO_TRACE static inline void itm_write(uint64_t v)
|
---|
[0259524] | 273 | {
|
---|
[5bda2f3e] | 274 | asm volatile (
|
---|
| 275 | "mov cr.itm = %[value]\n"
|
---|
| 276 | :: [value] "r" (v)
|
---|
| 277 | );
|
---|
[0259524] | 278 | }
|
---|
| 279 |
|
---|
[98492e8] | 280 | /** Read ITM (Interval Timer Match) register.
|
---|
| 281 | *
|
---|
| 282 | * @return Match value.
|
---|
[7a0359b] | 283 | *
|
---|
[98492e8] | 284 | */
|
---|
[7a0359b] | 285 | NO_TRACE static inline uint64_t itm_read(void)
|
---|
[98492e8] | 286 | {
|
---|
[7f1c620] | 287 | uint64_t v;
|
---|
[98492e8] | 288 |
|
---|
[5bda2f3e] | 289 | asm volatile (
|
---|
| 290 | "mov %[value] = cr.itm\n"
|
---|
| 291 | : [value] "=r" (v)
|
---|
| 292 | );
|
---|
[98492e8] | 293 |
|
---|
| 294 | return v;
|
---|
| 295 | }
|
---|
| 296 |
|
---|
[05d9dd89] | 297 | /** Read ITV (Interval Timer Vector) register.
|
---|
| 298 | *
|
---|
| 299 | * @return Current vector and mask bit.
|
---|
[7a0359b] | 300 | *
|
---|
[05d9dd89] | 301 | */
|
---|
[7a0359b] | 302 | NO_TRACE static inline uint64_t itv_read(void)
|
---|
[05d9dd89] | 303 | {
|
---|
[7f1c620] | 304 | uint64_t v;
|
---|
[05d9dd89] | 305 |
|
---|
[5bda2f3e] | 306 | asm volatile (
|
---|
| 307 | "mov %[value] = cr.itv\n"
|
---|
| 308 | : [value] "=r" (v)
|
---|
| 309 | );
|
---|
[05d9dd89] | 310 |
|
---|
| 311 | return v;
|
---|
| 312 | }
|
---|
| 313 |
|
---|
[0259524] | 314 | /** Write ITV (Interval Timer Vector) register.
|
---|
| 315 | *
|
---|
[abbc16e] | 316 | * @param v New vector and mask bit.
|
---|
[7a0359b] | 317 | *
|
---|
[0259524] | 318 | */
|
---|
[7a0359b] | 319 | NO_TRACE static inline void itv_write(uint64_t v)
|
---|
[0259524] | 320 | {
|
---|
[5bda2f3e] | 321 | asm volatile (
|
---|
| 322 | "mov cr.itv = %[value]\n"
|
---|
| 323 | :: [value] "r" (v)
|
---|
| 324 | );
|
---|
[0259524] | 325 | }
|
---|
| 326 |
|
---|
| 327 | /** Write EOI (End Of Interrupt) register.
|
---|
| 328 | *
|
---|
[abbc16e] | 329 | * @param v This value is ignored.
|
---|
[7a0359b] | 330 | *
|
---|
[0259524] | 331 | */
|
---|
[7a0359b] | 332 | NO_TRACE static inline void eoi_write(uint64_t v)
|
---|
[0259524] | 333 | {
|
---|
[5bda2f3e] | 334 | asm volatile (
|
---|
| 335 | "mov cr.eoi = %[value]\n"
|
---|
| 336 | :: [value] "r" (v)
|
---|
| 337 | );
|
---|
[0259524] | 338 | }
|
---|
| 339 |
|
---|
| 340 | /** Read TPR (Task Priority Register).
|
---|
| 341 | *
|
---|
| 342 | * @return Current value of TPR.
|
---|
[7a0359b] | 343 | *
|
---|
[0259524] | 344 | */
|
---|
[7a0359b] | 345 | NO_TRACE static inline uint64_t tpr_read(void)
|
---|
[0259524] | 346 | {
|
---|
[7f1c620] | 347 | uint64_t v;
|
---|
[5bda2f3e] | 348 |
|
---|
| 349 | asm volatile (
|
---|
| 350 | "mov %[value] = cr.tpr\n"
|
---|
| 351 | : [value] "=r" (v)
|
---|
| 352 | );
|
---|
[0259524] | 353 |
|
---|
| 354 | return v;
|
---|
[dbd1059] | 355 | }
|
---|
| 356 |
|
---|
[0259524] | 357 | /** Write TPR (Task Priority Register).
|
---|
| 358 | *
|
---|
[abbc16e] | 359 | * @param v New value of TPR.
|
---|
[7a0359b] | 360 | *
|
---|
[0259524] | 361 | */
|
---|
[7a0359b] | 362 | NO_TRACE static inline void tpr_write(uint64_t v)
|
---|
[0259524] | 363 | {
|
---|
[5bda2f3e] | 364 | asm volatile (
|
---|
| 365 | "mov cr.tpr = %[value]\n"
|
---|
| 366 | :: [value] "r" (v)
|
---|
| 367 | );
|
---|
[0259524] | 368 | }
|
---|
[9c0a9b3] | 369 |
|
---|
[0259524] | 370 | /** Disable interrupts.
|
---|
| 371 | *
|
---|
| 372 | * Disable interrupts and return previous
|
---|
| 373 | * value of PSR.
|
---|
| 374 | *
|
---|
| 375 | * @return Old interrupt priority level.
|
---|
[7a0359b] | 376 | *
|
---|
[0259524] | 377 | */
|
---|
[7a0359b] | 378 | NO_TRACE static ipl_t interrupts_disable(void)
|
---|
[0259524] | 379 | {
|
---|
[7f1c620] | 380 | uint64_t v;
|
---|
[0259524] | 381 |
|
---|
[e7b7be3f] | 382 | asm volatile (
|
---|
[5bda2f3e] | 383 | "mov %[value] = psr\n"
|
---|
| 384 | "rsm %[mask]\n"
|
---|
| 385 | : [value] "=r" (v)
|
---|
| 386 | : [mask] "i" (PSR_I_MASK)
|
---|
[0259524] | 387 | );
|
---|
| 388 |
|
---|
| 389 | return (ipl_t) v;
|
---|
| 390 | }
|
---|
| 391 |
|
---|
| 392 | /** Enable interrupts.
|
---|
| 393 | *
|
---|
| 394 | * Enable interrupts and return previous
|
---|
| 395 | * value of PSR.
|
---|
| 396 | *
|
---|
| 397 | * @return Old interrupt priority level.
|
---|
[7a0359b] | 398 | *
|
---|
[0259524] | 399 | */
|
---|
[7a0359b] | 400 | NO_TRACE static ipl_t interrupts_enable(void)
|
---|
[0259524] | 401 | {
|
---|
[7f1c620] | 402 | uint64_t v;
|
---|
[0259524] | 403 |
|
---|
[e7b7be3f] | 404 | asm volatile (
|
---|
[5bda2f3e] | 405 | "mov %[value] = psr\n"
|
---|
| 406 | "ssm %[mask]\n"
|
---|
[0259524] | 407 | ";;\n"
|
---|
| 408 | "srlz.d\n"
|
---|
[5bda2f3e] | 409 | : [value] "=r" (v)
|
---|
| 410 | : [mask] "i" (PSR_I_MASK)
|
---|
[0259524] | 411 | );
|
---|
| 412 |
|
---|
| 413 | return (ipl_t) v;
|
---|
| 414 | }
|
---|
[9c0a9b3] | 415 |
|
---|
[0259524] | 416 | /** Restore interrupt priority level.
|
---|
| 417 | *
|
---|
| 418 | * Restore PSR.
|
---|
| 419 | *
|
---|
| 420 | * @param ipl Saved interrupt priority level.
|
---|
[7a0359b] | 421 | *
|
---|
[0259524] | 422 | */
|
---|
[7a0359b] | 423 | NO_TRACE static inline void interrupts_restore(ipl_t ipl)
|
---|
[0259524] | 424 | {
|
---|
[2ccd275] | 425 | if (ipl & PSR_I_MASK)
|
---|
| 426 | (void) interrupts_enable();
|
---|
| 427 | else
|
---|
| 428 | (void) interrupts_disable();
|
---|
[0259524] | 429 | }
|
---|
[9c0a9b3] | 430 |
|
---|
[0259524] | 431 | /** Return interrupt priority level.
|
---|
| 432 | *
|
---|
| 433 | * @return PSR.
|
---|
[7a0359b] | 434 | *
|
---|
[0259524] | 435 | */
|
---|
[7a0359b] | 436 | NO_TRACE static inline ipl_t interrupts_read(void)
|
---|
[0259524] | 437 | {
|
---|
[b994a60] | 438 | return (ipl_t) psr_read();
|
---|
[0259524] | 439 | }
|
---|
[60f6b7c] | 440 |
|
---|
[fdb8c17] | 441 | /** Check interrupts state.
|
---|
| 442 | *
|
---|
| 443 | * @return True if interrupts are disabled.
|
---|
| 444 | *
|
---|
| 445 | */
|
---|
[7a0359b] | 446 | NO_TRACE static inline bool interrupts_disabled(void)
|
---|
[fdb8c17] | 447 | {
|
---|
[dbd5df1b] | 448 | return !(psr_read() & PSR_I_MASK);
|
---|
[fdb8c17] | 449 | }
|
---|
| 450 |
|
---|
[2a003d5b] | 451 | /** Disable protection key checking. */
|
---|
[7a0359b] | 452 | NO_TRACE static inline void pk_disable(void)
|
---|
[2a003d5b] | 453 | {
|
---|
[5bda2f3e] | 454 | asm volatile (
|
---|
| 455 | "rsm %[mask]\n"
|
---|
[8b4cfb9d] | 456 | ";;\n"
|
---|
| 457 | "srlz.d\n"
|
---|
[5bda2f3e] | 458 | :: [mask] "i" (PSR_PK_MASK)
|
---|
| 459 | );
|
---|
[2a003d5b] | 460 | }
|
---|
| 461 |
|
---|
[82474ef] | 462 | extern void cpu_halt(void) __attribute__((noreturn));
|
---|
[0259524] | 463 | extern void cpu_sleep(void);
|
---|
[7f1c620] | 464 | extern void asm_delay_loop(uint32_t t);
|
---|
[5e2455a] | 465 |
|
---|
[8b4d6cb] | 466 | extern void switch_to_userspace(uintptr_t, uintptr_t, uintptr_t, uintptr_t,
|
---|
| 467 | uint64_t, uint64_t);
|
---|
[b994a60] | 468 |
|
---|
[361635c] | 469 | #endif
|
---|
[b45c443] | 470 |
|
---|
[06e1e95] | 471 | /** @}
|
---|
[b45c443] | 472 | */
|
---|