ia64/xen-unstable

changeset 509:970fdf86f98e

bitkeeper revision 1.259.2.2 (3f06e641O43LXATNfuodJ2gD211aLg)

get_unmapped_area.c, dom0_core.c, Rules.mk, Makefile:
Some small cleanups, particularly to the dom0 /proc code. Pending some big changes there.
.del-vifinit~c5aa7eadc09606f3:
Delete: tools/domain_builder/vifinit
.del-newdom~ae685a05562d2af:
Delete: tools/domain_builder/newdom
.del-mynewdom~841547bf5108dbd4:
Delete: tools/domain_builder/mynewdom
.del-mem_defs.h~e1a458f2404d3c0c:
Delete: tools/domain_builder/mem_defs.h
.del-hypervisor_defs.h~8cb4ad0e3005c361:
Delete: tools/domain_builder/hypervisor_defs.h
.del-dom_kill.c~5e62eec71982bbcf:
Delete: tools/domain_builder/dom_kill.c
.del-dom_builder.c~36f2cc835770e7:
Delete: tools/domain_builder/dom_builder.c
.del-dom0_ops.h~a070a0ff28a546bd:
Delete: tools/domain_builder/dom0_ops.h
.del-dom0_defs.h~9b53986c1f64d2d:
Delete: tools/domain_builder/dom0_defs.h
.del-README~eb5dc409431f293e:
Delete: tools/domain_builder/README
.del-Makefile~a40ae6069befd9b6:
Delete: tools/domain_builder/Makefile
author kaf24@scramble.cl.cam.ac.uk
date Sat Jul 05 14:52:49 2003 +0000 (2003-07-05)
parents 43352a61d870
children 93c7dcf4a80e 5a8f903eccbd e5bf251a865f
files .rootkeys Makefile tools/domain_builder/Makefile tools/domain_builder/README tools/domain_builder/dom0_defs.h tools/domain_builder/dom0_ops.h tools/domain_builder/dom_builder.c tools/domain_builder/dom_kill.c tools/domain_builder/hypervisor_defs.h tools/domain_builder/mem_defs.h tools/domain_builder/mynewdom tools/domain_builder/newdom tools/domain_builder/vifinit xen/Rules.mk xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_core.c xenolinux-2.4.21-sparse/arch/xeno/mm/get_unmapped_area.c
line diff
     1.1 --- a/.rootkeys	Sat Jul 05 13:48:17 2003 +0000
     1.2 +++ b/.rootkeys	Sat Jul 05 14:52:49 2003 +0000
     1.3 @@ -87,17 +87,6 @@ 3ec41f7e6SAwV8ebs9Be7zV2LV92oQ tools/con
     1.4  3ec41f7ecn3uvsSrOVxKC8G8ACuulg tools/control/web/tmpl/xenofoot.def
     1.5  3ec41f7ek1RffqN2yRUzSTkD5m1J6w tools/control/web/tmpl/xenohead.def
     1.6  3ec41f7e1ZpfCsgQ2qRJBooBn_iRtA tools/control/web/tmpl/xenostyle.css
     1.7 -3e4d00468-FN2VDeEHo96zxrMHK_mA tools/domain_builder/Makefile
     1.8 -3e4d0046SPau_y0sw2WLJz8QkqNoRA tools/domain_builder/README
     1.9 -3e4d0046bbdH0GsI9J_1Eb4ZQHfIiQ tools/domain_builder/dom0_defs.h
    1.10 -3ee609abdxnu1GvbtXnPlMfEkTEIwQ tools/domain_builder/dom0_ops.h
    1.11 -3e4d0046ouLij_CMN_j7-dUHZIBI_A tools/domain_builder/dom_builder.c
    1.12 -3e4d0046EKs06fY0CWDEgZQcn7DYUg tools/domain_builder/dom_kill.c
    1.13 -3e4d0046aPbGiRTtdWxqY5b3ytWurA tools/domain_builder/hypervisor_defs.h
    1.14 -3e4d00468aE86IfyjfrJwYoxzM7pAw tools/domain_builder/mem_defs.h
    1.15 -3e71afadoAI0VvAGKebLpToVQxUKfQ tools/domain_builder/mynewdom
    1.16 -3e4d0046VHhXwFuG5FK34AVxqd5A_A tools/domain_builder/newdom
    1.17 -3e4d0046IBzDIeaMbQB-e2QB2ahbig tools/domain_builder/vifinit
    1.18  3eb781fdl4lXWYZzmqDDUAYhAThRqQ tools/internal/Makefile
    1.19  3eb781fdc539MQQm47rYRCCR3N5i-Q tools/internal/dom0_defs.h
    1.20  3ee609b3Yr4aggmLSKmhiIzT8-nURA tools/internal/dom0_ops.h
     2.1 --- a/Makefile	Sat Jul 05 13:48:17 2003 +0000
     2.2 +++ b/Makefile	Sat Jul 05 14:52:49 2003 +0000
     2.3 @@ -21,7 +21,6 @@ all:
     2.4  	$(MAKE) -C xen
     2.5  	$(MAKE) -C tools/balloon
     2.6  	$(MAKE) -C tools/control
     2.7 -	$(MAKE) -C tools/domain_builder
     2.8  	$(MAKE) -C tools/internal
     2.9  	$(MAKE) -C tools/vdmanager
    2.10  
    2.11 @@ -29,7 +28,6 @@ install: all
    2.12  	$(MAKE) -C xen install
    2.13  	$(MAKE) -C tools/balloon install
    2.14  	$(MAKE) -C tools/control install
    2.15 -	$(MAKE) -C tools/domain_builder install
    2.16  	$(MAKE) -C tools/internal install
    2.17  	$(MAKE) -C tools/vdmanager install
    2.18  
    2.19 @@ -38,7 +36,6 @@ clean:
    2.20  	$(MAKE) -C xen clean
    2.21  	$(MAKE) -C tools/balloon clean
    2.22  	$(MAKE) -C tools/control clean
    2.23 -	$(MAKE) -C tools/domain_builder clean
    2.24  	$(MAKE) -C tools/internal clean
    2.25  	$(MAKE) -C tools/vdmanager clean
    2.26  
     3.1 --- a/tools/domain_builder/Makefile	Sat Jul 05 13:48:17 2003 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,20 +0,0 @@
     3.4 -CC = gcc
     3.5 -BUILDER = domain_builder
     3.6 -KILL = kill_domain
     3.7 -
     3.8 -all: dom_builder.o dom_kill.o
     3.9 -	$(CC) -o $(BUILDER) dom_builder.o
    3.10 -	$(CC) -o $(KILL) dom_kill.o
    3.11 -
    3.12 -install: all
    3.13 -	cp domain_builder kill_domain ../../../install/bin
    3.14 -
    3.15 -dom_builder.o: dom_builder.c dom0_defs.h dom0_ops.h hypervisor_defs.h mem_defs.h
    3.16 -	$(CC) -c dom_builder.c 
    3.17 -
    3.18 -dom_kill.o: dom_kill.c dom0_ops.h dom0_defs.h
    3.19 -	$(CC) -c dom_kill.c 
    3.20 -
    3.21 -clean:
    3.22 -	$(RM) *.o domain_builder kill_domain
    3.23 -
     4.1 --- a/tools/domain_builder/README	Sat Jul 05 13:48:17 2003 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,29 +0,0 @@
     4.4 -A couple of simple steps to get you going:
     4.5 -
     4.6 -1. do make (suitable Makefile is in the source dir)
     4.7 -2. copy over andy's vifinit script to local dir
     4.8 -3. copy over xenolinux guestos image (NB. image needs to be uncompressed, so
     4.9 -if the only image you have is image.gz do gunzip image.gz before doing 
    4.10 -anything further)
    4.11 -4. add executable permissions to newdom and vifint
    4.12 -5. edit newdom script and change it as it suits you
    4.13 -
    4.14 -newdom script takes guestos image file name as first parameter and newdom id
    4.15 -as second parameter, eg.:
    4.16 -
    4.17 -./newdom xenolinux 1
    4.18 -
    4.19 -should initiate building of dom1 with the image contained in file named 
    4.20 -xenolinux in local dir.
    4.21 -
    4.22 -in general, domain_builder application takes three parameters: requested 
    4.23 -memory in kb, guestos image file name and number of vifs to be created, eg.
    4.24 -
    4.25 -./domain_builder 16000 xenolinux 1
    4.26 -
    4.27 -would build domX reserving 16MB mem, creating 1 vif and using os image stored
    4.28 -as xenolinux in local dir.
    4.29 -
    4.30 -happy booting!
    4.31 -
    4.32 -boris
     5.1 --- a/tools/domain_builder/dom0_defs.h	Sat Jul 05 13:48:17 2003 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,8 +0,0 @@
     5.4 -#define PROC_XENO_ROOT  "xeno"
     5.5 -#define PROC_CMD        "dom0_cmd"
     5.6 -#define PROC_DOM_PREFIX "dom"
     5.7 -#define PROC_DOM_MEM    "mem"
     5.8 -#define PROC_DOM_DATA   "new_dom_data"
     5.9 -
    5.10 -#define MAX_PATH        256
    5.11 -
     6.1 --- a/tools/domain_builder/dom0_ops.h	Sat Jul 05 13:48:17 2003 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,5 +0,0 @@
     6.4 -
     6.5 -#define NO_DOM0_OP_T
     6.6 -#include "../../xen/include/hypervisor-ifs/dom0_ops.h"
     6.7 -#undef  NO_DOM0_OP_T
     6.8 -#include "../../xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_ops.h"
     7.1 --- a/tools/domain_builder/dom_builder.c	Sat Jul 05 13:48:17 2003 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,559 +0,0 @@
     7.4 -/* 
     7.5 - * XenoDomainBuilder, copyright (c) Boris Dragovic, bd240@cl.cam.ac.uk
     7.6 - * This code is released under terms and conditions of GNU GPL :).
     7.7 - * Usage: <executable> <mem_kb> <os image> <num_vifs> 
     7.8 - */
     7.9 -
    7.10 -#include <unistd.h>
    7.11 -#include <stdio.h>
    7.12 -#include <errno.h>
    7.13 -#include <fcntl.h>
    7.14 -#include <sys/mman.h>
    7.15 -#include <sys/types.h>
    7.16 -#include <sys/stat.h>
    7.17 -#include <stdlib.h>
    7.18 -
    7.19 -#include "hypervisor_defs.h"
    7.20 -#include "dom0_ops.h"
    7.21 -#include "dom0_defs.h"
    7.22 -#include "mem_defs.h"
    7.23 -
    7.24 -#define PERR_STRING "Xeno Domain Builder"
    7.25 -
    7.26 -#define GUEST_SIG   "XenoGues"
    7.27 -#define SIG_LEN    8
    7.28 -
    7.29 -/*
    7.30 - * NB. No ring-3 access in initial guestOS pagetables. Note that we allow
    7.31 - * ring-3 privileges in the page directories, so that the guestOS may later
    7.32 - * decide to share a 4MB region with applications.
    7.33 - */
    7.34 -#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
    7.35 -#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
    7.36 -
    7.37 -/* standardized error reporting function */
    7.38 -static void dberr(char *msg)
    7.39 -{
    7.40 -    printf("%s: %s\n", PERR_STRING, msg);
    7.41 -}
    7.42 -
    7.43 -/* status reporting function */
    7.44 -static void dbstatus(char * msg)
    7.45 -{
    7.46 -    printf("Domain Builder: %s\n", msg);
    7.47 -}
    7.48 -
    7.49 -static int do_kill_domain(int dom_id, int force)
    7.50 -{
    7.51 -    char cmd_path[MAX_PATH];
    7.52 -    dom0_op_t dop;
    7.53 -    int cmd_fd;
    7.54 -
    7.55 -    dop.cmd = DOM0_DESTROYDOMAIN;
    7.56 -    dop.u.killdomain.domain = dom_id;
    7.57 -    dop.u.killdomain.force  = force;
    7.58 -
    7.59 -    /* open the /proc command interface */
    7.60 -    sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
    7.61 -    cmd_fd = open(cmd_path, O_WRONLY);
    7.62 -    if(cmd_fd < 0){
    7.63 -        perror(PERR_STRING);
    7.64 -        return -1;
    7.65 -    }
    7.66 -
    7.67 -    write(cmd_fd, &dop, sizeof(dom0_op_t));
    7.68 -    close(cmd_fd);
    7.69 -
    7.70 -    return 0;
    7.71 -}
    7.72 -
    7.73 -/* clean up domain's memory allocations */
    7.74 -static void dom_mem_cleanup(dom_mem_t * dom_mem)
    7.75 -{
    7.76 -    char mem_path[MAX_PATH];
    7.77 -    int mem_fd;
    7.78 -
    7.79 -    /* open the domain's /proc mem interface */
    7.80 -    sprintf(mem_path, "%s%s%s%s%d%s%s", "/proc/", PROC_XENO_ROOT, "/", 
    7.81 -        PROC_DOM_PREFIX, dom_mem->domain, "/", PROC_DOM_MEM);
    7.82 -
    7.83 -    mem_fd = open(mem_path, O_WRONLY);
    7.84 -    if(mem_fd < 0){
    7.85 -        perror(PERR_STRING);
    7.86 -    }
    7.87 -    
    7.88 -    if(write(mem_fd, (dom_mem_t *)dom_mem, sizeof(dom_mem_t)) < 0){
    7.89 -	dbstatus("Error unmapping domain's memory.\n");
    7.90 -    }
    7.91 -
    7.92 -    close(mem_fd);
    7.93 -}
    7.94 -
    7.95 -/* ask dom0 to export domains memory through /proc */
    7.96 -static int setup_dom_memmap(unsigned long pfn, int pages, int dom)
    7.97 -{
    7.98 -    char cmd_path[MAX_PATH];
    7.99 -    dom0_op_t dop;
   7.100 -    int cmd_fd;
   7.101 -
   7.102 -    dop.cmd = MAP_DOM_MEM;
   7.103 -    dop.u.dommem.start_pfn = pfn;
   7.104 -    dop.u.dommem.tot_pages = pages;
   7.105 -    dop.u.dommem.domain = dom;
   7.106 -
   7.107 -    /* open the /proc command interface */
   7.108 -    sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
   7.109 -    cmd_fd = open(cmd_path, O_WRONLY);
   7.110 -    if(cmd_fd < 0){
   7.111 -        perror(PERR_STRING);
   7.112 -        return -1;
   7.113 -    }
   7.114 -
   7.115 -    write(cmd_fd, &dop, sizeof(dom0_op_t));
   7.116 -    close(cmd_fd);
   7.117 -
   7.118 -    return 0;
   7.119 -}
   7.120 -      
   7.121 -/* request the actual mapping from dom0 */
   7.122 -static unsigned long get_vaddr(unsigned int dom)
   7.123 -{
   7.124 -    char mem_path[MAX_PATH];
   7.125 -	unsigned long addr;
   7.126 -    int mem_fd;
   7.127 -
   7.128 -    /* open the domain's /proc mem interface */
   7.129 -    sprintf(mem_path, "%s%s%s%s%d%s%s", "/proc/", PROC_XENO_ROOT, "/", 
   7.130 -                    PROC_DOM_PREFIX, dom, "/", PROC_DOM_MEM);
   7.131 -
   7.132 -    mem_fd = open(mem_path, O_RDONLY);
   7.133 -    if(mem_fd < 0){
   7.134 -        perror(PERR_STRING);
   7.135 -        return 0;
   7.136 -    }
   7.137 -
   7.138 -    /* get virtual address of mapped region */
   7.139 -	read(mem_fd, &addr, sizeof(addr));
   7.140 -	
   7.141 -    close(mem_fd);
   7.142 -
   7.143 -    return addr;
   7.144 -}
   7.145 -
   7.146 -static int map_dom_mem(unsigned long pfn, int pages, int dom, 
   7.147 -    dom_mem_t * dom_mem)
   7.148 -{
   7.149 -
   7.150 -    if(setup_dom_memmap(pfn, pages, dom)){
   7.151 -        perror(PERR_STRING);
   7.152 -        return -1;
   7.153 -    }
   7.154 -
   7.155 -    dom_mem->domain = dom;
   7.156 -    dom_mem->start_pfn = pfn;
   7.157 -    dom_mem->tot_pages = pages;
   7.158 -    if((dom_mem->vaddr = get_vaddr(dom)) == 0){
   7.159 -        dberr("Error mapping dom memory.");
   7.160 -        return -1;
   7.161 -    }
   7.162 -    
   7.163 -    return 0;
   7.164 -}
   7.165 -
   7.166 -/* create new domain */
   7.167 -static dom0_newdomain_t * create_new_domain(long req_mem)
   7.168 -{
   7.169 -    dom0_newdomain_t * dom_data;
   7.170 -    char cmd_path[MAX_PATH];
   7.171 -    char dom_id_path[MAX_PATH];
   7.172 -    dom0_op_t dop;
   7.173 -    int cmd_fd;
   7.174 -    int id_fd;
   7.175 -
   7.176 -    /* open the /proc command interface */
   7.177 -    sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
   7.178 -    cmd_fd = open(cmd_path, O_WRONLY);
   7.179 -    if(cmd_fd < 0){
   7.180 -        perror(PERR_STRING);
   7.181 -        return 0;
   7.182 -    }
   7.183 -
   7.184 -    dop.cmd = DOM0_CREATEDOMAIN;
   7.185 -    dop.u.newdomain.memory_kb = req_mem;
   7.186 -    dop.u.newdomain.name[0] = 0;
   7.187 -
   7.188 -    write(cmd_fd, &dop, sizeof(dom0_op_t));
   7.189 -    close(cmd_fd);
   7.190 -
   7.191 -    sprintf(dom_id_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", 
   7.192 -        PROC_DOM_DATA);
   7.193 -    while((id_fd = open(dom_id_path, O_RDONLY)) < 0) continue;
   7.194 -    dom_data = (dom0_newdomain_t *)malloc(sizeof(dom0_newdomain_t));
   7.195 -    read(id_fd, dom_data, sizeof(dom0_newdomain_t));
   7.196 -    close(id_fd);
   7.197 -    
   7.198 -    sprintf(cmd_path, "Reserved %ld kbytes memory and assigned id %d to the"
   7.199 -	    " new domain.", req_mem, dom_data->domain);
   7.200 -    dbstatus(cmd_path);
   7.201 -
   7.202 -    return dom_data;
   7.203 -}    
   7.204 -
   7.205 -/* open kernel image and do some sanity checks */
   7.206 -static int do_kernel_chcks(char *image, long dom_size, 
   7.207 -    unsigned long * load_addr, size_t * ksize)
   7.208 -{
   7.209 -    char signature[8];
   7.210 -    char status[MAX_PATH];
   7.211 -    struct stat stat;
   7.212 -    int fd;
   7.213 -    int ret; 
   7.214 -    
   7.215 -    fd = open(image, O_RDONLY);
   7.216 -    if(fd < 0){
   7.217 -        perror(PERR_STRING);
   7.218 -        ret = -1;    
   7.219 -        goto out;
   7.220 -    }
   7.221 -
   7.222 -    if(fstat(fd, &stat) < 0){
   7.223 -        perror(PERR_STRING);
   7.224 -        ret = -1;
   7.225 -		close(fd);
   7.226 -        goto out;
   7.227 -    }
   7.228 -
   7.229 -    if(stat.st_size > (dom_size << 10)){
   7.230 -        sprintf(status, "Kernel image size %ld larger than requested "
   7.231 -            "domain size %ld\n Terminated.\n", stat.st_size, dom_size);
   7.232 -        dberr(status);
   7.233 -        ret = -1;
   7.234 -		close(fd);
   7.235 -        goto out;
   7.236 -    }
   7.237 -    
   7.238 -    read(fd, signature, SIG_LEN);
   7.239 -    if(strncmp(signature, GUEST_SIG, SIG_LEN)){
   7.240 -        dberr("Kernel image does not contain required signature. "
   7.241 -		"Terminating.\n");
   7.242 -        ret = -1;
   7.243 -		close(fd);
   7.244 -        goto out;
   7.245 -    }
   7.246 -
   7.247 -    read(fd, load_addr, sizeof(unsigned long));
   7.248 -
   7.249 -    *ksize = stat.st_size - SIG_LEN - sizeof(unsigned long);
   7.250 -
   7.251 -    sprintf(status, "Kernel image %s valid, kernel virtual load address %lx", 
   7.252 -        image, *load_addr);
   7.253 -    dbstatus(status);
   7.254 -
   7.255 -    ret = fd;
   7.256 -
   7.257 -out:    
   7.258 -    return ret;
   7.259 -}
   7.260 -
   7.261 -/* this is the main guestos setup function,
   7.262 - * returnes domain descriptor structure to be used when launching
   7.263 - * the domain by hypervisor to do some last minute initialization.
   7.264 - * page table initialization is done by making a list of page table
   7.265 - * requests that are handeled by the hypervisor in the ordinary
   7.266 - * manner. this way, many potentially messy things are avoided...
   7.267 - */ 
   7.268 -#define PAGE_TO_VADDR(_pfn) ((void *)(dom_mem->vaddr + ((_pfn) * PAGE_SIZE)))
   7.269 -static dom_meminfo_t *setup_guestos(int dom, int kernel_fd, int initrd_fd,
   7.270 -    unsigned long virt_load_addr, size_t ksize, dom_mem_t *dom_mem)
   7.271 -{
   7.272 -    dom_meminfo_t *meminfo;
   7.273 -    unsigned long *page_array;
   7.274 -    page_update_request_t *pgt_updates;
   7.275 -    dom_mem_t mem_map;
   7.276 -    dom_meminfo_t *ret = NULL;
   7.277 -    int alloc_index, num_pt_pages;
   7.278 -    unsigned long l2tab;
   7.279 -    unsigned long l1tab = 0;
   7.280 -    unsigned long num_pgt_updates = 0;
   7.281 -    unsigned long count, pt_start;
   7.282 -    dom0_op_t pgupdate_req;
   7.283 -    char cmd_path[MAX_PATH];
   7.284 -    int cmd_fd;
   7.285 -
   7.286 -    meminfo     = (dom_meminfo_t *)malloc(sizeof(dom_meminfo_t));
   7.287 -    page_array  = malloc(dom_mem->tot_pages * 4);
   7.288 -    pgt_updates = (page_update_request_t *)dom_mem->vaddr;
   7.289 -    alloc_index = dom_mem->tot_pages - 1;
   7.290 -
   7.291 -    memset(meminfo, 0, sizeof(meminfo));
   7.292 -
   7.293 -    memcpy(page_array, (void *)dom_mem->vaddr, dom_mem->tot_pages * 4);
   7.294 -
   7.295 -    /* Count bottom-level PTs, rounding up. Include one PTE for shared info. */
   7.296 -    num_pt_pages = 
   7.297 -        (l1_table_offset(virt_load_addr) + dom_mem->tot_pages + 1024) / 1024;
   7.298 -
   7.299 -    /* We must also count the page directory. */
   7.300 -    num_pt_pages++;
   7.301 -
   7.302 -    /* Index of first PT page. */
   7.303 -    pt_start = dom_mem->tot_pages - num_pt_pages;
   7.304 -
   7.305 -    /* first allocate page for page dir. allocation goes backwards from the
   7.306 -     * end of the allocated physical address space.
   7.307 -     */
   7.308 -    l2tab = *(page_array + alloc_index) << PAGE_SHIFT; 
   7.309 -    memset(PAGE_TO_VADDR(alloc_index), 0, PAGE_SIZE);
   7.310 -    alloc_index--;
   7.311 -    meminfo->l2_pgt_addr = l2tab;
   7.312 -    meminfo->virt_shinfo_addr = virt_load_addr + nr_2_page(dom_mem->tot_pages);
   7.313 -
   7.314 -    /* pin down l2tab addr as page dir page - causes hypervisor to provide
   7.315 -     * correct protection for the page
   7.316 -     */ 
   7.317 -    pgt_updates->ptr = l2tab | PGREQ_EXTENDED_COMMAND;
   7.318 -    pgt_updates->val = PGEXT_PIN_L2_TABLE;
   7.319 -    pgt_updates++;
   7.320 -    num_pgt_updates++;
   7.321 -
   7.322 -    /*
   7.323 -     * Initialise the page tables. The final iteration is for the shared_info
   7.324 -     * PTE -- we break out before filling in the entry, as that is done by
   7.325 -     * Xen during final setup.
   7.326 -     */
   7.327 -    l2tab += l2_table_offset(virt_load_addr) * sizeof(l2_pgentry_t);
   7.328 -    for ( count = 0; count < (dom_mem->tot_pages + 1); count++ )
   7.329 -    {    
   7.330 -        if ( !((unsigned long)l1tab & (PAGE_SIZE-1)) ) 
   7.331 -        {
   7.332 -            l1tab = *(page_array + alloc_index) << PAGE_SHIFT;
   7.333 -            memset(PAGE_TO_VADDR(alloc_index), 0, PAGE_SIZE);
   7.334 -            alloc_index--;
   7.335 -			
   7.336 -            l1tab += l1_table_offset(virt_load_addr + nr_2_page(count)) 
   7.337 -                * sizeof(l1_pgentry_t);
   7.338 -
   7.339 -            /* make apropriate entry in the page directory */
   7.340 -            pgt_updates->ptr = l2tab;
   7.341 -            pgt_updates->val = l1tab | L2_PROT;
   7.342 -            pgt_updates++;
   7.343 -            num_pgt_updates++;
   7.344 -            l2tab += sizeof(l2_pgentry_t);
   7.345 -        }
   7.346 -
   7.347 -        /* The last PTE we consider is filled in later by Xen. */
   7.348 -        if ( count == dom_mem->tot_pages ) break;
   7.349 -		
   7.350 -        if ( count < pt_start )
   7.351 -        {
   7.352 -            pgt_updates->ptr = l1tab;
   7.353 -            pgt_updates->val = (*(page_array + count) << PAGE_SHIFT) | L1_PROT;
   7.354 -            pgt_updates++;
   7.355 -            num_pgt_updates++;
   7.356 -            l1tab += sizeof(l1_pgentry_t);
   7.357 -        }
   7.358 -        else
   7.359 -        {
   7.360 -            pgt_updates->ptr = l1tab;
   7.361 -            pgt_updates->val = 
   7.362 -		((*(page_array + count) << PAGE_SHIFT) | L1_PROT) & ~_PAGE_RW;
   7.363 -            pgt_updates++;
   7.364 -            num_pgt_updates++;
   7.365 -            l1tab += sizeof(l1_pgentry_t);
   7.366 -        }
   7.367 -
   7.368 -        pgt_updates->ptr = 
   7.369 -	    (*(page_array + count) << PAGE_SHIFT) | PGREQ_MPT_UPDATE;
   7.370 -        pgt_updates->val = count;
   7.371 -        pgt_updates++;
   7.372 -        num_pgt_updates++;
   7.373 -    }
   7.374 -
   7.375 -    meminfo->virt_startinfo_addr = virt_load_addr + nr_2_page(alloc_index - 1);
   7.376 -    meminfo->domain = dom;
   7.377 -
   7.378 -    /*
   7.379 -     * Send the page update requests down to the hypervisor.
   7.380 -     * NB. We must do this before loading the guest OS image!
   7.381 -     */
   7.382 -    sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
   7.383 -    if ( (cmd_fd = open(cmd_path, O_WRONLY)) < 0 ) goto out;
   7.384 -    pgupdate_req.cmd = DO_PGUPDATES;
   7.385 -    pgupdate_req.u.pgupdate.pgt_update_arr  = (unsigned long)dom_mem->vaddr;
   7.386 -    pgupdate_req.u.pgupdate.num_pgt_updates = num_pgt_updates;
   7.387 -    write(cmd_fd, &pgupdate_req, sizeof(dom0_op_t));
   7.388 -    close(cmd_fd);
   7.389 -
   7.390 -    /* Load the guest OS image. */
   7.391 -    if( read(kernel_fd, (char *)dom_mem->vaddr, ksize) != ksize )
   7.392 -    {
   7.393 -        dberr("Error reading kernel image, could not"
   7.394 -              " read the whole image. Terminating.\n");
   7.395 -        goto out;
   7.396 -    }
   7.397 -
   7.398 -    if( initrd_fd )
   7.399 -      {
   7.400 -	struct stat stat;
   7.401 -	unsigned long isize;
   7.402 -
   7.403 -	if(fstat(initrd_fd, &stat) < 0){
   7.404 -	  perror(PERR_STRING);
   7.405 -	  close(initrd_fd);
   7.406 -	  goto out;
   7.407 -	}
   7.408 -	isize = stat.st_size;
   7.409 -
   7.410 -	if( read(initrd_fd, ((char *)dom_mem->vaddr)+ksize, isize) != isize )
   7.411 -	  {
   7.412 -	    dberr("Error reading initrd image, could not"
   7.413 -		  " read the whole image. Terminating.\n");
   7.414 -	    goto out;
   7.415 -	  }
   7.416 -
   7.417 -	meminfo->virt_mod_addr = virt_load_addr + ksize;
   7.418 -	meminfo->virt_mod_len  = isize;
   7.419 -
   7.420 -      }
   7.421 -
   7.422 -
   7.423 -    ret = meminfo;
   7.424 -out:
   7.425 -
   7.426 -    return ret;
   7.427 -}
   7.428 -
   7.429 -static int launch_domain(dom_meminfo_t  * meminfo)
   7.430 -{
   7.431 -    char cmd_path[MAX_PATH];
   7.432 -    dom0_op_t dop;
   7.433 -    int cmd_fd;
   7.434 -
   7.435 -    sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
   7.436 -    cmd_fd = open(cmd_path, O_WRONLY);
   7.437 -    if(cmd_fd < 0){
   7.438 -        perror(PERR_STRING);
   7.439 -        return -1;
   7.440 -    }
   7.441 -
   7.442 -    dop.cmd = DOM0_BUILDDOMAIN;
   7.443 -    memcpy(&dop.u.meminfo, meminfo, sizeof(dom_meminfo_t));
   7.444 -    write(cmd_fd, &dop, sizeof(dom0_op_t));
   7.445 -
   7.446 -    dop.cmd = DOM0_STARTDOMAIN;
   7.447 -    memcpy(&dop.u.meminfo, meminfo, sizeof(dom_meminfo_t));
   7.448 -    write(cmd_fd, &dop, sizeof(dom0_op_t));
   7.449 -
   7.450 -    dbstatus("Launched the new domain!");
   7.451 -
   7.452 -    close(cmd_fd);
   7.453 -    return 0;
   7.454 -}
   7.455 -
   7.456 -int main(int argc, char **argv)
   7.457 -{
   7.458 -
   7.459 -    dom0_newdomain_t * dom_data;
   7.460 -    dom_mem_t dom_os_image;
   7.461 -    dom_mem_t dom_pgt; 
   7.462 -    dom_meminfo_t * meminfo;
   7.463 -    size_t ksize;
   7.464 -    unsigned long load_addr;
   7.465 -    char status[1024];
   7.466 -    int kernel_fd, initrd_fd = 0;
   7.467 -    int count;
   7.468 -    int cmd_len;
   7.469 -    int rc = -1;
   7.470 -    int args_start = 4;
   7.471 -    char initrd_name[1024];
   7.472 -
   7.473 -    unsigned long addr;
   7.474 -
   7.475 -    /**** this argument parsing code is really _gross_. rewrite me! ****/
   7.476 -
   7.477 -    if(argc < 4) {
   7.478 -        dberr("Usage: dom_builder <kbytes_mem> <image> <num_vifs> "
   7.479 -	      "[<initrd=initrd_name>] <boot_params>\n");
   7.480 -        return -1;
   7.481 -    }
   7.482 -
   7.483 -    /* create new domain and set up all the neccessary mappings */
   7.484 -
   7.485 -    kernel_fd = do_kernel_chcks(argv[2], atol(argv[1]), &load_addr, &ksize);
   7.486 -    if(kernel_fd < 0)
   7.487 -	return -1;
   7.488 -    
   7.489 -    /* request the creation of new domain */
   7.490 -    if(!(dom_data = create_new_domain(atol(argv[1])))) 
   7.491 -        return -1;
   7.492 -
   7.493 -    /* map domain's memory */
   7.494 -    if(map_dom_mem(dom_data->pg_head, dom_data->memory_kb >> (PAGE_SHIFT-10), 
   7.495 -		   dom_data->domain, &dom_os_image))
   7.496 -        goto out;
   7.497 -
   7.498 -    if( strncmp("initrd=", argv[args_start], 7) == 0 )
   7.499 -      {
   7.500 -	strncpy( initrd_name, argv[args_start]+7, sizeof(initrd_name) );
   7.501 -	initrd_name[sizeof(initrd_name)-1] = 0;
   7.502 -	printf("initrd present, name = %s\n", initrd_name );
   7.503 -	args_start++;
   7.504 -
   7.505 -	initrd_fd = open(initrd_name, O_RDONLY);
   7.506 -	if(initrd_fd < 0){
   7.507 -	  perror(PERR_STRING);
   7.508 -	  goto out;
   7.509 -	}
   7.510 -      }
   7.511 -
   7.512 -    /* the following code does the actual domain building */
   7.513 -    meminfo = setup_guestos(dom_data->domain, kernel_fd, initrd_fd, load_addr, 
   7.514 -			    ksize, &dom_os_image); 
   7.515 -    
   7.516 -    /* and unmap the new domain's memory image since we no longer need it */
   7.517 -    dom_mem_cleanup(&dom_os_image);
   7.518 -
   7.519 -    if(!meminfo) { 
   7.520 -	printf("Domain Builder: debug: meminfo NULL\n");
   7.521 -        goto out;
   7.522 -    }
   7.523 -
   7.524 -    meminfo->virt_load_addr = load_addr;
   7.525 -    meminfo->num_vifs = atoi(argv[3]);
   7.526 -    meminfo->cmd_line[0] = '\0';
   7.527 -    cmd_len = 0;
   7.528 -    for(count = args_start; count < argc; count++){
   7.529 -        if(cmd_len + strlen(argv[count]) > MAX_CMD_LEN - 1){
   7.530 -            dberr("Size of image boot params too big!\n");
   7.531 -            break;
   7.532 -        }
   7.533 -        strcat(meminfo->cmd_line, argv[count]);
   7.534 -        strcat(meminfo->cmd_line, " ");
   7.535 -        cmd_len += strlen(argv[count] + 1);
   7.536 -    }
   7.537 -
   7.538 -    sprintf(status, 
   7.539 -	    "About to launch new domain %d with folowing parameters:\n"
   7.540 -	    " * page table base: %lx \n * load address: %lx \n"
   7.541 -	    " * shared info address: %lx \n * start info address: %lx \n"
   7.542 -	    " * number of vifs: %d \n * cmd line: %s \n", meminfo->domain, 
   7.543 -	    meminfo->l2_pgt_addr, meminfo->virt_load_addr, 
   7.544 -	    meminfo->virt_shinfo_addr, meminfo->virt_startinfo_addr, 
   7.545 -	    meminfo->num_vifs, meminfo->cmd_line);
   7.546 -    dbstatus(status);
   7.547 -    
   7.548 -    /* and launch the domain */
   7.549 -    rc = launch_domain(meminfo); 
   7.550 -    
   7.551 -out:
   7.552 -    if( rc >= 0 )
   7.553 -    {
   7.554 -        return meminfo->domain;
   7.555 -    }
   7.556 -    else 
   7.557 -    {
   7.558 -        if ( dom_data->domain != 0 )
   7.559 -            do_kill_domain(dom_data->domain, 1);
   7.560 -        return rc;
   7.561 -    }
   7.562 -}
     8.1 --- a/tools/domain_builder/dom_kill.c	Sat Jul 05 13:48:17 2003 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,61 +0,0 @@
     8.4 -/* 
     8.5 - * A very(!) simple program to kill a domain. (c) Boris Dragovic
     8.6 - * Usage: <executable> <mem_kb> <os image> <num_vifs> 
     8.7 - */
     8.8 -
     8.9 -#include <unistd.h>
    8.10 -#include <stdio.h>
    8.11 -#include <errno.h>
    8.12 -#include <fcntl.h>
    8.13 -#include <sys/stat.h>
    8.14 -#include <sys/types.h>
    8.15 -
    8.16 -#include "dom0_ops.h"
    8.17 -#include "dom0_defs.h"
    8.18 -
    8.19 -#define PERR_STRING "Xen Domain Killer"
    8.20 -
    8.21 -static int do_kill_domain(int dom_id, int force)
    8.22 -{
    8.23 -    char cmd_path[MAX_PATH];
    8.24 -    dom0_op_t dop;
    8.25 -    int cmd_fd;
    8.26 -
    8.27 -    dop.cmd = DOM0_DESTROYDOMAIN;
    8.28 -    dop.u.killdomain.domain = dom_id;
    8.29 -    dop.u.killdomain.force  = force;
    8.30 -
    8.31 -    /* open the /proc command interface */
    8.32 -    sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
    8.33 -    cmd_fd = open(cmd_path, O_WRONLY);
    8.34 -    if(cmd_fd < 0){
    8.35 -        perror(PERR_STRING);
    8.36 -        return -1;
    8.37 -    }
    8.38 -
    8.39 -    write(cmd_fd, &dop, sizeof(dom0_op_t));
    8.40 -    close(cmd_fd);
    8.41 -
    8.42 -    return 0;
    8.43 -}
    8.44 -
    8.45 -int main(int argc, char **argv)
    8.46 -{
    8.47 -    int ret;
    8.48 -
    8.49 -    if ( (argc < 2) || (argc > 3) )
    8.50 -    {
    8.51 -    usage:
    8.52 -        printf("Usage: kill_domain [-f] <domain_id>\n");
    8.53 -        printf("  -f: Forces immediate destruction of specified domain\n");
    8.54 -        ret = -1;
    8.55 -        goto out;
    8.56 -    }
    8.57 -
    8.58 -    if ( (argc == 3) && strcmp("-f", argv[1]) ) goto usage;
    8.59 -
    8.60 -    ret = do_kill_domain(atoi(argv[argc-1]), argc == 3);
    8.61 -
    8.62 -out:
    8.63 -    return ret;
    8.64 -}
     9.1 --- a/tools/domain_builder/hypervisor_defs.h	Sat Jul 05 13:48:17 2003 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,36 +0,0 @@
     9.4 -/******************************************************************************
     9.5 - * hypervisor_defs.h
     9.6 - * 
     9.7 - * This needs to be kept in sync with Xen's pagetable update interface!
     9.8 - * 
     9.9 - * Copyright (c) 2002-2003, Keir Fraser & Boris Dragovic 
    9.10 - */
    9.11 -
    9.12 -/* taken from include/hypervisor-ifs/hypervisor-if.h */
    9.13 -typedef struct
    9.14 -{
    9.15 -/*
    9.16 - * PGREQ_XXX: specified in least-significant bits of 'ptr' field. All requests 
    9.17 - * specify relevent PTE or PT address in 'ptr'. Normal requests specify update 
    9.18 - * value in 'value'. Extended requests specify command in least 8 bits of 
    9.19 - * 'value'.
    9.20 - */
    9.21 -    unsigned long ptr, val; /* *ptr = val */
    9.22 -} page_update_request_t;
    9.23 -
    9.24 -/* A normal page-table update request. */
    9.25 -#define PGREQ_NORMAL           0
    9.26 -#define PGREQ_MPT_UPDATE 1
    9.27 -/* An extended command. */
    9.28 -#define PGREQ_EXTENDED_COMMAND 2
    9.29 -/* Announce a new top-level page table. */
    9.30 -#define PGEXT_PIN_L1_TABLE      0
    9.31 -#define PGEXT_PIN_L2_TABLE      1
    9.32 -#define PGEXT_PIN_L3_TABLE      2
    9.33 -#define PGEXT_PIN_L4_TABLE      3
    9.34 -#define PGEXT_UNPIN_TABLE       4
    9.35 -#define PGEXT_NEW_BASEPTR       5
    9.36 -#define PGEXT_TLB_FLUSH         6
    9.37 -#define PGEXT_INVLPG            7
    9.38 -#define PGEXT_CMD_MASK        255
    9.39 -#define PGEXT_CMD_SHIFT         8
    10.1 --- a/tools/domain_builder/mem_defs.h	Sat Jul 05 13:48:17 2003 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,45 +0,0 @@
    10.4 -/*
    10.5 - * memory related definitions needed for userspace domain builder dom0 application. these _need_ to
    10.6 - * be kept in sync with the kernel .h files they were copied over from or something horrible will
    10.7 - * happen. remmember: god kills a kitten every time you forget to keep these in sync.
    10.8 - * 
    10.9 - * KAF: Boris, these constants are all fixed by x86 hardware. So the kittens are safe for now :-)
   10.10 - * 
   10.11 - * Copyright 2002 by B Dragovic
   10.12 - */
   10.13 -
   10.14 -/* copied over from hypervisor: include/asm-i386/page.h */
   10.15 -
   10.16 -#define _PAGE_PRESENT   0x001
   10.17 -#define _PAGE_RW    0x002
   10.18 -#define _PAGE_USER  0x004
   10.19 -#define _PAGE_PWT   0x008
   10.20 -#define _PAGE_PCD   0x010
   10.21 -#define _PAGE_ACCESSED  0x020
   10.22 -#define _PAGE_DIRTY 0x040
   10.23 -#define _PAGE_PAT       0x080
   10.24 -#define _PAGE_PSE   0x080
   10.25 -#define _PAGE_GLOBAL    0x100
   10.26 -
   10.27 -
   10.28 -#define L1_PAGETABLE_SHIFT       12
   10.29 -#define L2_PAGETABLE_SHIFT       22
   10.30 - 
   10.31 -#define ENTRIES_PER_L1_PAGETABLE 1024
   10.32 -#define ENTRIES_PER_L2_PAGETABLE 1024
   10.33 - 
   10.34 -#define PAGE_SHIFT              L1_PAGETABLE_SHIFT
   10.35 -#define PAGE_SIZE               (1UL << PAGE_SHIFT)
   10.36 -#define PAGE_MASK               (~(PAGE_SIZE-1))
   10.37 -
   10.38 -typedef struct { unsigned long l1_lo; } l1_pgentry_t;
   10.39 -typedef struct { unsigned long l2_lo; } l2_pgentry_t;
   10.40 -
   10.41 -#define l1_table_offset(_a) \
   10.42 -          (((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1))
   10.43 -#define l2_table_offset(_a) \
   10.44 -          ((_a) >> L2_PAGETABLE_SHIFT)
   10.45 -
   10.46 -/* local definitions */
   10.47 -
   10.48 -#define nr_2_page(x) (x << PAGE_SHIFT)
    11.1 --- a/tools/domain_builder/mynewdom	Sat Jul 05 13:48:17 2003 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,65 +0,0 @@
    11.4 -#!/bin/sh
    11.5 -
    11.6 -# mynewdom <size> <extra args>
    11.7 -
    11.8 -SIZE=${1:?"size missing"}
    11.9 -
   11.10 -SITE_NFS=128.232.32.20
   11.11 -SITE_GW=128.232.32.1
   11.12 -SITE_MASK=255.255.240.0
   11.13 -
   11.14 -shift;
   11.15 -
   11.16 -ARGS="$*"
   11.17 -
   11.18 -IMAGE=../../../xenolinux-2.4.21/arch/xeno/boot/image
   11.19 -
   11.20 -
   11.21 -LASTDOM=`/bin/ls /proc/xeno/ | grep -v cmd | cut -c4- | sort -rn | head -1`
   11.22 -DOM=$[LASTDOM+1]
   11.23 -
   11.24 -echo Domain ${DOM} looks free
   11.25 -
   11.26 -ADDR=`/sbin/ifconfig eth0 | grep inet.addr | sed -e 's/.*inet addr:\([0-9.]*\) .*/\1/'`
   11.27 -LO=`echo $ADDR | sed -e 's/[0-9]\+\.[0-9]\+\.[0-9]\+\.\([0-9]\+\)/\1/'`
   11.28 -HI=`echo $ADDR | sed -e 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/'`
   11.29 -NEWADDR=$HI.$[LO+DOM]
   11.30 -
   11.31 -NEWNAME=$NEWADDR
   11.32 -LOOKUP=`host $NEWADDR`
   11.33 -echo $LOOKUP | grep 'domain name pointer' && NEWNAME=`echo $LOOKUP | sed -e 's!.*domain name pointer \([^ ]\+\).$!\1!'`
   11.34 -echo New IP address : ${NEWADDR}  name : ${NEWNAME}
   11.35 -
   11.36 -#SITE_GW=`netstat -rn|while read a b c;do case "$a" in 0.0.0.0)echo "$b";;esac;done`
   11.37 -NEWNAME=''
   11.38 -#${NEWADDR}
   11.39 -IP_CONFIG="ip=${NEWADDR}:${SITE_NFS}:${SITE_GW}:${SITE_MASK}:${NEWNAME}:eth0:off"
   11.40 -echo IP_CONFIG : ${IP_CONFIG}
   11.41 -
   11.42 -CMDLINE=`cat /proc/cmdline`
   11.43 -case $CMDLINE in
   11.44 -*root=/dev/nfs*)
   11.45 -ROOT_DIR=`echo $CMDLINE | sed -e 's,.*nfsroot=\([^ ]*\).*,\1,'`
   11.46 -ROOT_PATH=`echo $ROOT_DIR | sed -e 's!^\(.*\)[0-9]\+$!\1!'`
   11.47 -ROOT_NUM=`echo $ROOT_DIR | sed -e 's!^.*\([0-9]\+\)$!\1!'`
   11.48 -NEWROOT_DEV="root=/dev/nfs nfsroot=${ROOT_PATH}$[ROOT_NUM+DOM]"
   11.49 -;;
   11.50 -*root=/dev/[hs]d[abcd][0-9]*|*root=/dev/x[hs]d[abcd][0-9]*)
   11.51 -ROOT_DEV=`echo $CMDLINE | sed -e 's!^.*root=\(/dev/[x]*[hs]da[0-9]\+\).*$!\1!'`
   11.52 -ROOT_DISK=`echo $ROOT_DEV | sed -e 's!\(/dev/[x]\?[hs]d[a-z]\)[0-9]\+!\1!'`
   11.53 -ROOT_PART=`echo $ROOT_DEV | sed -e 's!/dev/[x]\?[hs]d[a-z]\([0-9]\+\)!\1!'`
   11.54 -NEWROOT_DEV="root=${ROOT_DISK}$[ROOT_PART+DOM] ro"
   11.55 -;;
   11.56 -*)
   11.57 -echo Could not determine root from /proc/cmdline
   11.58 -exit
   11.59 -;;
   11.60 -esac
   11.61 -
   11.62 -echo New root arguments : ${NEWROOT_DEV}
   11.63 -
   11.64 -echo ./newdom ${SIZE} ${IMAGE} ${NEWADDR} ${IP_CONFIG} ${NEWROOT_DEV} ${EXTRA_ARGS}
   11.65 -
   11.66 -./newdom ${SIZE} ${IMAGE} ${NEWADDR} ${IP_CONFIG} ${NEWROOT_DEV} ${EXTRA_ARGS}
   11.67 -
   11.68 -
    12.1 --- a/tools/domain_builder/newdom	Sat Jul 05 13:48:17 2003 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,26 +0,0 @@
    12.4 -#!/bin/sh
    12.5 -
    12.6 -# newdom <size> <image> <ip> <root details>  
    12.7 -# newdom 262144 ../../../xenolinux-2.4.16-kdb/arch/xeno/boot/image 128.232.35.240 root=/dev/nfs nfsroot=/usr/groups/srgboot/xxx/roots/root0
    12.8 -# newdom 262144 ../../../xenolinux-2.4.16-kdb/arch/xeno/boot/image 128.232.35.240 root=/dev/xhda7 
    12.9 -
   12.10 -
   12.11 -VIFINIT=./vifinit
   12.12 -DOM_BUILDER=./domain_builder
   12.13 -
   12.14 -SIZE=${1:?"size missing"}
   12.15 -IMAGE=${2:?"image missing"}
   12.16 -IP=${3:?"IP missing"}
   12.17 -
   12.18 -shift; shift; shift
   12.19 -
   12.20 -echo ARGS $*
   12.21 -
   12.22 -$DOM_BUILDER $SIZE $IMAGE 1 $*
   12.23 -DOM=$?
   12.24 -
   12.25 -echo DOM= $DOM
   12.26 -
   12.27 -$VIFINIT $DOM 0 $IP
   12.28 -
   12.29 -
    13.1 --- a/tools/domain_builder/vifinit	Sat Jul 05 13:48:17 2003 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,25 +0,0 @@
    13.4 -#!/bin/bash
    13.5 -#
    13.6 -# vifinit 
    13.7 -#
    13.8 -# This is a silly little script to dump a couple of simple rules down to 
    13.9 -# the hypervisor to assign a full static IP to a given virtual interface.
   13.10 -# 
   13.11 -# Usage is:
   13.12 -#
   13.13 -#   vifinit [vif dom] [vif idx] [dotted decimal ip address]
   13.14 -#
   13.15 -if [ $# -ne 3 ] ; 
   13.16 -then
   13.17 -        echo "usage: vifinit [vif dom] [vif idx] [dotted decimal ip address]"
   13.18 -        exit
   13.19 -fi
   13.20 -
   13.21 -#outbound rule:
   13.22 -echo "ADD ACCEPT srcaddr=$3 srcaddrmask=255.255.255.255 srcdom=$1 srcidx=$2 dst=PHYS proto=any" > /proc/vfr
   13.23 -
   13.24 -#inbound rule:
   13.25 -echo "ADD ACCEPT dstaddr=$3 dstaddrmask=255.255.255.255 src=ANY dstdom=$1 dstidx=$2 proto=any" > /proc/vfr
   13.26 -
   13.27 -#----] done.
   13.28 -
    14.1 --- a/xen/Rules.mk	Sat Jul 05 13:48:17 2003 +0000
    14.2 +++ b/xen/Rules.mk	Sat Jul 05 14:52:49 2003 +0000
    14.3 @@ -32,7 +32,7 @@ HOSTCFLAGS = -Wall -Wstrict-prototypes -
    14.4  include $(BASEDIR)/arch/$(ARCH)/Rules.mk
    14.5  
    14.6  %.o: %.c $(HDRS) Makefile
    14.7 -	$(CC) -g $(CFLAGS) -c $< -o $@
    14.8 +	$(CC) $(CFLAGS) -c $< -o $@
    14.9  
   14.10  %.o: %.S $(HDRS) Makefile
   14.11  	$(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
    15.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_core.c	Sat Jul 05 13:48:17 2003 +0000
    15.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_core.c	Sat Jul 05 14:52:49 2003 +0000
    15.3 @@ -32,9 +32,6 @@
    15.4  
    15.5  #include "dom0_ops.h"
    15.6  
    15.7 -#define TRUE  1
    15.8 -#define FALSE 0
    15.9 -
   15.10  /* Private proc-file data structures. */
   15.11  typedef struct proc_data {
   15.12      unsigned int domain;
   15.13 @@ -46,17 +43,6 @@ typedef struct proc_mem_data {
   15.14      int tot_pages;
   15.15  } proc_memdata_t;
   15.16  
   15.17 -#define XENO_BASE       "xeno"
   15.18 -#define DOM0_CMD_INTF   "dom0_cmd"
   15.19 -#define DOM0_NEWDOM     "new_dom_data"
   15.20 -#define DOM_LIST_INTF   "domains"
   15.21 -
   15.22 -#define MAX_LEN         16
   15.23 -#define DOM_DIR         "dom"
   15.24 -#define DOM_MEM         "mem"
   15.25 -#define DOM_VIF         "vif"
   15.26 -#define DOM_USAGE       "usage"
   15.27 -
   15.28  #define MAP_DISCONT     1
   15.29  
   15.30  struct proc_dir_entry *xeno_base;
   15.31 @@ -71,7 +57,7 @@ int direct_disc_unmap(unsigned long, uns
   15.32  static unsigned char readbuf[1204];
   15.33  
   15.34  static int cmd_read_proc(char *page, char **start, off_t off,
   15.35 -                          int count, int *eof, void *data)
   15.36 +                         int count, int *eof, void *data)
   15.37  {
   15.38      strcpy(page, readbuf);
   15.39      *readbuf = '\0';
   15.40 @@ -80,50 +66,6 @@ static int cmd_read_proc(char *page, cha
   15.41      return strlen(page);
   15.42  }
   15.43  
   15.44 -static ssize_t dom_vif_read(struct file * file, char * buff, size_t size, loff_t * off)
   15.45 -{
   15.46 -    int hyp_buf[32];
   15.47 -    char buf[128];
   15.48 -    network_op_t op;
   15.49 -    static int finished = 0;
   15.50 -
   15.51 -    if ( finished ) 
   15.52 -    {
   15.53 -        finished = 0;
   15.54 -        return 0;
   15.55 -    }
   15.56 -    
   15.57 -    op.cmd = NETWORK_OP_VIFQUERY;
   15.58 -    op.u.vif_query.domain = (unsigned int)
   15.59 -        ((struct proc_dir_entry *)file->f_dentry->d_inode->u.generic_ip)->data;
   15.60 -    op.u.vif_query.buf = hyp_buf;
   15.61 -
   15.62 -    (void) HYPERVISOR_network_op(&op);
   15.63 -
   15.64 -    if(hyp_buf[0] < 0) {
   15.65 -        strcpy(buf, "Error getting domain's vif list from hypervisor.\n");
   15.66 -    } else {
   15.67 -        int i;
   15.68 -        int len = 0;
   15.69 -        strcpy(buf, "No vif found");
   15.70 -
   15.71 -        for(i = 1; i <= hyp_buf[0] && len < 127; i++)
   15.72 -            len += snprintf(buf + len, 127 - len, "%d\n", hyp_buf[i]);
   15.73 -    }
   15.74 -
   15.75 -    if (*off >= (strlen(buf)+1)) return 0;
   15.76 -    
   15.77 -    copy_to_user(buff, buf, strlen(buf));
   15.78 -    
   15.79 -    finished = 1;
   15.80 -    
   15.81 -    return strlen(buf)+1;
   15.82 -}
   15.83 -
   15.84 -struct file_operations dom_vif_ops = {
   15.85 -    read:    dom_vif_read
   15.86 -};
   15.87 -
   15.88  static ssize_t dom_usage_read(struct file * file, char * buff, size_t size, loff_t * off)
   15.89  {
   15.90      char str[256];
   15.91 @@ -164,13 +106,13 @@ static ssize_t dom_usage_read(struct fil
   15.92          (void) HYPERVISOR_network_op(&netop);
   15.93  
   15.94          end += snprintf(str + end, 255 - end,
   15.95 -                "vif%d: sent %lld bytes (%lld packets) "
   15.96 -                "received %lld bytes (%lld packets)\n",
   15.97 -                vifs[i],
   15.98 -                netop.u.vif_getinfo.total_bytes_sent,
   15.99 -                netop.u.vif_getinfo.total_packets_sent,
  15.100 -                netop.u.vif_getinfo.total_bytes_received,
  15.101 -                netop.u.vif_getinfo.total_packets_received);
  15.102 +                        "vif%d: sent %lld bytes (%lld packets) "
  15.103 +                        "received %lld bytes (%lld packets)\n",
  15.104 +                        vifs[i],
  15.105 +                        netop.u.vif_getinfo.total_bytes_sent,
  15.106 +                        netop.u.vif_getinfo.total_packets_sent,
  15.107 +                        netop.u.vif_getinfo.total_bytes_received,
  15.108 +                        netop.u.vif_getinfo.total_packets_received);
  15.109      }
  15.110  
  15.111      if (*off >= end + 1) return 0;
  15.112 @@ -191,10 +133,10 @@ static void create_proc_dom_entries(int 
  15.113  {
  15.114      struct proc_dir_entry * dir;
  15.115      dom_procdata_t * dom_data;
  15.116 -    char dir_name[MAX_LEN];
  15.117 +    char dir_name[16];
  15.118      struct proc_dir_entry * file;
  15.119  
  15.120 -    snprintf(dir_name, MAX_LEN, "%s%d", DOM_DIR, dom);
  15.121 +    sprintf(dir_name, "dom%d", dom);
  15.122  
  15.123      dom_data = (dom_procdata_t *)kmalloc(sizeof(dom_procdata_t), GFP_KERNEL);
  15.124      dom_data->domain = dom;
  15.125 @@ -202,16 +144,7 @@ static void create_proc_dom_entries(int 
  15.126      dir = proc_mkdir(dir_name, xeno_base);
  15.127      dir->data = dom_data;
  15.128      
  15.129 -    file = create_proc_entry(DOM_VIF, 0600, dir);
  15.130 -    if (file != NULL)
  15.131 -    {
  15.132 -        file->owner         = THIS_MODULE;
  15.133 -        file->nlink         = 1;
  15.134 -        file->proc_fops     = &dom_vif_ops;
  15.135 -        file->data          = (void *) dom;
  15.136 -    }
  15.137 -
  15.138 -    file = create_proc_entry(DOM_USAGE, 0600, dir);
  15.139 +    file = create_proc_entry("usage", 0600, dir);
  15.140      if (file != NULL)
  15.141      {
  15.142          file->owner         = THIS_MODULE;
  15.143 @@ -222,14 +155,14 @@ static void create_proc_dom_entries(int 
  15.144  }
  15.145  
  15.146  static ssize_t dom_mem_write(struct file * file, const char * buff, 
  15.147 -	size_t size , loff_t * off)
  15.148 +                             size_t size , loff_t * off)
  15.149  {
  15.150      dom_mem_t mem_data;
  15.151      
  15.152      copy_from_user(&mem_data, (dom_mem_t *)buff, sizeof(dom_mem_t));
  15.153      
  15.154      if(direct_disc_unmap(mem_data.vaddr, mem_data.start_pfn, 
  15.155 -        mem_data.tot_pages) == 0){
  15.156 +                         mem_data.tot_pages) == 0){
  15.157          return sizeof(sizeof(dom_mem_t));
  15.158      } else {
  15.159          return -1;
  15.160 @@ -273,12 +206,12 @@ static int dom_map_mem(unsigned int dom,
  15.161              /* check if there is already an entry for mem and if so
  15.162               * remove it.
  15.163               */
  15.164 -            remove_proc_entry(DOM_MEM, pd);
  15.165 +            remove_proc_entry("mem", pd);
  15.166  
  15.167              /* create new entry with parameters describing what to do
  15.168               * when it is mmaped.
  15.169               */
  15.170 -            file = create_proc_entry(DOM_MEM, 0600, pd);
  15.171 +            file = create_proc_entry("mem", 0600, pd);
  15.172              if(file != NULL)
  15.173              {
  15.174                  file->owner = THIS_MODULE;
  15.175 @@ -311,7 +244,7 @@ static ssize_t dom_data_read(struct file
  15.176  
  15.177      copy_to_user((dom0_newdomain_t *)buff, dom_data, sizeof(dom0_newdomain_t));
  15.178  
  15.179 -    remove_proc_entry(DOM0_NEWDOM, xeno_base);
  15.180 +    remove_proc_entry("new_dom_data", xeno_base);
  15.181  
  15.182      kfree(dom_data);
  15.183  
  15.184 @@ -323,7 +256,7 @@ struct file_operations newdom_data_fops 
  15.185  };
  15.186  
  15.187  static int cmd_write_proc(struct file *file, const char *buffer, 
  15.188 -                           u_long count, void *data)
  15.189 +                          u_long count, void *data)
  15.190  {
  15.191      dom0_op_t op;
  15.192      int ret = 0;
  15.193 @@ -337,7 +270,7 @@ static int cmd_write_proc(struct file *f
  15.194      if ( op.cmd == MAP_DOM_MEM )
  15.195      {
  15.196          ret = dom_map_mem(op.u.dommem.domain, op.u.dommem.start_pfn, 
  15.197 -                        op.u.dommem.tot_pages); 
  15.198 +                          op.u.dommem.tot_pages); 
  15.199      }
  15.200      else if ( op.cmd == DO_PGUPDATES )
  15.201      {
  15.202 @@ -353,14 +286,14 @@ static int cmd_write_proc(struct file *f
  15.203              create_proc_dom_entries(ret);
  15.204  
  15.205              params = (dom0_newdomain_t *)kmalloc(sizeof(dom0_newdomain_t),
  15.206 -                GFP_KERNEL);
  15.207 +                                                 GFP_KERNEL);
  15.208              params->memory_kb = op.u.newdomain.memory_kb;
  15.209              params->pg_head = op.u.newdomain.pg_head;
  15.210              params->num_vifs = op.u.newdomain.num_vifs;
  15.211              params->domain = op.u.newdomain.domain;
  15.212  
  15.213              /* now notify user space of the new domain's id */
  15.214 -            new_dom_id = create_proc_entry(DOM0_NEWDOM, 0600, xeno_base);
  15.215 +            new_dom_id = create_proc_entry("new_dom_data", 0600, xeno_base);
  15.216              if ( new_dom_id != NULL )
  15.217              {
  15.218                  new_dom_id->owner      = THIS_MODULE;
  15.219 @@ -368,14 +301,11 @@ static int cmd_write_proc(struct file *f
  15.220                  new_dom_id->proc_fops  = &newdom_data_fops; 
  15.221                  new_dom_id->data       = (void *)params; 
  15.222              }
  15.223 -
  15.224          }
  15.225 -
  15.226      }
  15.227      
  15.228 -out:
  15.229 -    return ret;
  15.230 -    
  15.231 + out:
  15.232 +    return ret;   
  15.233  }
  15.234  
  15.235  /***********************************************************************
  15.236 @@ -389,83 +319,87 @@ static rwlock_t proc_xeno_domains_lock =
  15.237  
  15.238  static void *xeno_domains_next(struct seq_file *s, void *v, loff_t *pos)
  15.239  {
  15.240 -  int ret;
  15.241 +    int ret;
  15.242 +
  15.243 +    if ( pos != NULL )
  15.244 +        ++(*pos); 
  15.245  
  15.246 -  if (pos != NULL) { ++ (*pos); }
  15.247 -  if (!proc_domains_finished) {
  15.248 -    proc_domains_op.u.getdominfo.domain ++;
  15.249 -    ret = HYPERVISOR_dom0_op(&proc_domains_op);
  15.250 -    if (ret < 0) proc_domains_finished = TRUE;
  15.251 -  }
  15.252 +    if ( !proc_domains_finished ) 
  15.253 +    {
  15.254 +        proc_domains_op.u.getdominfo.domain++;
  15.255 +        ret = HYPERVISOR_dom0_op(&proc_domains_op);
  15.256 +        if ( ret < 0 ) 
  15.257 +            proc_domains_finished = 1;
  15.258 +    }
  15.259    
  15.260 -  return (proc_domains_finished) ? NULL : &proc_domains_op;
  15.261 +    return (proc_domains_finished) ? NULL : &proc_domains_op;
  15.262  }
  15.263  
  15.264  static void *xeno_domains_start(struct seq_file *s, loff_t *ppos)
  15.265  { 
  15.266 -  loff_t pos = *ppos;
  15.267 +    loff_t pos = *ppos;
  15.268    
  15.269 -  write_lock (&proc_xeno_domains_lock);
  15.270 -  proc_domains_op.cmd = DOM0_GETDOMAININFO;
  15.271 -  proc_domains_op.u.getdominfo.domain = 0;
  15.272 -  (void)HYPERVISOR_dom0_op(&proc_domains_op);
  15.273 -  proc_domains_finished = FALSE;
  15.274 +    write_lock (&proc_xeno_domains_lock);
  15.275 +    proc_domains_op.cmd = DOM0_GETDOMAININFO;
  15.276 +    proc_domains_op.u.getdominfo.domain = 0;
  15.277 +    (void)HYPERVISOR_dom0_op(&proc_domains_op);
  15.278 +    proc_domains_finished = 0;
  15.279    
  15.280 -  while (pos > 0) {
  15.281 -    pos --;
  15.282 -    xeno_domains_next (s, NULL, NULL);
  15.283 -  }
  15.284 +    while (pos > 0) {
  15.285 +        pos --;
  15.286 +        xeno_domains_next (s, NULL, NULL);
  15.287 +    }
  15.288    
  15.289 -  return (proc_domains_finished) ? NULL : &proc_domains_op;
  15.290 +    return (proc_domains_finished) ? NULL : &proc_domains_op;
  15.291  }
  15.292  
  15.293  static void xeno_domains_stop(struct seq_file *s, void *v)
  15.294  { 
  15.295 -  write_unlock (&proc_xeno_domains_lock);
  15.296 +    write_unlock (&proc_xeno_domains_lock);
  15.297  }
  15.298  
  15.299  static int xeno_domains_show(struct seq_file *s, void *v)
  15.300  { 
  15.301 -  dom0_op_t *di = v;
  15.302 +    dom0_op_t *di = v;
  15.303    
  15.304 -  /*
  15.305 -   * Output one domain's details to dom0.
  15.306 -   *
  15.307 -   * If you update this format string then change xi_list to match.
  15.308 -   */
  15.309 +    /*
  15.310 +     * Output one domain's details to dom0.
  15.311 +     *
  15.312 +     * If you update this format string then change xi_list to match.
  15.313 +     */
  15.314  
  15.315 -  seq_printf (s, 
  15.316 -              "%8d %2d %1d %2d %8d %8ld %p %8d %s\n",
  15.317 -              di -> u.getdominfo.domain, 
  15.318 -              di -> u.getdominfo.processor,
  15.319 -              di -> u.getdominfo.has_cpu,
  15.320 -              di -> u.getdominfo.state,
  15.321 -              di -> u.getdominfo.hyp_events,
  15.322 -              di -> u.getdominfo.mcu_advance,
  15.323 -              di -> u.getdominfo.pg_head,
  15.324 -              di -> u.getdominfo.tot_pages,
  15.325 -              di -> u.getdominfo.name);
  15.326 +    seq_printf (s, 
  15.327 +                "%8d %2d %1d %2d %8d %8ld %p %8d %s\n",
  15.328 +                di -> u.getdominfo.domain, 
  15.329 +                di -> u.getdominfo.processor,
  15.330 +                di -> u.getdominfo.has_cpu,
  15.331 +                di -> u.getdominfo.state,
  15.332 +                di -> u.getdominfo.hyp_events,
  15.333 +                di -> u.getdominfo.mcu_advance,
  15.334 +                di -> u.getdominfo.pg_head,
  15.335 +                di -> u.getdominfo.tot_pages,
  15.336 +                di -> u.getdominfo.name);
  15.337  
  15.338 -  return 0;
  15.339 +    return 0;
  15.340  }
  15.341  
  15.342  struct seq_operations xeno_domains_op = {
  15.343 -        .start          = xeno_domains_start,
  15.344 -        .next           = xeno_domains_next,
  15.345 -        .stop           = xeno_domains_stop,
  15.346 -        .show           = xeno_domains_show,
  15.347 +    .start          = xeno_domains_start,
  15.348 +    .next           = xeno_domains_next,
  15.349 +    .stop           = xeno_domains_stop,
  15.350 +    .show           = xeno_domains_show,
  15.351  };
  15.352  
  15.353  static int xeno_domains_open(struct inode *inode, struct file *file)
  15.354  {
  15.355 -        return seq_open(file, &xeno_domains_op);
  15.356 +    return seq_open(file, &xeno_domains_op);
  15.357  }
  15.358  
  15.359  static struct file_operations proc_xeno_domains_operations = {
  15.360 -        open:           xeno_domains_open,
  15.361 -        read:           seq_read,
  15.362 -        llseek:         seq_lseek,
  15.363 -        release:        seq_release,
  15.364 +    open:           xeno_domains_open,
  15.365 +    read:           seq_read,
  15.366 +    llseek:         seq_lseek,
  15.367 +    release:        seq_release,
  15.368  };
  15.369  
  15.370  /***********************************************************************/
  15.371 @@ -475,11 +409,11 @@ static struct file_operations proc_xeno_
  15.372  static int __init init_module(void)
  15.373  {
  15.374      /* xeno proc root setup */
  15.375 -    xeno_base = proc_mkdir(XENO_BASE, &proc_root); 
  15.376 +    xeno_base = proc_mkdir("xeno", &proc_root); 
  15.377  
  15.378      /* xeno control interface */
  15.379      *readbuf = '\0';
  15.380 -    dom0_cmd_intf = create_proc_entry (DOM0_CMD_INTF, 0600, xeno_base);
  15.381 +    dom0_cmd_intf = create_proc_entry("dom0_cmd", 0600, xeno_base);
  15.382      if ( dom0_cmd_intf != NULL )
  15.383      {
  15.384          dom0_cmd_intf->owner      = THIS_MODULE;
  15.385 @@ -489,13 +423,13 @@ static int __init init_module(void)
  15.386      }
  15.387  
  15.388      /* domain list interface */
  15.389 -    dom_list_intf = create_proc_entry (DOM_LIST_INTF, 0400, xeno_base);
  15.390 +    dom_list_intf = create_proc_entry("domains", 0400, xeno_base);
  15.391      if ( dom_list_intf != NULL )
  15.392 -      {
  15.393 -        dom_list_intf -> owner = THIS_MODULE;
  15.394 -        dom_list_intf -> nlink = 1;
  15.395 -        dom_list_intf -> proc_fops = &proc_xeno_domains_operations;
  15.396 -      }
  15.397 +    {
  15.398 +        dom_list_intf->owner = THIS_MODULE;
  15.399 +        dom_list_intf->nlink = 1;
  15.400 +        dom_list_intf->proc_fops = &proc_xeno_domains_operations;
  15.401 +    }
  15.402  
  15.403      /* set up /proc entries for dom 0 */
  15.404      create_proc_dom_entries(0);
    16.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/mm/get_unmapped_area.c	Sat Jul 05 13:48:17 2003 +0000
    16.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/mm/get_unmapped_area.c	Sat Jul 05 14:52:49 2003 +0000
    16.3 @@ -14,60 +14,11 @@
    16.4  #include <asm/uaccess.h>
    16.5  #include <asm/pgalloc.h>
    16.6  
    16.7 -/*
    16.8 -static int direct_mapped(unsigned long addr)
    16.9 +struct list_head *find_direct(struct list_head *list, unsigned long addr)
   16.10  {
   16.11 -    direct_mmap_node_t * node;
   16.12      struct list_head * curr;
   16.13      struct list_head * direct_list = &current->mm->context.direct_list;
   16.14 -
   16.15 -    curr = direct_list->next;
   16.16 -    while(curr != direct_list){
   16.17 -        node = list_entry(curr, direct_mmap_node_t, list);
   16.18 -        if(node->addr == addr)
   16.19 -            break;
   16.20 -        curr = curr->next;
   16.21 -    } 
   16.22 -
   16.23 -    if(curr == direct_list)
   16.24 -        return 0;
   16.25 -
   16.26 -    return 1;
   16.27 -}
   16.28 -*/
   16.29 -/*
   16.30 -unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
   16.31 -{
   16.32 -	struct vm_area_struct *vma;
   16.33 -
   16.34 -	if (len > TASK_SIZE)
   16.35 -		return -ENOMEM;
   16.36 -
   16.37 -	if (addr) {
   16.38 -		addr = PAGE_ALIGN(addr);
   16.39 -		vma = find_vma(current->mm, addr);
   16.40 -		if (TASK_SIZE - len >= addr &&
   16.41 -		    (!vma || addr + len <= vma->vm_start))
   16.42 -			return addr;
   16.43 -	}
   16.44 -	addr = PAGE_ALIGN(TASK_UNMAPPED_BASE);
   16.45 -
   16.46 -	for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) {
   16.47 -		if (TASK_SIZE - len < addr)
   16.48 -			return -ENOMEM;
   16.49 -        
   16.50 -		if ((!vma || addr + len <= vma->vm_start) && !direct_mapped(addr))
   16.51 -			return addr;
   16.52 -		
   16.53 -        addr = vma->vm_end;
   16.54 -	}
   16.55 -}
   16.56 -*/
   16.57 -struct list_head *find_direct(struct list_head *list, unsigned long addr)
   16.58 -{
   16.59 -	struct list_head * curr;
   16.60 -	struct list_head * direct_list = &current->mm->context.direct_list;
   16.61 -	direct_mmap_node_t * node;
   16.62 +    direct_mmap_node_t * node;
   16.63  
   16.64      for ( curr = direct_list->next; curr != direct_list; curr = curr->next )
   16.65      {
   16.66 @@ -78,15 +29,18 @@ struct list_head *find_direct(struct lis
   16.67      return curr;
   16.68  }
   16.69  
   16.70 -unsigned long arch_get_unmapped_area(struct file *filp, unsigned long
   16.71 -addr, unsigned long len, unsigned long pgoff, unsigned long flags)
   16.72 +unsigned long arch_get_unmapped_area(struct file *filp, 
   16.73 +                                     unsigned long addr, 
   16.74 +                                     unsigned long len, 
   16.75 +                                     unsigned long pgoff, 
   16.76 +                                     unsigned long flags)
   16.77  {
   16.78      struct vm_area_struct *vma;
   16.79      direct_mmap_node_t * node;
   16.80      struct list_head * curr;
   16.81      struct list_head * direct_list = &current->mm->context.direct_list;
   16.82  
   16.83 -    if (len > TASK_SIZE)
   16.84 +    if ( len > TASK_SIZE )
   16.85          return -ENOMEM;
   16.86  
   16.87      if ( addr )
   16.88 @@ -113,7 +67,8 @@ addr, unsigned long len, unsigned long p
   16.89      {
   16.90          if ( TASK_SIZE - len < addr ) return -ENOMEM;
   16.91  
   16.92 -        if ( vma && ((curr == direct_list) || (vma->vm_start < node->vm_start)))
   16.93 +        if ( vma && ((curr == direct_list) || 
   16.94 +                     (vma->vm_start < node->vm_start)) )
   16.95          {
   16.96              /* Do we fit before VMA node? */
   16.97              if ( addr + len <= vma->vm_start ) return addr;