ia64/xen-unstable

annotate xen/include/asm-x86/rwlock.h @ 15812:86a154e1ef5d

[HVM] Shadow: don't shadow the p2m table.
For HVM vcpus with paging disabled, we used to shadow the p2m table,
and skip the p2m lookup to go from gfn to mfn. Instead, we now
provide a simple pagetable that gives a one-to-one mapping of 4GB, and
shadow that, making the translations from gfn to mfn via the p2m.
This removes the paging-disabled special-case code from the shadow
fault handler, and allows us to expand the p2m interface, since all HVM
translations now go through the same p2m lookups.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Aug 31 11:06:22 2007 +0100 (2007-08-31)
parents 94a63704b6c4
children 7989e3999e83
rev   line source
kaf24@1452 1 /* include/asm-x86/rwlock.h
kaf24@1452 2 *
kaf24@1452 3 * Helpers used by both rw spinlocks and rw semaphores.
kaf24@1452 4 *
kaf24@1452 5 * Based in part on code from semaphore.h and
kaf24@1452 6 * spinlock.h Copyright 1996 Linus Torvalds.
kaf24@1452 7 *
kaf24@1452 8 * Copyright 1999 Red Hat, Inc.
kaf24@1452 9 *
kaf24@1452 10 * Written by Benjamin LaHaise.
kaf24@1452 11 *
kaf24@1452 12 * This program is free software; you can redistribute it and/or
kaf24@1452 13 * modify it under the terms of the GNU General Public License
kaf24@1452 14 * as published by the Free Software Foundation; either version
kaf24@1452 15 * 2 of the License, or (at your option) any later version.
kaf24@1452 16 */
kaf24@1452 17 #ifndef _ASM_X86_RWLOCK_H
kaf24@1452 18 #define _ASM_X86_RWLOCK_H
kaf24@1452 19
kaf24@1452 20 #define RW_LOCK_BIAS 0x01000000
kaf24@1452 21 #define RW_LOCK_BIAS_STR "0x01000000"
kaf24@1452 22
kaf24@1452 23 #define __build_read_lock_ptr(rw, helper) \
kaf24@1452 24 asm volatile(LOCK "subl $1,(%0)\n\t" \
kaf24@1452 25 "js 2f\n" \
kaf24@1452 26 "1:\n" \
kaf24@1452 27 ".section .text.lock,\"ax\"\n" \
kaf24@1452 28 "2:\tcall " helper "\n\t" \
kaf24@1452 29 "jmp 1b\n" \
kaf24@1452 30 ".previous" \
kaf24@1452 31 ::"a" (rw) : "memory")
kaf24@1452 32
kaf24@1452 33 #define __build_read_lock_const(rw, helper) \
kaf24@1452 34 asm volatile(LOCK "subl $1,%0\n\t" \
kaf24@1452 35 "js 2f\n" \
kaf24@1452 36 "1:\n" \
kaf24@1452 37 ".section .text.lock,\"ax\"\n" \
kaf24@5193 38 "2:\tpush %%"__OP"ax\n\t" \
kaf24@5193 39 "lea %0,%%"__OP"ax\n\t" \
kaf24@1452 40 "call " helper "\n\t" \
kaf24@5193 41 "pop %%"__OP"ax\n\t" \
kaf24@1452 42 "jmp 1b\n" \
kaf24@1452 43 ".previous" \
kaf24@1452 44 :"=m" (*(volatile int *)rw) : : "memory")
kaf24@1452 45
kaf24@1452 46 #define __build_read_lock(rw, helper) do { \
kaf24@1452 47 if (__builtin_constant_p(rw)) \
kaf24@1452 48 __build_read_lock_const(rw, helper); \
kaf24@1452 49 else \
kaf24@1452 50 __build_read_lock_ptr(rw, helper); \
kaf24@1452 51 } while (0)
kaf24@1452 52
kaf24@1452 53 #define __build_write_lock_ptr(rw, helper) \
kaf24@1452 54 asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
kaf24@1452 55 "jnz 2f\n" \
kaf24@1452 56 "1:\n" \
kaf24@1452 57 ".section .text.lock,\"ax\"\n" \
kaf24@1452 58 "2:\tcall " helper "\n\t" \
kaf24@1452 59 "jmp 1b\n" \
kaf24@1452 60 ".previous" \
kaf24@1452 61 ::"a" (rw) : "memory")
kaf24@1452 62
kaf24@1452 63 #define __build_write_lock_const(rw, helper) \
kaf24@1452 64 asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
kaf24@1452 65 "jnz 2f\n" \
kaf24@1452 66 "1:\n" \
kaf24@1452 67 ".section .text.lock,\"ax\"\n" \
kaf24@5193 68 "2:\tpush %%"__OP"ax\n\t" \
kaf24@5193 69 "lea %0,%%"__OP"ax\n\t" \
kaf24@1452 70 "call " helper "\n\t" \
kaf24@5193 71 "pop %%"__OP"ax\n\t" \
kaf24@1452 72 "jmp 1b\n" \
kaf24@1452 73 ".previous" \
kaf24@1452 74 :"=m" (*(volatile int *)rw) : : "memory")
kaf24@1452 75
kaf24@1452 76 #define __build_write_lock(rw, helper) do { \
kaf24@1452 77 if (__builtin_constant_p(rw)) \
kaf24@1452 78 __build_write_lock_const(rw, helper); \
kaf24@1452 79 else \
kaf24@1452 80 __build_write_lock_ptr(rw, helper); \
kaf24@1452 81 } while (0)
kaf24@1452 82
kaf24@1452 83 #endif