Module Name:    src
Committed By:   tsutsui
Date:           Sun May 15 17:27:49 UTC 2011

Modified Files:
        src/sys/arch/x68k/x68k: machdep.c

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/sys/arch/x68k/x68k/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.175 src/sys/arch/x68k/x68k/machdep.c:1.176
--- src/sys/arch/x68k/x68k/machdep.c:1.175	Sat May 14 10:57:50 2011
+++ src/sys/arch/x68k/x68k/machdep.c	Sun May 15 17:27:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.175 2011/05/14 10:57:50 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.176 2011/05/15 17:27:49 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175 2011/05/14 10:57:50 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.176 2011/05/15 17:27:49 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -131,8 +131,8 @@
 int	safepri = PSL_LOWIPL;
 
 /* prototypes for local functions */
-void    identifycpu(void);
-void    initcpu(void);
+void	identifycpu(void);
+void	initcpu(void);
 int	cpu_dumpsize(void);
 int	cpu_dump(int (*)(dev_t, daddr_t, void *, size_t), daddr_t *);
 void	cpu_init_kcore_hdr(void);
@@ -144,7 +144,7 @@
 /* functions called from locore.s */
 void	x68k_init(void);
 void	dumpsys(void);
-void    straytrap(int, u_short);
+void	straytrap(int, u_short);
 void	nmihand(struct frame);
 void	intrhand(int);
 
@@ -202,6 +202,7 @@
 void
 consinit(void)
 {
+
 	/*
 	 * bring graphics layer up.
 	 */
@@ -217,7 +218,7 @@
 #endif
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 	ksyms_addsyms_elf((int)esym - (int)&end - sizeof(Elf32_Ehdr),
-		 (void *)&end, esym);
+	    (void *)&end, esym);
 #endif
 #ifdef DDB
 	if (boothowto & RB_KDB)
@@ -263,7 +264,7 @@
 	 * Allocate a submap for physio
 	 */
 	phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
-				   VM_PHYS_SIZE, 0, false, NULL);
+	    VM_PHYS_SIZE, 0, false, NULL);
 
 #ifdef DEBUG
 	pmapdebug = opmapdebug;
@@ -319,7 +320,7 @@
 char	cpu_model[96];		/* max 85 chars */
 static const char *fpu_descr[] = {
 #ifdef	FPU_EMULATE
-	", emulator FPU", 	/* 0 */
+	", emulator FPU",	/* 0 */
 #else
 	", no math support",	/* 0 */
 #endif
@@ -399,7 +400,7 @@
 	else
 		fpu = ", unknown FPU";
 	sprintf(cpu_model, "X68%s (%s CPU%s%s, %s clock)",
-		mach, cpu_type, mmu, fpu, clock);
+	    mach, cpu_type, mmu, fpu, clock);
 	printf("%s\n", cpu_model);
 }
 
@@ -410,16 +411,16 @@
 {
 
 	sysctl_createv(clog, 0, NULL, NULL,
-		       CTLFLAG_PERMANENT,
-		       CTLTYPE_NODE, "machdep", NULL,
-		       NULL, 0, NULL, 0,
-		       CTL_MACHDEP, CTL_EOL);
+	    CTLFLAG_PERMANENT,
+	    CTLTYPE_NODE, "machdep", NULL,
+	    NULL, 0, NULL, 0,
+	    CTL_MACHDEP, CTL_EOL);
 
 	sysctl_createv(clog, 0, NULL, NULL,
-		       CTLFLAG_PERMANENT,
-		       CTLTYPE_STRUCT, "console_device", NULL,
-		       sysctl_consdev, 0, NULL, sizeof(dev_t),
-		       CTL_MACHDEP, CPU_CONSDEV, CTL_EOL);
+	    CTLFLAG_PERMANENT,
+	    CTLTYPE_STRUCT, "console_device", NULL,
+	    sysctl_consdev, 0, NULL, sizeof(dev_t),
+	    CTL_MACHDEP, CPU_CONSDEV, CTL_EOL);
 }
 
 int	waittime = -1;
@@ -487,7 +488,7 @@
 	printf("rebooting...\n");
 	DELAY(1000000);
 	doboot();
-	/*NOTREACHED*/
+	/* NOTREACHED */
 }
 
 /*
@@ -530,7 +531,7 @@
 	/*
 	 * Initialize pointer to kernel segment table.
 	 */
