Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/amiga/amiga/machdep.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/amiga/amiga/machdep.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.239 retrieving revision 1.239.2.3 diff -u -p -r1.239 -r1.239.2.3 --- src/sys/arch/amiga/amiga/machdep.c 2012/08/03 13:14:20 1.239 +++ src/sys/arch/amiga/amiga/machdep.c 2017/12/03 11:35:48 1.239.2.3 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.239 2012/08/03 13:14:20 rkujawa Exp $ */ +/* $NetBSD: machdep.c,v 1.239.2.3 2017/12/03 11:35:48 jdolecek Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -47,8 +47,10 @@ #include "opt_panicbutton.h" #include "opt_m68k_arch.h" +#include "empm.h" + #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.239 2012/08/03 13:14:20 rkujawa Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.239.2.3 2017/12/03 11:35:48 jdolecek Exp $"); #include #include @@ -108,6 +110,9 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v #include #include #include +#if NEMPM > 0 +#include +#endif /* NEMPM > 0 */ #include "fd.h" #include "ser.h" @@ -136,7 +141,6 @@ paddr_t msgbufpa; int machineid; int maxmem; /* max memory per process */ -extern int physmem; /* max supported memory, changes to actual */ extern int freebufspace; extern u_int lowram; @@ -281,8 +285,6 @@ cpu_startup(void) /* * Info for CTL_HW */ -char cpu_model[120]; - #if defined(M68060) int m68060_pcr_init = 0x21; /* make this patchable */ #endif @@ -303,7 +305,7 @@ identifycpu(void) char machbuf[16]; if (is_draco()) { - sprintf(machbuf, "DraCo rev.%d", is_draco()); + snprintf(machbuf, sizeof(machbuf), "DraCo rev.%d", is_draco()); mach = machbuf; } else #endif @@ -322,7 +324,7 @@ identifycpu(void) #ifdef M68060 if (machineid & AMIGA_68060) { __asm(".word 0x4e7a,0x0808; movl %%d0,%0" : "=d"(pcr) : : "d0"); - sprintf(cpubuf, "68%s060 rev.%d", + snprintf(cpubuf, sizeof(cpubuf), "68%s060 rev.%d", pcr & 0x10000 ? "LC/EC" : "", (pcr>>8)&0xff); cpu_type = cpubuf; mmu = "/MMU"; @@ -362,8 +364,8 @@ identifycpu(void) fputype = FPU_NONE; } } - sprintf(cpu_model, "%s (%s CPU%s%s)", mach, cpu_type, mmu, fpu); - printf("%s\n", cpu_model); + cpu_setmodel("%s (%s CPU%s%s)", mach, cpu_type, mmu, fpu); + printf("%s\n", cpu_getmodel()); } /* @@ -406,6 +408,9 @@ void cpu_reboot(register int howto, char *bootstr) { struct pcb *pcb = lwp_getpcb(curlwp); +#if NEMPM > 0 + device_t empmdev; +#endif /* NEMPM > 0 */ /* take a snap shot before clobbering any registers */ if (pcb != NULL) @@ -422,6 +427,15 @@ cpu_reboot(register int howto, char *boo if (howto & RB_DUMP) dumpsys(); +#if NEMPM > 0 + if (howto & RB_POWERDOWN) { + empmdev = device_find_by_xname("empm0"); + if (empmdev != NULL) { + empm_power_off(device_private(empmdev)); + } + } +#endif /* NEMPM > 0 */ + if (howto & RB_HALT) { printf("\n"); printf("The operating system has halted.\n"); @@ -520,7 +534,7 @@ cpu_dumpconf(void) else if (dumplo == 0) dumplo = nblks - btodb(ctob(dumpsize)); } - --dumplo; /* XXX assume header fits in one block */ + dumplo -= ctod(btoc(MDHDRSIZE)); /* * Don't dump on the first PAGE_SIZE (why PAGE_SIZE?) * in case the dump device includes a disk label. @@ -803,39 +817,35 @@ int *nofault; int badaddr(register void *addr) { - register int i; + int i; label_t faultbuf; -#ifdef lint - i = *addr; if (i) return(0); -#endif nofault = (int *) &faultbuf; if (setjmp((label_t *)nofault)) { - nofault = (int *) 0; - return(1); + nofault = NULL; + return 1; } i = *(volatile short *)addr; - nofault = (int *) 0; - return(0); + __USE(i); + nofault = NULL; + return 0; } int badbaddr(register void *addr) { - register int i; + int i; label_t faultbuf; -#ifdef lint - i = *addr; if (i) return(0); -#endif nofault = (int *) &faultbuf; if (setjmp((label_t *)nofault)) { - nofault = (int *) 0; - return(1); + nofault = NULL; + return 1; } i = *(volatile char *)addr; - nofault = (int *) 0; - return(0); + __USE(i); + nofault = NULL; + return 0; } struct isr *isr_ports; @@ -1171,17 +1181,14 @@ nmihand(struct frame frame) int cpu_exec_aout_makecmds(struct lwp *l, struct exec_package *epp) { - int error = ENOEXEC; #ifdef COMPAT_NOMID struct exec *execp = epp->ep_hdr; -#endif -#ifdef COMPAT_NOMID if (!((execp->a_midmag >> 16) & 0x0fff) && execp->a_midmag == ZMAGIC) return(exec_aout_prep_zmagic(l, epp)); #endif - return(error); + return ENOEXEC; } #ifdef MODULAR @@ -1197,21 +1204,21 @@ int _spllkm6(void); int _spllkm7(void); #ifdef LEV6_DEFER -int _spllkm6() { +int _spllkm6(void) { return spl4(); }; -int _spllkm7() { +int _spllkm7(void) { return spl4(); }; #else -int _spllkm6() { +int _spllkm6(void) { return spl6(); }; -int _spllkm7() { +int _spllkm7(void) { return spl7(); };