Module Name:    src
Committed By:   matt
Date:           Fri Jan  7 01:51:31 UTC 2011

Modified Files:
        src/sys/arch/powerpc/include [matt-nb5-pq3]: instr.h

Log Message:
Add fixup definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.104.1 src/sys/arch/powerpc/include/instr.h

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/include/instr.h
diff -u src/sys/arch/powerpc/include/instr.h:1.4 src/sys/arch/powerpc/include/instr.h:1.4.104.1
--- src/sys/arch/powerpc/include/instr.h:1.4	Sun Dec 11 12:18:43 2005
+++ src/sys/arch/powerpc/include/instr.h	Fri Jan  7 01:51:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: instr.h,v 1.4 2005/12/11 12:18:43 christos Exp $ */
+/*	$NetBSD: instr.h,v 1.4.104.1 2011/01/07 01:51:31 matt Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,6 +40,9 @@
  *	@(#)instr.h	8.1 (Berkeley) 6/11/93
  */
 
+#ifndef _POWERPC_INSTR_H_
+#define _POWERPC_INSTR_H_
+
 /*
  * An instruction.
  */
@@ -74,11 +77,11 @@
 	 */
 	struct {
 		u_int	i_opcd:6;
-		int	i_bo:5;
-		int	i_bi:5;
+		u_int	i_bo:5;
+		u_int	i_bi:5;
 		int	i_bd:14;
-		int	i_aa:1;
-		int	i_lk:1;
+		u_int	i_aa:1;
+		u_int	i_lk:1;
 	} i_b;
 
 	/*
@@ -307,6 +310,10 @@
 #define	OPC31_FPMASK	0x31f
 #define	OPC31_FPOP	0x217
 
+/* m[ft]spr are also opcode 31; ra/rb encode the spr */
+#define	OPC31_MFSPR	0x153
+#define OPC31_MTSPR	0x1d3
+
 /*
  * Opcode 59 sub-types:
  */
@@ -377,6 +384,12 @@
 #define	OPC63_FCFID	0x34e
 
 /*
+ * Branch instruction modifiers.
+ */
+#define	B_LK		0x01	/* Link flag (LR=CIA+4) */
+#define	B_AA		0x02	/* Absolute flag */
+
+/*
  * FPU data types.
  */
 #define FTYPE_LNG	-1	/* data = 64-bit signed long integer */		
@@ -391,3 +404,19 @@
 #define	  FSR_RD_RZ	1		/* round towards 0 */
 #define	  FSR_RD_RP	2		/* round towards +inf */
 #define	  FSR_RD_RM	3		/* round towards -inf */
+
+/*
+ * Convert an address to an offset used in a PowerPC branch instruction.
+ * We simply shift away the low bits since we are going convert the bl
+ * to a bla.
+ */
+#define	fixup_addr2offset(x)	((uintptr_t)(x) >> 2)
+struct powerpc_jump_fixup_info {
+	uint32_t jfi_stub;
+	uint32_t jfi_real;
+};
+ 
+void	powerpc_fixup_stubs(uint32_t *, uint32_t *);
+
+
+#endif /* !_POWERPC_INSTR_H_ */

Reply via email to