vm_machdep.c (cbd59a4f658ff44ebe2aab164cc6f830f8dfcd62) vm_machdep.c (a7b890448ca154fad9a3205e6294c362ea92f533)
1/*-
2 * Copyright (c) 1982, 1986 The Regents of the University of California.
3 * Copyright (c) 1989, 1990 William Jolitz
4 * Copyright (c) 1994 John Dyson
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer

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

46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/kernel.h>
49#include <sys/malloc.h>
50#include <sys/mbuf.h>
51#include <sys/proc.h>
52#include <sys/socketvar.h>
53#include <sys/sf_buf.h>
1/*-
2 * Copyright (c) 1982, 1986 The Regents of the University of California.
3 * Copyright (c) 1989, 1990 William Jolitz
4 * Copyright (c) 1994 John Dyson
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer

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

46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/kernel.h>
49#include <sys/malloc.h>
50#include <sys/mbuf.h>
51#include <sys/proc.h>
52#include <sys/socketvar.h>
53#include <sys/sf_buf.h>
54#include <sys/syscall.h>
55#include <sys/sysent.h>
54#include <sys/unistd.h>
55#include <machine/cpu.h>
56#include <machine/pcb.h>
57#include <machine/sysarch.h>
58#include <sys/lock.h>
59#include <sys/mutex.h>
60
61#include <vm/vm.h>

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

256 nsfbufspeak = imax(nsfbufspeak, nsfbufsused);
257 pmap_kenter(sf->kva, VM_PAGE_TO_PHYS(sf->m));
258done:
259 mtx_unlock(&sf_buf_lock);
260 return (sf);
261#endif
262}
263
56#include <sys/unistd.h>
57#include <machine/cpu.h>
58#include <machine/pcb.h>
59#include <machine/sysarch.h>
60#include <sys/lock.h>
61#include <sys/mutex.h>
62
63#include <vm/vm.h>

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

258 nsfbufspeak = imax(nsfbufspeak, nsfbufsused);
259 pmap_kenter(sf->kva, VM_PAGE_TO_PHYS(sf->m));
260done:
261 mtx_unlock(&sf_buf_lock);
262 return (sf);
263#endif
264}
265
266void
267cpu_set_syscall_retval(struct thread *td, int error)
268{
269 trapframe_t *frame;
270 int fixup;
271#ifdef __ARMEB__
272 uint32_t insn;
273#endif
274
275 frame = td->td_frame;
276 fixup = 0;
277
278#ifdef __ARMEB__
279 insn = *(u_int32_t *)(frame->tf_pc - INSN_SIZE);
280 if ((insn & 0x000fffff) == SYS___syscall) {
281 register_t *ap = &frame->tf_r0;
282 register_t code = ap[_QUAD_LOWWORD];
283 if (td->td_proc->p_sysent->sv_mask)
284 code &= td->td_proc->p_sysent->sv_mask;
285 fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek)
286 ? 1 : 0;
287 }
288#endif
289
290 switch (error) {
291 case 0:
292 if (fixup) {
293 frame->tf_r0 = 0;
294 frame->tf_r1 = td->td_retval[0];
295 } else {
296 frame->tf_r0 = td->td_retval[0];
297 frame->tf_r1 = td->td_retval[1];
298 }
299 frame->tf_spsr &= ~PSR_C_bit; /* carry bit */
300 break;
301 case ERESTART:
302 /*
303 * Reconstruct the pc to point at the swi.
304 */
305 frame->tf_pc -= INSN_SIZE;
306 break;
307 case EJUSTRETURN:
308 /* nothing to do */
309 break;
310 default:
311 frame->tf_r0 = error;
312 frame->tf_spsr |= PSR_C_bit; /* carry bit */
313 break;
314 }
315}
316
264/*
265 * Initialize machine state (pcb and trap frame) for a new thread about to
266 * upcall. Put enough state in the new thread's PCB to get it to go back
267 * userret(), where we can intercept it again to set the return (upcall)
268 * Address and stack, along with those from upcals that are from other sources
269 * such as those generated in thread_userret() itself.
270 */
271void

--- 384 unchanged lines hidden ---
317/*
318 * Initialize machine state (pcb and trap frame) for a new thread about to
319 * upcall. Put enough state in the new thread's PCB to get it to go back
320 * userret(), where we can intercept it again to set the return (upcall)
321 * Address and stack, along with those from upcals that are from other sources
322 * such as those generated in thread_userret() itself.
323 */
324void

--- 384 unchanged lines hidden ---