keep some processes mapped in always; direct message copying
where possible (no buffering); no more explicit vm checkranges in kernel; new allocator for vm using avl tree without needing remapping
This commit is contained in:
@@ -73,11 +73,6 @@ struct proc *p;
|
||||
i386_freepde(m_ptr->SVMCTL_VALUE);
|
||||
return OK;
|
||||
}
|
||||
case VMCTL_I386_INVLPG:
|
||||
{
|
||||
invlpg_range(m_ptr->SVMCTL_VALUE, 1);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
|
||||
extern int vm_copy_in_progress, catch_pagefaults;
|
||||
extern struct proc *vm_copy_from, *vm_copy_to;
|
||||
extern u32_t npagefaults;
|
||||
|
||||
PUBLIC u32_t pagefault_count = 0;
|
||||
|
||||
void pagefault(vir_bytes old_eip, struct proc *pr, int trap_errno,
|
||||
u32_t *old_eipptr, u32_t *old_eaxptr, u32_t pagefaultcr2)
|
||||
@@ -35,8 +32,6 @@ void pagefault(vir_bytes old_eip, struct proc *pr, int trap_errno,
|
||||
vmassert(*old_eipptr == old_eip);
|
||||
vmassert(old_eipptr != &old_eip);
|
||||
|
||||
vmassert(pagefault_count == 1);
|
||||
|
||||
#if 0
|
||||
printf("kernel: pagefault in pr %d, addr 0x%lx, his cr3 0x%lx, actual cr3 0x%lx\n",
|
||||
pr->p_endpoint, pagefaultcr2, pr->p_seg.p_cr3, read_cr3());
|
||||
@@ -48,8 +43,22 @@ void pagefault(vir_bytes old_eip, struct proc *pr, int trap_errno,
|
||||
#endif
|
||||
vmassert(pr->p_seg.p_cr3 == read_cr3());
|
||||
} else {
|
||||
u32_t cr3;
|
||||
lock;
|
||||
cr3 = read_cr3();
|
||||
vmassert(ptproc);
|
||||
vmassert(ptproc->p_seg.p_cr3 == read_cr3());
|
||||
if(ptproc->p_seg.p_cr3 != cr3) {
|
||||
util_stacktrace();
|
||||
printf("cr3 wrong in pagefault; value 0x%lx, ptproc %s / %d, his cr3 0x%lx, pr %s / %d\n",
|
||||
cr3,
|
||||
ptproc->p_name, ptproc->p_endpoint,
|
||||
ptproc->p_seg.p_cr3,
|
||||
pr->p_name, pr->p_endpoint);
|
||||
ser_dump_proc();
|
||||
vm_print(cr3);
|
||||
vm_print(ptproc->p_seg.p_cr3);
|
||||
}
|
||||
unlock;
|
||||
}
|
||||
|
||||
test_eip = k_reenter ? old_eip : pr->p_reg.pc;
|
||||
@@ -65,13 +74,9 @@ void pagefault(vir_bytes old_eip, struct proc *pr, int trap_errno,
|
||||
*old_eipptr = phys_copy_fault;
|
||||
*old_eaxptr = pagefaultcr2;
|
||||
|
||||
pagefault_count = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
npagefaults++;
|
||||
|
||||
/* System processes that don't have their own page table can't
|
||||
* have page faults. VM does have its own page table but also
|
||||
* can't have page faults (because VM has to handle them).
|
||||
@@ -107,8 +112,6 @@ void pagefault(vir_bytes old_eip, struct proc *pr, int trap_errno,
|
||||
|
||||
lock_notify(HARDWARE, VM_PROC_NR);
|
||||
|
||||
pagefault_count = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,5 +68,7 @@ struct pagefault
|
||||
u32_t pf_flags; /* Pagefault flags on stack. */
|
||||
};
|
||||
|
||||
#define INMEMORY(p) (!p->p_seg.p_cr3 || ptproc == p)
|
||||
|
||||
#endif /* #ifndef _I386_TYPES_H */
|
||||
|
||||
|
||||
@@ -40,10 +40,6 @@
|
||||
.define _read_cr4
|
||||
.define _thecr3
|
||||
.define _write_cr4
|
||||
.define _i386_invlpg_addr
|
||||
.define _i386_invlpg_level0
|
||||
.define __memcpy_k
|
||||
.define __memcpy_k_fault
|
||||
.define _catch_pagefaults
|
||||
|
||||
! The routines only guarantee to preserve the registers the C compiler
|
||||
@@ -587,57 +583,3 @@ _getcr3val:
|
||||
mov (_thecr3), eax
|
||||
ret
|
||||
|
||||
!*===========================================================================*
|
||||
!* i386_invlpg *
|
||||
!*===========================================================================*
|
||||
! PUBLIC void i386_invlpg(void);
|
||||
_i386_invlpg_level0:
|
||||
mov eax, (_i386_invlpg_addr)
|
||||
invlpg (eax)
|
||||
ret
|
||||
|
||||
|
||||
!*===========================================================================*
|
||||
!* _memcpy_k *
|
||||
!*===========================================================================*
|
||||
! _memcpy_k() Original Author: Kees J. Bot
|
||||
! 2 Jan 1994
|
||||
! void *_memcpy_k(void *s1, const void *s2, size_t n)
|
||||
! Copy a chunk of memory that the kernel can use to trap pagefaults.
|
||||
.define __memcpy_k
|
||||
.define __memcpy_k_fault
|
||||
.align 16
|
||||
__memcpy_k:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push esi
|
||||
push edi
|
||||
mov edi, 8(ebp) ! String s1
|
||||
mov esi, 12(ebp) ! String s2
|
||||
mov ecx, 16(ebp) ! Length
|
||||
cld ! Clear direction bit: upwards
|
||||
cmp ecx, 16
|
||||
jb upbyte ! Don't bother being smart with short arrays
|
||||
mov eax, esi
|
||||
or eax, edi
|
||||
testb al, 1
|
||||
jnz upbyte ! Bit 0 set, use byte copy
|
||||
testb al, 2
|
||||
jnz upword ! Bit 1 set, use word copy
|
||||
uplword:shrd eax, ecx, 2 ! Save low 2 bits of ecx in eax
|
||||
shr ecx, 2
|
||||
rep
|
||||
movs ! Copy longwords.
|
||||
shld ecx, eax, 2 ! Restore excess count
|
||||
upword: shr ecx, 1
|
||||
rep
|
||||
o16 movs ! Copy words
|
||||
adc ecx, ecx ! One more byte?
|
||||
upbyte: rep
|
||||
movsb ! Copy bytes
|
||||
done: mov eax, 0
|
||||
__memcpy_k_fault: ! Kernel can send us here with pf cr2 in eax
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
@@ -22,20 +22,12 @@ PRIVATE int psok = 0;
|
||||
|
||||
int verifyrange = 0;
|
||||
|
||||
extern u32_t newpde, overwritepde, linlincopies,
|
||||
physzero, invlpgs, straightpdes;
|
||||
|
||||
#define PROCPDEPTR(pr, pi) ((u32_t *) ((u8_t *) vm_pagedirs +\
|
||||
I386_PAGE_SIZE * pr->p_nr + \
|
||||
I386_VM_PT_ENT_SIZE * pi))
|
||||
|
||||
/* Signal to exception handler that pagefaults can happen. */
|
||||
int catch_pagefaults = 0;
|
||||
|
||||
u8_t *vm_pagedirs = NULL;
|
||||
|
||||
u32_t i386_invlpg_addr = 0;
|
||||
|
||||
#define WANT_FREEPDES 100
|
||||
#define NOPDE -1
|
||||
#define PDEMASK(n) (1L << (n))
|
||||
@@ -62,6 +54,145 @@ PUBLIC void vm_init(struct proc *newptproc)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This macro sets up a mapping from within the kernel's address
|
||||
* space to any other area of memory, either straight physical
|
||||
* memory (PROC == NULL) or a process view of memory, in 4MB chunks.
|
||||
* It recognizes PROC having kernel address space as a special case.
|
||||
*
|
||||
* It sets PTR to the pointer within kernel address space at the start
|
||||
* of the 4MB chunk, and OFFSET to the offset within that chunk
|
||||
* that corresponds to LINADDR.
|
||||
*
|
||||
* It needs FREEPDE (available and addressable PDE within kernel
|
||||
* address space), SEG (hardware segment), VIRT (in-datasegment
|
||||
* address if known).
|
||||
*/
|
||||
#define CREATEPDE(PROC, PTR, LINADDR, REMAIN, BYTES, PDE) { \
|
||||
int proc_pde_index; \
|
||||
proc_pde_index = I386_VM_PDE(LINADDR); \
|
||||
PDE = NOPDE; \
|
||||
if((PROC) && (((PROC) == ptproc) || !HASPT(PROC))) { \
|
||||
PTR = LINADDR; \
|
||||
} else { \
|
||||
int fp; \
|
||||
int mustinvl; \
|
||||
u32_t pdeval, *pdevalptr, mask; \
|
||||
phys_bytes offset; \
|
||||
vmassert(psok); \
|
||||
if(PROC) { \
|
||||
u32_t *pdeptr; \
|
||||
vmassert(!iskernelp(PROC)); \
|
||||
vmassert(HASPT(PROC)); \
|
||||
pdeptr = PROCPDEPTR(PROC, proc_pde_index); \
|
||||
pdeval = *pdeptr; \
|
||||
} else { \
|
||||
vmassert(!iskernelp(PROC)); \
|
||||
pdeval = (LINADDR & I386_VM_ADDR_MASK_4MB) | \
|
||||
I386_VM_BIGPAGE | I386_VM_PRESENT | \
|
||||
I386_VM_WRITE | I386_VM_USER; \
|
||||
} \
|
||||
for(fp = 0; fp < nfreepdes; fp++) { \
|
||||
int k = freepdes[fp]; \
|
||||
if(inusepde == k) \
|
||||
continue; \
|
||||
PDE = k; \
|
||||
mask = PDEMASK(k); \
|
||||
vmassert(mask); \
|
||||
if(dirtypde & mask) \
|
||||
continue; \
|
||||
break; \
|
||||
} \
|
||||
vmassert(PDE != NOPDE); \
|
||||
vmassert(mask); \
|
||||
if(dirtypde & mask) { \
|
||||
mustinvl = 1; \
|
||||
} else { \
|
||||
mustinvl = 0; \
|
||||
} \
|
||||
inusepde = PDE; \
|
||||
*PROCPDEPTR(ptproc, PDE) = pdeval; \
|
||||
offset = LINADDR & I386_VM_OFFSET_MASK_4MB; \
|
||||
PTR = I386_BIG_PAGE_SIZE*PDE + offset; \
|
||||
REMAIN = MIN(REMAIN, I386_BIG_PAGE_SIZE - offset); \
|
||||
if(mustinvl) { \
|
||||
level0(reload_cr3); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DONEPDE(PDE) { \
|
||||
if(PDE != NOPDE) { \
|
||||
dirtypde |= PDEMASK(PDE); \
|
||||
*PROCPDEPTR(ptproc, PDE) = 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*===========================================================================*
|
||||
* lin_lin_copy *
|
||||
*===========================================================================*/
|
||||
int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
|
||||
struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes)
|
||||
{
|
||||
u32_t addr;
|
||||
int procslot;
|
||||
NOREC_ENTER(linlincopy);
|
||||
|
||||
FIXME("lin_lin_copy requires big pages");
|
||||
vmassert(vm_running);
|
||||
vmassert(!catch_pagefaults);
|
||||
vmassert(nfreepdes >= 3);
|
||||
|
||||
vmassert(ptproc);
|
||||
vmassert(proc_ptr);
|
||||
vmassert(read_cr3() == ptproc->p_seg.p_cr3);
|
||||
|
||||
procslot = ptproc->p_nr;
|
||||
|
||||
vmassert(procslot >= 0 && procslot < I386_VM_DIR_ENTRIES);
|
||||
|
||||
while(bytes > 0) {
|
||||
phys_bytes srcptr, dstptr;
|
||||
vir_bytes chunk = bytes;
|
||||
int srcpde, dstpde;
|
||||
|
||||
/* Set up 4MB ranges. */
|
||||
inusepde = NOPDE;
|
||||
CREATEPDE(srcproc, srcptr, srclinaddr, chunk, bytes, srcpde);
|
||||
CREATEPDE(dstproc, dstptr, dstlinaddr, chunk, bytes, dstpde);
|
||||
|
||||
/* Copy pages. */
|
||||
PHYS_COPY_CATCH(srcptr, dstptr, chunk, addr);
|
||||
|
||||
DONEPDE(srcpde);
|
||||
DONEPDE(dstpde);
|
||||
|
||||
if(addr) {
|
||||
if(addr >= srcptr && addr < (srcptr + chunk)) {
|
||||
NOREC_RETURN(linlincopy, EFAULT_SRC);
|
||||
}
|
||||
if(addr >= dstptr && addr < (dstptr + chunk)) {
|
||||
NOREC_RETURN(linlincopy, EFAULT_DST);
|
||||
}
|
||||
minix_panic("lin_lin_copy fault out of range", NO_NUM);
|
||||
|
||||
/* Not reached. */
|
||||
NOREC_RETURN(linlincopy, EFAULT);
|
||||
}
|
||||
|
||||
/* Update counter and addresses for next iteration, if any. */
|
||||
bytes -= chunk;
|
||||
srclinaddr += chunk;
|
||||
dstlinaddr += chunk;
|
||||
}
|
||||
|
||||
NOREC_RETURN(linlincopy, OK);
|
||||
}
|
||||
|
||||
|
||||
PRIVATE u32_t phys_get32(addr)
|
||||
phys_bytes addr;
|
||||
{
|
||||
@@ -448,8 +579,6 @@ PUBLIC int vm_contiguous(struct proc *targetproc, u32_t vir_buf, size_t bytes)
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern u32_t vmreqs;
|
||||
|
||||
/*===========================================================================*
|
||||
* vm_suspend *
|
||||
*===========================================================================*/
|
||||
@@ -472,8 +601,6 @@ PUBLIC int vm_suspend(struct proc *caller, struct proc *target,
|
||||
util_stacktrace_strcat(caller->p_vmrequest.stacktrace);
|
||||
#endif
|
||||
|
||||
vmreqs++;
|
||||
|
||||
caller->p_vmrequest.writeflag = 1;
|
||||
caller->p_vmrequest.start = linaddr;
|
||||
caller->p_vmrequest.length = len;
|
||||
@@ -499,18 +626,21 @@ int delivermsg(struct proc *rp)
|
||||
vmassert(rp->p_delivermsg.m_source != NONE);
|
||||
|
||||
vmassert(rp->p_delivermsg_lin);
|
||||
vmassert(rp->p_delivermsg_lin ==
|
||||
#if DEBUG_VMASSERT
|
||||
if(rp->p_delivermsg_lin !=
|
||||
umap_local(rp, D, rp->p_delivermsg_vir, sizeof(message))) {
|
||||
printf("vir: 0x%lx lin was: 0x%lx umap now: 0x%lx\n",
|
||||
rp->p_delivermsg_vir, rp->p_delivermsg_lin,
|
||||
umap_local(rp, D, rp->p_delivermsg_vir, sizeof(message)));
|
||||
minix_panic("that's wrong", NO_NUM);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
vm_set_cr3(rp);
|
||||
|
||||
vmassert(intr_disabled());
|
||||
vmassert(!catch_pagefaults);
|
||||
catch_pagefaults = 1;
|
||||
addr = phys_copy(vir2phys(&rp->p_delivermsg),
|
||||
rp->p_delivermsg_lin, sizeof(message));
|
||||
vmassert(catch_pagefaults);
|
||||
catch_pagefaults = 0;
|
||||
PHYS_COPY_CATCH(vir2phys(&rp->p_delivermsg),
|
||||
rp->p_delivermsg_lin, sizeof(message), addr);
|
||||
|
||||
if(addr) {
|
||||
printf("phys_copy failed - addr 0x%lx\n", addr);
|
||||
@@ -600,32 +730,6 @@ void vm_print(u32_t *root)
|
||||
return;
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* invlpg_range *
|
||||
*===========================================================================*/
|
||||
void invlpg_range(u32_t lin, u32_t bytes)
|
||||
{
|
||||
/* Remove a range of translated addresses from the TLB.
|
||||
* Addresses are in linear, i.e., post-segment, pre-pagetable
|
||||
* form. Parameters are byte values, any offset and any multiple.
|
||||
*/
|
||||
u32_t cr3;
|
||||
u32_t o, limit, addr;
|
||||
limit = lin + bytes - 1;
|
||||
o = lin % I386_PAGE_SIZE;
|
||||
lin -= o;
|
||||
limit = (limit + o) & I386_VM_ADDR_MASK;
|
||||
#if 1
|
||||
for(i386_invlpg_addr = lin; i386_invlpg_addr <= limit;
|
||||
i386_invlpg_addr += I386_PAGE_SIZE) {
|
||||
invlpgs++;
|
||||
level0(i386_invlpg_level0);
|
||||
}
|
||||
#else
|
||||
level0(reload_cr3);
|
||||
#endif
|
||||
}
|
||||
|
||||
u32_t thecr3;
|
||||
|
||||
u32_t read_cr3(void)
|
||||
@@ -634,153 +738,6 @@ u32_t read_cr3(void)
|
||||
return thecr3;
|
||||
}
|
||||
|
||||
/* This macro sets up a mapping from within the kernel's address
|
||||
* space to any other area of memory, either straight physical
|
||||
* memory (PROC == NULL) or a process view of memory, in 4MB chunks.
|
||||
* It recognizes PROC having kernel address space as a special case.
|
||||
*
|
||||
* It sets PTR to the pointer within kernel address space at the start
|
||||
* of the 4MB chunk, and OFFSET to the offset within that chunk
|
||||
* that corresponds to LINADDR.
|
||||
*
|
||||
* It needs FREEPDE (available and addressable PDE within kernel
|
||||
* address space), SEG (hardware segment), VIRT (in-datasegment
|
||||
* address if known).
|
||||
*/
|
||||
#define CREATEPDE(PROC, PTR, LINADDR, REMAIN, BYTES, PDE) { \
|
||||
int proc_pde_index; \
|
||||
FIXME("CREATEPDE: check if invlpg is necessary"); \
|
||||
proc_pde_index = I386_VM_PDE(LINADDR); \
|
||||
PDE = NOPDE; \
|
||||
if((PROC) && (((PROC) == ptproc) || iskernelp(PROC))) { \
|
||||
PTR = LINADDR; \
|
||||
straightpdes++; \
|
||||
} else { \
|
||||
int fp; \
|
||||
int mustinvl; \
|
||||
u32_t pdeval, *pdevalptr, mask; \
|
||||
phys_bytes offset; \
|
||||
vmassert(psok); \
|
||||
if(PROC) { \
|
||||
u32_t *pdeptr; \
|
||||
vmassert(!iskernelp(PROC)); \
|
||||
vmassert(HASPT(PROC)); \
|
||||
pdeptr = PROCPDEPTR(PROC, proc_pde_index); \
|
||||
pdeval = *pdeptr; \
|
||||
} else { \
|
||||
vmassert(!iskernelp(PROC)); \
|
||||
pdeval = (LINADDR & I386_VM_ADDR_MASK_4MB) | \
|
||||
I386_VM_BIGPAGE | I386_VM_PRESENT | \
|
||||
I386_VM_WRITE | I386_VM_USER; \
|
||||
} \
|
||||
for(fp = 0; fp < nfreepdes; fp++) { \
|
||||
int k = freepdes[fp]; \
|
||||
if(inusepde == k) \
|
||||
continue; \
|
||||
PDE = k; \
|
||||
mask = PDEMASK(k); \
|
||||
vmassert(mask); \
|
||||
if(dirtypde & mask) \
|
||||
continue; \
|
||||
break; \
|
||||
} \
|
||||
vmassert(PDE != NOPDE); \
|
||||
vmassert(mask); \
|
||||
if(dirtypde & mask) { \
|
||||
mustinvl = 1; \
|
||||
overwritepde++; \
|
||||
} else { \
|
||||
mustinvl = 0; \
|
||||
newpde++; \
|
||||
} \
|
||||
inusepde = PDE; \
|
||||
*PROCPDEPTR(ptproc, PDE) = pdeval; \
|
||||
offset = LINADDR & I386_VM_OFFSET_MASK_4MB; \
|
||||
PTR = I386_BIG_PAGE_SIZE*PDE + offset; \
|
||||
REMAIN = MIN(REMAIN, I386_BIG_PAGE_SIZE - offset); \
|
||||
if(mustinvl) { \
|
||||
invlpg_range(PTR, REMAIN); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DONEPDE(PDE) { \
|
||||
if(PDE != NOPDE) { \
|
||||
dirtypde |= PDEMASK(PDE); \
|
||||
*PROCPDEPTR(ptproc, PDE) = 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*===========================================================================*
|
||||
* lin_lin_copy *
|
||||
*===========================================================================*/
|
||||
int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
|
||||
struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes)
|
||||
{
|
||||
u32_t addr;
|
||||
int procslot;
|
||||
NOREC_ENTER(linlincopy);
|
||||
|
||||
linlincopies++;
|
||||
|
||||
FIXME("lin_lin_copy requires big pages");
|
||||
vmassert(vm_running);
|
||||
vmassert(!catch_pagefaults);
|
||||
vmassert(nfreepdes >= 3);
|
||||
|
||||
vmassert(ptproc);
|
||||
vmassert(proc_ptr);
|
||||
vmassert(read_cr3() == ptproc->p_seg.p_cr3);
|
||||
|
||||
procslot = ptproc->p_nr;
|
||||
|
||||
vmassert(procslot >= 0 && procslot < I386_VM_DIR_ENTRIES);
|
||||
|
||||
while(bytes > 0) {
|
||||
phys_bytes srcptr, dstptr;
|
||||
vir_bytes chunk = bytes;
|
||||
int srcpde, dstpde;
|
||||
|
||||
/* Set up 4MB ranges. */
|
||||
inusepde = NOPDE;
|
||||
CREATEPDE(srcproc, srcptr, srclinaddr, chunk, bytes, srcpde);
|
||||
CREATEPDE(dstproc, dstptr, dstlinaddr, chunk, bytes, dstpde);
|
||||
|
||||
/* Copy pages. */
|
||||
vmassert(intr_disabled());
|
||||
vmassert(!catch_pagefaults);
|
||||
catch_pagefaults = 1;
|
||||
addr=phys_copy(srcptr, dstptr, chunk);
|
||||
vmassert(intr_disabled());
|
||||
vmassert(catch_pagefaults);
|
||||
catch_pagefaults = 0;
|
||||
|
||||
DONEPDE(srcpde);
|
||||
DONEPDE(dstpde);
|
||||
|
||||
if(addr) {
|
||||
if(addr >= srcptr && addr < (srcptr + chunk)) {
|
||||
NOREC_RETURN(linlincopy, EFAULT_SRC);
|
||||
}
|
||||
if(addr >= dstptr && addr < (dstptr + chunk)) {
|
||||
NOREC_RETURN(linlincopy, EFAULT_DST);
|
||||
}
|
||||
minix_panic("lin_lin_copy fault out of range", NO_NUM);
|
||||
|
||||
/* Not reached. */
|
||||
NOREC_RETURN(linlincopy, EFAULT);
|
||||
}
|
||||
|
||||
/* Update counter and addresses for next iteration, if any. */
|
||||
bytes -= chunk;
|
||||
srclinaddr += chunk;
|
||||
dstlinaddr += chunk;
|
||||
}
|
||||
|
||||
NOREC_RETURN(linlincopy, OK);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* lin_memset *
|
||||
@@ -791,8 +748,6 @@ int vm_phys_memset(phys_bytes ph, u8_t c, phys_bytes bytes)
|
||||
u32_t p;
|
||||
p = c | (c << 8) | (c << 16) | (c << 24);
|
||||
|
||||
physzero++;
|
||||
|
||||
if(!vm_running) {
|
||||
phys_memset(ph, p, bytes);
|
||||
return OK;
|
||||
|
||||
@@ -73,9 +73,6 @@ begbss:
|
||||
|
||||
.define _restart
|
||||
.define save
|
||||
.define _pagefault_count
|
||||
.define _cr3_test
|
||||
.define _cr3_reload
|
||||
.define _reload_cr3
|
||||
.define _write_cr3 ! write cr3
|
||||
|
||||
@@ -409,13 +406,11 @@ _restart:
|
||||
call _schedcheck ! ask C function who we're running
|
||||
mov esp, (_proc_ptr) ! will assume P_STACKBASE == 0
|
||||
lldt P_LDT_SEL(esp) ! enable process' segment descriptors
|
||||
inc (_cr3_test)
|
||||
cmp P_CR3(esp), 0 ! process does not have its own PT
|
||||
jz 0f
|
||||
mov eax, P_CR3(esp)
|
||||
cmp eax, (loadedcr3)
|
||||
jz 0f
|
||||
inc (_cr3_reload)
|
||||
mov cr3, eax
|
||||
mov (loadedcr3), eax
|
||||
mov eax, (_proc_ptr)
|
||||
@@ -498,7 +493,6 @@ _page_fault:
|
||||
push eax
|
||||
mov eax, cr2
|
||||
sseg mov (pagefaultcr2), eax
|
||||
sseg inc (_pagefault_count)
|
||||
pop eax
|
||||
jmp errexception
|
||||
|
||||
@@ -566,10 +560,8 @@ _write_cr3:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
mov eax, 8(ebp)
|
||||
inc (_cr3_test)
|
||||
cmp eax, (loadedcr3)
|
||||
jz 0f
|
||||
inc (_cr3_reload)
|
||||
mov cr3, eax
|
||||
mov (loadedcr3), eax
|
||||
mov (_dirtypde), 0
|
||||
@@ -584,7 +576,6 @@ _write_cr3:
|
||||
_reload_cr3:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
inc (_cr3_reload)
|
||||
mov (_dirtypde), 0
|
||||
mov eax, cr3
|
||||
mov cr3, eax
|
||||
|
||||
Reference in New Issue
Block a user