debuggers.hg

view xen/include/public/arch-x86_64.h @ 3668:d55d523078f7

bitkeeper revision 1.1159.212.77 (4202221693AFbvFZWeMHHIjQfbzTIQ)

More x86_64 prgress. Many more gaps filled in. Next step is DOM0
construction.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Thu Feb 03 13:07:34 2005 +0000 (2005-02-03)
parents 060c1ea52343
children 1c55bbe02576
line source
1 /******************************************************************************
2 * arch-x86_64.h
3 *
4 * Guest OS interface to x86 64-bit Xen.
5 *
6 * Copyright (c) 2004, K A Fraser
7 */
9 #ifndef __XEN_PUBLIC_ARCH_X86_64_H__
10 #define __XEN_PUBLIC_ARCH_X86_64_H__
12 #ifndef PACKED
13 /* GCC-specific way to pack structure definitions (no implicit padding). */
14 #define PACKED __attribute__ ((packed))
15 #endif
17 /* Pointers are naturally 64 bits in this architecture; no padding needed. */
18 #define _MEMORY_PADDING(_X)
19 #define MEMORY_PADDING
21 /*
22 * SEGMENT DESCRIPTOR TABLES
23 */
24 /*
25 * A number of GDT entries are reserved by Xen. These are not situated at the
26 * start of the GDT because some stupid OSes export hard-coded selector values
27 * in their ABI. These hard-coded values are always near the start of the GDT,
28 * so Xen places itself out of the way.
29 *
30 * NB. The reserved range is inclusive (that is, both FIRST_RESERVED_GDT_ENTRY
31 * and LAST_RESERVED_GDT_ENTRY are reserved).
32 */
33 #define NR_RESERVED_GDT_ENTRIES 72
34 #define FIRST_RESERVED_GDT_ENTRY 256
35 #define LAST_RESERVED_GDT_ENTRY \
36 (FIRST_RESERVED_GDT_ENTRY + NR_RESERVED_GDT_ENTRIES - 1)
38 /*
39 * 64-bit segment selectors
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 */
45 #define FLAT_RING3_CS32 0x0823 /* GDT index 260 */
46 #define FLAT_RING3_CS64 0x082b /* GDT index 261 */
47 #define FLAT_RING3_DS32 0x0833 /* GDT index 262 */
48 #define FLAT_RING3_DS64 0x0000
50 #define FLAT_GUESTOS_DS64 FLAT_RING3_DS64
51 #define FLAT_GUESTOS_DS32 FLAT_RING3_DS32
52 #define FLAT_GUESTOS_DS FLAT_GUESTOS_DS64
53 #define FLAT_GUESTOS_CS64 FLAT_RING3_CS64
54 #define FLAT_GUESTOS_CS32 FLAT_RING3_CS32
55 #define FLAT_GUESTOS_CS FLAT_GUESTOS_CS64
57 #define FLAT_USER_DS64 FLAT_RING3_DS64
58 #define FLAT_USER_DS32 FLAT_RING3_DS32
59 #define FLAT_USER_DS FLAT_USER_DS64
60 #define FLAT_USER_CS64 FLAT_RING3_CS64
61 #define FLAT_USER_CS32 FLAT_RING3_CS32
62 #define FLAT_USER_CS FLAT_USER_CS64
64 /* And the trap vector is... */
65 #define TRAP_INSTR "syscall"
67 /* The machine->physical mapping table starts at this address, read-only. */
68 #ifndef machine_to_phys_mapping
69 #define machine_to_phys_mapping ((unsigned long *)0xffff810000000000ULL)
70 #endif
72 #ifndef __ASSEMBLY__
74 /* NB. Both the following are 64 bits each. */
75 typedef unsigned long memory_t; /* Full-sized pointer/address/memory-size. */
76 typedef unsigned long cpureg_t; /* Full-sized register. */
78 /*
79 * Send an array of these to HYPERVISOR_set_trap_table()
80 */
81 #define TI_GET_DPL(_ti) ((_ti)->flags & 3)
82 #define TI_GET_IF(_ti) ((_ti)->flags & 4)
83 #define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
84 #define TI_SET_IF(_ti,_if) ((_ti)->flags |= ((!!(_if))<<2))
85 typedef struct {
86 u8 vector; /* 0: exception vector */
87 u8 flags; /* 1: 0-3: privilege level; 4: clear event enable? */
88 u16 cs; /* 2: code selector */
89 u32 __pad; /* 4 */
90 memory_t address; /* 8: code address */
91 } PACKED trap_info_t; /* 16 bytes */
93 typedef struct
94 {
95 unsigned long r15;
96 unsigned long r14;
97 unsigned long r13;
98 unsigned long r12;
99 union { unsigned long rbp, ebp; } PACKED;
100 union { unsigned long rbx, ebx; } PACKED;
101 unsigned long r11;
102 unsigned long r10;
103 unsigned long r9;
104 unsigned long r8;
105 union { unsigned long rax, eax; } PACKED;
106 union { unsigned long rcx, ecx; } PACKED;
107 union { unsigned long rdx, edx; } PACKED;
108 union { unsigned long rsi, esi; } PACKED;
109 union { unsigned long rdi, edi; } PACKED;
110 unsigned long _unused;
111 union { unsigned long rip, eip; } PACKED;
112 unsigned long cs;
113 union { unsigned long rflags, eflags; } PACKED;
114 union { unsigned long rsp, esp; } PACKED;
115 unsigned long ss;
116 unsigned long es;
117 unsigned long ds;
118 unsigned long fs;
119 unsigned long gs;
120 } PACKED execution_context_t;
122 typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
124 /*
125 * The following is all CPU context. Note that the i387_ctxt block is filled
126 * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
127 */
128 typedef struct {
129 #define ECF_I387_VALID (1<<0)
130 #define ECF_VMX_GUEST (2<<0)
131 unsigned long flags;
132 execution_context_t cpu_ctxt; /* User-level CPU registers */
133 char fpu_ctxt[512]; /* User-level FPU registers */
134 trap_info_t trap_ctxt[256]; /* Virtual IDT */
135 unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */
136 unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
137 unsigned long guestos_ss, guestos_esp; /* Virtual TSS (only SS1/ESP1) */
138 unsigned long pt_base; /* CR3 (pagetable base) */
139 unsigned long debugreg[8]; /* DB0-DB7 (debug registers) */
140 unsigned long event_callback_cs; /* CS:EIP of event callback */
141 unsigned long event_callback_eip;
142 unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */
143 unsigned long failsafe_callback_eip;
144 } PACKED full_execution_context_t;
146 typedef struct {
147 /* MFN of a table of MFNs that make up p2m table */
148 u64 pfn_to_mfn_frame_list;
149 } PACKED arch_shared_info_t;
151 #endif /* !__ASSEMBLY__ */
153 #endif