Deleted Added
full compact
subr_syscall.c (3258) subr_syscall.c (3436)
1/*-
2 * Copyright (C) 1994, David Greenman
3 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the University of Utah, and William Jolitz.
8 *

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

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
1/*-
2 * Copyright (C) 1994, David Greenman
3 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the University of Utah, and William Jolitz.
8 *

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

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
38 * $Id: trap.c,v 1.34 1994/09/11 11:26:18 davidg Exp $
38 * $Id: trap.c,v 1.35 1994/10/01 02:56:05 davidg Exp $
39 */
40
41/*
42 * 386 Trap and System call handling
43 */
44
45#include <sys/param.h>
46#include <sys/systm.h>

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

58#include <vm/pmap.h>
59#include <vm/vm_map.h>
60#include <vm/vm_page.h>
61
62#include <machine/cpu.h>
63#include <machine/psl.h>
64#include <machine/reg.h>
65#include <machine/trap.h>
39 */
40
41/*
42 * 386 Trap and System call handling
43 */
44
45#include <sys/param.h>
46#include <sys/systm.h>

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

58#include <vm/pmap.h>
59#include <vm/vm_map.h>
60#include <vm/vm_page.h>
61
62#include <machine/cpu.h>
63#include <machine/psl.h>
64#include <machine/reg.h>
65#include <machine/trap.h>
66#include <machine/../isa/isa_device.h>
66
67#include "isa.h"
68#include "npx.h"
69
70int trap_pfault __P((struct trapframe *, int));
71void trap_fatal __P((struct trapframe *));
72
73#define MAX_TRAP_MSG 27

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

