Deleted Added
full compact
imgact_aout.c (102808) imgact_aout.c (103047)
1/*
2 * Copyright (c) 1993, David Greenman
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*
2 * Copyright (c) 1993, David Greenman
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/kern/imgact_aout.c 102808 2002-09-01 21:41:24Z jake $
26 * $FreeBSD: head/sys/kern/imgact_aout.c 103047 2002-09-07 01:23:51Z peter $
27 */
28
29#include "opt_kstack_pages.h"
30
31#include <sys/param.h>
32#include <sys/exec.h>
33#include <sys/fcntl.h>
34#include <sys/imgact.h>

--- 9 unchanged lines hidden (view full) ---

44#include <sys/signalvar.h>
45#include <sys/stat.h>
46#include <sys/sysent.h>
47#include <sys/syscall.h>
48#include <sys/vnode.h>
49#include <sys/user.h>
50
51#include <machine/md_var.h>
27 */
28
29#include "opt_kstack_pages.h"
30
31#include <sys/param.h>
32#include <sys/exec.h>
33#include <sys/fcntl.h>
34#include <sys/imgact.h>

--- 9 unchanged lines hidden (view full) ---

44#include <sys/signalvar.h>
45#include <sys/stat.h>
46#include <sys/sysent.h>
47#include <sys/syscall.h>
48#include <sys/vnode.h>
49#include <sys/user.h>
50
51#include <machine/md_var.h>
52#include <machine/frame.h>
52
53#include <vm/vm.h>
54#include <vm/vm_param.h>
55#include <vm/pmap.h>
56#include <vm/vm_map.h>
57#include <vm/vm_object.h>
58
59static int exec_aout_imgact(struct image_params *imgp);

--- 208 unchanged lines hidden (view full) ---

268aout_coredump(td, vp, limit)
269 register struct thread *td;
270 register struct vnode *vp;
271 off_t limit;
272{
273 struct proc *p = td->td_proc;
274 register struct ucred *cred = td->td_ucred;
275 register struct vmspace *vm = p->p_vmspace;
53
54#include <vm/vm.h>
55#include <vm/vm_param.h>
56#include <vm/pmap.h>
57#include <vm/vm_map.h>
58#include <vm/vm_object.h>
59
60static int exec_aout_imgact(struct image_params *imgp);

--- 208 unchanged lines hidden (view full) ---

269aout_coredump(td, vp, limit)
270 register struct thread *td;
271 register struct vnode *vp;
272 off_t limit;
273{
274 struct proc *p = td->td_proc;
275 register struct ucred *cred = td->td_ucred;
276 register struct vmspace *vm = p->p_vmspace;
277 caddr_t tempuser;
276 int error;
277
278 if (ctob((UAREA_PAGES + KSTACK_PAGES)
279 + vm->vm_dsize + vm->vm_ssize) >= limit)
280 return (EFAULT);
278 int error;
279
280 if (ctob((UAREA_PAGES + KSTACK_PAGES)
281 + vm->vm_dsize + vm->vm_ssize) >= limit)
282 return (EFAULT);
283 tempuser = malloc(ctob(UAREA_PAGES + KSTACK_PAGES), M_TEMP,
284 M_WAITOK | M_ZERO);
285 if (tempuser == NULL)
286 return (ENOMEM);
287 bcopy(p->p_uarea, tempuser, sizeof(struct user));
288 bcopy(td->td_frame,
289 tempuser + ctob(UAREA_PAGES) +
290 ((caddr_t) td->td_frame - (caddr_t) td->td_kstack),
291 sizeof(struct trapframe));
281 PROC_LOCK(p);
282 fill_kinfo_proc(p, &p->p_uarea->u_kproc);
283 PROC_UNLOCK(p);
292 PROC_LOCK(p);
293 fill_kinfo_proc(p, &p->p_uarea->u_kproc);
294 PROC_UNLOCK(p);
284 error = cpu_coredump(td, vp, cred);
295 error = vn_rdwr(UIO_WRITE, vp, (caddr_t) tempuser,
296 ctob(UAREA_PAGES + KSTACK_PAGES),
297 (off_t)0, UIO_SYSSPACE, IO_UNIT, cred, NOCRED,
298 (int *)NULL, td);
299 free(tempuser, M_TEMP);
285 if (error == 0)
286 error = vn_rdwr(UIO_WRITE, vp, vm->vm_daddr,
287 (int)ctob(vm->vm_dsize),
288 (off_t)ctob(UAREA_PAGES + KSTACK_PAGES), UIO_USERSPACE,
289 IO_UNIT | IO_DIRECT, cred, NOCRED, (int *) NULL, td);
290 if (error == 0)
291 error = vn_rdwr_inchunks(UIO_WRITE, vp,
292 (caddr_t) trunc_page(USRSTACK - ctob(vm->vm_ssize)),

--- 12 unchanged lines hidden ---
300 if (error == 0)
301 error = vn_rdwr(UIO_WRITE, vp, vm->vm_daddr,
302 (int)ctob(vm->vm_dsize),
303 (off_t)ctob(UAREA_PAGES + KSTACK_PAGES), UIO_USERSPACE,
304 IO_UNIT | IO_DIRECT, cred, NOCRED, (int *) NULL, td);
305 if (error == 0)
306 error = vn_rdwr_inchunks(UIO_WRITE, vp,
307 (caddr_t) trunc_page(USRSTACK - ctob(vm->vm_ssize)),

--- 12 unchanged lines hidden ---