Initial import of kqemu-1.4.0pre1
[kqemu.git] / common / genoffsets.c
blob0a852884f48c3fea3013676fa81eb2037ae5ff65
1 /*
2 * KQEMU
4 * Copyright (C) 2004-2008 Fabrice Bellard
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #include <stdlib.h>
20 #include <stdio.h>
21 #include <inttypes.h>
23 #define NO_STD_TYPES
24 #include "kqemu_int.h"
26 #define OFFSET(x) \
27 printf("#define KQEMU_STATE_%s %d\n", \
28 #x, (int)offsetof(struct kqemu_state, x))
30 #define OFFSET1(x, name) \
31 printf("#define KQEMU_STATE_%s %d\n", \
32 name, (int)offsetof(struct kqemu_state, x))
34 int main(int argc, char **argv)
36 OFFSET(monitor_idt);
37 OFFSET(monitor_gdt);
38 OFFSET(monitor_tr_sel);
39 OFFSET(monitor_ldt_sel);
40 OFFSET(monitor_ds_sel);
41 OFFSET(monitor_ss16_sel);
42 OFFSET(monitor_cs_sel);
43 OFFSET(monitor_vaddr);
44 OFFSET(monitor_data_vaddr);
45 OFFSET(monitor_data_kaddr);
46 OFFSET(monitor_selector_base);
47 OFFSET(monitor_jmp);
48 OFFSET(monitor_cr3);
49 OFFSET(monitor_dr7);
50 OFFSET(monitor_esp);
52 OFFSET(kernel_idt);
53 OFFSET(kernel_gdt);
54 OFFSET(kernel_tr_sel);
55 OFFSET(kernel_ldt_sel);
56 OFFSET(kernel_esp);
57 OFFSET(kernel_ss_sel);
58 OFFSET(kernel_jmp);
59 OFFSET(kernel_cs_sel);
60 OFFSET(kernel_cr0);
61 OFFSET(kernel_cr3);
62 OFFSET(kernel_cr4);
63 OFFSET(kernel_esp);
65 OFFSET(nexus_orig_pte);
66 OFFSET(nexus_pte);
67 OFFSET(nexus_kaddr);
68 OFFSET(nexus_kaddr_vptep);
69 #ifdef __x86_64__
70 OFFSET(monitor_cs32_sel);
71 OFFSET(monitor_ss_null_sel);
72 #else
73 OFFSET(use_pae);
74 #endif
75 OFFSET(dt_table);
76 #ifdef USE_SEG_GP
77 OFFSET(seg_desc_cache);
78 #endif
79 OFFSET(tr_desc_cache);
80 OFFSET(cpuid_features);
82 OFFSET1(cpu_state.cpl, "cpu_state_cpl");
84 OFFSET(stack);
85 return 0;