aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'extras/mini-os/kernel.c')
-rw-r--r--extras/mini-os/kernel.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/extras/mini-os/kernel.c b/extras/mini-os/kernel.c
index 6888eee508..c37644bf4f 100644
--- a/extras/mini-os/kernel.c
+++ b/extras/mini-os/kernel.c
@@ -297,9 +297,20 @@ static void fbfront_thread(void *p)
{
size_t line_length = WIDTH * (DEPTH / 8);
size_t memsize = HEIGHT * line_length;
+ unsigned long *mfns;
+ int i, n = (memsize + PAGE_SIZE-1) / PAGE_SIZE;
+ memsize = n * PAGE_SIZE;
fb = _xmalloc(memsize, PAGE_SIZE);
- fb_dev = init_fbfront(NULL, fb, WIDTH, HEIGHT, DEPTH, line_length, memsize);
+ mfns = xmalloc_array(unsigned long, n);
+ for (i = 0; i < n; i++) {
+ /* trigger CoW */
+ ((char *) fb) [i * PAGE_SIZE] = 0;
+ barrier();
+ mfns[i] = virtual_to_mfn((char *) fb + i * PAGE_SIZE);
+ }
+ fb_dev = init_fbfront(NULL, mfns, WIDTH, HEIGHT, DEPTH, line_length, n);
+ xfree(mfns);
if (!fb_dev) {
xfree(fb);
return;