make kernel leave a page-sized gap in its code and data to not be
mapped in if so configured.
This commit is contained in:
parent
834d9d34e8
commit
f0000078c3
@ -593,6 +593,7 @@
|
|||||||
#define VMCTL_MEMREQ_REPLY 15
|
#define VMCTL_MEMREQ_REPLY 15
|
||||||
#define VMCTL_INCSP 16
|
#define VMCTL_INCSP 16
|
||||||
#define VMCTL_STACKTRACE 17
|
#define VMCTL_STACKTRACE 17
|
||||||
|
#define VMCTL_NOPAGEZERO 18
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* Messages for the Reincarnation Server *
|
* Messages for the Reincarnation Server *
|
||||||
|
@ -95,4 +95,7 @@
|
|||||||
#define SPROFILE 1 /* statistical profiling */
|
#define SPROFILE 1 /* statistical profiling */
|
||||||
#define CPROFILE 0 /* call profiling */
|
#define CPROFILE 0 /* call profiling */
|
||||||
|
|
||||||
|
/* Compile kernel so that first page of code and data can be unmapped. */
|
||||||
|
#define VM_KERN_NOPAGEZERO 1
|
||||||
|
|
||||||
#endif /* _CONFIG_H */
|
#endif /* _CONFIG_H */
|
||||||
|
@ -45,6 +45,7 @@ PUBLIC void vm_init(void)
|
|||||||
u32_t entry;
|
u32_t entry;
|
||||||
unsigned pages;
|
unsigned pages;
|
||||||
struct proc* rp;
|
struct proc* rp;
|
||||||
|
struct proc *sys = proc_addr(SYSTEM);
|
||||||
|
|
||||||
if (!vm_size)
|
if (!vm_size)
|
||||||
minix_panic("i386_vm_init: no space for page tables", NO_NUM);
|
minix_panic("i386_vm_init: no space for page tables", NO_NUM);
|
||||||
@ -77,6 +78,12 @@ PUBLIC void vm_init(void)
|
|||||||
I386_VM_PRESENT;
|
I386_VM_PRESENT;
|
||||||
if (phys_mem >= vm_mem_high)
|
if (phys_mem >= vm_mem_high)
|
||||||
entry= 0;
|
entry= 0;
|
||||||
|
#if VM_KERN_NOPAGEZERO
|
||||||
|
if (phys_mem == (sys->p_memmap[T].mem_phys << CLICK_SHIFT) ||
|
||||||
|
phys_mem == (sys->p_memmap[D].mem_phys << CLICK_SHIFT)) {
|
||||||
|
entry = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
phys_put32(vm_pt_base + p*I386_VM_PT_ENT_SIZE, entry);
|
phys_put32(vm_pt_base + p*I386_VM_PT_ENT_SIZE, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,6 +478,7 @@ PUBLIC int vm_checkrange(struct proc *caller, struct proc *target,
|
|||||||
|
|
||||||
vmassert(vm_running);
|
vmassert(vm_running);
|
||||||
|
|
||||||
|
|
||||||
/* If caller has had a reply to this request, return it. */
|
/* If caller has had a reply to this request, return it. */
|
||||||
if(RTS_ISSET(caller, VMREQUEST)) {
|
if(RTS_ISSET(caller, VMREQUEST)) {
|
||||||
if(caller->p_vmrequest.who == target->p_endpoint) {
|
if(caller->p_vmrequest.who == target->p_endpoint) {
|
||||||
@ -522,8 +530,9 @@ PUBLIC int vm_checkrange(struct proc *caller, struct proc *target,
|
|||||||
target->p_name, target->p_endpoint, v, wrfl, flags, phys);
|
target->p_name, target->p_endpoint, v, wrfl, flags, phys);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(checkonly)
|
if(checkonly) {
|
||||||
return VMSUSPEND;
|
return VMSUSPEND;
|
||||||
|
}
|
||||||
|
|
||||||
/* This range is not OK for this process. Set parameters
|
/* This range is not OK for this process. Set parameters
|
||||||
* of the request and notify VM about the pending request.
|
* of the request and notify VM about the pending request.
|
||||||
@ -544,7 +553,19 @@ PUBLIC int vm_checkrange(struct proc *caller, struct proc *target,
|
|||||||
/* Connect caller on vmrequest wait queue. */
|
/* Connect caller on vmrequest wait queue. */
|
||||||
caller->p_vmrequest.nextrequestor = vmrequest;
|
caller->p_vmrequest.nextrequestor = vmrequest;
|
||||||
vmrequest = caller;
|
vmrequest = caller;
|
||||||
soft_notify(VM_PROC_NR);
|
if(!caller->p_vmrequest.nextrequestor) {
|
||||||
|
int n = 0;
|
||||||
|
struct proc *vmr;
|
||||||
|
for(vmr = vmrequest; vmr; vmr = vmr->p_vmrequest.nextrequestor)
|
||||||
|
n++;
|
||||||
|
soft_notify(VM_PROC_NR);
|
||||||
|
#if 0
|
||||||
|
kprintf("(%d) ", n);
|
||||||
|
kprintf("%d/%d ",
|
||||||
|
caller->p_endpoint, target->p_endpoint);
|
||||||
|
util_stacktrace();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
kprintf("SYSTEM: vm_checkrange: range bad for "
|
kprintf("SYSTEM: vm_checkrange: range bad for "
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "../vm.h"
|
#include "../vm.h"
|
||||||
#include "../debug.h"
|
#include "../debug.h"
|
||||||
#include <minix/type.h>
|
#include <minix/type.h>
|
||||||
|
#include <minix/config.h>
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* do_vmctl *
|
* do_vmctl *
|
||||||
@ -92,6 +93,10 @@ kprintf("SYSTEM: request %d:0x%lx-0x%lx, wrflag %d, failed\n",
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
|
#if VM_KERN_NOPAGEZERO
|
||||||
|
case VMCTL_NOPAGEZERO:
|
||||||
|
return OK;
|
||||||
|
#endif
|
||||||
case VMCTL_STACKTRACE:
|
case VMCTL_STACKTRACE:
|
||||||
kprintf("vmctl stacktrace ");
|
kprintf("vmctl stacktrace ");
|
||||||
proc_stacktrace(p);
|
proc_stacktrace(p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user