-	m->sysseg_pa = (u_int32_t)(pmap_kernel()->pm_stpa);
+	m->sysseg_pa = (uint32_t)(pmap_kernel()->pm_stpa);
 
 	/*
 	 * Initialize relocation value such that:
@@ -542,7 +543,7 @@
 	/*
 	 * Define the end of the relocatable range.
 	 */
-	m->relocend = (u_int32_t)&end;
+	m->relocend = (uint32_t)&end;
 
 	/*
 	 * X68k has multiple RAM segments on some models.
@@ -550,9 +551,10 @@
 	m->ram_segs[0].start = lowram;
 	m->ram_segs[0].size = mem_size - lowram;
 	for (i = 1; i < vm_nphysseg; i++) {
-		m->ram_segs[i].start = ctob(VM_PHYSMEM_PTR(i)->start);
-		m->ram_segs[i].size  = ctob(VM_PHYSMEM_PTR(i)->end
-					    - VM_PHYSMEM_PTR(i)->start);
+		m->ram_segs[i].start =
+		    ctob(VM_PHYSMEM_PTR(i)->start);
+		m->ram_segs[i].size  =
+		    ctob(VM_PHYSMEM_PTR(i)->end - VM_PHYSMEM_PTR(i)->start);
 	}
 }
 
@@ -599,7 +601,7 @@
 /*
  * These variables are needed by /sbin/savecore
  */
-u_int32_t dumpmag = 0x8fca0101;	/* magic number */
+uint32_t dumpmag = 0x8fca0101;	/* magic number */
 int	dumpsize = 0;		/* pages */
 long	dumplo = 0;		/* blocks */
 
@@ -767,12 +769,12 @@
 #if defined(M68060)
 	extern void *vectab[256];
 #if defined(M060SP)
-	extern u_int8_t I_CALL_TOP[];
-	extern u_int8_t FP_CALL_TOP[];
+	extern uint8_t I_CALL_TOP[];
+	extern uint8_t FP_CALL_TOP[];
 #else
-	extern u_int8_t illinst;
+	extern uint8_t illinst;
 #endif
-	extern u_int8_t fpfault;
+	extern uint8_t fpfault;
 #endif
 
 #ifdef MAPPEDCOPY
@@ -782,7 +784,7 @@
 	 * page mapping (if not already set).  We don't do this on
 	 * VAC machines as it loses big time.
 	 */
-	if ((int) mappedcopysize == -1) {
+	if ((int)mappedcopysize == -1) {
 		mappedcopysize = PAGE_SIZE;
 	}
 #endif
@@ -816,8 +818,9 @@
 void
 straytrap(int pc, u_short evec)
 {
+
 	printf("unexpected trap (vector offset %x) from %x\n",
-	       evec & 0xFFF, pc);
+	    evec & 0xFFF, pc);
 #if defined(DDB)
 	Debugger();
 #endif
@@ -831,14 +834,14 @@
 	int i;
 	label_t	faultbuf;
 
-	nofault = (int *) &faultbuf;
+	nofault = (int *)&faultbuf;
 	if (setjmp((label_t *)nofault)) {
 		nofault = NULL;
-		return(1);
+		return 1;
 	}
 	i = *(volatile short *)addr;
 	nofault = NULL;
-	return(0);
+	return 0;
 }
 
 int
@@ -847,19 +850,20 @@
 	int i;
 	label_t	faultbuf;
 
-	nofault = (int *) &faultbuf;
+	nofault = (int *)&faultbuf;
 	if (setjmp((label_t *)nofault)) {
 		nofault = NULL;
-		return(1);
+		return 1;
 	}
 	i = *(volatile char *)addr;
 	nofault = NULL;
-	return(0);
+	return 0;
 }
 
 void
 intrhand(int sr)
 {
+
 	printf("intrhand: unexpected sr 0x%x\n", sr);
 }
 
