imgact_aout.c (103181) | imgact_aout.c (103767) |
---|---|
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 103181 2002-09-10 11:57:02Z bde $ | 26 * $FreeBSD: head/sys/kern/imgact_aout.c 103767 2002-09-21 22:07:17Z jake $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/exec.h> 31#include <sys/imgact.h> 32#include <sys/imgact_aout.h> 33#include <sys/kernel.h> 34#include <sys/lock.h> --- 100 unchanged lines hidden (view full) --- 135 file_offset = 0; 136 } 137 break; 138 case QMAGIC: 139 virtual_offset = PAGE_SIZE; 140 file_offset = 0; 141 /* Pass PS_STRINGS for BSD/OS binaries only. */ 142 if (N_GETMID(*a_out) == MID_ZERO) | 27 */ 28 29#include <sys/param.h> 30#include <sys/exec.h> 31#include <sys/imgact.h> 32#include <sys/imgact_aout.h> 33#include <sys/kernel.h> 34#include <sys/lock.h> --- 100 unchanged lines hidden (view full) --- 135 file_offset = 0; 136 } 137 break; 138 case QMAGIC: 139 virtual_offset = PAGE_SIZE; 140 file_offset = 0; 141 /* Pass PS_STRINGS for BSD/OS binaries only. */ 142 if (N_GETMID(*a_out) == MID_ZERO) |
143 imgp->ps_strings = PS_STRINGS; | 143 imgp->ps_strings = aout_sysvec.sv_psstrings; |
144 break; 145 default: 146 /* NetBSD compatibility */ 147 switch ((int)(ntohl(a_out->a_magic) & 0xffff)) { 148 case ZMAGIC: 149 case QMAGIC: 150 virtual_offset = PAGE_SIZE; 151 file_offset = 0; --- 35 unchanged lines hidden (view full) --- 187 /* copy in arguments and/or environment from old process */ 188 error = exec_extract_strings(imgp); 189 if (error) 190 return (error); 191 192 /* 193 * Destroy old process VM and create a new one (with a new stack) 194 */ | 144 break; 145 default: 146 /* NetBSD compatibility */ 147 switch ((int)(ntohl(a_out->a_magic) & 0xffff)) { 148 case ZMAGIC: 149 case QMAGIC: 150 virtual_offset = PAGE_SIZE; 151 file_offset = 0; --- 35 unchanged lines hidden (view full) --- 187 /* copy in arguments and/or environment from old process */ 188 error = exec_extract_strings(imgp); 189 if (error) 190 return (error); 191 192 /* 193 * Destroy old process VM and create a new one (with a new stack) 194 */ |
195 exec_new_vmspace(imgp, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS, USRSTACK); | 195 exec_new_vmspace(imgp, &aout_sysvec); |
196 197 /* 198 * The vm space can be changed by exec_new_vmspace 199 */ 200 vmspace = imgp->proc->p_vmspace; 201 202 vp = imgp->vp; 203 object = imgp->object; --- 90 unchanged lines hidden (view full) --- 294 free(tempuser, M_TEMP); 295 if (error == 0) 296 error = vn_rdwr(UIO_WRITE, vp, vm->vm_daddr, 297 (int)ctob(vm->vm_dsize), 298 (off_t)ctob(uarea_pages + kstack_pages), UIO_USERSPACE, 299 IO_UNIT | IO_DIRECT, cred, NOCRED, (int *) NULL, td); 300 if (error == 0) 301 error = vn_rdwr_inchunks(UIO_WRITE, vp, | 196 197 /* 198 * The vm space can be changed by exec_new_vmspace 199 */ 200 vmspace = imgp->proc->p_vmspace; 201 202 vp = imgp->vp; 203 object = imgp->object; --- 90 unchanged lines hidden (view full) --- 294 free(tempuser, M_TEMP); 295 if (error == 0) 296 error = vn_rdwr(UIO_WRITE, vp, vm->vm_daddr, 297 (int)ctob(vm->vm_dsize), 298 (off_t)ctob(uarea_pages + kstack_pages), UIO_USERSPACE, 299 IO_UNIT | IO_DIRECT, cred, NOCRED, (int *) NULL, td); 300 if (error == 0) 301 error = vn_rdwr_inchunks(UIO_WRITE, vp, |
302 (caddr_t)trunc_page(USRSTACK - ctob(vm->vm_ssize)), 303 round_page(ctob(vm->vm_ssize)), | 302 (caddr_t)trunc_page(p->p_sysent->sv_usrstack - 303 ctob(vm->vm_ssize)), round_page(ctob(vm->vm_ssize)), |
304 (off_t)ctob(uarea_pages + kstack_pages) + 305 ctob(vm->vm_dsize), UIO_USERSPACE, 306 IO_UNIT | IO_DIRECT, cred, NOCRED, (int *) NULL, td); 307 return (error); 308} 309 310/* 311 * Tell kern_execve.c about it, with a little help from the linker. 312 */ 313static struct execsw aout_execsw = { exec_aout_imgact, "a.out" }; 314EXEC_SET(aout, aout_execsw); | 304 (off_t)ctob(uarea_pages + kstack_pages) + 305 ctob(vm->vm_dsize), UIO_USERSPACE, 306 IO_UNIT | IO_DIRECT, cred, NOCRED, (int *) NULL, td); 307 return (error); 308} 309 310/* 311 * Tell kern_execve.c about it, with a little help from the linker. 312 */ 313static struct execsw aout_execsw = { exec_aout_imgact, "a.out" }; 314EXEC_SET(aout, aout_execsw); |