The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/xen/arch-x86/xen-x86_32.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /******************************************************************************
    2  * xen-x86_32.h
    3  *
    4  * Guest OS interface to x86 32-bit Xen.
    5  *
    6  * Permission is hereby granted, free of charge, to any person obtaining a copy
    7  * of this software and associated documentation files (the "Software"), to
    8  * deal in the Software without restriction, including without limitation the
    9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   10  * sell copies of the Software, and to permit persons to whom the Software is
   11  * furnished to do so, subject to the following conditions:
   12  *
   13  * The above copyright notice and this permission notice shall be included in
   14  * all copies or substantial portions of the Software.
   15  *
   16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   22  * DEALINGS IN THE SOFTWARE.
   23  *
   24  * Copyright (c) 2004-2007, K A Fraser
   25  */
   26 
   27 #ifndef __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__
   28 #define __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__
   29 
   30 /*
   31  * Hypercall interface:
   32  *  Input:  %ebx, %ecx, %edx, %esi, %edi, %ebp (arguments 1-6)
   33  *  Output: %eax
   34  * Access is via hypercall page (set up by guest loader or via a Xen MSR):
   35  *  call hypercall_page + hypercall-number * 32
   36  * Clobbered: Argument registers (e.g., 2-arg hypercall clobbers %ebx,%ecx)
   37  */
   38 
   39 /*
   40  * These flat segments are in the Xen-private section of every GDT. Since these
   41  * are also present in the initial GDT, many OSes will be able to avoid
   42  * installing their own GDT.
   43  */
   44 #define FLAT_RING1_CS 0xe019    /* GDT index 259 */
   45 #define FLAT_RING1_DS 0xe021    /* GDT index 260 */
   46 #define FLAT_RING1_SS 0xe021    /* GDT index 260 */
   47 #define FLAT_RING3_CS 0xe02b    /* GDT index 261 */
   48 #define FLAT_RING3_DS 0xe033    /* GDT index 262 */
   49 #define FLAT_RING3_SS 0xe033    /* GDT index 262 */
   50 
   51 #define FLAT_KERNEL_CS FLAT_RING1_CS
   52 #define FLAT_KERNEL_DS FLAT_RING1_DS
   53 #define FLAT_KERNEL_SS FLAT_RING1_SS
   54 #define FLAT_USER_CS    FLAT_RING3_CS
   55 #define FLAT_USER_DS    FLAT_RING3_DS
   56 #define FLAT_USER_SS    FLAT_RING3_SS
   57 
   58 #define __HYPERVISOR_VIRT_START_PAE    0xF5800000
   59 #define __MACH2PHYS_VIRT_START_PAE     0xF5800000
   60 #define __MACH2PHYS_VIRT_END_PAE       0xF6800000
   61 #define HYPERVISOR_VIRT_START_PAE      xen_mk_ulong(__HYPERVISOR_VIRT_START_PAE)
   62 #define MACH2PHYS_VIRT_START_PAE       xen_mk_ulong(__MACH2PHYS_VIRT_START_PAE)
   63 #define MACH2PHYS_VIRT_END_PAE         xen_mk_ulong(__MACH2PHYS_VIRT_END_PAE)
   64 
   65 /* Non-PAE bounds are obsolete. */
   66 #define __HYPERVISOR_VIRT_START_NONPAE 0xFC000000
   67 #define __MACH2PHYS_VIRT_START_NONPAE  0xFC000000
   68 #define __MACH2PHYS_VIRT_END_NONPAE    0xFC400000
   69 #define HYPERVISOR_VIRT_START_NONPAE   \
   70     xen_mk_ulong(__HYPERVISOR_VIRT_START_NONPAE)
   71 #define MACH2PHYS_VIRT_START_NONPAE    \
   72     xen_mk_ulong(__MACH2PHYS_VIRT_START_NONPAE)
   73 #define MACH2PHYS_VIRT_END_NONPAE      \
   74     xen_mk_ulong(__MACH2PHYS_VIRT_END_NONPAE)
   75 
   76 #define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_PAE
   77 #define __MACH2PHYS_VIRT_START  __MACH2PHYS_VIRT_START_PAE
   78 #define __MACH2PHYS_VIRT_END    __MACH2PHYS_VIRT_END_PAE
   79 
   80 #ifndef HYPERVISOR_VIRT_START
   81 #define HYPERVISOR_VIRT_START xen_mk_ulong(__HYPERVISOR_VIRT_START)
   82 #endif
   83 
   84 #define MACH2PHYS_VIRT_START  xen_mk_ulong(__MACH2PHYS_VIRT_START)
   85 #define MACH2PHYS_VIRT_END    xen_mk_ulong(__MACH2PHYS_VIRT_END)
   86 #define MACH2PHYS_NR_ENTRIES  ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>2)
   87 #ifndef machine_to_phys_mapping
   88 #define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)
   89 #endif
   90 
   91 /* 32-/64-bit invariability for control interfaces (domctl/sysctl). */
   92 #if defined(__XEN__) || defined(__XEN_TOOLS__)
   93 #undef ___DEFINE_XEN_GUEST_HANDLE
   94 #define ___DEFINE_XEN_GUEST_HANDLE(name, type)                  \
   95     typedef struct { type *p; }                                 \
   96         __guest_handle_ ## name;                                \
   97     typedef struct { union { type *p; uint64_aligned_t q; }; }  \
   98         __guest_handle_64_ ## name
   99 #undef set_xen_guest_handle_raw
  100 #define set_xen_guest_handle_raw(hnd, val)                  \
  101     do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0;   \
  102          (hnd).p = val;                                     \
  103     } while ( 0 )
  104 #define  int64_aligned_t  int64_t __attribute__((aligned(8)))
  105 #define uint64_aligned_t uint64_t __attribute__((aligned(8)))
  106 #define __XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
  107 #define XEN_GUEST_HANDLE_64(name) __XEN_GUEST_HANDLE_64(name)
  108 #endif
  109 
  110 #ifndef __ASSEMBLY__
  111 
  112 #if defined(XEN_GENERATING_COMPAT_HEADERS)
  113 /* nothing */
  114 #elif defined(__XEN__) || defined(__XEN_TOOLS__)
  115 /* Anonymous unions include all permissible names (e.g., al/ah/ax/eax). */
  116 #define __DECL_REG_LO8(which) union { \
  117     uint32_t e ## which ## x; \
  118     uint16_t which ## x; \
  119     struct { \
  120         uint8_t which ## l; \
  121         uint8_t which ## h; \
  122     }; \
  123 }
  124 #define __DECL_REG_LO16(name) union { \
  125     uint32_t e ## name, _e ## name; \
  126     uint16_t name; \
  127 }
  128 #else
  129 /* Other sources must always use the proper 32-bit name (e.g., eax). */
  130 #define __DECL_REG_LO8(which) uint32_t e ## which ## x
  131 #define __DECL_REG_LO16(name) uint32_t e ## name
  132 #endif
  133 
  134 struct cpu_user_regs {
  135     __DECL_REG_LO8(b);
  136     __DECL_REG_LO8(c);
  137     __DECL_REG_LO8(d);
  138     __DECL_REG_LO16(si);
  139     __DECL_REG_LO16(di);
  140     __DECL_REG_LO16(bp);
  141     __DECL_REG_LO8(a);
  142     uint16_t error_code;    /* private */
  143     uint16_t entry_vector;  /* private */
  144     __DECL_REG_LO16(ip);
  145     uint16_t cs;
  146     uint8_t  saved_upcall_mask;
  147     uint8_t  _pad0;
  148     __DECL_REG_LO16(flags); /* eflags.IF == !saved_upcall_mask */
  149     __DECL_REG_LO16(sp);
  150     uint16_t ss, _pad1;
  151     uint16_t es, _pad2;
  152     uint16_t ds, _pad3;
  153     uint16_t fs, _pad4;
  154     uint16_t gs, _pad5;
  155 };
  156 typedef struct cpu_user_regs cpu_user_regs_t;
  157 DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);
  158 
  159 #undef __DECL_REG_LO8
  160 #undef __DECL_REG_LO16
  161 
  162 /*
  163  * Page-directory addresses above 4GB do not fit into architectural %cr3.
  164  * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
  165  * must use the following accessor macros to pack/unpack valid MFNs.
  166  */
  167 #define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
  168 #define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
  169 
  170 struct arch_vcpu_info {
  171     unsigned long cr2;
  172     unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */
  173 };
  174 typedef struct arch_vcpu_info arch_vcpu_info_t;
  175 
  176 struct xen_callback {
  177     unsigned long cs;
  178     unsigned long eip;
  179 };
  180 typedef struct xen_callback xen_callback_t;
  181 
  182 #endif /* !__ASSEMBLY__ */
  183 
  184 #endif /* __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__ */
  185 
  186 /*
  187  * Local variables:
  188  * mode: C
  189  * c-file-style: "BSD"
  190  * c-basic-offset: 4
  191  * tab-width: 4
  192  * indent-tabs-mode: nil
  193  * End:
  194  */

Cache object: 6c40ca74ec2cdbb7db21dfd468157ddb


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.