Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
lg.h File Reference
#include <linux/types.h>
#include <linux/init.h>
#include <linux/stringify.h>
#include <linux/lguest.h>
#include <linux/lguest_launcher.h>
#include <linux/wait.h>
#include <linux/hrtimer.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <asm/lguest.h>

Go to the source code of this file.

Data Structures

struct  pgdir
 
struct  lguest_pages
 
struct  lg_cpu
 
struct  lg_eventfd
 
struct  lg_eventfd_map
 
struct  lguest
 

Macros

#define CHANGED_IDT   1
 
#define CHANGED_GDT   2
 
#define CHANGED_GDT_TLS   4 /* Actually a subset of CHANGED_GDT */
 
#define CHANGED_ALL   3
 
#define lgread(cpu, addr, type)   ({ type _v; __lgread((cpu), &_v, (addr), sizeof(_v)); _v; })
 
#define lgwrite(cpu, addr, type, val)
 
#define pgd_flags(x)   (pgd_val(x) & ~PAGE_MASK)
 
#define pgd_pfn(x)   (pgd_val(x) >> PAGE_SHIFT)
 
#define pmd_flags(x)   (pmd_val(x) & ~PAGE_MASK)
 
#define pmd_pfn(x)   (pmd_val(x) >> PAGE_SHIFT)
 
#define kill_guest(cpu, fmt...)
 

Functions

void free_pagetables (void)
 
int init_pagetables (struct page **switcher_page, unsigned int pages)
 
struct lguest_pages __attribute__ ((aligned(PAGE_SIZE)))
 
bool lguest_address_ok (const struct lguest *lg, unsigned long addr, unsigned long len)
 
void __lgread (struct lg_cpu *, void *, unsigned long, unsigned)
 
void __lgwrite (struct lg_cpu *, unsigned long, const void *, unsigned)
 
int run_guest (struct lg_cpu *cpu, unsigned long __user *user)
 
unsigned int interrupt_pending (struct lg_cpu *cpu, bool *more)
 
void try_deliver_interrupt (struct lg_cpu *cpu, unsigned int irq, bool more)
 
void set_interrupt (struct lg_cpu *cpu, unsigned int irq)
 
bool deliver_trap (struct lg_cpu *cpu, unsigned int num)
 
void load_guest_idt_entry (struct lg_cpu *cpu, unsigned int i, u32 low, u32 hi)
 
void guest_set_stack (struct lg_cpu *cpu, u32 seg, u32 esp, unsigned int pages)
 
void pin_stack_pages (struct lg_cpu *cpu)
 
void setup_default_idt_entries (struct lguest_ro_state *state, const unsigned long *def)
 
void copy_traps (const struct lg_cpu *cpu, struct desc_struct *idt, const unsigned long *def)
 
void guest_set_clockevent (struct lg_cpu *cpu, unsigned long delta)
 
bool send_notify_to_eventfd (struct lg_cpu *cpu)
 
void init_clockdev (struct lg_cpu *cpu)
 
bool check_syscall_vector (struct lguest *lg)
 
int init_interrupts (void)
 
void free_interrupts (void)
 
void setup_default_gdt_entries (struct lguest_ro_state *state)
 
void setup_guest_gdt (struct lg_cpu *cpu)
 
void load_guest_gdt_entry (struct lg_cpu *cpu, unsigned int i, u32 low, u32 hi)
 
void guest_load_tls (struct lg_cpu *cpu, unsigned long tls_array)
 
void copy_gdt (const struct lg_cpu *cpu, struct desc_struct *gdt)
 
void copy_gdt_tls (const struct lg_cpu *cpu, struct desc_struct *gdt)
 
int init_guest_pagetable (struct lguest *lg)
 
void free_guest_pagetable (struct lguest *lg)
 
void guest_new_pagetable (struct lg_cpu *cpu, unsigned long pgtable)
 
void guest_set_pgd (struct lguest *lg, unsigned long gpgdir, u32 i)
 
void guest_pagetable_clear_all (struct lg_cpu *cpu)
 
void guest_pagetable_flush_user (struct lg_cpu *cpu)
 
void guest_set_pte (struct lg_cpu *cpu, unsigned long gpgdir, unsigned long vaddr, pte_t val)
 
void map_switcher_in_guest (struct lg_cpu *cpu, struct lguest_pages *pages)
 
bool demand_page (struct lg_cpu *cpu, unsigned long cr2, int errcode)
 
void pin_page (struct lg_cpu *cpu, unsigned long vaddr)
 
unsigned long guest_pa (struct lg_cpu *cpu, unsigned long vaddr)
 
void page_table_guest_data_init (struct lg_cpu *cpu)
 
void lguest_arch_host_init (void)
 
