allow kernel to tell VM extra physical addresses it wants mapped in.

used in the future for mapping in local APIC memory.
This commit is contained in:
Tomas Hruby
2009-11-11 12:07:06 +00:00
parent 9ba3b53de8
commit b3b0a18403
6 changed files with 93 additions and 1 deletions
+17 -1
View File
@@ -715,7 +715,7 @@ void vm_print(u32_t *root)
printf("page table 0x%lx:\n", root);
for(pde = 10; pde < I386_VM_DIR_ENTRIES; pde++) {
for(pde = 0; pde < I386_VM_DIR_ENTRIES; pde++) {
u32_t pde_v;
u32_t *pte_a;
pde_v = phys_get32((u32_t) (root + pde));
@@ -1028,3 +1028,19 @@ void i386_freepde(int pde)
return;
freepdes[nfreepdes++] = pde;
}
PUBLIC arch_phys_map(int index, phys_bytes *addr, phys_bytes *len, int *flags)
{
/* we don't want anything */
return EINVAL;
}
PUBLIC arch_phys_map_reply(int index, vir_bytes addr)
{
return OK;
}
PUBLIC int arch_enable_paging(void)
{
return OK;
}
+4
View File
@@ -161,5 +161,9 @@ _PROTOTYPE( int vm_suspend, (struct proc *caller, struct proc *target,
phys_bytes lin, phys_bytes size, int wrflag, int type));
_PROTOTYPE( int delivermsg, (struct proc *target));
_PROTOTYPE( void arch_do_syscall, (struct proc *proc) );
_PROTOTYPE( int arch_phys_map, (int index, phys_bytes *addr,
phys_bytes *len, int *flags));
_PROTOTYPE( int arch_phys_map_reply, (int index, vir_bytes addr));
_PROTOTYPE( int arch_enable_paging, (void));
#endif /* PROTO_H */
+24
View File
@@ -22,6 +22,7 @@ register message *m_ptr; /* pointer to request message */
int proc_nr, i;
endpoint_t ep = m_ptr->SVMCTL_WHO;
struct proc *p, *rp, *target;
int err;
if(ep == SELF) { ep = m_ptr->m_source; }
@@ -119,6 +120,11 @@ register message *m_ptr; /* pointer to request message */
return OK;
case VMCTL_ENABLE_PAGING:
/*
* system task must not get preempted while switching to paging,
* interrupt handling is not safe
*/
lock;
if(vm_running)
minix_panic("do_vmctl: paging already enabled", NO_NUM);
vm_init(p);
@@ -126,11 +132,29 @@ register message *m_ptr; /* pointer to request message */
minix_panic("do_vmctl: paging enabling failed", NO_NUM);
vmassert(p->p_delivermsg_lin ==
umap_local(p, D, p->p_delivermsg_vir, sizeof(message)));
if ((err = arch_enable_paging()) != OK) {
unlock;
return err;
}
if(newmap(p, (struct mem_map *) m_ptr->SVMCTL_VALUE) != OK)
minix_panic("do_vmctl: newmap failed", NO_NUM);
FIXLINMSG(p);
vmassert(p->p_delivermsg_lin);
unlock;
return OK;
case VMCTL_KERN_PHYSMAP:
{
int i = m_ptr->SVMCTL_VALUE;
return arch_phys_map(i,
(phys_bytes *) &m_ptr->SVMCTL_MAP_PHYS_ADDR,
(phys_bytes *) &m_ptr->SVMCTL_MAP_PHYS_LEN,
&m_ptr->SVMCTL_MAP_FLAGS);
}
case VMCTL_KERN_MAP_REPLY:
{
return arch_phys_map_reply(m_ptr->SVMCTL_VALUE,
(vir_bytes) m_ptr->SVMCTL_MAP_VIR_ADDR);
}
}
/* Try architecture-specific vmctls. */