Sat Aug 31 15:01:08 2013 UTC ()
convert rfid to rfi in exception handlers.


(matt)
diff -r1.66 -r1.67 src/sys/arch/powerpc/oea/oea_machdep.c

cvs diff -r1.66 -r1.67 src/sys/arch/powerpc/oea/oea_machdep.c (expand / switch to unified diff)

--- src/sys/arch/powerpc/oea/oea_machdep.c 2013/08/31 07:33:15 1.66
+++ src/sys/arch/powerpc/oea/oea_machdep.c 2013/08/31 15:01:08 1.67
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: oea_machdep.c,v 1.66 2013/08/31 07:33:15 matt Exp $ */ 1/* $NetBSD: oea_machdep.c,v 1.67 2013/08/31 15:01:08 matt Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 2002 Matt Thomas 4 * Copyright (C) 2002 Matt Thomas
5 * Copyright (C) 1995, 1996 Wolfgang Solfrank. 5 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
6 * Copyright (C) 1995, 1996 TooLs GmbH. 6 * Copyright (C) 1995, 1996 TooLs GmbH.
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 23 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 31 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.66 2013/08/31 07:33:15 matt Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.67 2013/08/31 15:01:08 matt Exp $");
37 37
38#include "opt_ppcarch.h" 38#include "opt_ppcarch.h"
39#include "opt_compat_netbsd.h" 39#include "opt_compat_netbsd.h"
40#include "opt_ddb.h" 40#include "opt_ddb.h"
41#include "opt_kgdb.h" 41#include "opt_kgdb.h"
42#include "opt_ipkdb.h" 42#include "opt_ipkdb.h"
43#include "opt_multiprocessor.h" 43#include "opt_multiprocessor.h"
44#include "opt_altivec.h" 44#include "opt_altivec.h"
45 45
46#include <sys/param.h> 46#include <sys/param.h>
47#include <sys/buf.h> 47#include <sys/buf.h>
48#include <sys/boot_flag.h> 48#include <sys/boot_flag.h>
49#include <sys/exec.h> 49#include <sys/exec.h>
@@ -376,26 +376,28 @@ oea_init(void (*handler)(void)) @@ -376,26 +376,28 @@ oea_init(void (*handler)(void))
376 } 376 }
377 377
378#ifdef PPC_OEA64_BRIDGE 378#ifdef PPC_OEA64_BRIDGE
379 if ((oeacpufeat & OEACPU_64_BRIDGE) == 0) { 379 if ((oeacpufeat & OEACPU_64_BRIDGE) == 0) {
380 for (int *ip = (int *)exc_base; 380 for (int *ip = (int *)exc_base;
381 (uintptr_t)ip <= exc_base + EXC_LAST; 381 (uintptr_t)ip <= exc_base + EXC_LAST;
382 ip++) { 382 ip++) {
383 if ((ip[0] & MFMSR_MASK) == MFMSR 383 if ((ip[0] & MFMSR_MASK) == MFMSR
384 && (ip[1] & RLDICL_MASK) == RLDICL 384 && (ip[1] & RLDICL_MASK) == RLDICL
385 && (ip[2] & MTMSRD_MASK) == MTMSRD) { 385 && (ip[2] & MTMSRD_MASK) == MTMSRD) {
386 *ip++ = NOP; 386 *ip++ = NOP;
387 *ip++ = NOP; 387 *ip++ = NOP;
388 ip[0] = NOP; 388 ip[0] = NOP;
 389 } else if (*ip == RFID) {
 390 *ip = RFI;
389 } 391 }
390 } 392 }
391 393
392 /* 394 /*
393 * Now replace each rfid instruction with a rfi instruction. 395 * Now replace each rfid instruction with a rfi instruction.
394 */ 396 */
395 for (int *ip = trapstart; ip < trapend; ip++) { 397 for (int *ip = trapstart; ip < trapend; ip++) {
396 if ((ip[0] & MFMSR_MASK) == MFMSR 398 if ((ip[0] & MFMSR_MASK) == MFMSR
397 && (ip[1] & RLDICL_MASK) == RLDICL 399 && (ip[1] & RLDICL_MASK) == RLDICL
398 && (ip[2] & MTMSRD_MASK) == MTMSRD) { 400 && (ip[2] & MTMSRD_MASK) == MTMSRD) {
399 *ip++ = NOP; 401 *ip++ = NOP;
400 *ip++ = NOP; 402 *ip++ = NOP;
401 ip[0] = NOP; 403 ip[0] = NOP;
@@ -895,26 +897,28 @@ oea_install_extint(void (*handler)(void) @@ -895,26 +897,28 @@ oea_install_extint(void (*handler)(void)
895 __syncicache((void *)extint_call, sizeof extint_call[0]); 897 __syncicache((void *)extint_call, sizeof extint_call[0]);
896 memcpy((void *)exc_exi_base, extint, (size_t)extsize); 898 memcpy((void *)exc_exi_base, extint, (size_t)extsize);
897#ifdef PPC_OEA64_BRIDGE 899#ifdef PPC_OEA64_BRIDGE
898 if ((oeacpufeat & OEACPU_64_BRIDGE) == 0) { 900 if ((oeacpufeat & OEACPU_64_BRIDGE) == 0) {
899 for (int *ip = (int *)exc_exi_base; 901 for (int *ip = (int *)exc_exi_base;
900 (uintptr_t)ip <= exc_exi_base + (size_t)extsize; 902 (uintptr_t)ip <= exc_exi_base + (size_t)extsize;
901 ip++) { 903 ip++) {
902 if ((ip[0] & MFMSR_MASK) == MFMSR 904 if ((ip[0] & MFMSR_MASK) == MFMSR
903 && (ip[1] & RLDICL_MASK) == RLDICL 905 && (ip[1] & RLDICL_MASK) == RLDICL
904 && (ip[2] & MTMSRD_MASK) == MTMSRD) { 906 && (ip[2] & MTMSRD_MASK) == MTMSRD) {
905 *ip++ = NOP; 907 *ip++ = NOP;
906 *ip++ = NOP; 908 *ip++ = NOP;
907 ip[0] = NOP; 909 ip[0] = NOP;
 910 } else if (*ip == RFID) {
 911 *ip = RFI;
908 } 912 }
909 } 913 }
910 } 914 }
911#endif 915#endif
912 __syncicache((void *)exc_exi_base, (int)extsize); 916 __syncicache((void *)exc_exi_base, (int)extsize);
913 917
914 __asm volatile ("mtmsr %0" :: "r"(omsr)); 918 __asm volatile ("mtmsr %0" :: "r"(omsr));
915} 919}
916 920
917/* 921/*
918 * Machine dependent startup code. 922 * Machine dependent startup code.
919 */ 923 */
920void 924void