105static inline void
106userret(p, frame, oticks)
107 struct proc *p;
108 struct trapframe *frame;
109 u_quad_t oticks;
110{
111 int sig, s;
112
67
68#include "isa.h"
69#include "npx.h"
70
71int trap_pfault __P((struct trapframe *, int));
72void trap_fatal __P((struct trapframe *));
73
74#define MAX_TRAP_MSG 27

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

106static inline void
107userret(p, frame, oticks)
108 struct proc *p;
109 struct trapframe *frame;
110 u_quad_t oticks;
111{
112 int sig, s;
113
113 while (sig = CURSIG(p))
114 while ((sig = CURSIG(p)) != 0)
114 postsig(sig);
115 p->p_priority = p->p_usrpri;
116 if (want_resched) {
117 /*
118 * Since we are curproc, clock will normally just change
119 * our priority without moving us from one queue to another
120 * (since the running process is not on a queue.)
121 * If that happened after we setrunqueue ourselves but before we
122 * mi_switch()'ed, we might not be on the queue indicated by
123 * our priority.
124 */
125 s = splclock();
126 setrunqueue(p);
127 p->p_stats->p_ru.ru_nivcsw++;
128 mi_switch();
129 splx(s);
115 postsig(sig);
116 p->p_priority = p->p_usrpri;
117 if (want_resched) {
118 /*
119 * Since we are curproc, clock will normally just change
120 * our priority without moving us from one queue to another
121 * (since the running process is not on a queue.)
122 * If that happened after we setrunqueue ourselves but before we
123 * mi_switch()'ed, we might not be on the queue indicated by
124 * our priority.
125 */
126 s = splclock();
127 setrunqueue(p);
128 p->p_stats->p_ru.ru_nivcsw++;
129 mi_switch();
130 splx(s);
130 while (sig = CURSIG(p))
131 while ((sig = CURSIG(p)) != 0)
131 postsig(sig);
132 }
133 if (p->p_stats->p_prof.pr_scale) {
134 u_quad_t ticks = p->p_sticks - oticks;
135
136 if (ticks) {
137#ifdef PROFTIMER
138 extern int profscale;

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

156
157/*ARGSUSED*/
158void
159trap(frame)
160 struct trapframe frame;
161{
162 struct proc *p = curproc;
163 u_quad_t sticks = 0;
132 postsig(sig);
133 }
134 if (p->p_stats->p_prof.pr_scale) {
135 u_quad_t ticks = p->p_sticks - oticks;
136
137 if (ticks) {
138#ifdef PROFTIMER
139 extern int profscale;

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

157
158/*ARGSUSED*/
159void
160trap(frame)
161 struct trapframe frame;
162{
163 struct proc *p = curproc;
164 u_quad_t sticks = 0;
164 int i = 0, ucode = 0, type, code, eva, fault_type;
165 int i = 0, ucode = 0, type, code;
165
166 frame.tf_eflags &= ~PSL_NT; /* clear nested trap XXX */
167 type = frame.tf_trapno;
168 code = frame.tf_err;
169
170 if (ISPL(frame.tf_cs) == SEL_UPL) {
171 /* user trap */
172

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

334int
335trap_pfault(frame, usermode)
336 struct trapframe *frame;
337 int usermode;
338{
339 vm_offset_t va;
340 struct vmspace *vm = NULL;
341 vm_map_t map = 0;
166
167 frame.tf_eflags &= ~PSL_NT; /* clear nested trap XXX */
168 type = frame.tf_trapno;
169 code = frame.tf_err;
170
171 if (ISPL(frame.tf_cs) == SEL_UPL) {
172 /* user trap */
173

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

335int
336trap_pfault(frame, usermode)
337 struct trapframe *frame;
338 int usermode;
339{
340 vm_offset_t va;
341 struct vmspace *vm = NULL;
342 vm_map_t map = 0;
342 int rv = 0, oldflags;
343 int rv = 0;
343 vm_prot_t ftype;
344 extern vm_map_t kernel_map;
345 int eva;
346 struct proc *p = curproc;
347
348 eva = rcr2();
349 va = trunc_page((vm_offset_t)eva);
350

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

372 }
373
374 if (frame->tf_err & PGEX_W)
375 ftype = VM_PROT_READ | VM_PROT_WRITE;
376 else
377 ftype = VM_PROT_READ;
378
379 if (map != kernel_map) {
344 vm_prot_t ftype;
345 extern vm_map_t kernel_map;
346 int eva;
347 struct proc *p = curproc;
348
349 eva = rcr2();
350 va = trunc_page((vm_offset_t)eva);
351

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

373 }
374
375 if (frame->tf_err & PGEX_W)
376 ftype = VM_PROT_READ | VM_PROT_WRITE;
377 else
378 ftype = VM_PROT_READ;
379
380 if (map != kernel_map) {
380 vm_offset_t pa;
381 vm_offset_t v = (vm_offset_t) vtopte(va);
382 vm_page_t ptepg;
383
384 /*
385 * Keep swapout from messing with us during this
386 * critical time.
387 */
388 ++p->p_lock;

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

491 printf("nested task, ");
492 if (frame->tf_eflags & PSL_RF)
493 printf("resume, ");
494 if (frame->tf_eflags & PSL_VM)
495 printf("vm86, ");
496 printf("IOPL = %d\n", (frame->tf_eflags & PSL_IOPL) >> 12);
497 printf("current process = ");
498 if (curproc) {
381 vm_offset_t v = (vm_offset_t) vtopte(va);
382 vm_page_t ptepg;
383
384 /*
385 * Keep swapout from messing with us during this
386 * critical time.
387 */
388 ++p->p_lock;

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

491 printf("nested task, ");
492 if (frame->tf_eflags & PSL_RF)
493 printf("resume, ");
494 if (frame->tf_eflags & PSL_VM)
495 printf("vm86, ");
496 printf("IOPL = %d\n", (frame->tf_eflags & PSL_IOPL) >> 12);
497 printf("current process = ");
498 if (curproc) {
499 printf("%d (%s)\n",
500 curproc->p_pid, curproc->p_comm ?
499 printf("%lu (%s)\n",
500 (u_long)curproc->p_pid, curproc->p_comm ?
501 curproc->p_comm : "");
502 } else {
503 printf("Idle\n");
504 }
505 printf("interrupt mask = ");
506 if ((cpl & net_imask) == net_imask)
507 printf("net ");
508 if ((cpl & tty_imask) == tty_imask)

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

534 * are thrown out early for other reasons.
535 */
536int trapwrite(addr)
537 unsigned addr;
538{
539 struct proc *p;
540 vm_offset_t va, v;
541 struct vmspace *vm;
501 curproc->p_comm : "");
502 } else {
503 printf("Idle\n");
504 }
505 printf("interrupt mask = ");
506 if ((cpl & net_imask) == net_imask)
507 printf("net ");
508 if ((cpl & tty_imask) == tty_imask)

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

534 * are thrown out early for other reasons.
535 */
536int trapwrite(addr)
537 unsigned addr;
538{
539 struct proc *p;
540 vm_offset_t va, v;
541 struct vmspace *vm;
542 int oldflags;
543 int rv;
544
545 va = trunc_page((vm_offset_t)addr);
546 /*
547 * XXX - MAX is END. Changed > to >= for temp. fix.
548 */
549 if (va >= VM_MAXUSER_ADDRESS)
550 return (1);

--- 151 unchanged lines hidden ---
542 int rv;
543
544 va = trunc_page((vm_offset_t)addr);
545 /*
546 * XXX - MAX is END. Changed > to >= for temp. fix.
547 */
548 if (va >= VM_MAXUSER_ADDRESS)
549 return (1);

--- 151 unchanged lines hidden ---