bitkeeper revision 1.522 (3f8d3cffmNKgZ0npDLxqj41Tk8Lk4w)

xi_build.c:
  Cleanups to xi_build.
This commit is contained in:
kaf24@scramble.cl.cam.ac.uk committed 2003-10-15 12:26:39 +00:00
1 parent 7bc800b94f
commit d03d4e2132
1 file changed
+17 -4
+17 -4
View File
@@ -3,12 +3,15 @@
#include "dom0_defs.h"
#include "mem_defs.h"
/* This string is written to the head of every guest kernel image. */
#define GUEST_SIG "XenoGues"
#define SIG_LEN 8
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
static char *argv0 = "internal_domain_build";
static long get_tot_pages(int domain_id)
{
dom0_op_t op;
@@ -78,6 +81,7 @@ static int read_kernel_header(int fd, long dom_size,
return -1;
}
/* Double the kernel image size to account for dynamic memory usage etc. */
if ( (stat.st_size * 2) > (dom_size << 10) )
{
sprintf(status, "Kernel image size %ld larger than requested "
@@ -89,11 +93,12 @@ static int read_kernel_header(int fd, long dom_size,
read(fd, signature, SIG_LEN);
if ( strncmp(signature, GUEST_SIG, SIG_LEN) )
{
ERROR("Kernel image does not contain required signature. "
ERROR("Kernel image does not contain required signature.\n"
"Terminating.\n");
return -1;
}
/* Read the load address which immediately follows the Xeno signature. */
read(fd, load_addr, sizeof(unsigned long));
*ksize = stat.st_size - SIG_LEN - sizeof(unsigned long);
@@ -207,6 +212,7 @@ static int setup_guestos(
goto error_out;
}
/* 'i' is 'ksize' rounded up to a page boundary. */
meminfo->virt_mod_addr = virt_load_addr + i;
meminfo->virt_mod_len = isize;
@@ -336,8 +342,12 @@ static int setup_guestos(
int main(int argc, char **argv)
{
dom0_op_t launch_op;
/*
* NB. 'ksize' is the size in bytes of the main kernel image. It excludes
* the 8-byte signature and 4-byte load address.
*/
size_t ksize;
dom0_op_t launch_op;
unsigned long load_addr;
long tot_pages;
int kernel_fd, initrd_fd = -1;
@@ -348,10 +358,13 @@ int main(int argc, char **argv)
int domain_id;
int rc;
if ( argv[0] != NULL )
argv0 = argv[0];
if ( argc < 4 )
{
fprintf(stderr, "Usage: dom_builder <domain_id> <image> <num_vifs> "
"[<initrd=initrd_name>] <boot_params>\n");
fprintf(stderr, "Usage: %s <domain_id> <image> <num_vifs> "
"[<initrd=initrd_name>] <boot_params>\n", argv0);
return 1;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.