summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/powerpc/powerpc/Locore.c8
-rw-r--r--sys/arch/powerpc/powerpc/bcopy.c19
-rw-r--r--sys/arch/powerpc/powerpc/copystr.c4
-rw-r--r--sys/arch/powerpc/powerpc/fpu.c8
-rw-r--r--sys/arch/powerpc/powerpc/in_cksum.c6
-rw-r--r--sys/arch/powerpc/powerpc/process_machdep.c20
-rw-r--r--sys/arch/powerpc/powerpc/sys_machdep.c7
-rw-r--r--sys/arch/powerpc/powerpc/trap.c80
-rw-r--r--sys/arch/powerpc/powerpc/vm_machdep.c63
9 files changed, 84 insertions, 131 deletions
diff --git a/sys/arch/powerpc/powerpc/Locore.c b/sys/arch/powerpc/powerpc/Locore.c
index 2ee4886a0fd..5604b3795e7 100644
--- a/sys/arch/powerpc/powerpc/Locore.c
+++ b/sys/arch/powerpc/powerpc/Locore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: Locore.c,v 1.9 2003/05/12 08:46:05 jason Exp $ */
+/* $OpenBSD: Locore.c,v 1.10 2003/10/15 02:43:09 drahn Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -47,8 +47,7 @@ extern int whichqs;
* Calls should be made at splstatclock(), and p->p_stat should be SRUN.
*/
void
-setrunqueue(p)
- struct proc *p;
+setrunqueue(struct proc *p)
{
struct prochd *q;
struct proc *oldlast;
@@ -71,8 +70,7 @@ setrunqueue(p)
* Calls should be made at splstatclock().
*/
void
-remrunqueue(p)
- struct proc *p;
+remrunqueue(struct proc *p)
{
int which = p->p_priority >> 2;
struct prochd *q;
diff --git a/sys/arch/powerpc/powerpc/bcopy.c b/sys/arch/powerpc/powerpc/bcopy.c
index cf5e192a562..848b4e8fce2 100644
--- a/sys/arch/powerpc/powerpc/bcopy.c
+++ b/sys/arch/powerpc/powerpc/bcopy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcopy.c,v 1.4 2003/06/02 23:27:53 millert Exp $ */
+/* $OpenBSD: bcopy.c,v 1.5 2003/10/15 02:43:09 drahn Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)bcopy.c 5.11 (Berkeley) 6/21/91";*/
-static char *rcsid = "$Id: bcopy.c,v 1.4 2003/06/02 23:27:53 millert Exp $";
+static char *rcsid = "$Id: bcopy.c,v 1.5 2003/10/15 02:43:09 drahn Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
@@ -59,23 +59,20 @@ typedef int word; /* "word" used for optimal copy speed */
*/
#ifdef MEMCOPY
void *
-memcpy(dst0, src0, length)
+memcpy(void *dst0, const void *src0, size_t length)
#else
#ifdef MEMMOVE
void *
-memmove(dst0, src0, length)
+memmove(void *dst0, const void *src0, size_t length)
#else
void
-bcopy(src0, dst0, length)
+bcopy(const void *src0, void *dst0, size_t length)
#endif
#endif
- void *dst0;
- const void *src0;
- register size_t length;
{
- register char *dst = dst0;
- register const char *src = src0;
- register size_t t;
+ char *dst = dst0;
+ const char *src = src0;
+ size_t t;
if (length == 0 || dst == src) /* nothing to do */
goto done;
diff --git a/sys/arch/powerpc/powerpc/copystr.c b/sys/arch/powerpc/powerpc/copystr.c
index 479b136dd40..3000cd4b789 100644
--- a/sys/arch/powerpc/powerpc/copystr.c
+++ b/sys/arch/powerpc/powerpc/copystr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: copystr.c,v 1.7 2003/05/11 03:26:03 tedu Exp $ */
+/* $OpenBSD: copystr.c,v 1.8 2003/10/15 02:43:09 drahn Exp $ */
/*-
* Copyright (C) 1995 Wolfgang Solfrank.
@@ -35,7 +35,7 @@
#include <sys/systm.h>
/*
- * Emulate copyinstr.
+ * Emulate copystr.
*/
int
copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done)
diff --git a/sys/arch/powerpc/powerpc/fpu.c b/sys/arch/powerpc/powerpc/fpu.c
index 559647ee978..8b09ff065da 100644
--- a/sys/arch/powerpc/powerpc/fpu.c
+++ b/sys/arch/powerpc/powerpc/fpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpu.c,v 1.7 2003/07/02 22:09:29 drahn Exp $ */
+/* $OpenBSD: fpu.c,v 1.8 2003/10/15 02:43:09 drahn Exp $ */
/* $NetBSD: fpu.c,v 1.1 1996/09/30 16:34:44 ws Exp $ */
/*
@@ -39,8 +39,7 @@
#include <machine/psl.h>
void
-enable_fpu(p)
- struct proc *p;
+enable_fpu(struct proc *p)
{
int msr;
struct pcb *pcb = &p->p_addr->u_pcb;
@@ -93,8 +92,7 @@ enable_fpu(p)
}
void
-save_fpu(p)
- struct proc *p;
+save_fpu(struct proc *p)
{
int msr;
struct pcb *pcb;
diff --git a/sys/arch/powerpc/powerpc/in_cksum.c b/sys/arch/powerpc/powerpc/in_cksum.c
index a9a6d6a27b3..f6839e16da9 100644
--- a/sys/arch/powerpc/powerpc/in_cksum.c
+++ b/sys/arch/powerpc/powerpc/in_cksum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_cksum.c,v 1.5 2002/09/15 09:01:59 deraadt Exp $ */
+/* $OpenBSD: in_cksum.c,v 1.6 2003/10/15 02:43:09 drahn Exp $ */
/* $NetBSD: in_cksum.c,v 1.1 1996/09/30 16:34:47 ws Exp $ */
/*
@@ -48,9 +48,7 @@
#define ADDCARRY do { while (sum > 0xffff) REDUCE; } while (0)
int
-in_cksum(m, len)
- struct mbuf *m;
- int len;
+in_cksum(struct mbuf *m, int len)
{
u_char *w;
u_int sum = 0;
diff --git a/sys/arch/powerpc/powerpc/process_machdep.c b/sys/arch/powerpc/powerpc/process_machdep.c
index 952ec03b76c..050ec2f2346 100644
--- a/sys/arch/powerpc/powerpc/process_machdep.c
+++ b/sys/arch/powerpc/powerpc/process_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process_machdep.c,v 1.7 2002/09/15 09:01:59 deraadt Exp $ */
+/* $OpenBSD: process_machdep.c,v 1.8 2003/10/15 02:43:09 drahn Exp $ */
/* $NetBSD: process_machdep.c,v 1.1 1996/09/30 16:34:53 ws Exp $ */
/*
@@ -38,9 +38,7 @@
#include <machine/reg.h>
int
-process_read_regs(p, regs)
- struct proc *p;
- struct reg *regs;
+process_read_regs(struct proc *p, struct reg *regs)
{
struct trapframe *tf = trapframe(p);
@@ -66,20 +64,16 @@ process_read_regs(p, regs)
* Set the process's program counter.
*/
int
-process_set_pc(p, addr)
- struct proc *p;
- caddr_t addr;
+process_set_pc(struct proc *p, caddr_t addr)
{
struct trapframe *tf = trapframe(p);
- tf->srr0 = (int)addr;
+ tf->srr0 = (u_int32_t)addr;
return 0;
}
int
-process_sstep(p, sstep)
- struct proc *p;
- int sstep;
+process_sstep(struct proc *p, int sstep)
{
struct trapframe *tf = trapframe(p);
@@ -91,9 +85,7 @@ process_sstep(p, sstep)
}
int
-process_write_regs(p, regs)
- struct proc *p;
- struct reg *regs;
+process_write_regs(struct proc *p, struct reg *regs)
{
struct trapframe *tf = trapframe(p);
diff --git a/sys/arch/powerpc/powerpc/sys_machdep.c b/sys/arch/powerpc/powerpc/sys_machdep.c
index 1e1727c557b..7469aa290af 100644
--- a/sys/arch/powerpc/powerpc/sys_machdep.c
+++ b/sys/arch/powerpc/powerpc/sys_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_machdep.c,v 1.3 2001/07/09 01:21:30 mickey Exp $ */
+/* $OpenBSD: sys_machdep.c,v 1.4 2003/10/15 02:43:09 drahn Exp $ */
/* $NetBSD: sys_machdep.c,v 1.1 1996/09/30 16:34:56 ws Exp $ */
/*
@@ -37,10 +37,7 @@
#include <sys/syscallargs.h>
int
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
+sys_sysarch(struct proc *p, void *v, register_t *retval)
{
/*
* Currently no special system calls
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index fdeb14cffb0..27ad280b4fb 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.60 2003/07/02 21:57:52 drahn Exp $ */
+/* $OpenBSD: trap.c,v 1.61 2003/10/15 02:43:09 drahn Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -83,9 +83,8 @@ ppc_dumpbt(struct trapframe *frame)
u_int32_t addr;
/* dumpframe is defined in db_trace.c */
addr=frame->fixreg[1];
- while (addr != 0) {
+ while (addr != 0)
addr = db_dumpframe(addr, db_printf);
- }
return;
}
#endif
@@ -243,7 +242,7 @@ enable_vec(struct proc *p)
#endif /* ALTIVEC */
static __inline void
-userret(register struct proc *p, int pc, u_quad_t oticks)
+userret(struct proc *p, int pc, u_quad_t oticks)
{
int sig;
@@ -252,10 +251,7 @@ userret(register struct proc *p, int pc, u_quad_t oticks)
postsig(sig);
p->p_priority = p->p_usrpri;
if (want_resched) {
-
- /*
- * We're being preempted.
- */
+ /* We're being preempted. */
preempt(NULL);
while ((sig = CURSIG(p)))
postsig(sig);
@@ -274,8 +270,7 @@ userret(register struct proc *p, int pc, u_quad_t oticks)
}
void
-trap(frame)
- struct trapframe *frame;
+trap(struct trapframe *frame)
{
struct proc *p = curproc;
int type = frame->exc;
@@ -331,17 +326,16 @@ trap(frame)
va &= ADDR_PIDX | ADDR_POFF;
va |= user_sr << ADDR_SR_SHIFT;
map = &p->p_vmspace->vm_map;
- if (pte_spill_v(map->pmap, va, frame->dsisr, 0)) {
+ if (pte_spill_v(map->pmap, va, frame->dsisr, 0))
return;
- }
}
if (frame->dsisr & DSISR_STORE)
ftype = VM_PROT_READ | VM_PROT_WRITE;
else
ftype = VM_PROT_READ;
- if (uvm_fault(map, trunc_page(va), 0, ftype) == 0) {
+ if (uvm_fault(map, trunc_page(va), 0, ftype) == 0)
return;
- }
+
if ((fb = p->p_addr->u_pcb.pcb_onfault)) {
p->p_addr->u_pcb.pcb_onfault = 0;
frame->srr0 = fb->pc; /* PC */
@@ -359,12 +353,10 @@ printf("kern dsi on addr %x iar %x\n", frame->dar, frame->srr0);
{
int ftype, vftype;
+ /* Try spill handler first */
if (pte_spill_v(p->p_vmspace->vm_map.pmap,
- frame->dar, frame->dsisr, 0))
- {
- /* fault handled by spill handler */
+ frame->dar, frame->dsisr, 0))
break;
- }
if (frame->dsisr & DSISR_STORE) {
ftype = VM_PROT_READ | VM_PROT_WRITE;
@@ -372,9 +364,9 @@ printf("kern dsi on addr %x iar %x\n", frame->dar, frame->srr0);
} else
vftype = ftype = VM_PROT_READ;
if (uvm_fault(&p->p_vmspace->vm_map,
- trunc_page(frame->dar), 0, ftype) == 0) {
+ trunc_page(frame->dar), 0, ftype) == 0)
break;
- }
+
#if 0
printf("dsi on addr %x iar %x lr %x\n", frame->dar, frame->srr0,frame->lr);
#endif
@@ -389,17 +381,15 @@ printf("dsi on addr %x iar %x lr %x\n", frame->dar, frame->srr0,frame->lr);
{
int ftype;
+ /* Try spill handler */
if (pte_spill_v(p->p_vmspace->vm_map.pmap,
- frame->srr0, 0, 1))
- {
- /* fault handled by spill handler */
+ frame->srr0, 0, 1))
break;
- }
+
ftype = VM_PROT_READ | VM_PROT_EXECUTE;
if (uvm_fault(&p->p_vmspace->vm_map,
- trunc_page(frame->srr0), 0, ftype) == 0) {
+ trunc_page(frame->srr0), 0, ftype) == 0)
break;
- }
}
#if 0
printf("isi iar %x lr %x\n", frame->srr0, frame->lr);
@@ -457,8 +447,10 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr);
n = NARGREG - (params - (frame->fixreg + FIRSTARG));
if (argsize > n * sizeof(register_t)) {
bcopy(params, args, n * sizeof(register_t));
- if ((error = copyin(MOREARGS(frame->fixreg[1]),
- args + n, argsize - n * sizeof(register_t)))) {
+
+ error = copyin(MOREARGS(frame->fixreg[1]),
+ args + n, argsize - n * sizeof(register_t));
+ if (error) {
#ifdef KTRACE
/* Can't get all the arguments! */
if (KTRPOINT(p, KTR_SYSCALL))
@@ -537,9 +529,9 @@ syscall_bad:
* by the code that fixes the typical gcc misaligned code
* then kill the process if not.
*/
- if (fix_unaligned(p, frame) == 0) {
+ if (fix_unaligned(p, frame) == 0)
frame->srr0 += 4;
- } else {
+ else {
sv.sival_int = frame->srr0;
trapsignal(p, SIGSEGV, VM_PROT_EXECUTE, SEGV_MAPERR,
sv);
@@ -637,9 +629,9 @@ for (i = 0; i < errnum; i++) {
case EXC_PERF|EXC_USER:
#ifdef ALTIVEC
case EXC_VEC|EXC_USER:
- if (ppc_vecproc) {
+ if (ppc_vecproc)
save_vec(ppc_vecproc);
- }
+
ppc_vecproc = p;
enable_vec(p);
break;
@@ -667,27 +659,24 @@ for (i = 0; i < errnum; i++) {
/*
* If someone stole the fpu while we were away, disable it
*/
- if (p != fpuproc) {
+ if (p != fpuproc)
frame->srr1 &= ~PSL_FP;
- } else {
+ else
frame->srr1 |= PSL_FP;
- }
#ifdef ALTIVEC
/*
* If someone stole the vector unit while we were away, disable it
*/
- if (p != ppc_vecproc) {
+ if (p != ppc_vecproc)
frame->srr1 &= ~PSL_VEC;
- } else {
+ else
frame->srr1 |= PSL_VEC;
- }
#endif /* ALTIVEC */
}
void
-child_return(arg)
- void *arg;
+child_return(void *arg)
{
struct proc *p = (struct proc *)arg;
struct trapframe *tf = trapframe(p);
@@ -708,13 +697,11 @@ child_return(arg)
}
int
-badaddr(addr, len)
- char *addr;
- u_int32_t len;
+badaddr(char *addr, u_int32_t len)
{
faultbuf env;
u_int32_t v;
- register void *oldh = curpcb->pcb_onfault;
+ void *oldh = curpcb->pcb_onfault;
if (setfault(&env)) {
curpcb->pcb_onfault = oldh;
@@ -743,9 +730,7 @@ badaddr(addr, len)
*/
static int
-fix_unaligned(p, frame)
- struct proc *p;
- struct trapframe *frame;
+fix_unaligned(struct proc *p, struct trapframe *frame)
{
int indicator = EXC_ALI_OPCODE_INDICATOR(frame->dsisr);
@@ -781,6 +766,5 @@ fix_unaligned(p, frame)
}
break;
}
-
return -1;
}
diff --git a/sys/arch/powerpc/powerpc/vm_machdep.c b/sys/arch/powerpc/powerpc/vm_machdep.c
index fff9efff235..72dcf816a01 100644
--- a/sys/arch/powerpc/powerpc/vm_machdep.c
+++ b/sys/arch/powerpc/powerpc/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.36 2002/09/15 09:01:59 deraadt Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.37 2003/10/15 02:43:09 drahn Exp $ */
/* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */
/*
@@ -50,12 +50,8 @@
* Finish a fork operation, with process p2 nearly set up.
*/
void
-cpu_fork(p1, p2, stack, stacksize, func, arg)
- struct proc *p1, *p2;
- void *stack;
- size_t stacksize;
- void (*func)(void *);
- void *arg;
+cpu_fork(struct proc *p1, struct proc *p2, void *stack, size_t stacksize,
+ void (*func)(void *), void *arg)
{
struct trapframe *tf;
struct callframe *cf;
@@ -74,15 +70,15 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
save_vec(p1);
pcb->pcb_vr = pool_get(&ppc_vecpl, PR_WAITOK);
*pcb->pcb_vr = *p1->p_addr->u_pcb.pcb_vr;
- } else {
+ } else
pcb->pcb_vr = NULL;
- }
+
#endif /* ALTIVEC */
pcb->pcb_pm = p2->p_vmspace->vm_map.pmap;
pmap_extract(pmap_kernel(),
- (vm_offset_t)pcb->pcb_pm, (paddr_t *)&pcb->pcb_pmreal);
+ (vm_offset_t)pcb->pcb_pm, (paddr_t *)&pcb->pcb_pmreal);
/*
* Setup the trap frame for the new process
@@ -99,7 +95,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
tf->fixreg[1] = (register_t)stack + stacksize;
}
- stktop2 = (caddr_t)((u_long)stktop2 & ~15); /* Align stack pointer */
+ stktop2 = (caddr_t)((u_long)stktop2 & ~15); /* Align stack pointer */
/*
* There happens to be a callframe, too.
@@ -128,8 +124,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
}
void
-cpu_swapin(p)
- struct proc *p;
+cpu_swapin(struct proc *p)
{
struct pcb *pcb = &p->p_addr->u_pcb;
@@ -141,9 +136,7 @@ cpu_swapin(p)
* Move pages from one kernel virtual address to another.
*/
void
-pagemove(from, to, size)
- caddr_t from, to;
- size_t size;
+pagemove(caddr_t from, caddr_t to, size_t size)
{
vaddr_t va;
paddr_t pa;
@@ -169,8 +162,7 @@ pagemove(from, to, size)
* Not sure whether we can get away with this in the single proc version. XXX
*/
void
-cpu_exit(p)
- struct proc *p;
+cpu_exit(struct proc *p)
{
#ifdef ALTIVEC
struct pcb *pcb = &p->p_addr->u_pcb;
@@ -194,11 +186,8 @@ cpu_exit(p)
* Write the machine-dependent part of a core dump.
*/
int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
+cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
+ struct core *chdr)
{
struct coreseg cseg;
struct md_coredump md_core;
@@ -215,13 +204,16 @@ cpu_coredump(p, vp, cred, chdr)
cseg.c_addr = 0;
cseg.c_size = chdr->c_cpusize;
- if ((error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE,
- IO_NODELOCKED|IO_UNIT, cred, NULL, p)))
+ error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
+ (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT,
+ cred, NULL, p);
+ if (error)
return error;
- if ((error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof md_core,
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize),
- UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, NULL, p)))
+
+ error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof md_core,
+ (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
+ IO_NODELOCKED|IO_UNIT, cred, NULL, p);
+ if (error)
return error;
chdr->c_nseg++;
@@ -232,9 +224,7 @@ cpu_coredump(p, vp, cred, chdr)
* Map an IO request into kernel virtual address space.
*/
void
-vmapbuf(bp, len)
- struct buf *bp;
- vm_size_t len;
+vmapbuf(struct buf *bp, vm_size_t len)
{
vm_offset_t faddr, taddr, off;
vm_offset_t pa;
@@ -249,9 +239,10 @@ vmapbuf(bp, len)
taddr = uvm_km_valloc_wait(phys_map, len);
bp->b_data = (caddr_t)(taddr + off);
for (; len > 0; len -= NBPG) {
- pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map), faddr, &pa);
+ pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
+ faddr, &pa);
pmap_enter(vm_map_pmap(phys_map), taddr, pa,
- VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
+ VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
faddr += NBPG;
taddr += NBPG;
}
@@ -262,9 +253,7 @@ vmapbuf(bp, len)
* Free the io map addresses associated with this IO operation.
*/
void
-vunmapbuf(bp, len)
- struct buf *bp;
- vm_size_t len;
+vunmapbuf(struct buf *bp, vm_size_t len)
{
vm_offset_t addr, off;