void lguest_arch_host_fini (void)
 
void lguest_arch_run_guest (struct lg_cpu *cpu)
 
void lguest_arch_handle_trap (struct lg_cpu *cpu)
 
int lguest_arch_init_hypercalls (struct lg_cpu *cpu)
 
int lguest_arch_do_hcall (struct lg_cpu *cpu, struct hcall_args *args)
 
void lguest_arch_setup_regs (struct lg_cpu *cpu, unsigned long start)
 
int lguest_device_init (void)
 
void lguest_device_remove (void)
 
void do_hypercalls (struct lg_cpu *cpu)
 
void write_timestamp (struct lg_cpu *cpu)
 

Variables

char spare [PAGE_SIZE-sizeof(struct lguest_regs)]
 
struct lguest_regs regs
 
struct lguest_ro_state state
 
struct lg_cpu __attribute__
 
struct mutex lguest_lock
 
char start_switcher_text []
 
char end_switcher_text []
 
char switch_to_guest []
 

Macro Definition Documentation

#define CHANGED_ALL   3

Definition at line 38 of file lg.h.

#define CHANGED_GDT   2

Definition at line 36 of file lg.h.

#define CHANGED_GDT_TLS   4 /* Actually a subset of CHANGED_GDT */

Definition at line 37 of file lg.h.

#define CHANGED_IDT   1

Definition at line 35 of file lg.h.

#define kill_guest (   cpu,
  fmt... 
)
Value:
do { \
if (!(cpu)->lg->dead) { \
(cpu)->lg->dead = kasprintf(GFP_ATOMIC, fmt); \
if (!(cpu)->lg->dead) \
(cpu)->lg->dead = ERR_PTR(-ENOMEM); \
} \
} while(0)

Definition at line 249 of file lg.h.

#define lgread (   cpu,
  addr,
  type 
)    ({ type _v; __lgread((cpu), &_v, (addr), sizeof(_v)); _v; })

Definition at line 135 of file lg.h.

#define lgwrite (   cpu,
  addr,
  type,
  val 
)
Value:
do { \
typecheck(type, val); \
__lgwrite((cpu), (addr), &(val), sizeof(val)); \
} while(0)

Definition at line 139 of file lg.h.

#define pgd_flags (   x)    (pgd_val(x) & ~PAGE_MASK)

Definition at line 153 of file lg.h.

#define pgd_pfn (   x)    (pgd_val(x) >> PAGE_SHIFT)

Definition at line 154 of file lg.h.

#define pmd_flags (   x)    (pmd_val(x) & ~PAGE_MASK)

Definition at line 155 of file lg.h.

#define pmd_pfn (   x)    (pmd_val(x) >> PAGE_SHIFT)

Definition at line 156 of file lg.h.

Function Documentation

void __lgread ( struct lg_cpu ,
void ,
unsigned  long,
unsigned   
)

Definition at line 182 of file core.c.

void __lgwrite ( struct lg_cpu ,
unsigned  long,
const void ,
unsigned   
)

Definition at line 193 of file core.c.

bool check_syscall_vector ( struct lguest lg)

Definition at line 288 of file interrupts_and_traps.c.

void copy_gdt ( const struct lg_cpu cpu,
struct desc_struct gdt 
)

Definition at line 165 of file segments.c.

void copy_gdt_tls ( const struct lg_cpu cpu,
struct desc_struct gdt 
)

Definition at line 152 of file segments.c.

void copy_traps ( const struct lg_cpu cpu,
struct desc_struct idt,
const unsigned long def 
)

Definition at line 567 of file interrupts_and_traps.c.

bool deliver_trap ( struct lg_cpu cpu,
unsigned int  num 
)

Definition at line 331 of file interrupts_and_traps.c.

bool demand_page ( struct lg_cpu cpu,
unsigned long  cr2,
int  errcode 
)

Definition at line 312 of file page_tables.c.

void do_hypercalls ( struct lg_cpu cpu)

Definition at line 260 of file hypercalls.c.

void free_guest_pagetable ( struct lguest lg)

Definition at line 1009 of file page_tables.c.

void free_interrupts ( void  )

Definition at line 314 of file interrupts_and_traps.c.

void free_pagetables ( void  )

Definition at line 1149 of file page_tables.c.

void guest_load_tls ( struct lg_cpu cpu,
unsigned long  tls_array 
)

Definition at line 210 of file segments.c.

void guest_new_pagetable ( struct lg_cpu cpu,
unsigned long  pgtable 
)

Definition at line 785 of file page_tables.c.

unsigned long guest_pa ( struct lg_cpu cpu,
unsigned long  vaddr 
)

Definition at line 623 of file page_tables.c.

