Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / arch / x86 / context.h
1 #ifndef i386_CONTEXT_H
2 #define i386_CONTEXT_H
3
4 struct context {
5     /* Stack Segment, placed here because of the alignment issue... */
6     uint16_t ss;
7     /* Used with sgdt/lgdt */
8     uint16_t gdt_limit;
9     uint32_t gdt_base;
10     /* General registers, accessed with pushal/popal */
11     uint32_t edi;
12     uint32_t esi;
13     uint32_t ebp;
14     uint32_t esp; /* points just below eax */
15     uint32_t ebx;
16     uint32_t edx;
17     uint32_t ecx;
18     uint32_t eax;
19 #define ESP_LOC(ctx) (&(ctx)->gs)
20     /* Segment registers */
21     uint32_t gs;
22     uint32_t fs;
23     uint32_t es;
24     uint32_t ds;
25     /* Flags */
26     uint32_t eflags;
27     /* Code segment:offset */
28     uint32_t eip;
29     uint32_t cs;
30     /* Optional stack contents */
31     uint32_t return_addr;
32     uint32_t param[0];
33 };
34
35 /* Create a new context in the given stack */
36 struct context *
37 init_context(uint8_t *stack, uint32_t stack_size, int num_param);
38
39 /* Switch context */
40 struct context *switch_to(struct context *);
41
42 /* Holds physical address of boot context */
43 extern unsigned long __boot_ctx;
44
45 /* This can always be safely used to refer to the boot context */
46 #define boot_ctx ((struct context *) phys_to_virt(__boot_ctx))
47
48 #endif /* i386_CONTEXT_H */