diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-23 12:03:07 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-23 12:03:07 -0400 |
| commit | 0d6810091cdbd05efeb31654c6a41a6cbdfdd2c8 (patch) | |
| tree | 44d79f8133ea6acd791fe4f32188789c2c65da93 | |
| parent | a98ce5c6feead6bfedefabd46cb3d7f5be148d9a (diff) | |
| parent | 43d33b21a03d3abcc8cbdeb4d52bc4568f822c5e (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-lguest
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-lguest: (45 commits)
Use "struct boot_params" in example launcher
Loading bzImage directly.
Revert lguest magic and use hook in head.S
Update lguest documentation to reflect the new virtual block device name.
generalize lgread_u32/lgwrite_u32.
Example launcher handle guests not being ready for input
Update example launcher for virtio
Lguest support for Virtio
Remove old lguest I/O infrrasructure.
Remove old lguest bus and drivers.
Virtio helper routines for a descriptor ringbuffer implementation
Module autoprobing support for virtio drivers.
Virtio console driver
Block driver using virtio.
Net driver using virtio
Virtio interface
Boot with virtual == physical to get closer to native Linux.
Allow guest to specify syscall vector to use.
Rename "cr3" to "gpgdir" to avoid x86-specific naming.
Pagetables to use normal kernel types
...
70 files changed, 4822 insertions, 4401 deletions
diff --git a/Documentation/lguest/Makefile b/Documentation/lguest/Makefile index c0b7a45563..bac037eb1c 100644 --- a/Documentation/lguest/Makefile +++ b/Documentation/lguest/Makefile | |||
| @@ -1,28 +1,8 @@ | |||
| 1 | # This creates the demonstration utility "lguest" which runs a Linux guest. | 1 | # This creates the demonstration utility "lguest" which runs a Linux guest. |
| 2 | 2 | CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include | |
| 3 | # For those people that have a separate object dir, look there for .config | ||
| 4 | KBUILD_OUTPUT := ../.. | ||
| 5 | ifdef O | ||
| 6 | ifeq ("$(origin O)", "command line") | ||
| 7 | KBUILD_OUTPUT := $(O) | ||
| 8 | endif | ||
| 9 | endif | ||
| 10 | # We rely on CONFIG_PAGE_OFFSET to know where to put lguest binary. | ||
| 11 | include $(KBUILD_OUTPUT)/.config | ||
| 12 | LGUEST_GUEST_TOP := ($(CONFIG_PAGE_OFFSET) - 0x08000000) | ||
| 13 | |||
| 14 | CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -Wl,-T,lguest.lds | ||
| 15 | LDLIBS:=-lz | 3 | LDLIBS:=-lz |
| 16 | # Removing this works for some versions of ld.so (eg. Ubuntu Feisty) and | ||
| 17 | # not others (eg. FC7). | ||
| 18 | LDFLAGS+=-static | ||
| 19 | all: lguest.lds lguest | ||
| 20 | 4 | ||
| 21 | # The linker script on x86 is so complex the only way of creating one | 5 | all: lguest |
| 22 | # which will link our binary in the right place is to mangle the | ||
| 23 | # default one. | ||
| 24 | lguest.lds: | ||
| 25 | $(LD) --verbose | awk '/^==========/ { PRINT=1; next; } /SIZEOF_HEADERS/ { gsub(/0x[0-9A-F]*/, "$(LGUEST_GUEST_TOP)") } { if (PRINT) print $$0; }' > $@ | ||
| 26 | 6 | ||
| 27 | clean: | 7 | clean: |
| 28 | rm -f lguest.lds lguest | 8 | rm -f lguest |
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 103e346c8b..5bdc37f818 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
| @@ -1,10 +1,7 @@ | |||
| 1 | /*P:100 This is the Launcher code, a simple program which lays out the | 1 | /*P:100 This is the Launcher code, a simple program which lays out the |
| 2 | * "physical" memory for the new Guest by mapping the kernel image and the | 2 | * "physical" memory for the new Guest by mapping the kernel image and the |
| 3 | * virtual devices, then reads repeatedly from /dev/lguest to run the Guest. | 3 | * virtual devices, then reads repeatedly from /dev/lguest to run the Guest. |
| 4 | * | 4 | :*/ |
| 5 | * The only trick: the Makefile links it at a high address so it will be clear | ||
| 6 | * of the guest memory region. It means that each Guest cannot have more than | ||
| 7 | * about 2.5G of memory on a normally configured Host. :*/ | ||
| 8 | #define _LARGEFILE64_SOURCE | 5 | #define _LARGEFILE64_SOURCE |
| 9 | #define _GNU_SOURCE | 6 | #define _GNU_SOURCE |
| 10 | #include <stdio.h> | 7 | #include <stdio.h> |
| @@ -15,6 +12,7 @@ | |||
| 15 | #include <stdlib.h> | 12 | #include <stdlib.h> |
| 16 | #include <elf.h> | 13 | #include <elf.h> |
| 17 | #include <sys/mman.h> | 14 | #include <sys/mman.h> |
| 15 | #include <sys/param.h> | ||
| 18 | #include <sys/types.h> | 16 | #include <sys/types.h> |
| 19 | #include <sys/stat.h> | 17 | #include <sys/stat.h> |
| 20 | #include <sys/wait.h> | 18 | #include <sys/wait.h> |
| @@ -34,7 +32,9 @@ | |||
| 34 | #include <termios.h> | 32 | #include <termios.h> |
| 35 | #include <getopt.h> | 33 | #include <getopt.h> |
| 36 | #include <zlib.h> | 34 | #include <zlib.h> |
| 37 | /*L:110 We can ignore the 28 include files we need for this program, but I do | 35 | #include <assert.h> |
| 36 | #include <sched.h> | ||
| 37 | /*L:110 We can ignore the 30 include files we need for this program, but I do | ||
| 38 | * want to draw attention to the use of kernel-style types. | 38 | * want to draw attention to the use of kernel-style types. |
| 39 | * | 39 | * |
| 40 | * As Linus said, "C is a Spartan language, and so should your naming be." I | 40 | * As Linus said, "C is a Spartan language, and so should your naming be." I |
| @@ -45,8 +45,14 @@ typedef unsigned long long u64; | |||
| 45 | typedef uint32_t u32; | 45 | typedef uint32_t u32; |
| 46 | typedef uint16_t u16; | 46 | typedef uint16_t u16; |
| 47 | typedef uint8_t u8; | 47 | typedef uint8_t u8; |
| 48 | #include "../../include/linux/lguest_launcher.h" | 48 | #include "linux/lguest_launcher.h" |
| 49 | #include "../../include/asm-x86/e820_32.h" | 49 | #include "linux/pci_ids.h" |
| 50 | #include "linux/virtio_config.h" | ||
| 51 | #include "linux/virtio_net.h" | ||
| 52 | #include "linux/virtio_blk.h" | ||
| 53 | #include "linux/virtio_console.h" | ||
| 54 | #include "linux/virtio_ring.h" | ||
| 55 | #include "asm-x86/bootparam.h" | ||
| 50 | /*:*/ | 56 | /*:*/ |
| 51 | 57 | ||
| 52 | #define PAGE_PRESENT 0x7 /* Present, RW, Execute */ | 58 | #define PAGE_PRESENT 0x7 /* Present, RW, Execute */ |
| @@ -55,6 +61,10 @@ typedef uint8_t u8; | |||
| 55 | #ifndef SIOCBRADDIF | 61 | #ifndef SIOCBRADDIF |
| 56 | #define SIOCBRADDIF 0x89a2 /* add interface to bridge */ | 62 | #define SIOCBRADDIF 0x89a2 /* add interface to bridge */ |
| 57 | #endif | 63 | #endif |
| 64 | /* We can have up to 256 pages for devices. */ | ||
| 65 | #define DEVICE_PAGES 256 | ||
| 66 | /* This fits nicely in a single 4096-byte page. */ | ||