@@ -898,6 +902,7 @@
 void
 nmihand(struct frame frame)
 {
+
 	intio_set_sysport_keyctrl(intio_get_sysport_keyctrl() | 0x04);
 
 	if (1) {
@@ -920,7 +925,7 @@
 			if (crashandburn) {
 				crashandburn = 0;
 				panic(panicstr ?
-				      "forced crash, nosync" : "forced crash");
+				    "forced crash, nosync" : "forced crash");
 			}
 			crashandburn++;
 			callout_reset(&candbtimer_ch, candbdelay,
@@ -1027,49 +1032,49 @@
 	void *begin_check, *end_check;
 	label_t	faultbuf;
 
-	DPRINTF (("Enter mem_exists(%p, %x)\n", mem, basemax));
-	DPRINTF ((" pmap_enter(%p, %p) for target... ", mem_v, mem));
+	DPRINTF(("Enter mem_exists(%p, %x)\n", mem, basemax));
+	DPRINTF((" pmap_enter(%p, %p) for target... ", mem_v, mem));
 	pmap_enter(pmap_kernel(), mem_v, (paddr_t)mem,
-		   VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|PMAP_WIRED);
+	    VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|PMAP_WIRED);
 	pmap_update(pmap_kernel());
-	DPRINTF ((" done.\n"));
+	DPRINTF((" done.\n"));
 
 	/* only 24bits are significant on normal X680x0 systems */
 	base = (void *)((u_long)mem & 0x00FFFFFF);
-	DPRINTF ((" pmap_enter(%p, %p) for shadow... ", base_v, base));
+	DPRINTF((" pmap_enter(%p, %p) for shadow... ", base_v, base));
 	pmap_enter(pmap_kernel(), base_v, (paddr_t)base,
-		   VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|PMAP_WIRED);
+	    VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|PMAP_WIRED);
 	pmap_update(pmap_kernel());
-	DPRINTF ((" done.\n"));
+	DPRINTF((" done.\n"));
 
-	m = (void*)mem_v;
-	b = (void*)base_v;
+	m = (void *)mem_v;
+	b = (void *)base_v;
 
 	/* This is somewhat paranoid -- avoid overwriting myself */
 	__asm("lea %%pc@(begin_check_mem),%0" : "=a"(begin_check));
 	__asm("lea %%pc@(end_check_mem),%0" : "=a"(end_check));
 	if (base >= begin_check && base < end_check) {
-		size_t off = (char*)end_check - (char*)begin_check;
+		size_t off = (char *)end_check - (char *)begin_check;
 
-		DPRINTF ((" Adjusting the testing area.\n"));
+		DPRINTF((" Adjusting the testing area.\n"));
 		m -= off;
 		b -= off;
 	}
 
-	nofault = (int *) &faultbuf;
-	if (setjmp ((label_t *)nofault)) {
-		nofault = (int *) 0;
+	nofault = (int *)&faultbuf;
+	if (setjmp((label_t *)nofault)) {
+		nofault = (int *)0;
 		pmap_remove(pmap_kernel(), mem_v, mem_v+PAGE_SIZE);
 		pmap_remove(pmap_kernel(), base_v, base_v+PAGE_SIZE);
 		pmap_update(pmap_kernel());
-		DPRINTF (("Fault!!! Returning 0.\n"));
+		DPRINTF(("Fault!!! Returning 0.\n"));
 		return 0;
 	}
 
-	DPRINTF ((" Let's begin. mem=%p, base=%p, m=%p, b=%p\n",
-		  mem, base, m, b));
+	DPRINTF((" Let's begin. mem=%p, base=%p, m=%p, b=%p\n",
+	    mem, base, m, b));
 
-	(void) *m;
+	(void)*m;
 	/*
 	 * Can't check by writing if the corresponding
 	 * base address isn't memory.
@@ -1117,9 +1122,9 @@
 	pmap_remove(pmap_kernel(), base_v, base_v+PAGE_SIZE);
 	pmap_update(pmap_kernel());
 
-	DPRINTF ((" End.\n"));
+	DPRINTF((" End.\n"));
 
-	DPRINTF (("Returning from mem_exists. result = %d\n", exists));
+	DPRINTF(("Returning from mem_exists. result = %d\n", exists));
 
 	return exists;
 }
@@ -1178,11 +1183,10 @@
 		}
 		if ((u_long)mlist[i].base < h) {
 			uvm_page_physload(atop(mlist[i].base), atop(h),
-					  atop(mlist[i].base), atop(h),
-					  VM_FREELIST_DEFAULT);
+			    atop(mlist[i].base), atop(h),
+			    VM_FREELIST_DEFAULT);
 			mem_size += h - (u_long) mlist[i].base;
 		}
-			
 	}
 
 	{	/* Re-enable the processor cache. */

Reply via email to