diff options
author | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-11-03 10:25:35 +0000 |
---|---|---|
committer | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-11-03 10:25:35 +0000 |
commit | 91d671d051c346b798bd20a80daa45c43449c5fb (patch) | |
tree | 61ba4d721cbb04f74006e5fbc9c0a6d9d7525847 | |
parent | 8d24e730d41d85108cda4b5a0e9cd92e6cd07ac8 (diff) | |
download | xen-91d671d051c346b798bd20a80daa45c43449c5fb.tar.gz xen-91d671d051c346b798bd20a80daa45c43449c5fb.tar.bz2 xen-91d671d051c346b798bd20a80daa45c43449c5fb.zip |
bitkeeper revision 1.550 (3fa62d1fweoECOoyEeNP4Duqo5Btxw)
Many files:
More cleanups and renaming for suspend/resume.
-rw-r--r-- | tools/internal/xi_build.c | 4 | ||||
-rw-r--r-- | tools/internal/xi_create.c | 8 | ||||
-rw-r--r-- | tools/internal/xi_destroy.c | 4 | ||||
-rw-r--r-- | tools/internal/xi_list.c | 22 | ||||
-rw-r--r-- | tools/internal/xi_usage.c | 6 | ||||
-rw-r--r-- | tools/misc/xen_log.c | 4 | ||||
-rw-r--r-- | xen/arch/i386/smpboot.c | 4 | ||||
-rw-r--r-- | xen/common/dom0_ops.c | 36 | ||||
-rw-r--r-- | xen/common/domain.c | 4 | ||||
-rw-r--r-- | xen/common/kernel.c | 6 | ||||
-rw-r--r-- | xen/include/asm-i386/processor.h | 43 | ||||
-rw-r--r-- | xen/include/hypervisor-ifs/dom0_ops.h | 62 | ||||
-rw-r--r-- | xen/include/xeno/sched.h | 29 |
13 files changed, 116 insertions, 116 deletions
diff --git a/tools/internal/xi_build.c b/tools/internal/xi_build.c index 81f8a94097..f18f994124 100644 --- a/tools/internal/xi_build.c +++ b/tools/internal/xi_build.c @@ -15,8 +15,8 @@ static long get_tot_pages(int domain_id) { dom0_op_t op; op.cmd = DOM0_GETDOMAININFO; - op.u.getdominfo.domain = domain_id; - return (do_dom0_op(&op) < 0) ? -1 : op.u.getdominfo.tot_pages; + op.u.getdomaininfo.domain = domain_id; + return (do_dom0_op(&op) < 0) ? -1 : op.u.getdomaininfo.tot_pages; } static int get_pfn_list( diff --git a/tools/internal/xi_create.c b/tools/internal/xi_create.c index b5e718caa9..bd1b31e7af 100644 --- a/tools/internal/xi_create.c +++ b/tools/internal/xi_create.c @@ -15,13 +15,13 @@ static int create_new_domain(long req_mem, char *name) dom0_op_t op; op.cmd = DOM0_CREATEDOMAIN; - op.u.newdomain.memory_kb = req_mem; - strncpy(op.u.newdomain.name, name, MAX_DOMAIN_NAME); - op.u.newdomain.name[MAX_DOMAIN_NAME-1] = '\0'; + op.u.createdomain.memory_kb = req_mem; + strncpy(op.u.createdomain.name, name, MAX_DOMAIN_NAME); + op.u.createdomain.name[MAX_DOMAIN_NAME-1] = '\0'; err = do_dom0_op(&op); - return (err < 0) ? err : op.u.newdomain.domain; + return (err < 0) ? err : op.u.createdomain.domain; } int main(int argc, char **argv) diff --git a/tools/internal/xi_destroy.c b/tools/internal/xi_destroy.c index bd91c7941a..16624b483c 100644 --- a/tools/internal/xi_destroy.c +++ b/tools/internal/xi_destroy.c @@ -10,8 +10,8 @@ static int kill_domain(int dom_id, int force) dom0_op_t op; op.cmd = DOM0_DESTROYDOMAIN; - op.u.killdomain.domain = dom_id; - op.u.killdomain.force = force; + op.u.destroydomain.domain = dom_id; + op.u.destroydomain.force = force; err = do_dom0_op(&op); diff --git a/tools/internal/xi_list.c b/tools/internal/xi_list.c index fc8f4ed73c..73df092b1d 100644 --- a/tools/internal/xi_list.c +++ b/tools/internal/xi_list.c @@ -55,20 +55,20 @@ int main(int argc, char **argv) } op.cmd = DOM0_GETDOMAININFO; - op.u.getdominfo.domain = 0; + op.u.getdomaininfo.domain = 0; while ( do_dom0_op(&op) >= 0 ) { printf("%8d %2d %1d %2d %s %08x %8ld %8d %s\n", - op.u.getdominfo.domain, - op.u.getdominfo.processor, - op.u.getdominfo.has_cpu, - op.u.getdominfo.state, - statestr(op.u.getdominfo.state), - op.u.getdominfo.hyp_events, - op.u.getdominfo.mcu_advance, - op.u.getdominfo.tot_pages, - op.u.getdominfo.name); - op.u.getdominfo.domain++; + op.u.getdomaininfo.domain, + op.u.getdomaininfo.processor, + op.u.getdomaininfo.has_cpu, + op.u.getdomaininfo.state, + statestr(op.u.getdomaininfo.state), + op.u.getdomaininfo.hyp_events, + op.u.getdomaininfo.mcu_advance, + op.u.getdomaininfo.tot_pages, + op.u.getdomaininfo.name); + op.u.getdomaininfo.domain++; } return 0; diff --git a/tools/internal/xi_usage.c b/tools/internal/xi_usage.c index 59d4f7648a..875a3eae9d 100644 --- a/tools/internal/xi_usage.c +++ b/tools/internal/xi_usage.c @@ -22,13 +22,13 @@ int main(int argc, char **argv) domain = atol(argv[1]); op.cmd = DOM0_GETDOMAININFO; - op.u.getdominfo.domain = domain; + op.u.getdomaininfo.domain = domain; if ( do_dom0_op(&op) < 0 ) return 1; printf("cpu%d: %lld\n", - op.u.getdominfo.processor, - op.u.getdominfo.cpu_time); + op.u.getdomaininfo.processor, + op.u.getdomaininfo.cpu_time); if ( mlock(vifs, sizeof(vifs)) != 0 ) { diff --git a/tools/misc/xen_log.c b/tools/misc/xen_log.c index 012b934030..39ed848722 100644 --- a/tools/misc/xen_log.c +++ b/tools/misc/xen_log.c @@ -85,14 +85,14 @@ void process(void) curport = ntohs(from.sin_port); if ( lastport != curport ) { - op.u.getdominfo.domain = (int)curport; + op.u.getdomaininfo.domain = (int)curport; if ( do_dom0_op(&op) < 0 ) log("Error resolving domain name\n"); else lastport = curport; } - sprintf(obuf, "[%s] %s", op.u.getdominfo.name, buf); + sprintf(obuf, "[%s] %s", op.u.getdomaininfo.name, buf); log(obuf); fromlen = sizeof(from); diff --git a/xen/arch/i386/smpboot.c b/xen/arch/i386/smpboot.c index 4f3800903e..506ec09cb9 100644 --- a/xen/arch/i386/smpboot.c +++ b/xen/arch/i386/smpboot.c @@ -669,8 +669,8 @@ static void __init do_boot_cpu (int apicid) cpu = ++cpucount; - if ( (idle = do_newdomain(IDLE_DOMAIN_ID, cpu)) == NULL ) - panic("failed 'newdomain' for CPU %d", cpu); + if ( (idle = do_createdomain(IDLE_DOMAIN_ID, cpu)) == NULL ) + panic("failed 'createdomain' for CPU %d", cpu); idle->mm.pagetable = mk_pagetable(__pa(idle_pg_table)); diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c index b74c2d985d..5358f19b50 100644 --- a/xen/common/dom0_ops.c +++ b/xen/common/dom0_ops.c @@ -144,17 +144,17 @@ long do_dom0_op(dom0_op_t *u_dom0_op) goto exit_create; pro = (pro+1) % smp_num_cpus; - p = do_newdomain(dom, pro); + p = do_createdomain(dom, pro); if ( p == NULL ) goto exit_create; - if ( op.u.newdomain.name[0] ) + if ( op.u.createdomain.name[0] ) { - strncpy (p->name, op.u.newdomain.name, MAX_DOMAIN_NAME); + strncpy (p->name, op.u.createdomain.name, MAX_DOMAIN_NAME); p->name[MAX_DOMAIN_NAME - 1] = 0; } - ret = alloc_new_dom_mem(p, op.u.newdomain.memory_kb); + ret = alloc_new_dom_mem(p, op.u.createdomain.memory_kb); if ( ret != 0 ) { __kill_domain(p); @@ -165,7 +165,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) ret = p->domain; - op.u.newdomain.domain = ret; + op.u.createdomain.domain = ret; copy_to_user(u_dom0_op, &op, sizeof(op)); exit_create: @@ -175,8 +175,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op) case DOM0_DESTROYDOMAIN: { - unsigned int dom = op.u.killdomain.domain; - int force = op.u.killdomain.force; + unsigned int dom = op.u.destroydomain.domain; + int force = op.u.destroydomain.force; ret = (dom == IDLE_DOMAIN_ID) ? -EPERM : kill_other_domain(dom, force); } break; @@ -250,7 +250,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) read_lock_irqsave (&tasklist_lock, flags); while ( (p = p->next_task) != &idle0_task ) - if ( !is_idle_task(p) && (p->domain >= op.u.getdominfo.domain) ) + if ( !is_idle_task(p) && (p->domain >= op.u.getdomaininfo.domain) ) break; if ( p == &idle0_task ) @@ -259,16 +259,16 @@ long do_dom0_op(dom0_op_t *u_dom0_op) } else { - op.u.getdominfo.domain = p->domain; - strcpy (op.u.getdominfo.name, p->name); - op.u.getdominfo.processor = p->processor; - op.u.getdominfo.has_cpu = p->has_cpu; - op.u.getdominfo.state = p->state; - op.u.getdominfo.hyp_events = p->hyp_events; - op.u.getdominfo.mcu_advance = p->mcu_advance; - op.u.getdominfo.tot_pages = p->tot_pages; - op.u.getdominfo.cpu_time = p->cpu_time; - memcpy(&op.u.getdominfo.ctxt, + op.u.getdomaininfo.domain = p->domain; + strcpy (op.u.getdomaininfo.name, p->name); + op.u.getdomaininfo.processor = p->processor; + op.u.getdomaininfo.has_cpu = p->has_cpu; + op.u.getdomaininfo.state = p->state; + op.u.getdomaininfo.hyp_events = p->hyp_events; + op.u.getdomaininfo.mcu_advance = p->mcu_advance; + op.u.getdomaininfo.tot_pages = p->tot_pages; + op.u.getdomaininfo.cpu_time = p->cpu_time; + memcpy(&op.u.getdomaininfo.ctxt, &p->shared_info->execution_context, sizeof(execution_context_t)); } diff --git a/xen/common/domain.c b/xen/common/domain.c index 8fa6b8c1f8..5005cc9f47 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -33,7 +33,7 @@ struct task_struct *task_hash[TASK_HASH_SIZE]; /* * create a new domain */ -struct task_struct *do_newdomain(unsigned int dom_id, unsigned int cpu) +struct task_struct *do_createdomain(unsigned int dom_id, unsigned int cpu) { int retval, i; struct task_struct *p = NULL; @@ -441,7 +441,7 @@ static unsigned long alloc_page_from_domain(unsigned long * cur_addr, /* setup_guestos is used for building dom0 solely. other domains are built in * userspace dom0 and final setup is being done by final_setup_guestos. */ -int setup_guestos(struct task_struct *p, dom0_newdomain_t *params, +int setup_guestos(struct task_struct *p, dom0_createdomain_t *params, unsigned int num_vifs, char *phy_data_start, unsigned long data_len, char *cmdline, unsigned long initrd_len) diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 299215eb7d..6db936a3d7 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -92,7 +92,7 @@ static struct { void cmain (unsigned long magic, multiboot_info_t *mbi) { struct task_struct *new_dom; - dom0_newdomain_t dom0_params; + dom0_createdomain_t dom0_params; unsigned long max_page; unsigned char *cmdline; module_t *mod; @@ -190,7 +190,7 @@ void cmain (unsigned long magic, multiboot_info_t *mbi) init_page_allocator(__pa(&_end), MAX_MONITOR_ADDRESS); - /* These things will get done by do_newdomain() for all other tasks. */ + /* These things will get done by do_createdomain() for all other tasks. */ current->shared_info = (void *)get_free_page(GFP_KERNEL); memset(current->shared_info, 0, sizeof(shared_info_t)); set_fs(USER_DS); @@ -209,7 +209,7 @@ void cmain (unsigned long magic, multiboot_info_t *mbi) /* Create initial domain 0. */ dom0_params.memory_kb = opt_dom0_mem; - new_dom = do_newdomain(0, 0); + new_dom = do_createdomain(0, 0); if ( new_dom == NULL ) panic("Error creating domain 0\n"); /* diff --git a/xen/include/asm-i386/processor.h b/xen/include/asm-i386/processor.h index 123edf6739..3f3c8c4ba1 100644 --- a/xen/include/asm-i386/processor.h +++ b/xen/include/asm-i386/processor.h @@ -294,7 +294,6 @@ struct i387_fsave_struct { long foo; long fos; long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ - long status; /* software status information */ }; struct i387_fxsave_struct { @@ -313,24 +312,9 @@ struct i387_fxsave_struct { long padding[56]; } __attribute__ ((aligned (16))); -struct i387_soft_struct { - long cwd; - long swd; - long twd; - long fip; - long fcs; - long foo; - long fos; - long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ - unsigned char ftop, changed, lookahead, no_update, rm, alimit; - struct info *info; - unsigned long entry_eip; -}; - union i387_union { struct i387_fsave_struct fsave; struct i387_fxsave_struct fxsave; - struct i387_soft_struct soft; }; typedef struct { @@ -421,9 +405,32 @@ extern struct desc_struct *idt_tables[]; {~0, } /* ioperm */ \ } -/* Forward declaration, a strange C thing */ +struct mm_struct { + /* + * Every domain has a L1 pagetable of its own. Per-domain mappings + * are put in this table (eg. the current GDT is mapped here). + */ + l1_pgentry_t *perdomain_pt; + pagetable_t pagetable; + /* Current LDT details. */ + unsigned long ldt_base, ldt_ents, shadow_ldt_mapcnt; + /* Next entry is passed to LGDT on domain switch. */ + char gdt[6]; +}; + +#define IDLE0_MM \ +{ \ + perdomain_pt: 0, \ + pagetable: mk_pagetable(__pa(idle_pg_table)) \ +} + +/* Convenient accessor for mm.gdt. */ +#define SET_GDT_ENTRIES(_p, _e) ((*(u16 *)((_p)->mm.gdt + 0)) = (_e)) +#define SET_GDT_ADDRESS(_p, _a) ((*(u32 *)((_p)->mm.gdt + 2)) = (_a)) +#define GET_GDT_ENTRIES(_p) ((*(u16 *)((_p)->mm.gdt + 0))) +#define GET_GDT_ADDRESS(_p) ((*(u32 *)((_p)->mm.gdt + 2))) + struct task_struct; -struct mm_struct; /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); diff --git a/xen/include/hypervisor-ifs/dom0_ops.h b/xen/include/hypervisor-ifs/dom0_ops.h index 6f1cd137b0..639860dd8b 100644 --- a/xen/include/hypervisor-ifs/dom0_ops.h +++ b/xen/include/hypervisor-ifs/dom0_ops.h @@ -13,18 +13,35 @@ #include "hypervisor-if.h" +/* + * The following is all CPU context. Note that the i387_ctxt block is filled + * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used. + */ +typedef struct full_execution_context_st +{ + execution_context_t i386_ctxt; /* User-level CPU registers */ + char i387_ctxt[256]; /* User-level FPU registers */ + trap_info_t trap_ctxt[256]; /* Virtual IDT */ + unsigned int fast_trap_idx; /* "Fast trap" vector offset */ + unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */ + unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */ + unsigned long ring1_ss, ring1_esp; /* Virtual TSS (only SS1/ESP1) */ + unsigned long pt_base; /* CR3 (pagetable base) */ + unsigned long debugreg[8]; /* DB0-DB7 (debug registers) */ +} full_execution_context_t; + #define MAX_CMD_LEN 256 #define MAX_DOMAIN_NAME 16 #define DOM0_CREATEDOMAIN 8 -typedef struct dom0_newdomain_st +typedef struct dom0_createdomain_st { /* IN parameters. */ unsigned int memory_kb; char name[MAX_DOMAIN_NAME]; /* OUT parameters. */ unsigned int domain; -} dom0_newdomain_t; +} dom0_createdomain_t; #define DOM0_STARTDOMAIN 10 typedef struct dom0_startdomain_st @@ -41,12 +58,12 @@ typedef struct dom0_stopdomain_st } dom0_stopdomain_t; #define DOM0_DESTROYDOMAIN 9 -typedef struct dom0_killdomain_st +typedef struct dom0_destroydomain_st { /* IN variables. */ unsigned int domain; int force; -} dom0_killdomain_t; +} dom0_destroydomain_t; #define DOM0_GETMEMLIST 2 typedef struct dom0_getmemlist_st @@ -71,7 +88,7 @@ typedef struct dom0_builddomain_st char cmd_line[MAX_CMD_LEN]; unsigned long virt_mod_addr; unsigned long virt_mod_len; - execution_context_t ctxt; + full_execution_context_t ctxt; } dom0_builddomain_t; #define DOM0_BVTCTL 6 @@ -93,7 +110,7 @@ typedef struct dom0_adjustdom_st } dom0_adjustdom_t; #define DOM0_GETDOMAININFO 12 -typedef struct dom0_getdominfo_st +typedef struct dom0_getdomaininfo_st { /* IN variables. */ unsigned int domain; @@ -106,8 +123,8 @@ typedef struct dom0_getdominfo_st unsigned long mcu_advance; unsigned int tot_pages; long long cpu_time; - execution_context_t ctxt; -} dom0_getdominfo_t; + full_execution_context_t ctxt; +} dom0_getdomaininfo_t; #define DOM0_GETPAGEFRAMEINFO 18 typedef struct dom0_getpageframeinfo_st @@ -163,22 +180,21 @@ typedef struct dom0_op_st unsigned long cmd; union { - dom0_newdomain_t newdomain; - dom0_startdomain_t startdomain; - dom0_stopdomain_t stopdomain; - dom0_killdomain_t killdomain; - dom0_getmemlist_t getmemlist; - dom0_bvtctl_t bvtctl; - dom0_adjustdom_t adjustdom; - dom0_builddomain_t builddomain; - dom0_getdominfo_t getdominfo; + dom0_createdomain_t createdomain; + dom0_startdomain_t startdomain; + dom0_stopdomain_t stopdomain; + dom0_destroydomain_t destroydomain; + dom0_getmemlist_t getmemlist; + dom0_bvtctl_t bvtctl; + dom0_adjustdom_t adjustdom; + dom0_builddomain_t builddomain; + dom0_getdomaininfo_t getdomaininfo; dom0_getpageframeinfo_t getpageframeinfo; - dom0_iopl_t iopl; - dom0_msr_t msr; - dom0_debug_t debug; - dom0_settime_t settime; - } - u; + dom0_iopl_t iopl; + dom0_msr_t msr; + dom0_debug_t debug; + dom0_settime_t settime; + } u; } dom0_op_t; #endif diff --git a/xen/include/xeno/sched.h b/xen/include/xeno/sched.h index 40c3e08d6e..8265726fd8 100644 --- a/xen/include/xeno/sched.h +++ b/xen/include/xeno/sched.h @@ -27,31 +27,7 @@ extern struct timeval xtime; #include <xeno/spinlock.h> -struct mm_struct { - /* - * Every domain has a L1 pagetable of its own. Per-domain mappings - * are put in this table (eg. the current GDT is mapped here). - */ - l1_pgentry_t *perdomain_pt; - pagetable_t pagetable; - /* Current LDT details. */ - unsigned long ldt_base, ldt_ents, shadow_ldt_mapcnt; - /* Next entry is passed to LGDT on domain switch. */ - char gdt[6]; -}; - -/* Convenient accessor for mm.gdt. */ -#define SET_GDT_ENTRIES(_p, _e) ((*(u16 *)((_p)->mm.gdt + 0)) = (_e)) -#define SET_GDT_ADDRESS(_p, _a) ((*(u32 *)((_p)->mm.gdt + 2)) = (_a)) -#define GET_GDT_ENTRIES(_p) ((*(u16 *)((_p)->mm.gdt + 0))) -#define GET_GDT_ADDRESS(_p) ((*(u32 *)((_p)->mm.gdt + 2))) - extern struct mm_struct init_mm; -#define IDLE0_MM \ -{ \ - perdomain_pt: 0, \ - pagetable: mk_pagetable(__pa(idle_pg_table)) \ -} #define _HYP_EVENT_NEED_RESCHED 0 #define _HYP_EVENT_DIE 1 @@ -218,9 +194,10 @@ extern kmem_cache_t *task_struct_cachep; #define get_task_struct(_p) \ atomic_inc(&(_p)->refcnt) -extern struct task_struct *do_newdomain(unsigned int dom_id, unsigned int cpu); +extern struct task_struct *do_createdomain( + unsigned int dom_id, unsigned int cpu); extern int setup_guestos( - struct task_struct *p, dom0_newdomain_t *params, unsigned int num_vifs, + struct task_struct *p, dom0_createdomain_t *params, unsigned int num_vifs, char *data_start, unsigned long data_len, char *cmdline, unsigned long initrd_len); extern int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *); |