VKernel progress update - 7 Jan 2006
Matthew Dillon
dillon at apollo.backplane.com
Mon Jan 8 00:46:20 PST 2007
I've made phenominal progress. The virtual kernel can now actually
run a /bin/csh on the console given a suitable replacement to init
(see code at end).
It can't run init yet, or much else without crashing (not the real
system, just the virtual kernel process), but the fact that it
gives me a shell prompt at all is pretty significant :-). Just for
yucks I did the old 'dd' test:
[ on real kernel ]
test28# dd if=/dev/zero of=/dev/null bs=32k count=102400
102400+0 records in
102400+0 records out
3355443200 bytes transferred in 0.732878 secs (4578447352 bytes/sec)
test28#
[ on virtual kernel ]
./kernel.debug -m 64m -r /var/vkernel/rootimg.01
...
%dd if=/dev/zero of=/dev/null bs=32k count=102400
102400+0 records in
102400+0 records out
3355443200 bytes transferred in 1.989408 secs (1686654142 bytes/sec)
Don't read much into the times, it's doing some very, very nasty stuff
to keep the page tables in order, more nasty stuff to implement its
clock 'interrupt', console, context handling, etc. It's not preloading
any pages and the real kernel has to take a fault to mark a page as
modified in the virtual kernel's page table. And so on and so forth.
I'm not going to try optimizing anything until I actually have the
thing booting normally with a real init and running stable.
-Matt
/*
* /mnt/sbin/init replacement (vkernel root image) to get a shell prompt.
*
* cc blah.c -o /mnt/sbin/init -static
*/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
static int x = 1;
int
main(int ac, char **av)
{
int fd;
char buf[32];
fd = open("/dev/console", O_RDWR);
dup2(fd, 1);
dup2(fd, 2);
write(1, "TEST\n", 5);
execl("/bin/csh", "csh", "-i", NULL);
return(0);
}
More information about the Kernel
mailing list