Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v3.16-rc7 92 lines 2.5 kB view raw
1#ifndef _ASM_X86_LGUEST_H 2#define _ASM_X86_LGUEST_H 3 4#define GDT_ENTRY_LGUEST_CS 10 5#define GDT_ENTRY_LGUEST_DS 11 6#define LGUEST_CS (GDT_ENTRY_LGUEST_CS * 8) 7#define LGUEST_DS (GDT_ENTRY_LGUEST_DS * 8) 8 9#ifndef __ASSEMBLY__ 10#include <asm/desc.h> 11 12#define GUEST_PL 1 13 14/* Page for Switcher text itself, then two pages per cpu */ 15#define TOTAL_SWITCHER_PAGES (1 + 2 * nr_cpu_ids) 16 17/* Where we map the Switcher, in both Host and Guest. */ 18extern unsigned long switcher_addr; 19 20/* Found in switcher.S */ 21extern unsigned long default_idt_entries[]; 22 23/* Declarations for definitions in lguest_guest.S */ 24extern char lguest_noirq_start[], lguest_noirq_end[]; 25extern const char lgstart_cli[], lgend_cli[]; 26extern const char lgstart_sti[], lgend_sti[]; 27extern const char lgstart_popf[], lgend_popf[]; 28extern const char lgstart_pushf[], lgend_pushf[]; 29extern const char lgstart_iret[], lgend_iret[]; 30 31extern void lguest_iret(void); 32extern void lguest_init(void); 33 34struct lguest_regs { 35 /* Manually saved part. */ 36 unsigned long eax, ebx, ecx, edx; 37 unsigned long esi, edi, ebp; 38 unsigned long gs; 39 unsigned long fs, ds, es; 40 unsigned long trapnum, errcode; 41 /* Trap pushed part */ 42 unsigned long eip; 43 unsigned long cs; 44 unsigned long eflags; 45 unsigned long esp; 46 unsigned long ss; 47}; 48 49/* This is a guest-specific page (mapped ro) into the guest. */ 50struct lguest_ro_state { 51 /* Host information we need to restore when we switch back. */ 52 u32 host_cr3; 53 struct desc_ptr host_idt_desc; 54 struct desc_ptr host_gdt_desc; 55 u32 host_sp; 56 57 /* Fields which are used when guest is running. */ 58 struct desc_ptr guest_idt_desc; 59 struct desc_ptr guest_gdt_desc; 60 struct x86_hw_tss guest_tss; 61 struct desc_struct guest_idt[IDT_ENTRIES]; 62 struct desc_struct guest_gdt[GDT_ENTRIES]; 63}; 64 65struct lg_cpu_arch { 66 /* The GDT entries copied into lguest_ro_state when running. */ 67 struct desc_struct gdt[GDT_ENTRIES]; 68 69 /* The IDT entries: some copied into lguest_ro_state when running. */ 70 struct desc_struct idt[IDT_ENTRIES]; 71 72 /* The address of the last guest-visible pagefault (ie. cr2). */ 73 unsigned long last_pagefault; 74}; 75 76static inline void lguest_set_ts(void) 77{ 78 u32 cr0; 79 80 cr0 = read_cr0(); 81 if (!(cr0 & 8)) 82 write_cr0(cr0 | 8); 83} 84 85/* Full 4G segment descriptors, suitable for CS and DS. */ 86#define FULL_EXEC_SEGMENT \ 87 ((struct desc_struct)GDT_ENTRY_INIT(0xc09b, 0, 0xfffff)) 88#define FULL_SEGMENT ((struct desc_struct)GDT_ENTRY_INIT(0xc093, 0, 0xfffff)) 89 90#endif /* __ASSEMBLY__ */ 91 92#endif /* _ASM_X86_LGUEST_H */