aboutsummaryrefslogtreecommitdiffstats
path: root/stubdom
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-04-06 07:13:01 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-04-06 07:13:01 +0100
commitefdf57d6133754c78a095ae15174f83f88039fb8 (patch)
tree32d989f6852e0fd7d0e787e63dc5f71cbc93231f /stubdom
parentd98d3c520857f706fb83cdb9d398b7b8b1733141 (diff)
downloadxen-efdf57d6133754c78a095ae15174f83f88039fb8.tar.gz
xen-efdf57d6133754c78a095ae15174f83f88039fb8.tar.bz2
xen-efdf57d6133754c78a095ae15174f83f88039fb8.zip
pv-grub: fix boot crash when no fb is available
When no fb is available, init_fbfront will return, so the local semaphore for synchronization with the kbd thread would get dropped. Using a global static semaphore instead fixes this. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'stubdom')
-rw-r--r--stubdom/grub/mini-os.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/stubdom/grub/mini-os.c b/stubdom/grub/mini-os.c
index 4f1804170b..251e2ad000 100644
--- a/stubdom/grub/mini-os.c
+++ b/stubdom/grub/mini-os.c
@@ -651,12 +651,11 @@ int console_getkey (void)
return 0;
}
+static DECLARE_MUTEX_LOCKED(kbd_sem);
static void kbd_thread(void *p)
{
- struct semaphore *sem = p;
-
kbd_dev = init_kbdfront(NULL, 1);
- up(sem);
+ up(&kbd_sem);
}
struct fbfront_dev *fb_open(void *fb, int width, int height, int depth)
@@ -665,10 +664,9 @@ struct fbfront_dev *fb_open(void *fb, int width, int height, int depth)
int linesize = width * (depth / 8);
int memsize = linesize * height;
int numpages = (memsize + PAGE_SIZE - 1) / PAGE_SIZE;
- DECLARE_MUTEX_LOCKED(sem);
int i;
- create_thread("kbdfront", kbd_thread, &sem);
+ create_thread("kbdfront", kbd_thread, &kbd_sem);
mfns = malloc(numpages * sizeof(*mfns));
for (i = 0; i < numpages; i++) {
@@ -681,7 +679,7 @@ struct fbfront_dev *fb_open(void *fb, int width, int height, int depth)
if (!fb_dev)
return NULL;
- down(&sem);
+ down(&kbd_sem);
if (!kbd_dev)
return NULL;