void guest_pagetable_clear_all ( struct lg_cpu cpu)

Definition at line 771 of file page_tables.c.

void guest_pagetable_flush_user ( struct lg_cpu cpu)

Definition at line 615 of file page_tables.c.

void guest_set_clockevent ( struct lg_cpu cpu,
unsigned long  delta 
)

Definition at line 613 of file interrupts_and_traps.c.

void guest_set_pgd ( struct lguest lg,
unsigned long  gpgdir,
u32  i 
)

Definition at line 932 of file page_tables.c.

void guest_set_pte ( struct lg_cpu cpu,
unsigned long  gpgdir,
unsigned long  vaddr,
pte_t  val 
)

Definition at line 897 of file page_tables.c.

void guest_set_stack ( struct lg_cpu cpu,
u32  seg,
u32  esp,
unsigned int  pages 
)

Definition at line 438 of file interrupts_and_traps.c.

void init_clockdev ( struct lg_cpu cpu)

Definition at line 643 of file interrupts_and_traps.c.

int init_guest_pagetable ( struct lguest lg)

Definition at line 962 of file page_tables.c.

int init_interrupts ( void  )

Definition at line 298 of file interrupts_and_traps.c.

int init_pagetables ( struct page **  switcher_page,
unsigned int  pages 
)

Definition at line 1132 of file page_tables.c.

unsigned int interrupt_pending ( struct lg_cpu cpu,
bool more 
)

Definition at line 158 of file interrupts_and_traps.c.

bool lguest_address_ok ( const struct lguest lg,
unsigned long  addr,
unsigned long  len 
)

Definition at line 171 of file core.c.

int lguest_arch_do_hcall ( struct lg_cpu cpu,
struct hcall_args args 
)

Definition at line 613 of file core.c.

void lguest_arch_handle_trap ( struct lg_cpu cpu)

Definition at line 362 of file core.c.

void lguest_arch_host_fini ( void  )

Definition at line 599 of file core.c.

void lguest_arch_host_init ( void  )

Definition at line 463 of file core.c.

int lguest_arch_init_hypercalls ( struct lg_cpu cpu)

Definition at line 633 of file core.c.

void lguest_arch_run_guest ( struct lg_cpu cpu)

Definition at line 199 of file core.c.

void lguest_arch_setup_regs ( struct lg_cpu cpu,
unsigned long  start 
)

Definition at line 682 of file core.c.

int lguest_device_init ( void  )

Definition at line 534 of file lguest_user.c.

void lguest_device_remove ( void  )

Definition at line 539 of file lguest_user.c.

void load_guest_gdt_entry ( struct lg_cpu cpu,
unsigned int  i,
u32  low,
u32  hi 
)

Definition at line 182 of file segments.c.

void load_guest_idt_entry ( struct lg_cpu cpu,
unsigned int  i,
u32  low,
u32  hi 
)

Definition at line 499 of file interrupts_and_traps.c.

void map_switcher_in_guest ( struct lg_cpu cpu,
struct lguest_pages pages 
)

Definition at line 1028 of file page_tables.c.

void page_table_guest_data_init ( struct lg_cpu cpu)

Definition at line 978 of file page_tables.c.

void pin_page ( struct lg_cpu cpu,
unsigned long  vaddr 
)

Definition at line 527 of file page_tables.c.

void pin_stack_pages ( struct lg_cpu cpu)

Definition at line 410 of file interrupts_and_traps.c.

int run_guest ( struct lg_cpu cpu,
unsigned long __user user 
)

Definition at line 207 of file core.c.

bool send_notify_to_eventfd ( struct lg_cpu cpu)

Definition at line 27 of file lguest_user.c.

void set_interrupt ( struct lg_cpu cpu,
unsigned int  irq 
)

Definition at line 256 of file interrupts_and_traps.c.

void setup_default_gdt_entries ( struct lguest_ro_state state)

Definition at line 106 of file segments.c.

void setup_default_idt_entries ( struct lguest_ro_state state,
const unsigned long def 
)

Definition at line 553 of file interrupts_and_traps.c.

void setup_guest_gdt ( struct lg_cpu cpu)

Definition at line 136 of file segments.c.

void try_deliver_interrupt ( struct lg_cpu cpu,
unsigned int  irq,
bool  more 
)

Definition at line 187 of file interrupts_and_traps.c.

void write_timestamp ( struct lg_cpu cpu)

Definition at line 305 of file hypercalls.c.

Variable Documentation

char end_switcher_text[]
struct mutex lguest_lock

Definition at line 36 of file lg.h.

__u8 spare

Definition at line 35 of file lg.h.

char start_switcher_text[]

Definition at line 39 of file lg.h.

char switch_to_guest[]