mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-22 00:42:06 +01:00
Changed vm_fault_quick in vm_machdep.c to be global. Needed for
new pipe code.
This commit is contained in:
parent
267173e72d
commit
dca5129987
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13909
@ -69,8 +69,6 @@
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
|
||||
static void vm_fault_quick __P((caddr_t v, int prot));
|
||||
|
||||
#ifdef BOUNCE_BUFFERS
|
||||
static vm_offset_t
|
||||
vm_bounce_kva __P((int size, int waitok));
|
||||
@ -540,7 +538,7 @@ vm_bounce_init()
|
||||
/*
|
||||
* quick version of vm_fault
|
||||
*/
|
||||
static void
|
||||
void
|
||||
vm_fault_quick(v, prot)
|
||||
caddr_t v;
|
||||
int prot;
|
||||
@ -564,8 +562,8 @@ int
|
||||
cpu_fork(p1, p2)
|
||||
register struct proc *p1, *p2;
|
||||
{
|
||||
struct pcb *pcb2 = &p2->p_addr->u_pcb;
|
||||
int sp, offset;
|
||||
register struct user *up = p2->p_addr;
|
||||
int offset;
|
||||
|
||||
/*
|
||||
* Copy pcb and stack from proc p1 to p2.
|
||||
@ -573,25 +571,23 @@ cpu_fork(p1, p2)
|
||||
* part of the stack. The stack and pcb need to agree;
|
||||
* this is tricky, as the final pcb is constructed by savectx,
|
||||
* but its frame isn't yet on the stack when the stack is copied.
|
||||
* swtch compensates for this when the child eventually runs.
|
||||
* This should be done differently, with a single call
|
||||
* that copies and updates the pcb+stack,
|
||||
* replacing the bcopy and savectx.
|
||||
*/
|
||||
|
||||
__asm __volatile("movl %%esp,%0" : "=r" (sp));
|
||||
offset = sp - (int)kstack;
|
||||
|
||||
p2->p_addr->u_pcb = p1->p_addr->u_pcb;
|
||||
offset = mvesp() - (int)kstack;
|
||||
bcopy((caddr_t)kstack + offset, (caddr_t)p2->p_addr + offset,
|
||||
(unsigned) ctob(UPAGES) - offset);
|
||||
p2->p_md.md_regs = p1->p_md.md_regs;
|
||||
|
||||
*pcb2 = p1->p_addr->u_pcb;
|
||||
pcb2->pcb_cr3 = vtophys(p2->p_vmspace->vm_pmap.pm_pdir);
|
||||
pmap_activate(&p2->p_vmspace->vm_pmap, &up->u_pcb);
|
||||
|
||||
/*
|
||||
* Returns (0) in parent, (1) in child.
|
||||
* Return (0) in parent, (1) in child.
|
||||
*/
|
||||
return (savectx(pcb2));
|
||||
return (savectx(&up->u_pcb));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -69,8 +69,6 @@
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
|
||||
static void vm_fault_quick __P((caddr_t v, int prot));
|
||||
|
||||
#ifdef BOUNCE_BUFFERS
|
||||
static vm_offset_t
|
||||
vm_bounce_kva __P((int size, int waitok));
|
||||
@ -540,7 +538,7 @@ vm_bounce_init()
|
||||
/*
|
||||
* quick version of vm_fault
|
||||
*/
|
||||
static void
|
||||
void
|
||||
vm_fault_quick(v, prot)
|
||||
caddr_t v;
|
||||
int prot;
|
||||
@ -564,8 +562,8 @@ int
|
||||
cpu_fork(p1, p2)
|
||||
register struct proc *p1, *p2;
|
||||
{
|
||||
struct pcb *pcb2 = &p2->p_addr->u_pcb;
|
||||
int sp, offset;
|
||||
register struct user *up = p2->p_addr;
|
||||
int offset;
|
||||
|
||||
/*
|
||||
* Copy pcb and stack from proc p1 to p2.
|
||||
@ -573,25 +571,23 @@ cpu_fork(p1, p2)
|
||||
* part of the stack. The stack and pcb need to agree;
|
||||
* this is tricky, as the final pcb is constructed by savectx,
|
||||
* but its frame isn't yet on the stack when the stack is copied.
|
||||
* swtch compensates for this when the child eventually runs.
|
||||
* This should be done differently, with a single call
|
||||
* that copies and updates the pcb+stack,
|
||||
* replacing the bcopy and savectx.
|
||||
*/
|
||||
|
||||
__asm __volatile("movl %%esp,%0" : "=r" (sp));
|
||||
offset = sp - (int)kstack;
|
||||
|
||||
p2->p_addr->u_pcb = p1->p_addr->u_pcb;
|
||||
offset = mvesp() - (int)kstack;
|
||||
bcopy((caddr_t)kstack + offset, (caddr_t)p2->p_addr + offset,
|
||||
(unsigned) ctob(UPAGES) - offset);
|
||||
p2->p_md.md_regs = p1->p_md.md_regs;
|
||||
|
||||
*pcb2 = p1->p_addr->u_pcb;
|
||||
pcb2->pcb_cr3 = vtophys(p2->p_vmspace->vm_pmap.pm_pdir);
|
||||
pmap_activate(&p2->p_vmspace->vm_pmap, &up->u_pcb);
|
||||
|
||||
/*
|
||||
* Returns (0) in parent, (1) in child.
|
||||
* Return (0) in parent, (1) in child.
|
||||
*/
|
||||
return (savectx(pcb2));
|
||||
return (savectx(&up->u_pcb));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -185,6 +185,9 @@ free1:
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate kva for pipe circular buffer, the space is pageable
|
||||
*/
|
||||
static void
|
||||
pipespace(cpipe)
|
||||
struct pipe *cpipe;
|
||||
@ -464,7 +467,7 @@ pipe_build_write_buffer(wpipe, uio)
|
||||
|
||||
vm_page_t m;
|
||||
|
||||
vm_fault_quick( addr, VM_PROT_READ);
|
||||
vm_fault_quick( (caddr_t) addr, VM_PROT_READ);
|
||||
paddr = pmap_kextract(addr);
|
||||
if (!paddr) {
|
||||
int j;
|
||||
@ -765,6 +768,10 @@ pipewrite(wpipe, uio, nbio)
|
||||
wakeup(wpipe);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't return EPIPE if I/O was successful
|
||||
*/
|
||||
if ((wpipe->pipe_buffer.cnt == 0) &&
|
||||
(uio->uio_resid == 0) &&
|
||||
(error == EPIPE))
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vm_extern.h 8.2 (Berkeley) 1/12/94
|
||||
* $Id: vm_extern.h,v 1.21 1995/12/11 04:58:04 dyson Exp $
|
||||
* $Id: vm_extern.h,v 1.22 1995/12/14 09:54:55 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _VM_EXTERN_H_
|
||||
@ -104,6 +104,7 @@ void vslock __P((caddr_t, u_int));
|
||||
void vsunlock __P((caddr_t, u_int, int));
|
||||
void vm_object_print __P((/* db_expr_t */ int, boolean_t, /* db_expr_t */ int,
|
||||
char *));
|
||||
void vm_fault_quick __P((caddr_t v, int prot));
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user