diff options
author | Jes Sorensen <jes@sgi.com> | 2007-10-22 11:03:31 +1000 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-23 15:49:52 +1000 |
commit | 511801dc31c095b2bfe3bf5c6a370dbe9b042a70 (patch) | |
tree | fcd0f1111e503f33e39660d3aba55ff5b64ebf56 /Documentation | |
parent | b410e7b1499c49513cab18275db8a8ab549d9e09 (diff) |
Change example launcher to use unsigned long not u32
Apply Clue 2x4 to lguest userland<->kernel handling code and the
lguest launcher. Pointers are not to be passed in u32's!
Basic rule of thumb: Anything passing u32's back and forth should be
passing unsigned longs to be portable to 64 bit archs.
For those who forgotten already, I repeat: NO POINTERS IN u32!
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/lguest/lguest.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 140bd98a8417..4950b03514e6 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c @@ -473,9 +473,9 @@ static unsigned long setup_pagetables(unsigned long mem, unsigned long initrd_size, unsigned long page_offset) { - u32 *pgdir, *linear; + unsigned long *pgdir, *linear; unsigned int mapped_pages, i, linear_pages; - unsigned int ptes_per_page = getpagesize()/sizeof(u32); + unsigned int ptes_per_page = getpagesize()/sizeof(void *); /* Ideally we map all physical memory starting at page_offset. * However, if page_offset is 0xC0000000 we can only map 1G of physical @@ -505,7 +505,7 @@ static unsigned long setup_pagetables(unsigned long mem, * continue from there. */ for (i = 0; i < mapped_pages; i += ptes_per_page) { pgdir[(i + page_offset/getpagesize())/ptes_per_page] - = ((to_guest_phys(linear) + i*sizeof(u32)) + = ((to_guest_phys(linear) + i*sizeof(void *)) | PAGE_PRESENT); } @@ -537,12 +537,13 @@ static void concat(char *dst, char *args[]) * the base of guest "physical" memory, the top physical page to allow, the * top level pagetable, the entry point and the page_offset constant for the * Guest. */ -static int tell_kernel(u32 pgdir, u32 start, u32 page_offset) +static int tell_kernel(unsigned long pgdir, unsigned long start, + unsigned long page_offset) { - u32 args[] = { LHREQ_INITIALIZE, - (unsigned long)guest_base, - guest_limit / getpagesize(), - pgdir, start, page_offset }; + unsigned long args[] = { LHREQ_INITIALIZE, + (unsigned long)guest_base, + guest_limit / getpagesize(), + pgdir, start, page_offset }; int fd; verbose("Guest: %p - %p (%#lx)\n", @@ -586,7 +587,7 @@ static void wake_parent(int pipefd, int lguest_fd, struct device_list *devices) for (;;) { fd_set rfds = devices->infds; - u32 args[] = { LHREQ_BREAK, 1 }; + unsigned long args[] = { LHREQ_BREAK, 1 }; /* Wait until input is ready from one of the devices. */ select(devices->max_infd+1, &rfds, NULL, NULL, NULL); @@ -684,7 +685,7 @@ static u32 *dma2iov(unsigned long dma, struct iovec iov[], unsigned *num) static u32 *get_dma_buffer(int fd, void *key, struct iovec iov[], unsigned int *num, u32 *irq) { - u32 buf[] = { LHREQ_GETDMA, to_guest_phys(key) }; + unsigned long buf[] = { LHREQ_GETDMA, to_guest_phys(key) }; unsigned long udma; u32 *res; @@ -705,7 +706,7 @@ static u32 *get_dma_buffer(int fd, void *key, /* This is a convenient routine to send the Guest an interrupt. */ static void trigger_irq(int fd, u32 irq) { - u32 buf[] = { LHREQ_IRQ, irq }; + unsigned long buf[] = { LHREQ_IRQ, irq }; if (write(fd, buf, sizeof(buf)) != 0) err(1, "Triggering irq %i", irq); } @@ -787,7 +788,7 @@ static bool handle_console_input(int fd, struct device *dev) struct timeval now; gettimeofday(&now, NULL); if (now.tv_sec <= abort->start.tv_sec+1) { - u32 args[] = { LHREQ_BREAK, 0 }; + unsigned long args[] = { LHREQ_BREAK, 0 }; /* Close the fd so Waker will know it has to * exit. */ close(waker_fd); @@ -1365,7 +1366,7 @@ static void __attribute__((noreturn)) run_guest(int lguest_fd, struct device_list *device_list) { for (;;) { - u32 args[] = { LHREQ_BREAK, 0 }; + unsigned long args[] = { LHREQ_BREAK, 0 }; unsigned long arr[2]; int readval; |