Lines Matching refs:gz
154 do_aout_hdr(struct imgact_gzip * gz)
164 switch ((int) (gz->a_out.a_midmag & 0xffff)) {
166 gz->virtual_offset = 0;
167 if (gz->a_out.a_text) {
168 gz->file_offset = PAGE_SIZE;
171 gz->file_offset = 0;
175 gz->virtual_offset = PAGE_SIZE;
176 gz->file_offset = 0;
180 switch ((int) (ntohl(gz->a_out.a_midmag) & 0xffff)) {
183 gz->virtual_offset = PAGE_SIZE;
184 gz->file_offset = 0;
187 gz->where = __LINE__;
192 gz->bss_size = roundup(gz->a_out.a_bss, PAGE_SIZE);
198 gz->a_out.a_entry < gz->virtual_offset ||
199 gz->a_out.a_entry >= gz->virtual_offset + gz->a_out.a_text ||
202 gz->a_out.a_text & PAGE_MASK || gz->a_out.a_data & PAGE_MASK) {
203 gz->where = __LINE__;
209 PROC_LOCK(gz->ip->proc);
211 gz->a_out.a_text > maxtsiz ||
214 gz->a_out.a_data + gz->bss_size >
215 lim_cur_proc(gz->ip->proc, RLIMIT_DATA) ||
216 racct_set(gz->ip->proc, RACCT_DATA,
217 gz->a_out.a_data + gz->bss_size) != 0) {
218 PROC_UNLOCK(gz->ip->proc);
219 gz->where = __LINE__;
222 PROC_UNLOCK(gz->ip->proc);
224 gz->file_end = gz->file_offset + gz->a_out.a_text + gz->a_out.a_data;
234 VOP_UNLOCK(gz->ip->vp, 0);
239 error = exec_new_vmspace(gz->ip, &aout_sysvec);
241 vn_lock(gz->ip->vp, LK_EXCLUSIVE | LK_RETRY);
243 gz->where = __LINE__;
247 vmspace = gz->ip->proc->p_vmspace;
249 vmaddr = gz->virtual_offset;
253 gz->a_out.a_text + gz->a_out.a_data,
260 gz->where = __LINE__;
264 if (gz->bss_size != 0) {
270 vmaddr = gz->virtual_offset + gz->a_out.a_text +
271 gz->a_out.a_data;
273 gz->bss_size, 0, VMFS_NO_SPACE, VM_PROT_ALL, VM_PROT_ALL,
276 gz->where = __LINE__;
281 vmspace->vm_tsize = gz->a_out.a_text >> PAGE_SHIFT;
282 vmspace->vm_dsize = (gz->a_out.a_data + gz->bss_size) >> PAGE_SHIFT;
283 vmspace->vm_taddr = (caddr_t) (uintptr_t) gz->virtual_offset;
285 (gz->virtual_offset + gz->a_out.a_text);
288 gz->ip->interpreted = 0;
289 gz->ip->entry_addr = gz->a_out.a_entry;
291 gz->ip->proc->p_sysent = &aout_sysvec;
333 struct imgact_gzip *gz = (struct imgact_gzip *) vp;
338 if (gz->output < sizeof gz->a_out) {
339 q = (u_char *) & gz->a_out;
340 i = min(siz, sizeof gz->a_out - gz->output);
341 bcopy(p, q + gz->output, i);
342 gz->output += i;
345 if (gz->output == sizeof gz->a_out) {
346 gz->gotheader = 1;
347 i = do_aout_hdr(gz);
349 if (!gz->where)
350 gz->where = __LINE__;
351 gz->error = ENOEXEC;
354 gz->where = __LINE__;
355 gz->error = i;
358 if (gz->file_offset == 0) {
359 q = (u_char *) (uintptr_t) gz->virtual_offset;
360 copyout(&gz->a_out, q, sizeof gz->a_out);
365 if (gz->output < gz->file_offset &&
366 gz->output + siz > gz->file_offset) {
367 i = min(siz, gz->file_offset - gz->output);
368 gz->output += i;
372 if (gz->output >= gz->file_offset && gz->output < gz->file_end) {
373 i = min(siz, gz->file_end - gz->output);
375 (gz->virtual_offset + gz->output - gz->file_offset);
377 gz->output += i;
381 gz->output += siz;