DragonFly kernel List (threaded) for 2010-01
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: 64-bit vkernel
On 1/25/10 6:10 PM, Matthew Dillon wrote:
The issue has to do with the vkernel not having a boot loader.
So the vkernel binary is loaded as a normal ELF program by the
normal rtelf-elf, libc, etc code. This portion of the vkernel,
along with any incidental malloc()'s done by libc and friends,
does not use the mapped vpagetable area.
I'm not sure what you are proposing in terms of coding. Are
you talking about changing the KernelPTA calculation in the
vkernel code and the related pmaps? If so I think it is a good
idea.
I was proposing to change vm_fault() and vm_fault_page() to pass an
additional argument to vm_fault_vpagetable() - the actual virtual
address of the fault. This would have allowed vm_fault_vpagetable() to
always use the actual virtual address and not some value that is offset
for the vkernel and not offset for userland processes.
I've found a less invasive solution though.
I'll illustrate it on the code of the 32-bit vkernel.
The vkernel does this to map its kernel virtual memory:
try = (void *)0x40000000;
base = NULL;
while ((char *)try + KERNEL_KVA_SIZE < topofstack) {
base = mmap(try, KERNEL_KVA_SIZE, PROT_READ|PROT_WRITE,
MAP_FILE|MAP_SHARED|MAP_VPAGETABLE,
MemImageFd, 0);
if (base == try)
break;
if (base != MAP_FAILED)
munmap(base, KERNEL_KVA_SIZE);
try = (char *)try + 0x10000000;
}
A simple change does wonders:
--- a/sys/platform/vkernel/platform/init.c
+++ b/sys/platform/vkernel/platform/init.c
@@ -473,7 +473,7 @@ init_kern_memory(void)
while ((char *)try + KERNEL_KVA_SIZE < topofstack) {
base = mmap(try, KERNEL_KVA_SIZE, PROT_READ|PROT_WRITE,
MAP_FILE|MAP_SHARED|MAP_VPAGETABLE,
- MemImageFd, 0);
+ MemImageFd, try);
if (base == try)
break;
if (base != MAP_FAILED)
Now when we access address 'va', the vpagetable is asked to map address
'va - start_of_region + offset' == 'va - try + try' == 'va'.
We can't pass mmap() a suitable offset argument unless we know where it
will map our region.
About the progress of the 64-bit vkernel: it will be enduring a pkgsrc
bulk build tomorrow; then I'll have to make the SMP version compile and
run; after that I have to prepare it for publishing.
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]