Module Name:    src
Committed By:   matt
Date:           Fri Aug  1 21:57:22 UTC 2014

Modified Files:
        src/sys/arch/powerpc/powerpc: fixup.c

Log Message:
Deal with the code LLVM generates for stubs.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/powerpc/fixup.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/powerpc/powerpc/fixup.c
diff -u src/sys/arch/powerpc/powerpc/fixup.c:1.8 src/sys/arch/powerpc/powerpc/fixup.c:1.9
--- src/sys/arch/powerpc/powerpc/fixup.c:1.8	Mon Mar  3 15:36:36 2014
+++ src/sys/arch/powerpc/powerpc/fixup.c	Fri Aug  1 21:57:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fixup.c,v 1.8 2014/03/03 15:36:36 macallan Exp $	*/
+/*	$NetBSD: fixup.c,v 1.9 2014/08/01 21:57:22 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: fixup.c,v 1.8 2014/03/03 15:36:36 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fixup.c,v 1.9 2014/08/01 21:57:22 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -144,6 +144,15 @@ powerpc_fixup_stubs(uint32_t *start, uin
 					ctr = fixreg[rs];
 					break;
 				}
+				case OPC31_OR: {
+#ifdef DIAGNOSTIC
+					KASSERT(valid_mask & (1 << rs));
+					KASSERT(valid_mask & (1 << rb));
+#endif
+					fixreg[ra] = fixreg[rs] | fixreg[rb];
+					valid_mask |= 1 << ra;
+					break;
+				}
 				default:
 					panic("%s: %p: unexpected insn 0x%08x",
 					    __func__, stub, i.i_int);
@@ -176,7 +185,7 @@ powerpc_fixup_stubs(uint32_t *start, uin
 				break;
 			}
 			case OPC_STW: {
-				KASSERT(i.i_d.i_rs == r_lr && i.i_d.i_ra == 1);
+				KASSERT((i.i_d.i_rs == r_lr || i.i_d.i_rs == 31) && i.i_d.i_ra == 1);
 				break;
 			}
 			case OPC_STWU: {
@@ -195,6 +204,11 @@ powerpc_fixup_stubs(uint32_t *start, uin
 				fixup.jfi_real = fixup_addr2offset(ctr);
 				break;
 			}
+			case OPC_RLWINM: {
+				// LLVM emits these for bool operands.
+				// Ignore them.
+				break;
+			}
 			default: {
 				panic("%s: %p: unexpected insn 0x%08x",
 					    __func__, stub, i.i_int);

Reply via email to