ia64/xen-unstable
changeset 1082:143de83a34dd
bitkeeper revision 1.717 (402a69d0603eYoV240buOqj3mgegjA)
Many files:
Move everything except the Python toolset to 64-bit domain identifiers.
.del-block.c~add8486d96ee5b5f:
Delete: xen/common/block.c
Many files:
Move everything except the Python toolset to 64-bit domain identifiers.
.del-block.c~add8486d96ee5b5f:
Delete: xen/common/block.c
line diff
1.1 --- a/.rootkeys Tue Feb 10 14:38:31 2004 +0000 1.2 +++ b/.rootkeys Wed Feb 11 17:43:44 2004 +0000 1.3 @@ -126,7 +126,6 @@ 3ddb79bc4nTpGQOe6_-MbyZzkhlhFQ xen/arch/ 1.4 3ddb79bcOMCu9-5mKpjIh5d0qqBDPg xen/arch/i386/xeno.lds 1.5 3ddb79bdff-gj-jFGKjOejeHLqL8Lg xen/common/Makefile 1.6 3e397e66AyyD5fYraAySWuwi9uqSXg xen/common/ac_timer.c 1.7 -3ddb79bddEYJbcURvqqcx99Yl2iAhQ xen/common/block.c 1.8 3ddb79bdrqnW93GR9gZk1OJe1qK-iQ xen/common/brlock.c 1.9 3fb10d07GscSWPKxBqpvNfU-dYfa0g xen/common/console.c 1.10 4022a73c_BbDFd2YJ_NQYVvKX5Oz7w xen/common/debug-linux.c
2.1 --- a/tools/xc/lib/xc.h Tue Feb 10 14:38:31 2004 +0000 2.2 +++ b/tools/xc/lib/xc.h Wed Feb 11 17:43:44 2004 +0000 2.3 @@ -9,12 +9,21 @@ 2.4 #ifndef __XC_H__ 2.5 #define __XC_H__ 2.6 2.7 +typedef unsigned char u8; 2.8 +typedef unsigned short u16; 2.9 +typedef unsigned long u32; 2.10 +typedef unsigned long long u64; 2.11 +typedef signed char s8; 2.12 +typedef signed short s16; 2.13 +typedef signed long s32; 2.14 +typedef signed long long s64; 2.15 + 2.16 /* Obtain or relinquish a handle on the 'xc' library. */ 2.17 int xc_interface_open(void); 2.18 int xc_interface_close(int xc_handle); 2.19 2.20 typedef struct { 2.21 - unsigned int domid; 2.22 + u64 domid; 2.23 unsigned int cpu; 2.24 int has_cpu; 2.25 int stopped; 2.26 @@ -26,44 +35,46 @@ typedef struct { 2.27 2.28 int xc_domain_create(int xc_handle, 2.29 unsigned int mem_kb, 2.30 - const char *name); 2.31 + const char *name, 2.32 + u64 *pdomid); 2.33 int xc_domain_start(int xc_handle, 2.34 - unsigned int domid); 2.35 + u64 domid); 2.36 int xc_domain_stop(int xc_handle, 2.37 - unsigned int domid); 2.38 + u64 domid); 2.39 int xc_domain_destroy(int xc_handle, 2.40 - unsigned int domid, 2.41 + u64 domid, 2.42 int force); 2.43 int xc_domain_pincpu(int xc_handle, 2.44 - unsigned int domid, 2.45 + u64 domid, 2.46 int cpu); 2.47 int xc_domain_getinfo(int xc_handle, 2.48 - unsigned int first_domid, 2.49 + u64 first_domid, 2.50 unsigned int max_doms, 2.51 xc_dominfo_t *info); 2.52 2.53 int xc_linux_save(int xc_handle, 2.54 - unsigned int domid, 2.55 + u64 domid, 2.56 const char *state_file, 2.57 int verbose); 2.58 int xc_linux_restore(int xc_handle, 2.59 const char *state_file, 2.60 - int verbose); 2.61 + int verbose, 2.62 + u64 *pdomid); 2.63 int xc_linux_build(int xc_handle, 2.64 - unsigned int domid, 2.65 + u64 domid, 2.66 const char *image_name, 2.67 const char *ramdisk_name, 2.68 const char *cmdline); 2.69 2.70 int xc_netbsd_build(int xc_handle, 2.71 - unsigned int domid, 2.72 + u64 domid, 2.73 const char *image_name, 2.74 const char *cmdline); 2.75 2.76 int xc_bvtsched_global_set(int xc_handle, 2.77 unsigned long ctx_allow); 2.78 int xc_bvtsched_domain_set(int xc_handle, 2.79 - unsigned int domid, 2.80 + u64 domid, 2.81 unsigned long mcuadv, 2.82 unsigned long warp, 2.83 unsigned long warpl, 2.84 @@ -80,21 +91,21 @@ typedef struct { 2.85 } xc_vif_stats_t; 2.86 2.87 int xc_vif_scheduler_set(int xc_handle, 2.88 - unsigned int domid, 2.89 + u64 domid, 2.90 unsigned int vifid, 2.91 xc_vif_sched_params_t *params); 2.92 int xc_vif_scheduler_get(int xc_handle, 2.93 - unsigned int domid, 2.94 + u64 domid, 2.95 unsigned int vifid, 2.96 xc_vif_sched_params_t *params); 2.97 int xc_vif_stats_get(int xc_handle, 2.98 - unsigned int domid, 2.99 + u64 domid, 2.100 unsigned int vifid, 2.101 xc_vif_stats_t *stats); 2.102 2.103 typedef struct { 2.104 -#define XC_VBDDOM_PROBE_ALL (~0U) 2.105 - unsigned int domid; 2.106 +#define XC_VBDDOM_PROBE_ALL (~0ULL) 2.107 + u64 domid; 2.108 unsigned short vbdid; 2.109 #define XC_VBDF_WRITEABLE (1<<0) 2.110 unsigned long flags; 2.111 @@ -108,32 +119,32 @@ typedef struct { 2.112 } xc_vbdextent_t; 2.113 2.114 int xc_vbd_create(int xc_handle, 2.115 - unsigned int domid, 2.116 + u64 domid, 2.117 unsigned short vbdid, 2.118 int writeable); 2.119 int xc_vbd_destroy(int xc_handle, 2.120 - unsigned int domid, 2.121 + u64 domid, 2.122 unsigned short vbdid); 2.123 int xc_vbd_grow(int xc_handle, 2.124 - unsigned int domid, 2.125 + u64 domid, 2.126 unsigned short vbdid, 2.127 xc_vbdextent_t *extent); 2.128 int xc_vbd_shrink(int xc_handle, 2.129 - unsigned int domid, 2.130 + u64 domid, 2.131 unsigned short vbdid); 2.132 int xc_vbd_setextents(int xc_handle, 2.133 - unsigned int domid, 2.134 + u64 domid, 2.135 unsigned short vbdid, 2.136 unsigned int nr_extents, 2.137 xc_vbdextent_t *extents); 2.138 int xc_vbd_getextents(int xc_handle, 2.139 - unsigned int domid, 2.140 + u64 domid, 2.141 unsigned short vbdid, 2.142 unsigned int max_extents, 2.143 xc_vbdextent_t *extents, 2.144 int *writeable); 2.145 int xc_vbd_probe(int xc_handle, 2.146 - unsigned int domid, 2.147 + u64 domid, 2.148 unsigned int max_vbds, 2.149 xc_vbd_t *vbds); 2.150
3.1 --- a/tools/xc/lib/xc_bvtsched.c Tue Feb 10 14:38:31 2004 +0000 3.2 +++ b/tools/xc/lib/xc_bvtsched.c Wed Feb 11 17:43:44 2004 +0000 3.3 @@ -18,7 +18,7 @@ int xc_bvtsched_global_set(int xc_handle 3.4 } 3.5 3.6 int xc_bvtsched_domain_set(int xc_handle, 3.7 - unsigned int domid, 3.8 + domid_t domid, 3.9 unsigned long mcuadv, 3.10 unsigned long warp, 3.11 unsigned long warpl,
4.1 --- a/tools/xc/lib/xc_domain.c Tue Feb 10 14:38:31 2004 +0000 4.2 +++ b/tools/xc/lib/xc_domain.c Wed Feb 11 17:43:44 2004 +0000 4.3 @@ -10,7 +10,8 @@ 4.4 4.5 int xc_domain_create(int xc_handle, 4.6 unsigned int mem_kb, 4.7 - const char *name) 4.8 + const char *name, 4.9 + domid_t *pdomid) 4.10 { 4.11 int err; 4.12 dom0_op_t op; 4.13 @@ -20,14 +21,15 @@ int xc_domain_create(int xc_handle, 4.14 strncpy(op.u.createdomain.name, name, MAX_DOMAIN_NAME); 4.15 op.u.createdomain.name[MAX_DOMAIN_NAME-1] = '\0'; 4.16 4.17 - err = do_dom0_op(xc_handle, &op); 4.18 + if ( (err = do_dom0_op(xc_handle, &op)) == 0 ) 4.19 + *pdomid = op.u.createdomain.domain; 4.20 4.21 - return (err < 0) ? err : op.u.createdomain.domain; 4.22 + return err; 4.23 } 4.24 4.25 4.26 int xc_domain_start(int xc_handle, 4.27 - unsigned int domid) 4.28 + domid_t domid) 4.29 { 4.30 dom0_op_t op; 4.31 op.cmd = DOM0_STARTDOMAIN; 4.32 @@ -37,7 +39,7 @@ int xc_domain_start(int xc_handle, 4.33 4.34 4.35 int xc_domain_stop(int xc_handle, 4.36 - unsigned int domid) 4.37 + domid_t domid) 4.38 { 4.39 dom0_op_t op; 4.40 op.cmd = DOM0_STOPDOMAIN; 4.41 @@ -47,7 +49,7 @@ int xc_domain_stop(int xc_handle, 4.42 4.43 4.44 int xc_domain_destroy(int xc_handle, 4.45 - unsigned int domid, 4.46 + domid_t domid, 4.47 int force) 4.48 { 4.49 dom0_op_t op; 4.50 @@ -58,8 +60,8 @@ int xc_domain_destroy(int xc_handle, 4.51 } 4.52 4.53 int xc_domain_pincpu(int xc_handle, 4.54 - unsigned int domid, 4.55 - int cpu) 4.56 + domid_t domid, 4.57 + int cpu) 4.58 { 4.59 dom0_op_t op; 4.60 op.cmd = DOM0_PINCPUDOMAIN; 4.61 @@ -70,11 +72,12 @@ int xc_domain_pincpu(int xc_handle, 4.62 4.63 4.64 int xc_domain_getinfo(int xc_handle, 4.65 - unsigned int first_domid, 4.66 + domid_t first_domid, 4.67 unsigned int max_doms, 4.68 xc_dominfo_t *info) 4.69 { 4.70 - unsigned int nr_doms, next_domid = first_domid; 4.71 + unsigned int nr_doms; 4.72 + domid_t next_domid = first_domid; 4.73 dom0_op_t op; 4.74 4.75 for ( nr_doms = 0; nr_doms < max_doms; nr_doms++ )
5.1 --- a/tools/xc/lib/xc_linux_build.c Tue Feb 10 14:38:31 2004 +0000 5.2 +++ b/tools/xc/lib/xc_linux_build.c Wed Feb 11 17:43:44 2004 +0000 5.3 @@ -12,7 +12,7 @@ 5.4 #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED) 5.5 #define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER) 5.6 5.7 -static long get_tot_pages(int xc_handle, int domid) 5.8 +static long get_tot_pages(int xc_handle, domid_t domid) 5.9 { 5.10 dom0_op_t op; 5.11 op.cmd = DOM0_GETDOMAININFO; 5.12 @@ -22,7 +22,7 @@ static long get_tot_pages(int xc_handle, 5.13 } 5.14 5.15 static int get_pfn_list(int xc_handle, 5.16 - int domid, 5.17 + domid_t domid, 5.18 unsigned long *pfn_buf, 5.19 unsigned long max_pfns) 5.20 { 5.21 @@ -96,7 +96,7 @@ static int copy_to_domain_page(int pm_ha 5.22 } 5.23 5.24 static int setup_guestos(int xc_handle, 5.25 - int dom, 5.26 + domid_t dom, 5.27 gzFile kernel_gfd, 5.28 gzFile initrd_gfd, 5.29 unsigned long tot_pages, 5.30 @@ -282,7 +282,6 @@ static int setup_guestos(int xc_handle, 5.31 start_info->mod_len = initrd_len; 5.32 start_info->nr_pages = tot_pages; 5.33 start_info->shared_info = shared_info_frame << PAGE_SHIFT; 5.34 - start_info->dom_id = dom; 5.35 start_info->flags = 0; 5.36 strncpy(start_info->cmd_line, cmdline, MAX_CMD_LEN); 5.37 start_info->cmd_line[MAX_CMD_LEN-1] = '\0'; 5.38 @@ -313,7 +312,7 @@ static int setup_guestos(int xc_handle, 5.39 } 5.40 5.41 int xc_linux_build(int xc_handle, 5.42 - unsigned int domid, 5.43 + domid_t domid, 5.44 const char *image_name, 5.45 const char *ramdisk_name, 5.46 const char *cmdline)
6.1 --- a/tools/xc/lib/xc_linux_restore.c Tue Feb 10 14:38:31 2004 +0000 6.2 +++ b/tools/xc/lib/xc_linux_restore.c Wed Feb 11 17:43:44 2004 +0000 6.3 @@ -19,7 +19,7 @@ 6.4 } while ( 0 ) 6.5 6.6 static int get_pfn_list(int xc_handle, 6.7 - int domain_id, 6.8 + domid_t domain_id, 6.9 unsigned long *pfn_buf, 6.10 unsigned long max_pfns) 6.11 { 6.12 @@ -103,11 +103,13 @@ static int checked_read(gzFile fd, void 6.13 6.14 int xc_linux_restore(int xc_handle, 6.15 const char *state_file, 6.16 - int verbose) 6.17 + int verbose, 6.18 + domid_t *pdomid) 6.19 { 6.20 dom0_op_t op; 6.21 int rc = 1, i, j; 6.22 - unsigned long mfn, pfn, dom = 0; 6.23 + unsigned long mfn, pfn; 6.24 + domid_t dom = 0; 6.25 unsigned int prev_pc, this_pc; 6.26 6.27 /* Number of page frames in use by this XenoLinux session. */ 6.28 @@ -370,7 +372,6 @@ int xc_linux_restore(int xc_handle, 6.29 p_srec = map_pfn(pm_handle, mfn); 6.30 p_srec->resume_info.nr_pages = nr_pfns; 6.31 p_srec->resume_info.shared_info = shared_info_frame << PAGE_SHIFT; 6.32 - p_srec->resume_info.dom_id = dom; 6.33 p_srec->resume_info.flags = 0; 6.34 unmap_pfn(pm_handle, p_srec); 6.35 6.36 @@ -470,7 +471,7 @@ int xc_linux_restore(int xc_handle, 6.37 else 6.38 { 6.39 /* Success: print the domain id. */ 6.40 - verbose_printf("DOM=%ld\n", dom); 6.41 + verbose_printf("DOM=%llu\n", dom); 6.42 } 6.43 6.44 if ( pm_handle >= 0 ) 6.45 @@ -483,5 +484,8 @@ int xc_linux_restore(int xc_handle, 6.46 6.47 gzclose(gfd); 6.48 6.49 - return (rc == 0) ? dom : rc; 6.50 + if ( rc == 0 ) 6.51 + *pdomid = dom; 6.52 + 6.53 + return rc; 6.54 }
7.1 --- a/tools/xc/lib/xc_linux_save.c Tue Feb 10 14:38:31 2004 +0000 7.2 +++ b/tools/xc/lib/xc_linux_save.c Wed Feb 11 17:43:44 2004 +0000 7.3 @@ -40,7 +40,7 @@ 7.4 7.5 static int check_pfn_ownership(int xc_handle, 7.6 unsigned long mfn, 7.7 - unsigned int dom) 7.8 + domid_t dom) 7.9 { 7.10 dom0_op_t op; 7.11 op.cmd = DOM0_GETPAGEFRAMEINFO; 7.12 @@ -52,7 +52,7 @@ static int check_pfn_ownership(int xc_ha 7.13 #define GETPFN_ERR (~0U) 7.14 static unsigned int get_pfn_type(int xc_handle, 7.15 unsigned long mfn, 7.16 - unsigned int dom) 7.17 + domid_t dom) 7.18 { 7.19 dom0_op_t op; 7.20 op.cmd = DOM0_GETPAGEFRAMEINFO; 7.21 @@ -75,7 +75,7 @@ static int checked_write(gzFile fd, void 7.22 } 7.23 7.24 int xc_linux_save(int xc_handle, 7.25 - unsigned int domid, 7.26 + domid_t domid, 7.27 const char *state_file, 7.28 int verbose) 7.29 {
8.1 --- a/tools/xc/lib/xc_netbsd_build.c Tue Feb 10 14:38:31 2004 +0000 8.2 +++ b/tools/xc/lib/xc_netbsd_build.c Wed Feb 11 17:43:44 2004 +0000 8.3 @@ -22,7 +22,7 @@ static int loadelfimage(gzFile, int, uns 8.4 #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED) 8.5 #define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER) 8.6 8.7 -static long get_tot_pages(int xc_handle, int domid) 8.8 +static long get_tot_pages(int xc_handle, domid_t domid) 8.9 { 8.10 dom0_op_t op; 8.11 op.cmd = DOM0_GETDOMAININFO; 8.12 @@ -32,7 +32,7 @@ static long get_tot_pages(int xc_handle, 8.13 } 8.14 8.15 static int get_pfn_list(int xc_handle, 8.16 - int domid, 8.17 + domid_t domid, 8.18 unsigned long *pfn_buf, 8.19 unsigned long max_pfns) 8.20 { 8.21 @@ -75,7 +75,7 @@ static int send_pgupdates(int xc_handle, 8.22 } 8.23 8.24 static int setup_guestos(int xc_handle, 8.25 - int dom, 8.26 + domid_t dom, 8.27 gzFile kernel_gfd, 8.28 unsigned long tot_pages, 8.29 unsigned long *virt_startinfo_addr, 8.30 @@ -218,7 +218,6 @@ static int setup_guestos(int xc_handle, 8.31 start_info->mod_len = symtab_len; 8.32 start_info->nr_pages = tot_pages; 8.33 start_info->shared_info = shared_info_frame << PAGE_SHIFT; 8.34 - start_info->dom_id = dom; 8.35 start_info->flags = 0; 8.36 strncpy(start_info->cmd_line, cmdline, MAX_CMD_LEN); 8.37 start_info->cmd_line[MAX_CMD_LEN-1] = '\0'; 8.38 @@ -249,7 +248,7 @@ static int setup_guestos(int xc_handle, 8.39 } 8.40 8.41 int xc_netbsd_build(int xc_handle, 8.42 - unsigned int domid, 8.43 + domid_t domid, 8.44 const char *image_name, 8.45 const char *cmdline) 8.46 {
9.1 --- a/tools/xc/lib/xc_private.h Tue Feb 10 14:38:31 2004 +0000 9.2 +++ b/tools/xc/lib/xc_private.h Wed Feb 11 17:43:44 2004 +0000 9.3 @@ -2,15 +2,6 @@ 9.4 #ifndef __XC_PRIVATE_H__ 9.5 #define __XC_PRIVATE_H__ 9.6 9.7 -typedef unsigned char u8; 9.8 -typedef unsigned short u16; 9.9 -typedef unsigned long u32; 9.10 -typedef unsigned long long u64; 9.11 -typedef signed char s8; 9.12 -typedef signed short s16; 9.13 -typedef signed long s32; 9.14 -typedef signed long long s64; 9.15 - 9.16 #include <unistd.h> 9.17 #include <stdio.h> 9.18 #include <errno.h>
10.1 --- a/tools/xc/lib/xc_vbd.c Tue Feb 10 14:38:31 2004 +0000 10.2 +++ b/tools/xc/lib/xc_vbd.c Wed Feb 11 17:43:44 2004 +0000 10.3 @@ -10,7 +10,7 @@ 10.4 #include "xc_private.h" 10.5 10.6 int xc_vbd_create(int xc_handle, 10.7 - unsigned int domid, 10.8 + domid_t domid, 10.9 unsigned short vbdid, 10.10 int writeable) 10.11 { 10.12 @@ -24,7 +24,7 @@ int xc_vbd_create(int xc_handle, 10.13 10.14 10.15 int xc_vbd_destroy(int xc_handle, 10.16 - unsigned int domid, 10.17 + domid_t domid, 10.18 unsigned short vbdid) 10.19 { 10.20 block_io_op_t op; 10.21 @@ -36,7 +36,7 @@ int xc_vbd_destroy(int xc_handle, 10.22 10.23 10.24 int xc_vbd_grow(int xc_handle, 10.25 - unsigned int domid, 10.26 + domid_t domid, 10.27 unsigned short vbdid, 10.28 xc_vbdextent_t *extent) 10.29 { 10.30 @@ -52,7 +52,7 @@ int xc_vbd_grow(int xc_handle, 10.31 10.32 10.33 int xc_vbd_shrink(int xc_handle, 10.34 - unsigned int domid, 10.35 + domid_t domid, 10.36 unsigned short vbdid) 10.37 { 10.38 block_io_op_t op; 10.39 @@ -64,7 +64,7 @@ int xc_vbd_shrink(int xc_handle, 10.40 10.41 10.42 int xc_vbd_setextents(int xc_handle, 10.43 - unsigned int domid, 10.44 + domid_t domid, 10.45 unsigned short vbdid, 10.46 unsigned int nr_extents, 10.47 xc_vbdextent_t *extents) 10.48 @@ -110,7 +110,7 @@ int xc_vbd_setextents(int xc_handle, 10.49 10.50 10.51 int xc_vbd_getextents(int xc_handle, 10.52 - unsigned int domid, 10.53 + domid_t domid, 10.54 unsigned short vbdid, 10.55 unsigned int max_extents, 10.56 xc_vbdextent_t *extents, 10.57 @@ -159,7 +159,7 @@ int xc_vbd_getextents(int xc_handle, 10.58 10.59 10.60 int xc_vbd_probe(int xc_handle, 10.61 - unsigned int domid, 10.62 + domid_t domid, 10.63 unsigned int max_vbds, 10.64 xc_vbd_t *vbds) 10.65 {
11.1 --- a/tools/xc/lib/xc_vif.c Tue Feb 10 14:38:31 2004 +0000 11.2 +++ b/tools/xc/lib/xc_vif.c Wed Feb 11 17:43:44 2004 +0000 11.3 @@ -9,7 +9,7 @@ 11.4 #include "xc_private.h" 11.5 11.6 int xc_vif_scheduler_set(int xc_handle, 11.7 - unsigned int domid, 11.8 + domid_t domid, 11.9 unsigned int vifid, 11.10 xc_vif_sched_params_t *params) 11.11 { 11.12 @@ -24,7 +24,7 @@ int xc_vif_scheduler_set(int xc_handle, 11.13 11.14 11.15 int xc_vif_scheduler_get(int xc_handle, 11.16 - unsigned int domid, 11.17 + domid_t domid, 11.18 unsigned int vifid, 11.19 xc_vif_sched_params_t *params) 11.20 { 11.21 @@ -46,7 +46,7 @@ int xc_vif_scheduler_get(int xc_handle, 11.22 11.23 11.24 int xc_vif_stats_get(int xc_handle, 11.25 - unsigned int domid, 11.26 + domid_t domid, 11.27 unsigned int vifid, 11.28 xc_vif_stats_t *stats) 11.29 {
12.1 --- a/tools/xc/py/Xc.c Tue Feb 10 14:38:31 2004 +0000 12.2 +++ b/tools/xc/py/Xc.c Wed Feb 11 17:43:44 2004 +0000 12.3 @@ -24,6 +24,7 @@ static PyObject *pyxc_domain_create(PyOb 12.4 12.5 unsigned int mem_kb = 65536; 12.6 char *name = "(anon)"; 12.7 + u64 dom; 12.8 int ret; 12.9 12.10 static char *kwd_list[] = { "mem_kb", "name", NULL }; 12.11 @@ -32,9 +33,10 @@ static PyObject *pyxc_domain_create(PyOb 12.12 &mem_kb, &name) ) 12.13 return NULL; 12.14 12.15 - ret = xc_domain_create(xc->xc_handle, mem_kb, name); 12.16 - 12.17 - return PyInt_FromLong(ret); 12.18 + if ( (ret = xc_domain_create(xc->xc_handle, mem_kb, name, &dom)) < 0 ) 12.19 + return PyLong_FromLong(ret); 12.20 + 12.21 + return PyLong_FromUnsignedLongLong(dom); 12.22 } 12.23 12.24 static PyObject *pyxc_domain_start(PyObject *self, 12.25 @@ -43,12 +45,12 @@ static PyObject *pyxc_domain_start(PyObj 12.26 { 12.27 XcObject *xc = (XcObject *)self; 12.28 12.29 - unsigned int dom; 12.30 - int ret; 12.31 + u64 dom; 12.32 + int ret; 12.33 12.34 static char *kwd_list[] = { "dom", NULL }; 12.35 12.36 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) ) 12.37 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L", kwd_list, &dom) ) 12.38 return NULL; 12.39 12.40 ret = xc_domain_start(xc->xc_handle, dom); 12.41 @@ -62,12 +64,12 @@ static PyObject *pyxc_domain_stop(PyObje 12.42 { 12.43 XcObject *xc = (XcObject *)self; 12.44 12.45 - unsigned int dom; 12.46 - int ret; 12.47 + u64 dom; 12.48 + int ret; 12.49 12.50 static char *kwd_list[] = { "dom", NULL }; 12.51 12.52 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) ) 12.53 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L", kwd_list, &dom) ) 12.54 return NULL; 12.55 12.56 ret = xc_domain_stop(xc->xc_handle, dom); 12.57 @@ -81,12 +83,12 @@ static PyObject *pyxc_domain_destroy(PyO 12.58 { 12.59 XcObject *xc = (XcObject *)self; 12.60 12.61 - unsigned int dom; 12.62 - int force = 0, ret; 12.63 + u64 dom; 12.64 + int force = 0, ret; 12.65 12.66 static char *kwd_list[] = { "dom", "force", NULL }; 12.67 12.68 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, 12.69 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L|i", kwd_list, 12.70 &dom, &force) ) 12.71 return NULL; 12.72 12.73 @@ -101,12 +103,12 @@ static PyObject *pyxc_domain_pincpu(PyOb 12.74 { 12.75 XcObject *xc = (XcObject *)self; 12.76 12.77 - unsigned int dom; 12.78 - int cpu, ret; 12.79 + u64 dom; 12.80 + int cpu = -1, ret; 12.81 12.82 static char *kwd_list[] = { "dom", "cpu", NULL }; 12.83 12.84 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, 12.85 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L|i", kwd_list, 12.86 &dom, &cpu) ) 12.87 return NULL; 12.88 12.89 @@ -122,13 +124,13 @@ static PyObject *pyxc_domain_getinfo(PyO 12.90 XcObject *xc = (XcObject *)self; 12.91 PyObject *list; 12.92 12.93 - unsigned int first_dom = 0, max_doms = 1024; 12.94 - int nr_doms, i; 12.95 + u64 first_dom = 0; 12.96 + int max_doms = 1024, nr_doms, i; 12.97 xc_dominfo_t *info; 12.98 12.99 static char *kwd_list[] = { "first_dom", "max_doms", NULL }; 12.100 12.101 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list, 12.102 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|Li", kwd_list, 12.103 &first_dom, &max_doms) ) 12.104 return NULL; 12.105 12.106 @@ -143,7 +145,7 @@ static PyObject *pyxc_domain_getinfo(PyO 12.107 { 12.108 PyList_SetItem( 12.109 list, i, 12.110 - Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:L,s:s}", 12.111 + Py_BuildValue("{s:L,s:i,s:i,s:i,s:l,s:L,s:s}", 12.112 "dom", info[i].domid, 12.113 "cpu", info[i].cpu, 12.114 "running", info[i].has_cpu, 12.115 @@ -165,13 +167,13 @@ static PyObject *pyxc_linux_save(PyObjec 12.116 { 12.117 XcObject *xc = (XcObject *)self; 12.118 12.119 - unsigned int dom; 12.120 - char *state_file; 12.121 - int progress = 1, ret; 12.122 + u64 dom; 12.123 + char *state_file; 12.124 + int progress = 1, ret; 12.125 12.126 static char *kwd_list[] = { "dom", "state_file", "progress", NULL }; 12.127 12.128 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|i", kwd_list, 12.129 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls|i", kwd_list, 12.130 &dom, &state_file, &progress) ) 12.131 return NULL; 12.132 12.133 @@ -188,6 +190,7 @@ static PyObject *pyxc_linux_restore(PyOb 12.134 12.135 char *state_file; 12.136 int progress = 1, ret; 12.137 + u64 dom; 12.138 12.139 static char *kwd_list[] = { "state_file", "progress", NULL }; 12.140 12.141 @@ -195,9 +198,11 @@ static PyObject *pyxc_linux_restore(PyOb 12.142 &state_file, &progress) ) 12.143 return NULL; 12.144 12.145 - ret = xc_linux_restore(xc->xc_handle, state_file, progress); 12.146 - 12.147 - return PyInt_FromLong(ret); 12.148 + ret = xc_linux_restore(xc->xc_handle, state_file, progress, &dom); 12.149 + if ( ret < 0 ) 12.150 + return PyLong_FromLong(ret); 12.151 + 12.152 + return PyLong_FromUnsignedLongLong(dom); 12.153 } 12.154 12.155 static PyObject *pyxc_linux_build(PyObject *self, 12.156 @@ -206,13 +211,13 @@ static PyObject *pyxc_linux_build(PyObje 12.157 { 12.158 XcObject *xc = (XcObject *)self; 12.159 12.160 - unsigned int dom; 12.161 - char *image, *ramdisk = NULL, *cmdline = ""; 12.162 - int ret; 12.163 + u64 dom; 12.164 + char *image, *ramdisk = NULL, *cmdline = ""; 12.165 + int ret; 12.166 12.167 static char *kwd_list[] = { "dom", "image", "ramdisk", "cmdline", NULL }; 12.168 12.169 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|ss", kwd_list, 12.170 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls|ss", kwd_list, 12.171 &dom, &image, &ramdisk, &cmdline) ) 12.172 return NULL; 12.173 12.174 @@ -227,13 +232,13 @@ static PyObject *pyxc_netbsd_build(PyObj 12.175 { 12.176 XcObject *xc = (XcObject *)self; 12.177 12.178 - unsigned int dom; 12.179 - char *image, *ramdisk = NULL, *cmdline = ""; 12.180 - int ret; 12.181 + u64 dom; 12.182 + char *image, *ramdisk = NULL, *cmdline = ""; 12.183 + int ret; 12.184 12.185 static char *kwd_list[] = { "dom", "image", "ramdisk", "cmdline", NULL }; 12.186 12.187 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|ss", kwd_list, 12.188 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls|ss", kwd_list, 12.189 &dom, &image, &ramdisk, &cmdline) ) 12.190 return NULL; 12.191 12.192 @@ -267,14 +272,14 @@ static PyObject *pyxc_bvtsched_domain_se 12.193 { 12.194 XcObject *xc = (XcObject *)self; 12.195 12.196 - unsigned int dom; 12.197 + u64 dom; 12.198 unsigned long mcuadv, warp, warpl, warpu; 12.199 int ret; 12.200 12.201 static char *kwd_list[] = { "dom", "mcuadv", "warp", "warpl", 12.202 "warpu", NULL }; 12.203 12.204 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illll", kwd_list, 12.205 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Lllll", kwd_list, 12.206 &dom, &mcuadv, &warp, &warpl, &warpu) ) 12.207 return NULL; 12.208 12.209 @@ -290,14 +295,15 @@ static PyObject *pyxc_vif_scheduler_set( 12.210 { 12.211 XcObject *xc = (XcObject *)self; 12.212 12.213 - unsigned int dom, vif; 12.214 + u64 dom; 12.215 + unsigned int vif; 12.216 xc_vif_sched_params_t sched = { 0, 0 }; 12.217 int ret; 12.218 12.219 static char *kwd_list[] = { "dom", "vif", "credit_bytes", 12.220 "credit_usecs", NULL }; 12.221 12.222 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|ll", kwd_list, 12.223 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li|ll", kwd_list, 12.224 &dom, &vif, 12.225 &sched.credit_bytes, 12.226 &sched.credit_usec) ) 12.227 @@ -315,13 +321,14 @@ static PyObject *pyxc_vif_scheduler_get( 12.228 XcObject *xc = (XcObject *)self; 12.229 PyObject *dict; 12.230 12.231 - unsigned int dom, vif; 12.232 + u64 dom; 12.233 + unsigned int vif; 12.234 xc_vif_sched_params_t sched; 12.235 int ret; 12.236 12.237 static char *kwd_list[] = { "dom", "vif", NULL }; 12.238 12.239 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 12.240 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list, 12.241 &dom, &vif) ) 12.242 return NULL; 12.243 12.244 @@ -344,13 +351,14 @@ static PyObject *pyxc_vif_stats_get(PyOb 12.245 XcObject *xc = (XcObject *)self; 12.246 PyObject *dict; 12.247 12.248 - unsigned int dom, vif; 12.249 + u64 dom; 12.250 + unsigned int vif; 12.251 xc_vif_stats_t stats; 12.252 - int ret; 12.253 + int ret; 12.254 12.255 static char *kwd_list[] = { "dom", "vif", NULL }; 12.256 12.257 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 12.258 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list, 12.259 &dom, &vif) ) 12.260 return NULL; 12.261 12.262 @@ -374,12 +382,13 @@ static PyObject *pyxc_vbd_create(PyObjec 12.263 { 12.264 XcObject *xc = (XcObject *)self; 12.265 12.266 - unsigned int dom, vbd; 12.267 + u64 dom; 12.268 + unsigned int vbd; 12.269 int writeable, ret; 12.270 12.271 static char *kwd_list[] = { "dom", "vbd", "writeable", NULL }; 12.272 12.273 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list, 12.274 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Lii", kwd_list, 12.275 &dom, &vbd, &writeable) ) 12.276 return NULL; 12.277 12.278 @@ -394,12 +403,13 @@ static PyObject *pyxc_vbd_destroy(PyObje 12.279 { 12.280 XcObject *xc = (XcObject *)self; 12.281 12.282 - unsigned int dom, vbd; 12.283 + u64 dom; 12.284 + unsigned int vbd; 12.285 int ret; 12.286 12.287 static char *kwd_list[] = { "dom", "vbd", NULL }; 12.288 12.289 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 12.290 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list, 12.291 &dom, &vbd) ) 12.292 return NULL; 12.293 12.294 @@ -414,14 +424,15 @@ static PyObject *pyxc_vbd_grow(PyObject 12.295 { 12.296 XcObject *xc = (XcObject *)self; 12.297 12.298 - unsigned int dom, vbd; 12.299 + u64 dom; 12.300 + unsigned int vbd; 12.301 xc_vbdextent_t extent; 12.302 int ret; 12.303 12.304 static char *kwd_list[] = { "dom", "vbd", "device", 12.305 "start_sector", "nr_sectors", NULL }; 12.306 12.307 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiill", kwd_list, 12.308 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Liill", kwd_list, 12.309 &dom, &vbd, 12.310 &extent.real_device, 12.311 &extent.start_sector, 12.312 @@ -439,12 +450,13 @@ static PyObject *pyxc_vbd_shrink(PyObjec 12.313 { 12.314 XcObject *xc = (XcObject *)self; 12.315 12.316 - unsigned int dom, vbd; 12.317 - int ret; 12.318 + u64 dom; 12.319 + unsigned int vbd; 12.320 + int ret; 12.321 12.322 static char *kwd_list[] = { "dom", "vbd", NULL }; 12.323 12.324 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 12.325 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list, 12.326 &dom, &vbd) ) 12.327 return NULL; 12.328 12.329 @@ -460,13 +472,14 @@ static PyObject *pyxc_vbd_setextents(PyO 12.330 XcObject *xc = (XcObject *)self; 12.331 PyObject *list, *dict, *obj; 12.332 12.333 - unsigned int dom, vbd; 12.334 + u64 dom; 12.335 + unsigned int vbd; 12.336 xc_vbdextent_t *extents = NULL; 12.337 int ret, i, nr_extents; 12.338 12.339 static char *kwd_list[] = { "dom", "vbd", "extents", NULL }; 12.340 12.341 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiO", kwd_list, 12.342 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "LiO", kwd_list, 12.343 &dom, &vbd, &list) ) 12.344 goto fail; 12.345 12.346 @@ -520,13 +533,14 @@ static PyObject *pyxc_vbd_getextents(PyO 12.347 XcObject *xc = (XcObject *)self; 12.348 PyObject *list; 12.349 12.350 - unsigned int dom, vbd; 12.351 + u64 dom; 12.352 + unsigned int vbd; 12.353 xc_vbdextent_t *extents; 12.354 int i, nr_extents, max_extents; 12.355 12.356 static char *kwd_list[] = { "dom", "vbd", NULL }; 12.357 12.358 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 12.359 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list, 12.360 &dom, &vbd) ) 12.361 return NULL; 12.362 12.363 @@ -570,13 +584,14 @@ static PyObject *pyxc_vbd_probe(PyObject 12.364 XcObject *xc = (XcObject *)self; 12.365 PyObject *list; 12.366 12.367 - unsigned int dom = XC_VBDDOM_PROBE_ALL, max_vbds = 1024; 12.368 + u64 dom = XC_VBDDOM_PROBE_ALL; 12.369 + unsigned int max_vbds = 1024; 12.370 xc_vbd_t *info; 12.371 int nr_vbds, i; 12.372 12.373 static char *kwd_list[] = { "dom", "max_vbds", NULL }; 12.374 12.375 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list, 12.376 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|Li", kwd_list, 12.377 &dom, &max_vbds) ) 12.378 return NULL; 12.379 12.380 @@ -591,7 +606,7 @@ static PyObject *pyxc_vbd_probe(PyObject 12.381 { 12.382 PyList_SetItem( 12.383 list, i, 12.384 - Py_BuildValue("{s:i,s:i,s:i,s:l}", 12.385 + Py_BuildValue("{s:L,s:i,s:i,s:l}", 12.386 "dom", info[i].domid, 12.387 "vbd", info[i].vbdid, 12.388 "writeable", !!(info[i].flags & XC_VBDF_WRITEABLE), 12.389 @@ -631,27 +646,27 @@ static PyMethodDef pyxc_methods[] = { 12.390 "Create a new domain.\n" 12.391 " mem_kb [int, 65536]: Memory allocation, in kilobytes.\n" 12.392 " name [str, '(anon)']: Informative textual name.\n\n" 12.393 - "Returns: [int] new domain identifier; -1 on error.\n" }, 12.394 + "Returns: [long] new domain identifier; -1 on error.\n" }, 12.395 12.396 { "domain_start", 12.397 (PyCFunction)pyxc_domain_start, 12.398 METH_VARARGS | METH_KEYWORDS, "\n" 12.399 "Start execution of a domain.\n" 12.400 - " dom [int]: Identifier of domain to be started.\n\n" 12.401 + " dom [long]: Identifier of domain to be started.\n\n" 12.402 "Returns: [int] 0 on success; -1 on error.\n" }, 12.403 12.404 { "domain_stop", 12.405 (PyCFunction)pyxc_domain_stop, 12.406 METH_VARARGS | METH_KEYWORDS, "\n" 12.407 "Stop execution of a domain.\n" 12.408 - " dom [int]: Identifier of domain to be stopped.\n\n" 12.409 + " dom [long]: Identifier of domain to be stopped.\n\n" 12.410 "Returns: [int] 0 on success; -1 on error.\n" }, 12.411 12.412 { "domain_destroy", 12.413 (PyCFunction)pyxc_domain_destroy, 12.414 METH_VARARGS | METH_KEYWORDS, "\n" 12.415 "Destroy a domain.\n" 12.416 - " dom [int]: Identifier of domain to be destroyed.\n" 12.417 + " dom [long]: Identifier of domain to be destroyed.\n" 12.418 " force [int, 0]: Bool - force immediate destruction?\n\n" 12.419 "Returns: [int] 0 on success; -1 on error.\n" }, 12.420 12.421 @@ -659,21 +674,21 @@ static PyMethodDef pyxc_methods[] = { 12.422 (PyCFunction)pyxc_domain_pincpu, 12.423 METH_VARARGS | METH_KEYWORDS, "\n" 12.424 "Pin a domain to a specified CPU.\n" 12.425 - " dom [int]: Identifier of domain to be destroyed.\n" 12.426 - " force [int, -1]: CPU to pin to, or -1 to unpin\n\n" 12.427 + " dom [long]: Identifier of domain to be destroyed.\n" 12.428 + " cpu [int, -1]: CPU to pin to, or -1 to unpin\n\n" 12.429 "Returns: [int] 0 on success; -1 on error.\n" }, 12.430 12.431 { "domain_getinfo", 12.432 (PyCFunction)pyxc_domain_getinfo, 12.433 METH_VARARGS | METH_KEYWORDS, "\n" 12.434 "Get information regarding a set of domains, in increasing id order.\n" 12.435 - " first_dom [int, 0]: First domain to retrieve info about.\n" 12.436 + " first_dom [long, 0]: First domain to retrieve info about.\n" 12.437 " max_doms [int, 1024]: Maximum number of domains to retrieve info" 12.438 " about.\n\n" 12.439 "Returns: [list of dicts] if list length is less than 'max_doms'\n" 12.440 " parameter then there was an error, or the end of the\n" 12.441 " domain-id space was reached.\n" 12.442 - " dom [int]: Identifier of domain to which this info pertains\n" 12.443 + " dom [long]: Identifier of domain to which this info pertains\n" 12.444 " cpu [int]: CPU to which this domain is bound\n" 12.445 " running [int]: Bool - is the domain currently running?\n" 12.446 " stopped [int]: Bool - is the domain suspended?\n" 12.447 @@ -685,7 +700,7 @@ static PyMethodDef pyxc_methods[] = { 12.448 (PyCFunction)pyxc_linux_save, 12.449 METH_VARARGS | METH_KEYWORDS, "\n" 12.450 "Save the CPU and memory state of a Linux guest OS.\n" 12.451 - " dom [int]: Identifier of domain to be saved.\n" 12.452 + " dom [long]: Identifier of domain to be saved.\n" 12.453 " state_file [str]: Name of state file. Must not currently exist.\n" 12.454 " progress [int, 1]: Bool - display a running progress indication?\n\n" 12.455 "Returns: [int] 0 on success; -1 on error.\n" }, 12.456 @@ -696,26 +711,26 @@ static PyMethodDef pyxc_methods[] = { 12.457 "Restore the CPU and memory state of a Linux guest OS.\n" 12.458 " state_file [str]: Name of state file. Must not currently exist.\n" 12.459 " progress [int, 1]: Bool - display a running progress indication?\n\n" 12.460 - "Returns: [int] new domain identifier on success; -1 on error.\n" }, 12.461 + "Returns: [long] new domain identifier on success; -1 on error.\n" }, 12.462 12.463 { "linux_build", 12.464 (PyCFunction)pyxc_linux_build, 12.465 METH_VARARGS | METH_KEYWORDS, "\n" 12.466 "Build a new Linux guest OS.\n" 12.467 - " dom [int]: Identifier of domain to build into.\n" 12.468 + " dom [long]: Identifier of domain to build into.\n" 12.469 " image [str]: Name of kernel image file. May be gzipped.\n" 12.470 " ramdisk [str, n/a]: Name of ramdisk file, if any.\n" 12.471 " cmdline [str, n/a]: Kernel parameters, if any.\n\n" 12.472 - "Returns: [int] new domain identifier on success; -1 on error.\n" }, 12.473 + "Returns: [int] 0 on success; -1 on error.\n" }, 12.474 12.475 { "netbsd_build", 12.476 (PyCFunction)pyxc_netbsd_build, 12.477 METH_VARARGS | METH_KEYWORDS, "\n" 12.478 "Build a new NetBSD guest OS.\n" 12.479 - " dom [int]: Identifier of domain to build into.\n" 12.480 + " dom [long]: Identifier of domain to build into.\n" 12.481 " image [str]: Name of kernel image file. May be gzipped.\n" 12.482 " cmdline [str, n/a]: Kernel parameters, if any.\n\n" 12.483 - "Returns: [int] new domain identifier on success; -1 on error.\n" }, 12.484 + "Returns: [int] 0 on success; -1 on error.\n" }, 12.485 12.486 { "bvtsched_global_set", 12.487 (PyCFunction)pyxc_bvtsched_global_set, 12.488 @@ -728,18 +743,18 @@ static PyMethodDef pyxc_methods[] = { 12.489 (PyCFunction)pyxc_bvtsched_domain_set, 12.490 METH_VARARGS | METH_KEYWORDS, "\n" 12.491 "Set per-domain tuning parameters for Borrowed Virtual Time scheduler.\n" 12.492 - " dom [int]: Identifier of domain to be tuned.\n" 12.493 - " mcuadv [int]: Internal BVT parameter.\n" 12.494 - " warp [int]: Internal BVT parameter.\n" 12.495 - " warpl [int]: Internal BVT parameter.\n" 12.496 - " warpu [int]: Internal BVT parameter.\n\n" 12.497 + " dom [long]: Identifier of domain to be tuned.\n" 12.498 + " mcuadv [int]: Internal BVT parameter.\n" 12.499 + " warp [int]: Internal BVT parameter.\n" 12.500 + " warpl [int]: Internal BVT parameter.\n" 12.501 + " warpu [int]: Internal BVT parameter.\n\n" 12.502 "Returns: [int] 0 on success; -1 on error.\n" }, 12.503 12.504 { "vif_scheduler_set", 12.505 (PyCFunction)pyxc_vif_scheduler_set, 12.506 METH_VARARGS | METH_KEYWORDS, "\n" 12.507 "Set per-network-interface scheduling parameters.\n" 12.508 - " dom [int]: Identifier of domain to be adjusted.\n" 12.509 + " dom [long]: Identifier of domain to be adjusted.\n" 12.510 " vif [int]: Identifier of VIF to be adjusted.\n" 12.511 " credit_bytes [int, 0]: Tx bytes permitted each interval.\n" 12.512 " credit_usecs [int, 0]: Interval, in usecs. 0 == no scheduling.\n\n" 12.513 @@ -749,7 +764,7 @@ static PyMethodDef pyxc_methods[] = { 12.514 (PyCFunction)pyxc_vif_scheduler_get, 12.515 METH_VARARGS | METH_KEYWORDS, "\n" 12.516 "Query the per-network-interface scheduling parameters.\n" 12.517 - " dom [int]: Identifier of domain to be queried.\n" 12.518 + " dom [long]: Identifier of domain to be queried.\n" 12.519 " vif [int]: Identifier of VIF to be queried.\n\n" 12.520 "Returns: [dict] dictionary is empty on failure.\n" 12.521 " credit_bytes [int]: Tx bytes permitted each interval.\n" 12.522 @@ -759,8 +774,8 @@ static PyMethodDef pyxc_methods[] = { 12.523 (PyCFunction)pyxc_vif_stats_get, 12.524 METH_VARARGS | METH_KEYWORDS, "\n" 12.525 "Query the per-network-interface statistics.\n" 12.526 - " dom [int]: Identifier of domain to be queried.\n" 12.527 - " vif [int]: Identifier of VIF to be queried.\n\n" 12.528 + " dom [long]: Identifier of domain to be queried.\n" 12.529 + " vif [int]: Identifier of VIF to be queried.\n\n" 12.530 "Returns: [dict] dictionary is empty on failure.\n" 12.531 " tx_bytes [long]: Bytes transmitted.\n" 12.532 " tx_packets [long]: Packets transmitted.\n" 12.533 @@ -771,44 +786,44 @@ static PyMethodDef pyxc_methods[] = { 12.534 (PyCFunction)pyxc_vbd_create, 12.535 METH_VARARGS | METH_KEYWORDS, "\n" 12.536 "Create a new virtual block device associated with a given domain.\n" 12.537 - " dom [int]: Identifier of domain to get a new VBD.\n" 12.538 - " vbd [int]: Identifier for new VBD.\n" 12.539 - " writeable [int]: Bool - is the new VBD writeable?\n\n" 12.540 + " dom [long]: Identifier of domain to get a new VBD.\n" 12.541 + " vbd [int]: Identifier for new VBD.\n" 12.542 + " writeable [int]: Bool - is the new VBD writeable?\n\n" 12.543 "Returns: [int] 0 on success; -1 on error.\n" }, 12.544 12.545 { "vbd_destroy", 12.546 (PyCFunction)pyxc_vbd_destroy, 12.547 METH_VARARGS | METH_KEYWORDS, "\n" 12.548 "Destroy a virtual block device.\n" 12.549 - " dom [int]: Identifier of domain containing the VBD.\n" 12.550 - " vbd [int]: Identifier of the VBD.\n\n" 12.551 + " dom [long]: Identifier of domain containing the VBD.\n" 12.552 + " vbd [int]: Identifier of the VBD.\n\n" 12.553 "Returns: [int] 0 on success; -1 on error.\n" }, 12.554 12.555 { "vbd_grow", 12.556 (PyCFunction)pyxc_vbd_grow, 12.557 METH_VARARGS | METH_KEYWORDS, "\n" 12.558 "Grow a virtual block device by appending a new extent.\n" 12.559 - " dom [int]: Identifier of domain containing the VBD.\n" 12.560 - " vbd [int]: Identifier of the VBD.\n" 12.561 - " device [int]: Identifier of the real underlying block device.\n" 12.562 - " start_sector [int]: Real start sector of this extent.\n" 12.563 - " nr_sectors [int]: Length, in sectors, of this extent.\n\n" 12.564 + " dom [long]: Identifier of domain containing the VBD.\n" 12.565 + " vbd [int]: Identifier of the VBD.\n" 12.566 + " device [int]: Identifier of the real underlying block device.\n" 12.567 + " start_sector [int]: Real start sector of this extent.\n" 12.568 + " nr_sectors [int]: Length, in sectors, of this extent.\n\n" 12.569 "Returns: [int] 0 on success; -1 on error.\n" }, 12.570 12.571 { "vbd_shrink", 12.572 (PyCFunction)pyxc_vbd_shrink, 12.573 METH_VARARGS | METH_KEYWORDS, "\n" 12.574 "Shrink a virtual block device by deleting its final extent.\n" 12.575 - " dom [int]: Identifier of domain containing the VBD.\n" 12.576 - " vbd [int]: Identifier of the VBD.\n\n" 12.577 + " dom [long]: Identifier of domain containing the VBD.\n" 12.578 + " vbd [int]: Identifier of the VBD.\n\n" 12.579 "Returns: [int] 0 on success; -1 on error.\n" }, 12.580 12.581 { "vbd_setextents", 12.582 (PyCFunction)pyxc_vbd_setextents, 12.583 METH_VARARGS | METH_KEYWORDS, "\n" 12.584 "Set all the extent information for a virtual block device.\n" 12.585 - " dom [int]: Identifier of domain containing the VBD.\n" 12.586 - " vbd [int]: Identifier of the VBD.\n" 12.587 + " dom [long]: Identifier of domain containing the VBD.\n" 12.588 + " vbd [int]: Identifier of the VBD.\n" 12.589 " extents [list of dicts]: Per-extent information.\n" 12.590 " device [int]: Identifier of the real underlying block device.\n" 12.591 " start_sector [int]: Real start sector of this extent.\n" 12.592 @@ -819,8 +834,8 @@ static PyMethodDef pyxc_methods[] = { 12.593 (PyCFunction)pyxc_vbd_getextents, 12.594 METH_VARARGS | METH_KEYWORDS, "\n" 12.595 "Get info on all the extents in a virtual block device.\n" 12.596 - " dom [int]: Identifier of domain containing the VBD.\n" 12.597 - " vbd [int]: Identifier of the VBD.\n\n" 12.598 + " dom [long]: Identifier of domain containing the VBD.\n" 12.599 + " vbd [int]: Identifier of the VBD.\n\n" 12.600 "Returns: [list of dicts] per-extent information; empty on error.\n" 12.601 " device [int]: Identifier of the real underlying block device.\n" 12.602 " start_sector [int]: Real start sector of this extent.\n" 12.603 @@ -830,14 +845,14 @@ static PyMethodDef pyxc_methods[] = { 12.604 (PyCFunction)pyxc_vbd_probe, 12.605 METH_VARARGS | METH_KEYWORDS, "\n" 12.606 "Get information regarding extant virtual block devices.\n" 12.607 - " dom [int, ALL]: Domain to query (default is to query all).\n" 12.608 + " dom [long, ALL]: Domain to query (default is to query all).\n" 12.609 " max_vbds [int, 1024]: Maximum VBDs to query.\n\n" 12.610 "Returns: [list of dicts] if list length is less than 'max_vbds'\n" 12.611 " parameter then there was an error, or there were fewer vbds.\n" 12.612 - " dom [int]: Domain containing this VBD.\n" 12.613 - " vbd [int]: Domain-specific identifier of this VBD.\n" 12.614 - " writeable [int]: Bool - is this VBD writeable?\n" 12.615 - " nr_sectors [int]: Size of this VBD, in 512-byte sectors.\n" }, 12.616 + " dom [long]: Domain containing this VBD.\n" 12.617 + " vbd [int]: Domain-specific identifier of this VBD.\n" 12.618 + " writeable [int]: Bool - is this VBD writeable?\n" 12.619 + " nr_sectors [int]: Size of this VBD, in 512-byte sectors.\n" }, 12.620 12.621 { "readconsolering", 12.622 (PyCFunction)pyxc_readconsolering,
13.1 --- a/xen/arch/i386/i387.c Tue Feb 10 14:38:31 2004 +0000 13.2 +++ b/xen/arch/i386/i387.c Wed Feb 11 17:43:44 2004 +0000 13.3 @@ -17,7 +17,7 @@ void init_fpu(void) 13.4 { 13.5 __asm__("fninit"); 13.6 if ( cpu_has_xmm ) load_mxcsr(0x1f80); 13.7 - current->flags |= PF_DONEFPUINIT; 13.8 + set_bit(PF_DONEFPUINIT, ¤t->flags); 13.9 } 13.10 13.11 static inline void __save_init_fpu( struct task_struct *tsk ) 13.12 @@ -29,7 +29,7 @@ static inline void __save_init_fpu( stru 13.13 asm volatile( "fnsave %0 ; fwait" 13.14 : "=m" (tsk->thread.i387.fsave) ); 13.15 } 13.16 - tsk->flags &= ~PF_USEDFPU; 13.17 + clear_bit(PF_USEDFPU, &tsk->flags); 13.18 } 13.19 13.20 void save_init_fpu( struct task_struct *tsk ) 13.21 @@ -39,7 +39,7 @@ void save_init_fpu( struct task_struct * 13.22 * This causes us to set the real flag, so we'll need 13.23 * to temporarily clear it while saving f-p state. 13.24 */ 13.25 - if ( tsk->flags & PF_GUEST_STTS ) clts(); 13.26 + if ( test_bit(PF_GUEST_STTS, &tsk->flags) ) clts(); 13.27 __save_init_fpu(tsk); 13.28 stts(); 13.29 }
14.1 --- a/xen/arch/i386/pdb-stub.c Tue Feb 10 14:38:31 2004 +0000 14.2 +++ b/xen/arch/i386/pdb-stub.c Wed Feb 11 17:43:44 2004 +0000 14.3 @@ -72,7 +72,7 @@ pdb_process_query (char *ptr) 14.4 pdb_out_buffer[buf_idx++] = 'm'; 14.5 while ( (p = p->next_task) != &idle0_task ) 14.6 { 14.7 - int domain = p->domain + PDB_DOMAIN_OFFSET; 14.8 + domid_t domain = p->domain + PDB_DOMAIN_OFFSET; 14.9 14.10 if (count > 0) 14.11 pdb_out_buffer[buf_idx++] = ',';
15.1 --- a/xen/arch/i386/process.c Tue Feb 10 14:38:31 2004 +0000 15.2 +++ b/xen/arch/i386/process.c Wed Feb 11 17:43:44 2004 +0000 15.3 @@ -289,7 +289,7 @@ void switch_to(struct task_struct *prev_ 15.4 15.5 15.6 /* XXX Currently the 'domain' field is ignored! XXX */ 15.7 -long do_iopl(unsigned int domain, unsigned int new_io_pl) 15.8 +long do_iopl(domid_t domain, unsigned int new_io_pl) 15.9 { 15.10 execution_context_t *ec = get_execution_context(); 15.11 ec->eflags = (ec->eflags & 0xffffcfff) | ((new_io_pl&3) << 12);
16.1 --- a/xen/arch/i386/smpboot.c Tue Feb 10 14:38:31 2004 +0000 16.2 +++ b/xen/arch/i386/smpboot.c Wed Feb 11 17:43:44 2004 +0000 16.3 @@ -673,7 +673,9 @@ static void __init do_boot_cpu (int apic 16.4 16.5 if ( (idle = do_createdomain(IDLE_DOMAIN_ID, cpu)) == NULL ) 16.6 panic("failed 'createdomain' for CPU %d", cpu); 16.7 - 16.8 + 16.9 + set_bit(PF_IDLETASK, &idle->flags); 16.10 + 16.11 idle->mm.pagetable = mk_pagetable(__pa(idle_pg_table)); 16.12 16.13 map_cpu_to_boot_apicid(cpu, apicid);
17.1 --- a/xen/arch/i386/traps.c Tue Feb 10 14:38:31 2004 +0000 17.2 +++ b/xen/arch/i386/traps.c Wed Feb 11 17:43:44 2004 +0000 17.3 @@ -500,22 +500,21 @@ asmlinkage void math_state_restore(struc 17.4 /* Prevent recursion. */ 17.5 clts(); 17.6 17.7 - if ( !(current->flags & PF_USEDFPU) ) 17.8 + if ( !test_bit(PF_USEDFPU, ¤t->flags) ) 17.9 { 17.10 - if ( current->flags & PF_DONEFPUINIT ) 17.11 + if ( test_bit(PF_DONEFPUINIT, ¤t->flags) ) 17.12 restore_fpu(current); 17.13 else 17.14 init_fpu(); 17.15 - current->flags |= PF_USEDFPU; /* So we fnsave on switch_to() */ 17.16 + set_bit(PF_USEDFPU, ¤t->flags); /* so we fnsave on switch_to() */ 17.17 } 17.18 17.19 - if ( current->flags & PF_GUEST_STTS ) 17.20 + if ( test_and_clear_bit(PF_GUEST_STTS, ¤t->flags) ) 17.21 { 17.22 struct guest_trap_bounce *gtb = guest_trap_bounce+smp_processor_id(); 17.23 gtb->flags = GTBF_TRAP_NOCODE; 17.24 gtb->cs = current->thread.traps[7].cs; 17.25 gtb->eip = current->thread.traps[7].address; 17.26 - current->flags &= ~PF_GUEST_STTS; 17.27 } 17.28 } 17.29 17.30 @@ -802,7 +801,7 @@ long do_set_fast_trap(int idx) 17.31 17.32 long do_fpu_taskswitch(void) 17.33 { 17.34 - current->flags |= PF_GUEST_STTS; 17.35 + set_bit(PF_GUEST_STTS, ¤t->flags); 17.36 stts(); 17.37 return 0; 17.38 }
18.1 --- a/xen/common/block.c Tue Feb 10 14:38:31 2004 +0000 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,22 +0,0 @@ 18.4 -/* block.c 18.5 - * 18.6 - * ring data structures for buffering messages between hypervisor and 18.7 - * guestos's. 18.8 - * 18.9 - */ 18.10 - 18.11 -#include <hypervisor-ifs/block.h> 18.12 -#include <xeno/lib.h> 18.13 - 18.14 -/* 18.15 - * create_block_ring 18.16 - * 18.17 - * domain: 18.18 - * 18.19 - * allocates space for a particular domain's block io ring. 18.20 - */ 18.21 -blk_ring_t *create_block_ring(int domain) 18.22 -{ 18.23 - printk ("XEN create block ring <not implemented>"); 18.24 - return (blk_ring_t *)NULL; 18.25 -}
19.1 --- a/xen/common/debug-linux.c Tue Feb 10 14:38:31 2004 +0000 19.2 +++ b/xen/common/debug-linux.c Wed Feb 11 17:43:44 2004 +0000 19.3 @@ -32,11 +32,13 @@ 19.4 19.5 19.6 /* adapted from asm-xeno/page.h */ 19.7 -static inline unsigned long machine_to_phys(int domain, unsigned long machine) 19.8 +static inline unsigned long machine_to_phys(domid_t domain, 19.9 + unsigned long machine) 19.10 { 19.11 unsigned long phys; 19.12 pdb_get_values(domain, (u_char *) &phys, 19.13 - (unsigned long) machine_to_phys_mapping + (machine >> PAGE_SHIFT) * 4, 19.14 + (unsigned long) machine_to_phys_mapping + 19.15 + (machine >> PAGE_SHIFT) * 4, 19.16 sizeof(phys)); 19.17 phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK); 19.18 return phys; 19.19 @@ -61,7 +63,7 @@ static inline unsigned long machine_to_p 19.20 */ 19.21 19.22 /* read a byte from a process */ 19.23 -u_char pdb_linux_get_value (int domain, int pid, unsigned long addr) 19.24 +u_char pdb_linux_get_value(domid_t domain, int pid, unsigned long addr) 19.25 { 19.26 u_char result = 0; 19.27 unsigned long task_struct_p, mm_p, pgd, task_struct_pid; 19.28 @@ -90,7 +92,7 @@ u_char pdb_linux_get_value (int domain, 19.29 if (task_struct_p == (unsigned long)NULL) 19.30 { 19.31 /* oops */ 19.32 - printk ("error: couldn't find process 0x%x in domain %d\n", pid, domain); 19.33 + printk ("error: couldn't find process 0x%x in domain %llu\n", pid, domain); 19.34 return 0; 19.35 } 19.36
20.1 --- a/xen/common/debug.c Tue Feb 10 14:38:31 2004 +0000 20.2 +++ b/xen/common/debug.c Wed Feb 11 17:43:44 2004 +0000 20.3 @@ -23,9 +23,10 @@ 20.4 20.5 /****************************************************************************/ 20.6 20.7 -extern int pdb_change_values (int domain, u_char *buffer, unsigned long addr, 20.8 - int length, int rw); 20.9 -extern u_char pdb_linux_get_value (int domain, int pid, unsigned long addr); 20.10 +extern int pdb_change_values(domid_t domain, 20.11 + u_char *buffer, unsigned long addr, 20.12 + int length, int rw); 20.13 +extern u_char pdb_linux_get_value(domid_t domain, int pid, unsigned long addr); 20.14 20.15 /* 20.16 * Set memory in a domain's address space 20.17 @@ -35,7 +36,8 @@ extern u_char pdb_linux_get_value (int d 20.18 * THIS WILL BECOME A MACRO 20.19 */ 20.20 20.21 -int pdb_set_values (int domain, u_char *buffer, unsigned long addr, int length) 20.22 +int pdb_set_values(domid_t domain, 20.23 + u_char *buffer, unsigned long addr, int length) 20.24 { 20.25 int count = pdb_change_values(domain, buffer, addr, length, 2); 20.26 20.27 @@ -63,7 +65,8 @@ int pdb_set_values (int domain, u_char * 20.28 * THIS WILL BECOME A MACRO 20.29 */ 20.30 20.31 -int pdb_get_values (int domain, u_char *buffer, unsigned long addr, int length) 20.32 +int pdb_get_values(domid_t domain, 20.33 + u_char *buffer, unsigned long addr, int length) 20.34 { 20.35 return pdb_change_values(domain, buffer, addr, length, 1); 20.36 } 20.37 @@ -75,8 +78,8 @@ int pdb_get_values (int domain, u_char * 20.38 * RW: 1 = read, 2 = write 20.39 */ 20.40 20.41 -int pdb_change_values (int domain, u_char *buffer, unsigned long addr, 20.42 - int length, int rw) 20.43 +int pdb_change_values(domid_t domain, u_char *buffer, unsigned long addr, 20.44 + int length, int rw) 20.45 { 20.46 struct task_struct *p; 20.47 l2_pgentry_t* l2_table = NULL; 20.48 @@ -166,7 +169,7 @@ void pdb_do_debug (dom0_op_t *op) 20.49 { 20.50 op->u.debug.status = 0; 20.51 20.52 - TRC(printk("PDB: op:%c, dom:%x, in1:%x, in2:%x, in3:%x, in4:%x\n", 20.53 + TRC(printk("PDB: op:%c, dom:%llu, in1:%x, in2:%x, in3:%x, in4:%x\n", 20.54 op->u.debug.opcode, op->u.debug.domain, 20.55 op->u.debug.in1, op->u.debug.in2, 20.56 op->u.debug.in3, op->u.debug.in4)); 20.57 @@ -186,7 +189,7 @@ void pdb_do_debug (dom0_op_t *op) 20.58 struct task_struct * p = find_domain_by_id(op->u.debug.domain); 20.59 if ( p != NULL ) 20.60 { 20.61 - if ( (p->flags & PF_CONSTRUCTED) != 0 ) 20.62 + if ( test_bit(PF_CONSTRUCTED, &p->flags) ) 20.63 { 20.64 wake_up(p); 20.65 reschedule(p);
21.1 --- a/xen/common/dom0_ops.c Tue Feb 10 14:38:31 2004 +0000 21.2 +++ b/xen/common/dom0_ops.c Wed Feb 11 17:43:44 2004 +0000 21.3 @@ -22,21 +22,10 @@ extern unsigned int alloc_new_dom_mem(st 21.4 /* Basically used to protect the domain-id space. */ 21.5 static spinlock_t create_dom_lock = SPIN_LOCK_UNLOCKED; 21.6 21.7 -static unsigned int get_domnr(void) 21.8 +static domid_t get_domnr(void) 21.9 { 21.10 - static unsigned int domnr = 0; 21.11 - struct task_struct *p; 21.12 - int tries = 0; 21.13 - 21.14 - for ( tries = 0; tries < 1024; tries++ ) 21.15 - { 21.16 - domnr = (domnr+1) & ((1<<20)-1); 21.17 - if ( (p = find_domain_by_id(domnr)) == NULL ) 21.18 - return domnr; 21.19 - put_task_struct(p); 21.20 - } 21.21 - 21.22 - return 0; 21.23 + static domid_t domnr = 0; 21.24 + return ++domnr; 21.25 } 21.26 21.27 static int msr_cpu_mask; 21.28 @@ -101,7 +90,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 21.29 ret = -EINVAL; 21.30 if ( p != NULL ) 21.31 { 21.32 - if ( (p->flags & PF_CONSTRUCTED) != 0 ) 21.33 + if ( test_bit(PF_CONSTRUCTED, &p->flags) ) 21.34 { 21.35 wake_up(p); 21.36 reschedule(p); 21.37 @@ -122,7 +111,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 21.38 { 21.39 struct task_struct *p; 21.40 static unsigned int pro = 0; 21.41 - unsigned int dom; 21.42 + domid_t dom; 21.43 ret = -ENOMEM; 21.44 21.45 spin_lock_irq(&create_dom_lock); 21.46 @@ -137,8 +126,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 21.47 21.48 if ( op->u.createdomain.name[0] ) 21.49 { 21.50 - strncpy (p->name, op->u.createdomain.name, MAX_DOMAIN_NAME); 21.51 - p->name[MAX_DOMAIN_NAME - 1] = 0; 21.52 + strncpy(p->name, op->u.createdomain.name, MAX_DOMAIN_NAME); 21.53 + p->name[MAX_DOMAIN_NAME - 1] = '\0'; 21.54 } 21.55 21.56 ret = alloc_new_dom_mem(p, op->u.createdomain.memory_kb); 21.57 @@ -148,9 +137,9 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 21.58 goto exit_create; 21.59 } 21.60 21.61 - ret = p->domain; 21.62 + ret = 0; 21.63 21.64 - op->u.createdomain.domain = ret; 21.65 + op->u.createdomain.domain = p->domain; 21.66 copy_to_user(u_dom0_op, op, sizeof(*op)); 21.67 21.68 exit_create: 21.69 @@ -160,7 +149,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 21.70 21.71 case DOM0_DESTROYDOMAIN: 21.72 { 21.73 - unsigned int dom = op->u.destroydomain.domain; 21.74 + domid_t dom = op->u.destroydomain.domain; 21.75 int force = op->u.destroydomain.force; 21.76 ret = (dom == IDLE_DOMAIN_ID) ? -EPERM : kill_other_domain(dom, force); 21.77 } 21.78 @@ -214,7 +203,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 21.79 21.80 case DOM0_ADJUSTDOM: 21.81 { 21.82 - unsigned int dom = op->u.adjustdom.domain; 21.83 + domid_t dom = op->u.adjustdom.domain; 21.84 unsigned long mcu_adv = op->u.adjustdom.mcu_adv; 21.85 unsigned long warp = op->u.adjustdom.warp; 21.86 unsigned long warpl = op->u.adjustdom.warpl; 21.87 @@ -303,7 +292,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 21.88 memcpy(&op->u.getdomaininfo.ctxt.i386_ctxt, 21.89 &p->shared_info->execution_context, 21.90 sizeof(p->shared_info->execution_context)); 21.91 - if ( p->flags & PF_DONEFPUINIT ) 21.92 + if ( test_bit(PF_DONEFPUINIT, &p->flags) ) 21.93 op->u.getdomaininfo.ctxt.flags |= ECF_I387_VALID; 21.94 memcpy(&op->u.getdomaininfo.ctxt.i387_ctxt, 21.95 &p->thread.i387, 21.96 @@ -354,7 +343,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 21.97 { 21.98 struct pfn_info *page; 21.99 unsigned long pfn = op->u.getpageframeinfo.pfn; 21.100 - unsigned int dom = op->u.getpageframeinfo.domain; 21.101 + domid_t dom = op->u.getpageframeinfo.domain; 21.102 struct task_struct *p; 21.103 21.104 ret = -EINVAL; 21.105 @@ -395,7 +384,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 21.106 21.107 case DOM0_IOPL: 21.108 { 21.109 - extern long do_iopl(unsigned int, unsigned int); 21.110 + extern long do_iopl(domid_t, unsigned int); 21.111 ret = do_iopl(op->u.iopl.domain, op->u.iopl.iopl); 21.112 } 21.113 break;
22.1 --- a/xen/common/domain.c Tue Feb 10 14:38:31 2004 +0000 22.2 +++ b/xen/common/domain.c Wed Feb 11 17:43:44 2004 +0000 22.3 @@ -31,9 +31,10 @@ 22.4 rwlock_t tasklist_lock __cacheline_aligned = RW_LOCK_UNLOCKED; 22.5 struct task_struct *task_hash[TASK_HASH_SIZE]; 22.6 22.7 -struct task_struct *do_createdomain(unsigned int dom_id, unsigned int cpu) 22.8 +struct task_struct *do_createdomain(domid_t dom_id, unsigned int cpu) 22.9 { 22.10 int retval; 22.11 + char buf[100]; 22.12 struct task_struct *p = NULL; 22.13 unsigned long flags; 22.14 22.15 @@ -47,7 +48,10 @@ struct task_struct *do_createdomain(unsi 22.16 p->domain = dom_id; 22.17 p->processor = cpu; 22.18 22.19 - sprintf(p->name, "Domain-%d", dom_id); 22.20 + /* We use a large intermediate to avoid overflow in sprintf. */ 22.21 + sprintf(buf, "Domain-%llu", dom_id); 22.22 + strncpy(p->name, buf, MAX_DOMAIN_NAME); 22.23 + p->name[MAX_DOMAIN_NAME-1] = '\0'; 22.24 22.25 spin_lock_init(&p->blk_ring_lock); 22.26 spin_lock_init(&p->event_channel_lock); 22.27 @@ -79,7 +83,7 @@ struct task_struct *do_createdomain(unsi 22.28 } 22.29 22.30 22.31 -struct task_struct *find_domain_by_id(unsigned int dom) 22.32 +struct task_struct *find_domain_by_id(domid_t dom) 22.33 { 22.34 struct task_struct *p; 22.35 unsigned long flags; 22.36 @@ -103,8 +107,7 @@ struct task_struct *find_domain_by_id(un 22.37 22.38 void kill_domain_with_errmsg(const char *err) 22.39 { 22.40 - printk("DOM%d FATAL ERROR: %s\n", 22.41 - current->domain, err); 22.42 + printk("DOM%llu FATAL ERROR: %s\n", current->domain, err); 22.43 kill_domain(); 22.44 } 22.45 22.46 @@ -126,7 +129,7 @@ void __kill_domain(struct task_struct *p 22.47 if ( !sched_rem_domain(p) ) 22.48 return; 22.49 22.50 - printk("Killing domain %d\n", p->domain); 22.51 + printk("Killing domain %llu\n", p->domain); 22.52 22.53 unlink_blkdev_info(p); 22.54 22.55 @@ -162,7 +165,7 @@ void kill_domain(void) 22.56 } 22.57 22.58 22.59 -long kill_other_domain(unsigned int dom, int force) 22.60 +long kill_other_domain(domid_t dom, int force) 22.61 { 22.62 struct task_struct *p; 22.63 unsigned long cpu_mask = 0; 22.64 @@ -200,7 +203,7 @@ void stop_domain(void) 22.65 __enter_scheduler(); 22.66 } 22.67 22.68 -long stop_other_domain(unsigned int dom) 22.69 +long stop_other_domain(domid_t dom) 22.70 { 22.71 unsigned long cpu_mask; 22.72 struct task_struct *p; 22.73 @@ -208,7 +211,7 @@ long stop_other_domain(unsigned int dom) 22.74 if ( dom == 0 ) 22.75 return -EINVAL; 22.76 22.77 - p = find_domain_by_id (dom); 22.78 + p = find_domain_by_id(dom); 22.79 if ( p == NULL) return -ESRCH; 22.80 22.81 if ( p->state != TASK_STOPPED ) 22.82 @@ -452,7 +455,7 @@ void release_task(struct task_struct *p) 22.83 ASSERT(p->state == TASK_DYING); 22.84 ASSERT(!p->has_cpu); 22.85 22.86 - printk("Releasing task %d\n", p->domain); 22.87 + printk("Releasing task %llu\n", p->domain); 22.88 22.89 /* 22.90 * This frees up blkdev rings and vbd-access lists. Totally safe since 22.91 @@ -480,12 +483,12 @@ int final_setup_guestos(struct task_stru 22.92 unsigned long phys_l2tab; 22.93 int i; 22.94 22.95 - if ( (p->flags & PF_CONSTRUCTED) ) 22.96 + if ( test_bit(PF_CONSTRUCTED, &p->flags) ) 22.97 return -EINVAL; 22.98 22.99 - p->flags &= ~PF_DONEFPUINIT; 22.100 + clear_bit(PF_DONEFPUINIT, &p->flags); 22.101 if ( builddomain->ctxt.flags & ECF_I387_VALID ) 22.102 - p->flags |= PF_DONEFPUINIT; 22.103 + set_bit(PF_DONEFPUINIT, &p->flags); 22.104 memcpy(&p->shared_info->execution_context, 22.105 &builddomain->ctxt.i386_ctxt, 22.106 sizeof(p->shared_info->execution_context)); 22.107 @@ -526,7 +529,7 @@ int final_setup_guestos(struct task_stru 22.108 while ( builddomain->num_vifs-- > 0 ) 22.109 (void)create_net_vif(p->domain); 22.110 22.111 - p->flags |= PF_CONSTRUCTED; 22.112 + set_bit(PF_CONSTRUCTED, &p->flags); 22.113 22.114 return 0; 22.115 } 22.116 @@ -553,7 +556,8 @@ int setup_guestos(struct task_struct *p, 22.117 { 22.118 struct list_head *list_ent; 22.119 char *src, *vsrc, *dst, *data_start; 22.120 - int i, dom = p->domain; 22.121 + int i; 22.122 + domid_t dom = p->domain; 22.123 unsigned long phys_l1tab, phys_l2tab; 22.124 unsigned long cur_address, alloc_address; 22.125 unsigned long virt_load_address, virt_stack_address; 22.126 @@ -571,7 +575,7 @@ int setup_guestos(struct task_struct *p, 22.127 22.128 /* Sanity! */ 22.129 if ( p->domain != 0 ) BUG(); 22.130 - if ( (p->flags & PF_CONSTRUCTED) ) BUG(); 22.131 + if ( test_bit(PF_CONSTRUCTED, &p->flags) ) BUG(); 22.132 22.133 /* 22.134 * This is all a bit grim. We've moved the modules to the "safe" physical 22.135 @@ -589,21 +593,21 @@ int setup_guestos(struct task_struct *p, 22.136 22.137 if ( strncmp(data_start, "XenoGues", 8) ) 22.138 { 22.139 - printk("DOM%d: Invalid guest OS image\n", dom); 22.140 + printk("DOM%llu: Invalid guest OS image\n", dom); 22.141 return -1; 22.142 } 22.143 22.144 virt_load_address = *(unsigned long *)(data_start + 8); 22.145 if ( (virt_load_address & (PAGE_SIZE-1)) ) 22.146 { 22.147 - printk("DOM%d: Guest OS load address not page-aligned (%08lx)\n", 22.148 + printk("DOM%llu: Guest OS load address not page-aligned (%08lx)\n", 22.149 dom, virt_load_address); 22.150 return -1; 22.151 } 22.152 22.153 if ( alloc_new_dom_mem(p, params->memory_kb) ) 22.154 { 22.155 - printk("DOM%d: Not enough memory --- reduce dom0_mem ??\n", dom); 22.156 + printk("DOM%llu: Not enough memory --- reduce dom0_mem ??\n", dom); 22.157 return -ENOMEM; 22.158 } 22.159 22.160 @@ -614,7 +618,7 @@ int setup_guestos(struct task_struct *p, 22.161 22.162 if ( data_len > (params->memory_kb << 9) ) 22.163 { 22.164 - printk("DOM%d: Guest OS image is too large\n" 22.165 + printk("DOM%llu: Guest OS image is too large\n" 22.166 " (%luMB is greater than %uMB limit for a\n" 22.167 " %uMB address space)\n", 22.168 dom, data_len>>20, 22.169 @@ -624,7 +628,7 @@ int setup_guestos(struct task_struct *p, 22.170 return -1; 22.171 } 22.172 22.173 - printk("DOM%d: Guest OS virtual load address is %08lx\n", dom, 22.174 + printk("DOM%llu: Guest OS virtual load address is %08lx\n", dom, 22.175 virt_load_address); 22.176 22.177 SET_GDT_ENTRIES(p, DEFAULT_GDT_ENTRIES); 22.178 @@ -753,14 +757,11 @@ int setup_guestos(struct task_struct *p, 22.179 virt_startinfo_address->pt_base = virt_load_address + 22.180 ((p->tot_pages - 1) << PAGE_SHIFT); 22.181 22.182 - virt_startinfo_address->dom_id = p->domain; 22.183 virt_startinfo_address->flags = 0; 22.184 if ( IS_PRIV(p) ) 22.185 - { 22.186 virt_startinfo_address->flags |= SIF_PRIVILEGED; 22.187 - if ( CONSOLE_ISOWNER(p) ) 22.188 - virt_startinfo_address->flags |= SIF_CONSOLE; 22.189 - } 22.190 + if ( p->domain == 0 ) 22.191 + virt_startinfo_address->flags |= SIF_INITDOMAIN; 22.192 22.193 if ( initrd_len ) 22.194 { 22.195 @@ -787,12 +788,8 @@ int setup_guestos(struct task_struct *p, 22.196 *dst = '\0'; 22.197 22.198 /* If this guy's getting the console we'd better let go. */ 22.199 - if ( virt_startinfo_address->flags & SIF_CONSOLE ) 22.200 - { 22.201 - /* NB. Should reset the console here. */ 22.202 + if ( CONSOLE_ISOWNER(p) ) 22.203 opt_console = 0; 22.204 - } 22.205 - 22.206 22.207 /* Reinstate the caller's page tables. */ 22.208 write_cr3_counted(pagetable_val(current->mm.pagetable)); 22.209 @@ -819,7 +816,7 @@ int setup_guestos(struct task_struct *p, 22.210 } 22.211 kfree(xd); 22.212 22.213 - p->flags |= PF_CONSTRUCTED; 22.214 + set_bit(PF_CONSTRUCTED, &p->flags); 22.215 22.216 new_thread(p, 22.217 (unsigned long)virt_load_address,
23.1 --- a/xen/common/kernel.c Tue Feb 10 14:38:31 2004 +0000 23.2 +++ b/xen/common/kernel.c Wed Feb 11 17:43:44 2004 +0000 23.3 @@ -222,6 +222,8 @@ void cmain (unsigned long magic, multibo 23.4 new_dom = do_createdomain(0, 0); 23.5 if ( new_dom == NULL ) panic("Error creating domain 0\n"); 23.6 23.7 + set_bit(PF_PRIVILEGED, &new_dom->flags); 23.8 + 23.9 /* 23.10 * We're going to setup domain0 using the module(s) that we stashed safely 23.11 * above our MAX_DIRECTMAP_ADDRESS in boot/Boot.S The second module, if 23.12 @@ -620,7 +622,7 @@ int console_export(char *str, int len) 23.13 23.14 unmap_domain_mem(skb_data); 23.15 23.16 - skb->dst_vif = find_vif_by_id(0); 23.17 + skb->dst_vif = find_net_vif(0, 0); 23.18 (void)netif_rx(skb); 23.19 23.20 return 1; 23.21 @@ -655,7 +657,7 @@ long do_console_write(char *str, unsigne 23.22 spin_lock_irqsave(&console_lock, flags); 23.23 23.24 __putstr("DOM"); 23.25 - sprintf(dom_id, "%d", current->domain); 23.26 + sprintf(dom_id, "%llu", current->domain); 23.27 __putstr(dom_id); 23.28 __putstr(": "); 23.29
24.1 --- a/xen/common/keyhandler.c Tue Feb 10 14:38:31 2004 +0000 24.2 +++ b/xen/common/keyhandler.c Wed Feb 11 17:43:44 2004 +0000 24.3 @@ -107,7 +107,7 @@ void do_task_queues(u_char key, void *de 24.4 24.5 p = &idle0_task; 24.6 do { 24.7 - printk("Xen: DOM %d, CPU %d [has=%c], state = %s, " 24.8 + printk("Xen: DOM %llu, CPU %d [has=%c], state = %s, " 24.9 "hyp_events = %08x\n", 24.10 p->domain, p->processor, p->has_cpu ? 'T':'F', 24.11 task_states[p->state], p->hyp_events);
25.1 --- a/xen/common/network.c Tue Feb 10 14:38:31 2004 +0000 25.2 +++ b/xen/common/network.c Wed Feb 11 17:43:44 2004 +0000 25.3 @@ -1,4 +1,5 @@ 25.4 -/* network.c 25.5 +/****************************************************************************** 25.6 + * network.c 25.7 * 25.8 * Network virtualization for Xen. Lower-level network interactions are in 25.9 * net/dev.c and in the drivers. This file contains routines to interact 25.10 @@ -6,6 +7,20 @@ 25.11 * the use of rules. 25.12 * 25.13 * Copyright (c) 2002-2003, A K Warfield and K A Fraser 25.14 + * 25.15 + * This program is free software; you can redistribute it and/or modify 25.16 + * it under the terms of the GNU General Public License as published by 25.17 + * the Free Software Foundation; either version 2 of the License, or 25.18 + * (at your option) any later version. 25.19 + * 25.20 + * This program is distributed in the hope that it will be useful, 25.21 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 25.22 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25.23 + * GNU General Public License for more details. 25.24 + * 25.25 + * You should have received a copy of the GNU General Public License 25.26 + * along with this program; if not, write to the Free Software 25.27 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25.28 */ 25.29 25.30 #include <xeno/sched.h> 25.31 @@ -32,11 +47,11 @@ void print_net_rule_list(); 25.32 /* ----[ VIF Functions ]----------------------------------------------------*/ 25.33 25.34 25.35 -net_vif_t *find_vif_by_id(unsigned long id) 25.36 +net_vif_t *find_net_vif(domid_t dom, unsigned int idx) 25.37 { 25.38 struct task_struct *p; 25.39 net_vif_t *vif = NULL; 25.40 - unsigned long flags, dom = id>>VIF_DOMAIN_SHIFT; 25.41 + unsigned long flags; 25.42 25.43 read_lock_irqsave(&tasklist_lock, flags); 25.44 p = task_hash[TASK_HASH(dom)]; 25.45 @@ -44,8 +59,9 @@ net_vif_t *find_vif_by_id(unsigned long 25.46 { 25.47 if ( p->domain == dom ) 25.48 { 25.49 - vif = p->net_vif_list[id&VIF_INDEX_MASK]; 25.50 - if ( vif != NULL ) get_vif(vif); 25.51 + vif = p->net_vif_list[idx]; 25.52 + if ( vif != NULL ) 25.53 + get_vif(vif); 25.54 break; 25.55 } 25.56 p = p->next_hash; 25.57 @@ -56,30 +72,32 @@ net_vif_t *find_vif_by_id(unsigned long 25.58 } 25.59 25.60 25.61 -/* create_net_vif - Create a new vif and append it to the specified domain. 25.62 +/* 25.63 + * create_net_vif - Create a new vif and append it to the specified domain. 25.64 * 25.65 - * the domain is examined to determine how many vifs currently are allocated 25.66 + * The domain is examined to determine how many vifs currently are allocated 25.67 * and the newly allocated vif is appended. The vif is also added to the 25.68 * global list. 25.69 * 25.70 */ 25.71 -net_vif_t *create_net_vif(int domain) 25.72 +net_vif_t *create_net_vif(domid_t dom) 25.73 { 25.74 - int dom_vif_idx; 25.75 + unsigned int idx; 25.76 net_vif_t *new_vif = NULL; 25.77 net_ring_t *new_ring = NULL; 25.78 struct task_struct *p = NULL; 25.79 unsigned long flags, vmac_hash; 25.80 unsigned char vmac_key[ETH_ALEN + 2 + MAX_DOMAIN_NAME]; 25.81 25.82 - if ( !(p = find_domain_by_id(domain)) ) 25.83 + if ( (p = find_domain_by_id(dom)) == NULL ) 25.84 return NULL; 25.85 25.86 write_lock_irqsave(&tasklist_lock, flags); 25.87 25.88 - for ( dom_vif_idx = 0; dom_vif_idx < MAX_DOMAIN_VIFS; dom_vif_idx++ ) 25.89 - if ( p->net_vif_list[dom_vif_idx] == NULL ) break; 25.90 - if ( dom_vif_idx == MAX_DOMAIN_VIFS ) 25.91 + for ( idx = 0; idx < MAX_DOMAIN_VIFS; idx++ ) 25.92 + if ( p->net_vif_list[idx] == NULL ) 25.93 + break; 25.94 + if ( idx == MAX_DOMAIN_VIFS ) 25.95 goto fail; 25.96 25.97 if ( (new_vif = kmem_cache_alloc(net_vif_cache, GFP_KERNEL)) == NULL ) 25.98 @@ -87,7 +105,8 @@ net_vif_t *create_net_vif(int domain) 25.99 25.100 memset(new_vif, 0, sizeof(*new_vif)); 25.101 25.102 - if ( sizeof(net_ring_t) > PAGE_SIZE ) BUG(); 25.103 + if ( sizeof(net_ring_t) > PAGE_SIZE ) 25.104 + BUG(); 25.105 new_ring = (net_ring_t *)get_free_page(GFP_KERNEL); 25.106 clear_page(new_ring); 25.107 SHARE_PFN_WITH_DOMAIN(virt_to_page(new_ring), p); 25.108 @@ -98,9 +117,9 @@ net_vif_t *create_net_vif(int domain) 25.109 */ 25.110 atomic_set(&new_vif->refcnt, 1); 25.111 new_vif->shared_rings = new_ring; 25.112 - new_vif->shared_idxs = &p->shared_info->net_idx[dom_vif_idx]; 25.113 + new_vif->shared_idxs = &p->shared_info->net_idx[idx]; 25.114 new_vif->domain = p; 25.115 - new_vif->idx = dom_vif_idx; 25.116 + new_vif->idx = idx; 25.117 new_vif->list.next = NULL; 25.118 spin_lock_init(&new_vif->rx_lock); 25.119 spin_lock_init(&new_vif->tx_lock); 25.120 @@ -109,7 +128,7 @@ net_vif_t *create_net_vif(int domain) 25.121 new_vif->credit_usec = 0UL; 25.122 init_ac_timer(&new_vif->credit_timeout); 25.123 25.124 - if ( (p->domain == 0) && (dom_vif_idx == 0) ) 25.125 + if ( (p->domain == 0) && (idx == 0) ) 25.126 { 25.127 /* 25.128 * DOM0/VIF0 gets the real physical MAC address, so that users can 25.129 @@ -134,7 +153,7 @@ net_vif_t *create_net_vif(int domain) 25.130 * MAC addresses for some VIFs with no fear of clashes. 25.131 */ 25.132 memcpy(&vmac_key[0], the_dev->dev_addr, ETH_ALEN); 25.133 - *(__u16 *)(&vmac_key[ETH_ALEN]) = htons(dom_vif_idx); 25.134 + *(__u16 *)(&vmac_key[ETH_ALEN]) = htons(idx); 25.135 strcpy(&vmac_key[ETH_ALEN+2], p->name); 25.136 vmac_hash = hash(vmac_key, ETH_ALEN + 2 + strlen(p->name)); 25.137 memcpy(new_vif->vmac, "\xaa\x00\x00", 3); 25.138 @@ -143,7 +162,7 @@ net_vif_t *create_net_vif(int domain) 25.139 new_vif->vmac[5] = (vmac_hash >> 0) & 0xff; 25.140 } 25.141 25.142 - p->net_vif_list[dom_vif_idx] = new_vif; 25.143 + p->net_vif_list[idx] = new_vif; 25.144 25.145 write_unlock_irqrestore(&tasklist_lock, flags); 25.146 return new_vif; 25.147 @@ -182,9 +201,6 @@ void unlink_net_vif(net_vif_t *vif) 25.148 } 25.149 25.150 25.151 -/* vif_query - Call from the proc file system to get a list of indexes 25.152 - * in use by a particular domain. 25.153 - */ 25.154 int vif_query(vif_query_t *vq) 25.155 { 25.156 net_vif_t *vif; 25.157 @@ -193,7 +209,8 @@ int vif_query(vif_query_t *vq) 25.158 int i; 25.159 int count = 0; 25.160 25.161 - if ( !(p = find_domain_by_id(vq->domain)) ) { 25.162 + if ( (p = find_domain_by_id(vq->domain)) == NULL ) 25.163 + { 25.164 buf[0] = -1; 25.165 copy_to_user(vq->buf, buf, sizeof(int)); 25.166 return -ESRCH; 25.167 @@ -215,15 +232,11 @@ int vif_query(vif_query_t *vq) 25.168 return 0; 25.169 } 25.170 25.171 -/* vif_getinfo - Call from the proc file system to get info about a specific 25.172 - * vif in use by a particular domain. 25.173 - */ 25.174 int vif_getinfo(vif_getinfo_t *info) 25.175 { 25.176 net_vif_t *vif; 25.177 25.178 - vif = find_vif_by_id((info->domain << VIF_DOMAIN_SHIFT) | info->vif); 25.179 - if ( vif == NULL ) 25.180 + if ( (vif = find_net_vif(info->domain, info->vif)) == NULL ) 25.181 return -ESRCH; 25.182 25.183 info->total_bytes_sent = vif->total_bytes_sent; 25.184 @@ -244,8 +257,7 @@ int vif_setparams(vif_setparams_t *param 25.185 { 25.186 net_vif_t *vif; 25.187 25.188 - vif = find_vif_by_id((params->domain << VIF_DOMAIN_SHIFT) | params->vif); 25.189 - if ( vif == NULL ) 25.190 + if ( (vif = find_net_vif(params->domain, params->vif)) == NULL ) 25.191 return -ESRCH; 25.192 25.193 /* Turning off rate limiting? */ 25.194 @@ -263,9 +275,6 @@ int vif_setparams(vif_setparams_t *param 25.195 25.196 /* ----[ Net Rule Functions ]-----------------------------------------------*/ 25.197 25.198 -/* add_net_rule - Add a new network filter rule. 25.199 - */ 25.200 - 25.201 int add_net_rule(net_rule_t *rule) 25.202 { 25.203 net_rule_ent_t *new_ent; 25.204 @@ -283,83 +292,72 @@ int add_net_rule(net_rule_t *rule) 25.205 return 0; 25.206 } 25.207 25.208 -/* delete_net_rule - Delete an existing network rule. 25.209 - */ 25.210 - 25.211 int delete_net_rule(net_rule_t *rule) 25.212 { 25.213 - net_rule_ent_t *ent = net_rule_list, *prev = NULL; 25.214 - while ( (ent) && ((memcmp(rule, &ent->r, sizeof(net_rule_t))) != 0) ) 25.215 + net_rule_ent_t **pent, *ent; 25.216 + 25.217 + write_lock(&net_rule_lock); 25.218 + 25.219 + for ( pent = &net_rule_list; pent != NULL; pent = &ent->next ) 25.220 { 25.221 - prev = ent; 25.222 - ent = ent->next; 25.223 + ent = *pent; 25.224 + if ( memcmp(rule, &ent->r, sizeof(net_rule_t)) == 0 ) 25.225 + { 25.226 + *pent = ent->next; 25.227 + kmem_cache_free(net_rule_cache, ent); 25.228 + break; 25.229 + } 25.230 } 25.231 25.232 - if (ent != NULL) 25.233 - { 25.234 - write_lock(&net_rule_lock); 25.235 - if (prev != NULL) 25.236 - { 25.237 - prev->next = ent->next; 25.238 - } 25.239 - else 25.240 - { 25.241 - net_rule_list = ent->next; 25.242 - } 25.243 - kmem_cache_free(net_rule_cache, ent); 25.244 - write_unlock(&net_rule_lock); 25.245 - } 25.246 + write_unlock(&net_rule_lock); 25.247 return 0; 25.248 } 25.249 25.250 -/* print_net_rule - Print a single net rule. 25.251 - */ 25.252 +static char *idx_to_name(unsigned int idx) 25.253 +{ 25.254 + if ( idx == VIF_PHYSICAL_INTERFACE ) 25.255 + return "PHYSICAL"; 25.256 + if ( idx == VIF_ANY_INTERFACE ) 25.257 + return "ANY"; 25.258 + return "UNKNOWN"; 25.259 +} 25.260 + 25.261 +static char *print_ip_addr(char *buf, unsigned long addr) 25.262 +{ 25.263 + sprintf(buf, "%lu.%lu.%lu.%lu", 25.264 + (addr>>24)&255, (addr>>16)&255, (addr>>8)&255, addr&255); 25.265 + return buf; 25.266 +} 25.267 25.268 void print_net_rule(net_rule_t *r) 25.269 { 25.270 + char buf[20]; 25.271 + 25.272 printk("===] NET RULE:\n"); 25.273 - printk("=] src_addr : %lu\n", (unsigned long) r->src_addr); 25.274 - printk("=] src_addr_mask : %lu\n", (unsigned long) r->src_addr_mask); 25.275 - printk("=] dst_addr : %lu\n", (unsigned long) r->dst_addr); 25.276 - printk("=] dst_addr_mask : %lu\n", (unsigned long) r->dst_addr_mask); 25.277 + printk("=] src_addr : %s\n", print_ip_addr(buf, r->src_addr)); 25.278 + printk("=] src_addr_mask : %s\n", print_ip_addr(buf, r->src_addr_mask)); 25.279 + printk("=] dst_addr : %s\n", print_ip_addr(buf, r->dst_addr)); 25.280 + printk("=] dst_addr_mask : %s\n", print_ip_addr(buf, r->dst_addr_mask)); 25.281 printk("=] src_port : %u\n", r->src_port); 25.282 printk("=] src_port_mask : %u\n", r->src_port_mask); 25.283 printk("=] dst_port : %u\n", r->dst_port); 25.284 printk("=] dst_port_mask : %u\n", r->dst_port_mask); 25.285 printk("=] dst_proto : %u\n", r->proto); 25.286 - switch ( r->src_vif ) 25.287 - { 25.288 - case VIF_PHYSICAL_INTERFACE: 25.289 - printk("=] src_dom/idx : PHYSICAL\n"); 25.290 - break; 25.291 - case VIF_ANY_INTERFACE: 25.292 - printk("=] src_dom/idx : ANY\n"); 25.293 - break; 25.294 - default: 25.295 - printk("=] src_dom/idx : %lu/%lu\n", 25.296 - r->src_vif>>VIF_DOMAIN_SHIFT, r->src_vif&VIF_INDEX_MASK); 25.297 - break; 25.298 - } 25.299 - switch ( r->dst_vif ) 25.300 - { 25.301 - case VIF_PHYSICAL_INTERFACE: 25.302 - printk("=] dst_dom/idx : PHYSICAL\n"); 25.303 - break; 25.304 - case VIF_ANY_INTERFACE: 25.305 - printk("=] dst_dom/idx : ANY\n"); 25.306 - break; 25.307 - default: 25.308 - printk("=] dst_dom/idx : %lu/%lu\n", 25.309 - r->dst_vif>>VIF_DOMAIN_SHIFT, r->dst_vif&VIF_INDEX_MASK); 25.310 - break; 25.311 - } 25.312 + 25.313 + if ( r->src_dom == VIF_SPECIAL ) 25.314 + printk("=] src_dom/idx : %s\n", idx_to_name(r->src_idx)); 25.315 + else 25.316 + printk("=] src_dom/idx : %llu/%u\n", r->src_dom, r->src_idx); 25.317 + 25.318 + if ( r->dst_dom == VIF_SPECIAL ) 25.319 + printk("=] dst_dom/idx : %s\n", idx_to_name(r->dst_idx)); 25.320 + else 25.321 + printk("=] dst_dom/idx : %llu/%u\n", r->dst_dom, r->dst_idx); 25.322 + 25.323 printk("=] action : %u\n", r->action); 25.324 } 25.325 25.326 -/* print_net_rule_list - Print the global rule table. 25.327 - */ 25.328 - 25.329 -void print_net_rule_list() 25.330 +void print_net_rule_list(void) 25.331 { 25.332 net_rule_ent_t *ent; 25.333 int count = 0; 25.334 @@ -368,17 +366,19 @@ void print_net_rule_list() 25.335 25.336 ent = net_rule_list; 25.337 25.338 - while (ent) 25.339 + while ( ent != NULL ) 25.340 { 25.341 print_net_rule(&ent->r); 25.342 ent = ent->next; 25.343 count++; 25.344 } 25.345 + 25.346 printk("\nTotal of %d rules.\n", count); 25.347 25.348 read_unlock(&net_rule_lock); 25.349 } 25.350 25.351 + 25.352 /* net_find_rule - Find the destination vif according to the current rules. 25.353 * 25.354 * Apply the rules to this skbuff and return the vif id that it is bound for. 25.355 @@ -386,10 +386,12 @@ void print_net_rule_list() 25.356 */ 25.357 static net_vif_t *net_find_rule(u8 nproto, u8 tproto, u32 src_addr, 25.358 u32 dst_addr, u16 src_port, 25.359 - u16 dst_port, unsigned long src_vif) 25.360 + u16 dst_port, 25.361 + domid_t src_dom, unsigned int src_idx) 25.362 { 25.363 net_rule_ent_t *ent; 25.364 - unsigned long dest = VIF_UNKNOWN_INTERFACE; 25.365 + domid_t dst_dom = VIF_SPECIAL; 25.366 + unsigned int dst_idx = VIF_UNKNOWN_INTERFACE; 25.367 25.368 read_lock(&net_rule_lock); 25.369 25.370 @@ -397,10 +399,13 @@ static net_vif_t *net_find_rule(u8 nprot 25.371 25.372 while ( ent != NULL ) 25.373 { 25.374 - if ( ((ent->r.src_vif == src_vif) 25.375 - || (ent->r.src_vif == VIF_ANY_INTERFACE)) && 25.376 + if ( (((ent->r.src_dom == src_dom) && 25.377 + (ent->r.src_idx == src_idx)) || 25.378 + ((ent->r.src_dom == VIF_SPECIAL) && 25.379 + (ent->r.src_idx == VIF_ANY_INTERFACE))) && 25.380 25.381 - (src_vif != ent->r.dst_vif) && 25.382 + ((src_dom != ent->r.dst_dom) || 25.383 + (src_idx != ent->r.dst_idx)) && 25.384 25.385 (!((ent->r.src_addr ^ src_addr) & ent->r.src_addr_mask )) && 25.386 (!((ent->r.dst_addr ^ dst_addr) & ent->r.dst_addr_mask )) && 25.387 @@ -418,14 +423,14 @@ static net_vif_t *net_find_rule(u8 nprot 25.388 (tproto == IPPROTO_UDP))) 25.389 ) 25.390 { 25.391 + dst_dom = ent->r.dst_dom; 25.392 + dst_idx = ent->r.dst_idx; 25.393 /* 25.394 * XXX FFS! We keep going to find the "best" rule. Where best 25.395 * corresponds to vaguely sane routing of a packet. We need a less 25.396 * shafted model for our "virtual firewall/router" methinks! 25.397 */ 25.398 - if ( (dest & VIF_DOMAIN_MASK) == VIF_SPECIAL ) 25.399 - dest = ent->r.dst_vif; 25.400 - if ( (dest & VIF_DOMAIN_MASK) != VIF_SPECIAL ) 25.401 + if ( dst_dom != VIF_SPECIAL ) 25.402 break; 25.403 } 25.404 ent = ent->next; 25.405 @@ -433,12 +438,14 @@ static net_vif_t *net_find_rule(u8 nprot 25.406 25.407 read_unlock(&net_rule_lock); 25.408 25.409 - if ( dest == VIF_PHYSICAL_INTERFACE ) 25.410 - return VIF_PHYS; 25.411 - else if ( (dest & VIF_DOMAIN_MASK) == VIF_SPECIAL ) 25.412 + if ( dst_dom == VIF_SPECIAL ) 25.413 + { 25.414 + if ( dst_idx == VIF_PHYSICAL_INTERFACE ) 25.415 + return VIF_PHYS; 25.416 return VIF_DROP; 25.417 - else 25.418 - return find_vif_by_id(dest); 25.419 + } 25.420 + 25.421 + return find_net_vif(dst_dom, dst_idx); 25.422 } 25.423 25.424 /* net_get_target_vif - Find the vif that the given sk_buff is bound for. 25.425 @@ -463,13 +470,17 @@ net_vif_t *net_get_target_vif(u8 *data, 25.426 { 25.427 net_vif_t *target = VIF_DROP; 25.428 u8 *h_raw, *nh_raw; 25.429 - unsigned long src_vif_val = VIF_PHYSICAL_INTERFACE; 25.430 + domid_t src_dom = VIF_SPECIAL; 25.431 + unsigned int src_idx = VIF_PHYSICAL_INTERFACE; 25.432 25.433 if ( src_vif != VIF_PHYS ) 25.434 - src_vif_val = (src_vif->domain->domain<<VIF_DOMAIN_SHIFT) | 25.435 - src_vif->idx; 25.436 + { 25.437 + src_dom = src_vif->domain->domain; 25.438 + src_idx = src_vif->idx; 25.439 + } 25.440 25.441 - if ( len < ETH_HLEN ) goto drop; 25.442 + if ( len < ETH_HLEN ) 25.443 + goto drop; 25.444 25.445 nh_raw = data + ETH_HLEN; 25.446 switch ( ntohs(*(unsigned short *)(data + 12)) ) 25.447 @@ -478,7 +489,7 @@ net_vif_t *net_get_target_vif(u8 *data, 25.448 if ( len < (ETH_HLEN + 28) ) goto drop; 25.449 target = net_find_rule((u8)ETH_P_ARP, 0, ntohl(*(u32 *)(nh_raw + 14)), 25.450 ntohl(*(u32 *)(nh_raw + 24)), 0, 0, 25.451 - src_vif_val); 25.452 + src_dom, src_idx); 25.453 break; 25.454 25.455 case ETH_P_IP: 25.456 @@ -490,14 +501,14 @@ net_vif_t *net_get_target_vif(u8 *data, 25.457 ntohl(*(u32 *)(nh_raw + 16)), 25.458 0, 25.459 0, 25.460 - src_vif_val); 25.461 + src_dom, src_idx); 25.462 break; 25.463 } 25.464 return target; 25.465 25.466 drop: 25.467 - printk("VIF%lu/%lu: pkt to drop!\n", 25.468 - src_vif_val>>VIF_DOMAIN_SHIFT, src_vif_val&VIF_INDEX_MASK); 25.469 + printk("VIF%llu/%u: pkt to drop!\n", 25.470 + src_dom, src_idx); 25.471 return VIF_DROP; 25.472 } 25.473
26.1 --- a/xen/common/schedule.c Tue Feb 10 14:38:31 2004 +0000 26.2 +++ b/xen/common/schedule.c Wed Feb 11 17:43:44 2004 +0000 26.3 @@ -306,7 +306,7 @@ long sched_bvtctl(unsigned long c_allow) 26.4 } 26.5 26.6 /* Adjust scheduling parameter for a given domain. */ 26.7 -long sched_adjdom(int dom, unsigned long mcu_adv, unsigned long warp, 26.8 +long sched_adjdom(domid_t dom, unsigned long mcu_adv, unsigned long warp, 26.9 unsigned long warpl, unsigned long warpu) 26.10 { 26.11 struct task_struct *p; 26.12 @@ -512,6 +512,7 @@ asmlinkage void __enter_scheduler(void) 26.13 * 'next_prime's evt. Take context switch allowance into account. 26.14 */ 26.15 ASSERT(next_prime->evt >= next->evt); 26.16 + 26.17 r_time = ((next_prime->evt - next->evt)/next->mcu_advance) + ctx_allow; 26.18 26.19 sched_done: 26.20 @@ -697,7 +698,8 @@ static void dump_rqueue(struct list_head 26.21 (unsigned long) queue->next, (unsigned long) queue->prev); 26.22 list_for_each (list, queue) { 26.23 p = list_entry(list, struct task_struct, run_list); 26.24 - printk("%3d: %3d has=%c mcua=0x%04lX ev=0x%08X av=0x%08X c=0x%X%08X\n", 26.25 + printk("%3d: %llu has=%c mcua=0x%04lX" 26.26 + " ev=0x%08X av=0x%08X c=0x%X%08X\n", 26.27 loop++, p->domain, 26.28 p->has_cpu ? 'T':'F', 26.29 p->mcu_advance, p->evt, p->avt,
27.1 --- a/xen/drivers/block/xen_block.c Tue Feb 10 14:38:31 2004 +0000 27.2 +++ b/xen/drivers/block/xen_block.c Wed Feb 11 17:43:44 2004 +0000 27.3 @@ -567,7 +567,7 @@ static void dump_blockq(u_char key, void 27.4 do { 27.5 if ( !is_idle_task(p) ) 27.6 { 27.7 - printk("Domain: %d\n", p->domain); 27.8 + printk("Domain: %llu\n", p->domain); 27.9 blk_ring = p->blk_ring_base; 27.10 27.11 printk(" req_prod:0x%08x, req_cons:0x%08x resp_prod:0x%08x/"
28.1 --- a/xen/include/asm-i386/i387.h Tue Feb 10 14:38:31 2004 +0000 28.2 +++ b/xen/include/asm-i386/i387.h Wed Feb 11 17:43:44 2004 +0000 28.3 @@ -19,14 +19,13 @@ extern void save_init_fpu( struct task_s 28.4 extern void restore_fpu( struct task_struct *tsk ); 28.5 28.6 #define unlazy_fpu( tsk ) do { \ 28.7 - if ( tsk->flags & PF_USEDFPU ) \ 28.8 + if ( test_bit(PF_USEDFPU, &tsk->flags) ) \ 28.9 save_init_fpu( tsk ); \ 28.10 } while (0) 28.11 28.12 #define clear_fpu( tsk ) do { \ 28.13 - if ( tsk->flags & PF_USEDFPU ) { \ 28.14 + if ( test_and_clear_bit(PF_USEDFPU, &tsk->flags) ) { \ 28.15 asm volatile("fwait"); \ 28.16 - tsk->flags &= ~PF_USEDFPU; \ 28.17 stts(); \ 28.18 } \ 28.19 } while (0)
29.1 --- a/xen/include/asm-i386/pdb.h Tue Feb 10 14:38:31 2004 +0000 29.2 +++ b/xen/include/asm-i386/pdb.h Wed Feb 11 17:43:44 2004 +0000 29.3 @@ -21,10 +21,10 @@ extern int pdb_high_bit; 29.4 extern void initialize_pdb(void); 29.5 29.6 /* Get/set values from generic debug interface. */ 29.7 -extern int pdb_set_values (int domain, u_char *buffer, 29.8 - unsigned long addr, int length); 29.9 -extern int pdb_get_values (int domain, u_char *buffer, 29.10 - unsigned long addr, int length); 29.11 +extern int pdb_set_values(domid_t domain, u_char *buffer, 29.12 + unsigned long addr, int length); 29.13 +extern int pdb_get_values(domid_t domain, u_char *buffer, 29.14 + unsigned long addr, int length); 29.15 29.16 /* External entry points. */ 29.17 extern int pdb_handle_exception(int exceptionVector,
30.1 --- a/xen/include/hypervisor-ifs/block.h Tue Feb 10 14:38:31 2004 +0000 30.2 +++ b/xen/include/hypervisor-ifs/block.h Wed Feb 11 17:43:44 2004 +0000 30.3 @@ -98,7 +98,7 @@ typedef struct xen_disk 30.4 unsigned short device; /* device number (opaque 16 bit val) */ 30.5 unsigned short info; /* device type and flags */ 30.6 unsigned long capacity; /* size in terms of #512 byte sectors */ 30.7 - unsigned int domain; /* if a VBD, domain this 'belongs to' */ 30.8 + domid_t domain; /* if a VBD, domain this 'belongs to' */ 30.9 } xen_disk_t; 30.10 30.11 typedef struct xen_disk_info
31.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h Tue Feb 10 14:38:31 2004 +0000 31.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h Wed Feb 11 17:43:44 2004 +0000 31.3 @@ -17,7 +17,7 @@ 31.4 * This makes sure that old versions of dom0 tools will stop working in a 31.5 * well-defined way (rather than crashing the machine, for instance). 31.6 */ 31.7 -#define DOM0_INTERFACE_VERSION 0xAAAA0004 31.8 +#define DOM0_INTERFACE_VERSION 0xAAAA0005 31.9 31.10 31.11 /* 31.12 @@ -51,30 +51,30 @@ typedef struct dom0_createdomain_st 31.13 { 31.14 /* IN parameters. */ 31.15 unsigned int memory_kb; 31.16 - char name[MAX_DOMAIN_NAME]; 31.17 + char name[MAX_DOMAIN_NAME]; 31.18 /* OUT parameters. */ 31.19 - unsigned int domain; 31.20 + domid_t domain; 31.21 } dom0_createdomain_t; 31.22 31.23 #define DOM0_STARTDOMAIN 10 31.24 typedef struct dom0_startdomain_st 31.25 { 31.26 /* IN parameters. */ 31.27 - unsigned int domain; 31.28 + domid_t domain; 31.29 } dom0_startdomain_t; 31.30 31.31 #define DOM0_STOPDOMAIN 11 31.32 typedef struct dom0_stopdomain_st 31.33 { 31.34 /* IN parameters. */ 31.35 - unsigned int domain; 31.36 + domid_t domain; 31.37 } dom0_stopdomain_t; 31.38 31.39 #define DOM0_DESTROYDOMAIN 9 31.40 typedef struct dom0_destroydomain_st 31.41 { 31.42 /* IN variables. */ 31.43 - unsigned int domain; 31.44 + domid_t domain; 31.45 int force; 31.46 } dom0_destroydomain_t; 31.47 31.48 @@ -82,7 +82,7 @@ typedef struct dom0_destroydomain_st 31.49 typedef struct dom0_getmemlist_st 31.50 { 31.51 /* IN variables. */ 31.52 - unsigned int domain; 31.53 + domid_t domain; 31.54 unsigned long max_pfns; 31.55 void *buffer; 31.56 /* OUT variables. */ 31.57 @@ -93,8 +93,8 @@ typedef struct dom0_getmemlist_st 31.58 typedef struct dom0_builddomain_st 31.59 { 31.60 /* IN variables. */ 31.61 - unsigned int domain; 31.62 - unsigned int num_vifs; 31.63 + domid_t domain; 31.64 + unsigned int num_vifs; 31.65 full_execution_context_t ctxt; 31.66 } dom0_builddomain_t; 31.67 31.68 @@ -109,7 +109,7 @@ typedef struct dom0_bvtctl_st 31.69 typedef struct dom0_adjustdom_st 31.70 { 31.71 /* IN variables. */ 31.72 - unsigned int domain; /* domain id */ 31.73 + domid_t domain; /* domain id */ 31.74 unsigned long mcu_adv; /* mcu advance: inverse of weight */ 31.75 unsigned long warp; /* time warp */ 31.76 unsigned long warpl; /* warp limit */ 31.77 @@ -120,7 +120,7 @@ typedef struct dom0_adjustdom_st 31.78 typedef struct dom0_getdomaininfo_st 31.79 { 31.80 /* IN variables. */ 31.81 - unsigned int domain; 31.82 + domid_t domain; 31.83 /* OUT variables. */ 31.84 char name[MAX_DOMAIN_NAME]; 31.85 int processor; 31.86 @@ -141,7 +141,7 @@ typedef struct dom0_getpageframeinfo_st 31.87 { 31.88 /* IN variables. */ 31.89 unsigned long pfn; /* Machine page frame number to query. */ 31.90 - unsigned int domain; /* To which domain does the frame belong? */ 31.91 + domid_t domain; /* To which domain does the frame belong? */ 31.92 /* OUT variables. */ 31.93 enum { NONE, L1TAB, L2TAB } type; /* Is the page PINNED to a type? */ 31.94 } dom0_getpageframeinfo_t; 31.95 @@ -149,7 +149,7 @@ typedef struct dom0_getpageframeinfo_st 31.96 #define DOM0_IOPL 14 31.97 typedef struct dom0_iopl_st 31.98 { 31.99 - unsigned int domain; 31.100 + domid_t domain; 31.101 unsigned int iopl; 31.102 } dom0_iopl_t; 31.103 31.104 @@ -168,7 +168,7 @@ typedef struct dom0_debug_st 31.105 { 31.106 /* IN variables. */ 31.107 char opcode; 31.108 - unsigned int domain; 31.109 + domid_t domain; 31.110 int in1, in2, in3, in4; 31.111 /* OUT variables. */ 31.112 unsigned int status; 31.113 @@ -206,7 +206,7 @@ typedef struct dom0_readconsole_st 31.114 typedef struct dom0_pincpudomain_st 31.115 { 31.116 /* IN variables. */ 31.117 - unsigned int domain; 31.118 + domid_t domain; 31.119 int cpu; /* -1 implies unpin */ 31.120 } dom0_pincpudomain_t; 31.121
32.1 --- a/xen/include/hypervisor-ifs/hypervisor-if.h Tue Feb 10 14:38:31 2004 +0000 32.2 +++ b/xen/include/hypervisor-ifs/hypervisor-if.h Wed Feb 11 17:43:44 2004 +0000 32.3 @@ -185,6 +185,10 @@ 32.4 32.5 #ifndef __ASSEMBLY__ 32.6 32.7 +typedef u64 domid_t; 32.8 +/* DOMID_SELF is used in certain contexts to refer to oneself. */ 32.9 +#define DOMID_SELF (~1ULL) 32.10 + 32.11 #include "network.h" 32.12 #include "block.h" 32.13 32.14 @@ -334,7 +338,6 @@ typedef struct start_info_st { 32.15 /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */ 32.16 unsigned long nr_pages; /* total pages allocated to this domain. */ 32.17 unsigned long shared_info; /* MACHINE address of shared info struct.*/ 32.18 - unsigned long dom_id; /* Domain identifier. */ 32.19 unsigned long flags; /* SIF_xxx flags. */ 32.20 /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */ 32.21 unsigned long pt_base; /* VIRTUAL address of page directory. */ 32.22 @@ -345,7 +348,7 @@ typedef struct start_info_st { 32.23 32.24 /* These flags are passed in the 'flags' field of start_info_t. */ 32.25 #define SIF_PRIVILEGED 1 /* Is the domain privileged? */ 32.26 -#define SIF_CONSOLE 2 /* Does the domain own the physical console? */ 32.27 +#define SIF_INITDOMAIN 2 /* Is thsi the initial control domain? */ 32.28 32.29 /* For use in guest OSes. */ 32.30 extern shared_info_t *HYPERVISOR_shared_info;
33.1 --- a/xen/include/hypervisor-ifs/network.h Tue Feb 10 14:38:31 2004 +0000 33.2 +++ b/xen/include/hypervisor-ifs/network.h Wed Feb 11 17:43:44 2004 +0000 33.3 @@ -135,31 +135,26 @@ typedef struct net_rule_st 33.4 u16 src_port_mask; 33.5 u16 dst_port_mask; 33.6 u16 proto; 33.7 - unsigned long src_vif; 33.8 - unsigned long dst_vif; 33.9 + domid_t src_dom, dst_dom; 33.10 + unsigned int src_idx, dst_idx; 33.11 u16 action; 33.12 } net_rule_t; 33.13 33.14 -#define VIF_DOMAIN_MASK 0xfffff000UL 33.15 -#define VIF_DOMAIN_SHIFT 12 33.16 -#define VIF_INDEX_MASK 0x00000fffUL 33.17 -#define VIF_INDEX_SHIFT 0 33.18 - 33.19 -/* These are specified in the index if the dom is SPECIAL. */ 33.20 -#define VIF_SPECIAL 0xfffff000UL 33.21 -#define VIF_UNKNOWN_INTERFACE (VIF_SPECIAL | 0) 33.22 -#define VIF_PHYSICAL_INTERFACE (VIF_SPECIAL | 1) 33.23 -#define VIF_ANY_INTERFACE (VIF_SPECIAL | 2) 33.24 +/* These are specified in the 'idx' if the 'dom' is SPECIAL. */ 33.25 +#define VIF_SPECIAL (~0ULL) 33.26 +#define VIF_UNKNOWN_INTERFACE 0 33.27 +#define VIF_PHYSICAL_INTERFACE 1 33.28 +#define VIF_ANY_INTERFACE 2 33.29 33.30 typedef struct vif_query_st 33.31 { 33.32 - unsigned int domain; 33.33 + domid_t domain; 33.34 int *buf; /* reply buffer -- guest virtual address */ 33.35 } vif_query_t; 33.36 33.37 typedef struct vif_getinfo_st 33.38 { 33.39 - unsigned int domain; 33.40 + domid_t domain; 33.41 unsigned int vif; 33.42 33.43 /* domain & vif are supplied by dom0, the rest are response fields */ 33.44 @@ -179,7 +174,7 @@ typedef struct vif_getinfo_st 33.45 */ 33.46 typedef struct vif_setparams_st 33.47 { 33.48 - unsigned int domain; 33.49 + domid_t domain; 33.50 unsigned int vif; 33.51 unsigned long credit_bytes; 33.52 unsigned long credit_usec;
34.1 --- a/xen/include/hypervisor-ifs/vbd.h Tue Feb 10 14:38:31 2004 +0000 34.2 +++ b/xen/include/hypervisor-ifs/vbd.h Wed Feb 11 17:43:44 2004 +0000 34.3 @@ -32,43 +32,43 @@ typedef struct _xen_extent { 34.4 34.5 34.6 typedef struct _vbd_create { 34.7 - unsigned domain; /* create VBD for this domain */ 34.8 + domid_t domain; /* create VBD for this domain */ 34.9 u16 vdevice; /* id by which dom will refer to VBD */ 34.10 u16 mode; /* OR of { VBD_MODE_R , VBD_MODE_W } */ 34.11 } vbd_create_t; 34.12 34.13 typedef struct _vbd_grow { 34.14 - unsigned domain; /* domain in question */ 34.15 + domid_t domain; /* domain in question */ 34.16 u16 vdevice; /* 16 bit id domain refers to VBD as */ 34.17 xen_extent_t extent; /* the extent to add to this VBD */ 34.18 } vbd_grow_t; 34.19 34.20 typedef struct _vbd_shrink { 34.21 - unsigned domain; /* domain in question */ 34.22 + domid_t domain; /* domain in question */ 34.23 u16 vdevice; /* 16 bit id domain refers to VBD as */ 34.24 } vbd_shrink_t; 34.25 34.26 typedef struct _vbd_setextents { 34.27 - unsigned domain; /* domain in question */ 34.28 + domid_t domain; /* domain in question */ 34.29 u16 vdevice; /* 16 bit id domain refers to VBD as */ 34.30 u16 nr_extents; /* number of extents in the list */ 34.31 xen_extent_t *extents; /* the extents to add to this VBD */ 34.32 } vbd_setextents_t; 34.33 34.34 typedef struct _vbd_delete { 34.35 - unsigned domain; /* domain in question */ 34.36 + domid_t domain; /* domain in question */ 34.37 u16 vdevice; /* 16 bit id domain refers to VBD as */ 34.38 } vbd_delete_t; 34.39 34.40 -#define VBD_PROBE_ALL 0xFFFFFFFF 34.41 +#define VBD_PROBE_ALL (~0ULL) 34.42 typedef struct _vbd_probe { 34.43 - unsigned domain; /* domain in question or VBD_PROBE_ALL */ 34.44 + domid_t domain; /* domain in question or VBD_PROBE_ALL */ 34.45 xen_disk_info_t xdi; /* where's our space for VBD/disk info */ 34.46 } vbd_probe_t; 34.47 34.48 typedef struct _vbd_info { 34.49 /* IN variables */ 34.50 - unsigned domain; /* domain in question */ 34.51 + domid_t domain; /* domain in question */ 34.52 u16 vdevice; /* 16 bit id domain refers to VBD as */ 34.53 u16 maxextents; /* max # of extents to return info for */ 34.54 xen_extent_t *extents; /* pointer to space for extent list */
35.1 --- a/xen/include/xeno/sched.h Tue Feb 10 14:38:31 2004 +0000 35.2 +++ b/xen/include/xeno/sched.h Wed Feb 11 17:43:44 2004 +0000 35.3 @@ -33,19 +33,17 @@ extern struct mm_struct init_mm; 35.4 #define _HYP_EVENT_NEED_RESCHED 0 35.5 #define _HYP_EVENT_DIE 1 35.6 35.7 -#define PF_DONEFPUINIT 0x1 /* Has the FPU been initialised for this task? */ 35.8 -#define PF_USEDFPU 0x2 /* Has this task used the FPU since last save? */ 35.9 -#define PF_GUEST_STTS 0x4 /* Has the guest OS requested 'stts'? */ 35.10 -#define PF_CONSTRUCTED 0x8 /* Has the guest OS been fully built yet? */ 35.11 +#define PF_DONEFPUINIT 0 /* Has the FPU been initialised for this task? */ 35.12 +#define PF_USEDFPU 1 /* Has this task used the FPU since last save? */ 35.13 +#define PF_GUEST_STTS 2 /* Has the guest OS requested 'stts'? */ 35.14 +#define PF_CONSTRUCTED 3 /* Has the guest OS been fully built yet? */ 35.15 +#define PF_IDLETASK 4 /* Is this one of the per-CPU idle domains? */ 35.16 +#define PF_PRIVILEGED 5 /* Is this domain privileged? */ 35.17 35.18 #include <xeno/vif.h> 35.19 #include <xeno/vbd.h> 35.20 35.21 -/* SMH: replace below when have explicit 'priv' flag or bitmask */ 35.22 -#define IS_PRIV(_p) ((_p)->domain == 0) 35.23 - 35.24 -#define DOMAIN_ID_BITS (16) 35.25 -#define MAX_DOMAIN_ID ((1<<(DOMAIN_ID_BITS))-1) 35.26 +#define IS_PRIV(_p) (test_bit(PF_PRIVILEGED, &(_p)->flags)) 35.27 35.28 typedef struct event_channel_st 35.29 { 35.30 @@ -92,8 +90,8 @@ struct task_struct 35.31 /* 35.32 * From here on things can be added and shuffled without special attention 35.33 */ 35.34 - 35.35 - unsigned int domain; /* domain id */ 35.36 + 35.37 + domid_t domain; 35.38 35.39 spinlock_t page_list_lock; 35.40 struct list_head page_list; 35.41 @@ -185,14 +183,15 @@ struct task_struct 35.42 addr_limit: KERNEL_DS, \ 35.43 thread: INIT_THREAD, \ 35.44 prev_task: &(_t), \ 35.45 - next_task: &(_t) \ 35.46 + next_task: &(_t), \ 35.47 + flags: 1<<PF_IDLETASK \ 35.48 } 35.49 35.50 extern struct task_struct idle0_task; 35.51 35.52 extern struct task_struct *idle_task[NR_CPUS]; 35.53 -#define IDLE_DOMAIN_ID (~0) 35.54 -#define is_idle_task(_p) ((_p)->domain == IDLE_DOMAIN_ID) 35.55 +#define IDLE_DOMAIN_ID (~0ULL) 35.56 +#define is_idle_task(_p) (test_bit(PF_IDLETASK, &(_p)->flags)) 35.57 35.58 #include <xeno/slab.h> 35.59 35.60 @@ -205,21 +204,21 @@ extern kmem_cache_t *task_struct_cachep; 35.61 atomic_inc(&(_p)->refcnt) 35.62 35.63 extern struct task_struct *do_createdomain( 35.64 - unsigned int dom_id, unsigned int cpu); 35.65 + domid_t dom_id, unsigned int cpu); 35.66 extern int setup_guestos( 35.67 struct task_struct *p, dom0_createdomain_t *params, unsigned int num_vifs, 35.68 char *data_start, unsigned long data_len, 35.69 char *cmdline, unsigned long initrd_len); 35.70 extern int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *); 35.71 35.72 -struct task_struct *find_domain_by_id(unsigned int dom); 35.73 +struct task_struct *find_domain_by_id(domid_t dom); 35.74 extern void release_task(struct task_struct *); 35.75 extern void __kill_domain(struct task_struct *p); 35.76 extern void kill_domain(void); 35.77 extern void kill_domain_with_errmsg(const char *err); 35.78 -extern long kill_other_domain(unsigned int dom, int force); 35.79 +extern long kill_other_domain(domid_t dom, int force); 35.80 extern void stop_domain(void); 35.81 -extern long stop_other_domain(unsigned int dom); 35.82 +extern long stop_other_domain(domid_t dom); 35.83 35.84 /* arch/process.c */ 35.85 void new_thread(struct task_struct *p, 35.86 @@ -247,7 +246,7 @@ void schedulers_start(void); 35.87 void sched_add_domain(struct task_struct *p); 35.88 int sched_rem_domain(struct task_struct *p); 35.89 long sched_bvtctl(unsigned long ctx_allow); 35.90 -long sched_adjdom(int dom, unsigned long mcu_adv, unsigned long warp, 35.91 +long sched_adjdom(domid_t dom, unsigned long mcu_adv, unsigned long warp, 35.92 unsigned long warpl, unsigned long warpu); 35.93 void init_idle_task(void); 35.94 void __wake_up(struct task_struct *p); 35.95 @@ -287,7 +286,7 @@ void continue_nonidle_task(void); 35.96 35.97 /* This hash table is protected by the tasklist_lock. */ 35.98 #define TASK_HASH_SIZE 256 35.99 -#define TASK_HASH(_id) ((_id)&(TASK_HASH_SIZE-1)) 35.100 +#define TASK_HASH(_id) ((int)(_id)&(TASK_HASH_SIZE-1)) 35.101 extern struct task_struct *task_hash[TASK_HASH_SIZE]; 35.102 35.103 #define REMOVE_LINKS(p) do { \
36.1 --- a/xen/include/xeno/vif.h Tue Feb 10 14:38:31 2004 +0000 36.2 +++ b/xen/include/xeno/vif.h Wed Feb 11 17:43:44 2004 +0000 36.3 @@ -94,11 +94,11 @@ do { 36.4 } while (0) \ 36.5 36.6 /* vif prototypes */ 36.7 -net_vif_t *create_net_vif(int domain); 36.8 +net_vif_t *create_net_vif(domid_t dom); 36.9 void destroy_net_vif(net_vif_t *vif); 36.10 void unlink_net_vif(net_vif_t *vif); 36.11 net_vif_t *net_get_target_vif(u8 *data, unsigned int len, net_vif_t *src_vif); 36.12 -net_vif_t *find_vif_by_id(unsigned long id); 36.13 +net_vif_t *find_net_vif(domid_t dom, unsigned int idx); 36.14 36.15 /* 36.16 * Return values from net_get_target_vif:
37.1 --- a/xen/net/dev.c Tue Feb 10 14:38:31 2004 +0000 37.2 +++ b/xen/net/dev.c Wed Feb 11 17:43:44 2004 +0000 37.3 @@ -642,7 +642,7 @@ static void net_rx_action(struct softirq 37.4 skb->data, skb->len, skb->src_vif); 37.5 37.6 if ( !VIF_LOCAL(skb->dst_vif) ) 37.7 - skb->dst_vif = find_vif_by_id(0); 37.8 + skb->dst_vif = find_net_vif(0, 0); 37.9 37.10 if ( skb->dst_vif != NULL ) 37.11 {
38.1 --- a/xenolinux-2.4.24-sparse/arch/xeno/drivers/dom0/vfr.c Tue Feb 10 14:38:31 2004 +0000 38.2 +++ b/xenolinux-2.4.24-sparse/arch/xeno/drivers/dom0/vfr.c Wed Feb 11 17:43:44 2004 +0000 38.3 @@ -22,6 +22,7 @@ static unsigned char readbuf[1024]; 38.4 /* Helpers, implemented at the bottom. */ 38.5 u32 getipaddr(const char *buff, unsigned int len); 38.6 u16 antous(const char *buff, int len); 38.7 +u64 antoull(const char *buff, int len); 38.8 int anton(const char *buff, int len); 38.9 38.10 static int vfr_read_proc(char *page, char **start, off_t off, 38.11 @@ -141,11 +142,14 @@ static int vfr_write_proc(struct file *f 38.12 /* NB. Prefix matches must go first! */ 38.13 if (strncmp(&buffer[fs], "src", fl) == 0) 38.14 { 38.15 - op.u.net_rule.src_vif = VIF_ANY_INTERFACE; 38.16 + 38.17 + op.u.net_rule.src_dom = VIF_SPECIAL; 38.18 + op.u.net_rule.src_idx = VIF_ANY_INTERFACE; 38.19 } 38.20 else if (strncmp(&buffer[fs], "dst", fl) == 0) 38.21 { 38.22 - op.u.net_rule.dst_vif = VIF_PHYSICAL_INTERFACE; 38.23 + op.u.net_rule.dst_dom = VIF_SPECIAL; 38.24 + op.u.net_rule.dst_idx = VIF_PHYSICAL_INTERFACE; 38.25 } 38.26 else if (strncmp(&buffer[fs], "srcaddr", fl) == 0) 38.27 { 38.28 @@ -181,19 +185,19 @@ static int vfr_write_proc(struct file *f 38.29 } 38.30 else if (strncmp(&buffer[fs], "srcdom", fl) == 0) 38.31 { 38.32 - op.u.net_rule.src_vif |= anton(&buffer[ts], tl)<<VIF_DOMAIN_SHIFT; 38.33 + op.u.net_rule.src_dom = antoull(&buffer[ts], tl); 38.34 } 38.35 else if (strncmp(&buffer[fs], "srcidx", fl) == 0) 38.36 { 38.37 - op.u.net_rule.src_vif |= anton(&buffer[ts], tl); 38.38 + op.u.net_rule.src_idx = anton(&buffer[ts], tl); 38.39 } 38.40 else if (strncmp(&buffer[fs], "dstdom", fl) == 0) 38.41 { 38.42 - op.u.net_rule.dst_vif |= anton(&buffer[ts], tl)<<VIF_DOMAIN_SHIFT; 38.43 + op.u.net_rule.dst_dom = antoull(&buffer[ts], tl); 38.44 } 38.45 else if (strncmp(&buffer[fs], "dstidx", fl) == 0) 38.46 { 38.47 - op.u.net_rule.dst_vif |= anton(&buffer[ts], tl); 38.48 + op.u.net_rule.dst_idx = anton(&buffer[ts], tl); 38.49 } 38.50 else if ( (strncmp(&buffer[fs], "proto", fl) == 0)) 38.51 { 38.52 @@ -289,6 +293,23 @@ u16 antous(const char *buff, int len) 38.53 return ret; 38.54 } 38.55 38.56 +u64 antoull(const char *buff, int len) 38.57 +{ 38.58 + u64 ret; 38.59 + char c; 38.60 + 38.61 + ret = 0; 38.62 + 38.63 + while ( (len) && ((c = *buff) >= '0') && (c <= '9') ) 38.64 + { 38.65 + ret *= 10; 38.66 + ret += c - '0'; 38.67 + buff++; len--; 38.68 + } 38.69 + 38.70 + return ret; 38.71 +} 38.72 + 38.73 u32 getipaddr(const char *buff, unsigned int len) 38.74 { 38.75 char c;
39.1 --- a/xenolinux-2.4.24-sparse/arch/xeno/drivers/network/network.c Tue Feb 10 14:38:31 2004 +0000 39.2 +++ b/xenolinux-2.4.24-sparse/arch/xeno/drivers/network/network.c Wed Feb 11 17:43:44 2004 +0000 39.3 @@ -498,16 +498,20 @@ static int inetdev_notify(struct notifie 39.4 else 39.5 goto out; 39.6 39.7 - op.u.net_rule.src_vif = idx; 39.8 - op.u.net_rule.dst_vif = VIF_PHYSICAL_INTERFACE; 39.9 + op.u.net_rule.src_dom = 0; 39.10 + op.u.net_rule.src_idx = idx; 39.11 + op.u.net_rule.dst_dom = VIF_SPECIAL; 39.12 + op.u.net_rule.dst_idx = VIF_PHYSICAL_INTERFACE; 39.13 op.u.net_rule.src_addr = ntohl(ifa->ifa_address); 39.14 op.u.net_rule.src_addr_mask = ~0UL; 39.15 op.u.net_rule.dst_addr = 0; 39.16 op.u.net_rule.dst_addr_mask = 0; 39.17 (void)HYPERVISOR_network_op(&op); 39.18 39.19 - op.u.net_rule.src_vif = VIF_ANY_INTERFACE; 39.20 - op.u.net_rule.dst_vif = idx; 39.21 + op.u.net_rule.src_dom = VIF_SPECIAL; 39.22 + op.u.net_rule.src_idx = VIF_ANY_INTERFACE; 39.23 + op.u.net_rule.dst_dom = 0; 39.24 + op.u.net_rule.dst_idx = idx; 39.25 op.u.net_rule.src_addr = 0; 39.26 op.u.net_rule.src_addr_mask = 0; 39.27 op.u.net_rule.dst_addr = ntohl(ifa->ifa_address); 39.28 @@ -539,7 +543,7 @@ int __init init_module(void) 39.29 * addresses. All other domains have a privileged "parent" to do this for 39.30 * them at start of day. 39.31 */ 39.32 - if ( start_info.dom_id == 0 ) 39.33 + if ( start_info.flags & SIF_INITDOMAIN ) 39.34 (void)register_inetaddr_notifier(¬ifier_inetdev); 39.35 39.36 err = request_irq(NET_IRQ, network_interrupt, 39.37 @@ -619,7 +623,7 @@ static void cleanup_module(void) 39.38 kfree(dev); 39.39 } 39.40 39.41 - if ( start_info.dom_id == 0 ) 39.42 + if ( start_info.flags & SIF_INITDOMAIN ) 39.43 (void)unregister_inetaddr_notifier(¬ifier_inetdev); 39.44 } 39.45
40.1 --- a/xenolinux-2.4.24-sparse/arch/xeno/kernel/head.S Tue Feb 10 14:38:31 2004 +0000 40.2 +++ b/xenolinux-2.4.24-sparse/arch/xeno/kernel/head.S Wed Feb 11 17:43:44 2004 +0000 40.3 @@ -9,8 +9,8 @@ 40.4 #include <asm/desc.h> 40.5 40.6 /* Offsets in start_info structure */ 40.7 -#define MOD_START 20 40.8 -#define MOD_LEN 24 40.9 +#define MOD_START 16 40.10 +#define MOD_LEN 20 40.11 40.12 startup_32: 40.13 cld
41.1 --- a/xenolinux-2.4.24-sparse/arch/xeno/kernel/ioport.c Tue Feb 10 14:38:31 2004 +0000 41.2 +++ b/xenolinux-2.4.24-sparse/arch/xeno/kernel/ioport.c Wed Feb 11 17:43:44 2004 +0000 41.3 @@ -30,7 +30,7 @@ asmlinkage int sys_iopl(unsigned int new 41.4 41.5 /* Force the change at ring 0. */ 41.6 op.cmd = DOM0_IOPL; 41.7 - op.u.iopl.domain = start_info.dom_id; 41.8 + op.u.iopl.domain = DOMID_SELF; 41.9 op.u.iopl.iopl = new_io_pl; 41.10 HYPERVISOR_dom0_op(&op); 41.11
42.1 --- a/xenolinux-2.4.24-sparse/arch/xeno/kernel/process.c Tue Feb 10 14:38:31 2004 +0000 42.2 +++ b/xenolinux-2.4.24-sparse/arch/xeno/kernel/process.c Wed Feb 11 17:43:44 2004 +0000 42.3 @@ -394,7 +394,7 @@ void __switch_to(struct task_struct *pre 42.4 { 42.5 dom0_op_t op; 42.6 op.cmd = DOM0_IOPL; 42.7 - op.u.iopl.domain = start_info.dom_id; 42.8 + op.u.iopl.domain = DOMID_SELF; 42.9 op.u.iopl.iopl = next->io_pl; 42.10 queue_multicall1(__HYPERVISOR_dom0_op, (unsigned long)&op); 42.11 }
43.1 --- a/xenolinux-2.4.24-sparse/arch/xeno/kernel/setup.c Tue Feb 10 14:38:31 2004 +0000 43.2 +++ b/xenolinux-2.4.24-sparse/arch/xeno/kernel/setup.c Wed Feb 11 17:43:44 2004 +0000 43.3 @@ -318,14 +318,14 @@ void __init setup_arch(char **cmdline_p) 43.4 { 43.5 dom0_op_t op; 43.6 op.cmd = DOM0_IOPL; 43.7 - op.u.iopl.domain = start_info.dom_id; 43.8 + op.u.iopl.domain = DOMID_SELF; 43.9 op.u.iopl.iopl = 1; 43.10 if( HYPERVISOR_dom0_op(&op) != 0 ) 43.11 panic("Unable to obtain IOPL, despite being SIF_PRIVILEGED"); 43.12 current->thread.io_pl = 1; 43.13 } 43.14 43.15 - if(start_info.flags & SIF_CONSOLE) 43.16 + if ( start_info.flags & SIF_INITDOMAIN ) 43.17 { 43.18 if( !(start_info.flags & SIF_PRIVILEGED) ) 43.19 panic("Xen granted us console access but not privileged status");
44.1 --- a/xenolinux-2.4.24-sparse/arch/xeno/kernel/time.c Tue Feb 10 14:38:31 2004 +0000 44.2 +++ b/xenolinux-2.4.24-sparse/arch/xeno/kernel/time.c Wed Feb 11 17:43:44 2004 +0000 44.3 @@ -297,7 +297,7 @@ void do_settimeofday(struct timeval *tv) 44.4 { 44.5 struct timeval newtv; 44.6 44.7 - if ( !independent_wallclock && (start_info.dom_id != 0) ) 44.8 + if ( !independent_wallclock && !(start_info.flags & SIF_INITDOMAIN) ) 44.9 return; 44.10 44.11 write_lock_irq(&xtime_lock); 44.12 @@ -333,7 +333,7 @@ void do_settimeofday(struct timeval *tv) 44.13 last_update_from_xen = 0; 44.14 44.15 #ifdef CONFIG_XENO_PRIV 44.16 - if ( start_info.dom_id == 0 ) 44.17 + if ( start_info.flags & SIF_INITDOMAIN ) 44.18 { 44.19 dom0_op_t op; 44.20 last_update_to_rtc = last_update_to_xen = 0; 44.21 @@ -445,7 +445,8 @@ static inline void do_timer_interrupt(in 44.22 } 44.23 44.24 #ifdef CONFIG_XENO_PRIV 44.25 - if ( (start_info.dom_id == 0) && ((time_status & STA_UNSYNC) == 0) ) 44.26 + if ( (start_info.flags & SIF_INITDOMAIN) && 44.27 + ((time_status & STA_UNSYNC) == 0) ) 44.28 { 44.29 /* Send synchronised time to Xen approximately every minute. */ 44.30 if ( xtime.tv_sec > (last_update_to_xen + 60) )
45.1 --- a/xenolinux-2.4.24-sparse/include/asm-xeno/keyboard.h Tue Feb 10 14:38:31 2004 +0000 45.2 +++ b/xenolinux-2.4.24-sparse/include/asm-xeno/keyboard.h Wed Feb 11 17:43:44 2004 +0000 45.3 @@ -1,6 +1,9 @@ 45.4 /* xenolinux/include/asm-xeno/keyboard.h */ 45.5 /* Portions copyright (c) 2003 James Scott, Intel Research Cambridge */ 45.6 -/* Talks to hypervisor to get PS/2 keyboard and mouse events, and send keyboard and mouse commands */ 45.7 +/* 45.8 + * Talks to hypervisor to get PS/2 keyboard and mouse events, and send keyboard 45.9 + * and mouse commands 45.10 + */ 45.11 45.12 /* Based on: 45.13 * linux/include/asm-i386/keyboard.h 45.14 @@ -50,7 +53,7 @@ extern unsigned char pckbd_sysrq_xlate[1 45.15 45.16 static inline int xen_kbd_controller_present () 45.17 { 45.18 - return start_info.flags & SIF_CONSOLE; 45.19 + return start_info.flags & SIF_INITDOMAIN; 45.20 } 45.21 45.22 /* resource allocation */