Patchwork [09/40] xenner: kernel: Global data

login
register
mail settings
Submitter Alexander Graf
Date Nov. 1, 2010, 3:01 p.m.
Message ID <1288623713-28062-10-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/69772/
State New
Headers show

Comments

Alexander Graf - Nov. 1, 2010, 3:01 p.m.
We need to access global variables from various points in the code. Keep them
in a single file, so we know where they are.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 pc-bios/xenner/xenner-data.c |  142 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 142 insertions(+), 0 deletions(-)
 create mode 100644 pc-bios/xenner/xenner-data.c

Patch

diff --git a/pc-bios/xenner/xenner-data.c b/pc-bios/xenner/xenner-data.c
new file mode 100644
index 0000000..cbe399c
--- /dev/null
+++ b/pc-bios/xenner/xenner-data.c
@@ -0,0 +1,142 @@ 
+/*
+ *  Copyright (C) Red Hat 2007
+ *  Copyright (C) Novell Inc. 2010
+ *
+ *  Author(s): Gerd Hoffmann <kraxel@redhat.com>
+ *             Alexander Graf <agraf@suse.de>
+ *
+ *  Xenner random data structures
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "xenner.h"
+
+#ifdef CONFIG_64BIT
+
+struct idt_64 page_aligned xen_idt[256];
+
+#else
+
+struct descriptor_32 page_aligned xen_idt[256];
+
+page_aligned uint32_t maps_32[PTE_COUNT_32];
+page_aligned uint64_t maps_pae[PTE_COUNT_PAE];
+uint32_t maps_refcnt[MAPS_MAX];
+
+#endif
+
+unsigned long *m2p;
+
+page_aligned struct vcpu_guest_context boot_ctxt;
+LIST_HEAD(cpus);
+
+int grant_frames;
+struct grant_entry_v1 page_aligned grant_table[GRANT_ENTRIES];
+struct shared_info page_aligned shared_info;
+struct xenner_info page_aligned vminfo = {
+    .abi_version          = XENNER_ABI_VERSION,
+};
+
+struct vmconfig  vmconf;
+xen_callback_t   xencb[8];
+struct trap_info xentr[256];
+int wrpt;
+
+/* trap/fault info */
+const struct trapinfo trapinfo[32] = {
+    [  0 ] = { .name = "division by zero",              .ec = 0, .lvl = 1 },
+    [  1 ] = { .name = "debug interrupt",               .ec = 0, .lvl = 3 },
+    [  2 ] = { .name = "NMI",                           .ec = 0, .lvl = 1 },
+    [  3 ] = { .name = "breakpoint",                    .ec = 0, .lvl = 3 },
+    [  4 ] = { .name = "overflow",                      .ec = 0, .lvl = 1 },
+    [  5 ] = { .name = "bound check",                   .ec = 0, .lvl = 1 },
+    [  6 ] = { .name = "illegal instruction",           .ec = 0, .lvl = 1 },
+    [  7 ] = { .name = "device not present",            .ec = 0, .lvl = 1 },
+    [  8 ] = { .name = "double fault",                  .ec = 1, .lvl = 0 },
+    [  9 ] = { .name = "coprocessor",                   .ec = 0, .lvl = 1 },
+    [ 10 ] = { .name = "invalid TSS",                   .ec = 1, .lvl = 0 },
+    [ 11 ] = { .name = "segment not pesent",            .ec = 1, .lvl = 1 },
+    [ 12 ] = { .name = "stack fault",                   .ec = 1, .lvl = 1 },
+    [ 13 ] = { .name = "general protection fault",      .ec = 1, .lvl = 1 },
+    [ 14 ] = { .name = "page fault",                    .ec = 1, .lvl = 1 },
+    [ 16 ] = { .name = "floating point exception",      .ec = 0, .lvl = 1 },
+    [ 17 ] = { .name = "alignment",                     .ec = 1, .lvl = 1 },
+    [ 18 ] = { .name = "machine check",                 .ec = 0, .lvl = 1 },
+    [ 19 ] = { .name = "SIMD floating point exception", .ec = 0, .lvl = 1 },
+};
+
+const char *cr0_bits[32] = {
+    [  0 ] = "PE",
+    [  1 ] = "MP",
+    [  2 ] = "EM",
+    [  3 ] = "TS",
+    [  4 ] = "ET",
+    [  5 ] = "NE",
+    [ 16 ] = "WP",
+    [ 18 ] = "AM",
+    [ 29 ] = "NW",
+    [ 30 ] = "CD",
+    [ 31 ] = "PG",
+};
+
+const char *cr4_bits[32] = {
+    [  0 ] = "VME",
+    [  1 ] = "PVI",
+    [  2 ] = "TSD",
+    [  3 ] = "DE",
+    [  4 ] = "PSE",
+    [  5 ] = "PAE",
+    [  6 ] = "MCE",
+    [  7 ] = "PGE",
+    [  8 ] = "PCE",
+    [  9 ] = "OSFXSR",
+    [ 10 ] = "OSXMMEXCPT",
+};
+
+const char *pg_bits[32] = {
+    [ 0 ] = "present",
+    [ 1 ] = "write",
+    [ 2 ] = "user",
+    [ 3 ] = "pwt",
+    [ 4 ] = "pcd",
+    [ 5 ] = "access",
+    [ 6 ] = "dirty",
+    [ 7 ] = "pse",
+    [ 8 ] = "global",
+};
+
+const char *rflags_bits[32] = {
+    [  0 ] = "CF",
+    [  2 ] = "PF",
+
+    [  4 ] = "AF",
+    [  6 ] = "ZF",
+
+    [  8 ] = "TF",
+    [  9 ] = "IF",
+    [ 10 ] = "DF",
+    [ 11 ] = "OF",
+
+    [ 12 ] = "IOPL-1",
+    [ 13 ] = "IOPL-2",
+    [ 14 ] = "NT",
+
+    [ 16 ] = "RF",
+    [ 17 ] = "VM",
+    [ 18 ] = "AC",
+    [ 19 ] = "VIF",
+
+    [ 20 ] = "VIP",
+    [ 21 ] = "ID",
+};