aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-06-18 09:36:47 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-06-18 09:36:47 +0100
commita2c7db64f561821fd528614e68c4d92718210126 (patch)
tree79c7e1c3ef49b5b4272fd12d36420e6fb8d23cd1 /extras/mini-os
parent7074b13cee246f09b3b0a2a6da139b2e047cf4a4 (diff)
downloadxen-a2c7db64f561821fd528614e68c4d92718210126.tar.gz
xen-a2c7db64f561821fd528614e68c4d92718210126.tar.bz2
xen-a2c7db64f561821fd528614e68c4d92718210126.zip
Add PV-GRUB
This fetches GRUB1 sources, applies the {graphical, print function, save default, and ext3_256byte} patches from debian, and applies a patch to make it work on x86_64 and port it to Mini-OS. By using libxc, PV-GRUB can then "kexec" the loaded kernel from inside the domain itself, hence permitting to avoid the security-concerned pygrub. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras/mini-os')
-rw-r--r--extras/mini-os/arch/x86/mm.c2
-rw-r--r--extras/mini-os/blkfront.c8
-rw-r--r--extras/mini-os/fbfront.c24
-rw-r--r--extras/mini-os/include/x86/arch_mm.h2
-rw-r--r--extras/mini-os/main.c4
-rw-r--r--extras/mini-os/netfront.c13
6 files changed, 47 insertions, 6 deletions
diff --git a/extras/mini-os/arch/x86/mm.c b/extras/mini-os/arch/x86/mm.c
index 96c433b135..ea8158045b 100644
--- a/extras/mini-os/arch/x86/mm.c
+++ b/extras/mini-os/arch/x86/mm.c
@@ -372,7 +372,7 @@ static pgentry_t *get_pgt(unsigned long addr)
return &tab[offset];
}
-static pgentry_t *need_pgt(unsigned long addr)
+pgentry_t *need_pgt(unsigned long addr)
{
unsigned long mfn;
pgentry_t *tab;
diff --git a/extras/mini-os/blkfront.c b/extras/mini-os/blkfront.c
index 9e5411bce6..48704bd1c4 100644
--- a/extras/mini-os/blkfront.c
+++ b/extras/mini-os/blkfront.c
@@ -242,9 +242,15 @@ void shutdown_blkfront(struct blkfront_dev *dev)
err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6);
xenbus_wait_for_value(path, "6", &dev->events);
+ err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 1);
+ xenbus_wait_for_value(path, "2", &dev->events);
+
xenbus_unwatch_path(XBT_NIL, path);
- err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 1);
+ snprintf(path, sizeof(path), "%s/ring-ref", nodename);
+ xenbus_rm(XBT_NIL, path);
+ snprintf(path, sizeof(path), "%s/event-channel", nodename);
+ xenbus_rm(XBT_NIL, path);
free_blkfront(dev);
}
diff --git a/extras/mini-os/fbfront.c b/extras/mini-os/fbfront.c
index 6517cdf4b5..245ef468ed 100644
--- a/extras/mini-os/fbfront.c
+++ b/extras/mini-os/fbfront.c
@@ -229,9 +229,18 @@ void shutdown_kbdfront(struct kbdfront_dev *dev)
err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6);
xenbus_wait_for_value(path, "6", &dev->events);
+ err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 1);
+ // does not work yet.
+ //xenbus_wait_for_value(path, "2", &dev->events);
+
xenbus_unwatch_path(XBT_NIL, path);
- err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 1);
+ snprintf(path, sizeof(path), "%s/page-ref", nodename);
+ xenbus_rm(XBT_NIL, path);
+ snprintf(path, sizeof(path), "%s/event-channel", nodename);
+ xenbus_rm(XBT_NIL, path);
+ snprintf(path, sizeof(path), "%s/request-abs-pointer", nodename);
+ xenbus_rm(XBT_NIL, path);
free_kbdfront(dev);
}
@@ -561,9 +570,20 @@ void shutdown_fbfront(struct fbfront_dev *dev)
err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6);
xenbus_wait_for_value(path, "6", &dev->events);
+ err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 1);
+ // does not work yet
+ //xenbus_wait_for_value(path, "2", &dev->events);
+
xenbus_unwatch_path(XBT_NIL, path);
- err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 1);
+ snprintf(path, sizeof(path), "%s/page-ref", nodename);
+ xenbus_rm(XBT_NIL, path);
+ snprintf(path, sizeof(path), "%s/event-channel", nodename);
+ xenbus_rm(XBT_NIL, path);
+ snprintf(path, sizeof(path), "%s/protocol", nodename);
+ xenbus_rm(XBT_NIL, path);
+ snprintf(path, sizeof(path), "%s/feature-update", nodename);
+ xenbus_rm(XBT_NIL, path);
unbind_evtchn(dev->evtchn);
diff --git a/extras/mini-os/include/x86/arch_mm.h b/extras/mini-os/include/x86/arch_mm.h
index a7e013bc06..4a04812891 100644
--- a/extras/mini-os/include/x86/arch_mm.h
+++ b/extras/mini-os/include/x86/arch_mm.h
@@ -221,4 +221,6 @@ static __inline__ paddr_t machine_to_phys(maddr_t machine)
#define map_zero(n, a) map_frames_ex(&mfn_zero, n, 0, 0, a, DOMID_SELF, 0, L1_PROT_RO)
#define do_map_zero(start, n) do_map_frames(start, &mfn_zero, n, 0, 0, DOMID_SELF, 0, L1_PROT_RO)
+pgentry_t *need_pgt(unsigned long addr);
+
#endif /* _ARCH_MM_H_ */
diff --git a/extras/mini-os/main.c b/extras/mini-os/main.c
index 6c26e96057..dac185a528 100644
--- a/extras/mini-os/main.c
+++ b/extras/mini-os/main.c
@@ -59,11 +59,13 @@ static void call_main(void *p)
* crashing. */
//sleep(1);
+#ifndef CONFIG_GRUB
sparse((unsigned long) &__app_bss_start, &__app_bss_end - &__app_bss_start);
#ifdef HAVE_LWIP
start_networking();
#endif
init_fs_frontend();
+#endif
#ifdef CONFIG_QEMU
if (!fs_import) {
@@ -154,7 +156,7 @@ void _exit(int ret)
#ifdef HAVE_LWIP
stop_networking();
#endif
- unbind_all_ports();
+ stop_kernel();
if (!ret) {
/* No problem, just shutdown. */
struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_poweroff };
diff --git a/extras/mini-os/netfront.c b/extras/mini-os/netfront.c
index 00f159c332..d01ce6927b 100644
--- a/extras/mini-os/netfront.c
+++ b/extras/mini-os/netfront.c
@@ -497,15 +497,26 @@ void shutdown_netfront(struct netfront_dev *dev)
printk("close network: backend at %s\n",dev->backend);
snprintf(path, sizeof(path), "%s/state", dev->backend);
+
err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 5); /* closing */
xenbus_wait_for_value(path, "5", &dev->events);
err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6);
xenbus_wait_for_value(path, "6", &dev->events);
+ err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 1);
+ xenbus_wait_for_value(path, "2", &dev->events);
+
xenbus_unwatch_path(XBT_NIL, path);
- err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 1);
+ snprintf(path, sizeof(path), "%s/tx-ring-ref", nodename);
+ xenbus_rm(XBT_NIL, path);
+ snprintf(path, sizeof(path), "%s/rx-ring-ref", nodename);
+ xenbus_rm(XBT_NIL, path);
+ snprintf(path, sizeof(path), "%s/event-channel", nodename);
+ xenbus_rm(XBT_NIL, path);
+ snprintf(path, sizeof(path), "%s/request-rx-copy", nodename);
+ xenbus_rm(XBT_NIL, path);
free_netfront(dev);
}