public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* Another patch to unit tests and frysk assembly.
@ 2007-10-18 12:31 Jose Flavio Aguilar Paulino
  0 siblings, 0 replies; only message in thread
From: Jose Flavio Aguilar Paulino @ 2007-10-18 12:31 UTC (permalink / raw)
  To: Frysk

[-- Attachment #1: Type: text/plain, Size: 158 bytes --]


-- 
Jose Flavio Aguilar Paulino
(jflavio@br.ibm.com)
http://www.j-fap.com
System / Software Engineer

Toolchain Team
LTC, Linux Technology Center
IBM Brazil

[-- Attachment #2: power_frysk_assembly_2 --]
[-- Type: text/x-patch, Size: 4404 bytes --]

Index: frysk/frysk-core/frysk/pkglibdir/funit-location.S
===================================================================
--- frysk.orig/frysk-core/frysk/pkglibdir/funit-location.S
+++ frysk/frysk-core/frysk/pkglibdir/funit-location.S
@@ -44,7 +44,13 @@ MAIN_PROLOGUE(0)
 
 LOAD_IMMED_WORD (REG0, 0)
 LOAD_IMMED_WORD (REG1, 987)
-LOAD_IMMED_WORD (REG2, memory)
+
+#if defined __powerpc__
+#warning PowerPC do not support load a LABEL into a Register as a immediate
+#else
+	LOAD_IMMED_WORD (REG2, memory)
+#endif
+
 STORE (REG0, REG0)   				// To crash program
 
 MAIN_EPILOGUE(0)
@@ -52,4 +58,8 @@ FUNCTION_RETURN(main,0)
 FUNCTION_END(main,0)
 
 memory:						// Set up memory locations
+#if defined __powerpc__
+	.4byte 0x1234
+#else
 	.word 0x1234
+#endif
Index: frysk/frysk-imports/include/frysk-asm.h
===================================================================
--- frysk.orig/frysk-imports/include/frysk-asm.h
+++ frysk/frysk-imports/include/frysk-asm.h
@@ -324,8 +324,6 @@
 #  define COMPARE(LHS_REG,RHS_REG) cmpq LHS_REG, RHS_REG
 #elif defined __powerpc__
 #  define COMPARE(LHS_REG,RHS_REG) cmpw cr7, LHS_REG, RHS_REG
-//#elif defined __powerpc64__
-//#  define COMPARE(LHS_REG,RHS_REG)
 #else
 #  warning "No register-compare instruction defined"
 #endif
@@ -342,9 +340,7 @@
 #elif defined __x86_64__
 #  define JUMP_EQ(LABEL) je LABEL
 #elif defined __powerpc__
-#  define JUMP_EQ(LABEL) bf eq, LABEL
-#elif defined __powerpc64__
-#  define JUMP_EQ(LABEL) bf eq, LABEL
+#  define JUMP_EQ(LABEL) beq cr7, LABEL
 #else
 #  warning "No jump equal instruction defined"
 #endif
@@ -354,9 +350,7 @@
 #elif defined __x86_64__
 #  define JUMP_NE(LABEL) jne LABEL
 #elif defined __powerpc__
-#  define JUMP_NE(LABEL) bf ne, LABEL
-#elif defined __powerpc64__
-#  define JUMP_NE(LABEL) bf ne, LABEL
+#  define JUMP_NE(LABEL) bne cr7, LABEL
 #else
 #  warning "No jump not-equal instruction defined"
 #endif
Index: frysk/frysk-core/frysk/pkglibdir/funit-raise.S
===================================================================
--- frysk.orig/frysk-core/frysk/pkglibdir/funit-raise.S
+++ frysk/frysk-core/frysk/pkglibdir/funit-raise.S
@@ -48,6 +48,10 @@
 #if defined(__i386__) || defined(__x86_64__)
 	#define DIV_ZERO(REG)	div REG;
 	#define ILL_INST	.word 0xffff;
+#elif defined(__powerpc__)
+	#define DIV_ZERO(REG)	li 5, 0; divw 6, REG, 5
+	//PowePC64 has fixed size instructions upcodes, 16 bytes (64bits) long
+	#define ILL_INST	.8byte 0xffff; .8byte 0xffff;
 #else
 	#error unsuported architecture
 #endif
@@ -136,8 +140,14 @@ FUNCTION_BEGIN(main,0)
 	// Unknown, print usage.
 	LOAD_IMMED_BYTE(REG0, SYS_write)
 	LOAD_IMMED_BYTE(REG1, 1)
-	LOAD_IMMED_WORD(REG2, usage)
-	LOAD_IMMED_WORD(REG3, .usage-usage)
+
+	#if defined(__powerpc__)
+		#warning You cant load a LABEL as an immediate in PowerPC
+	#else
+		LOAD_IMMED_WORD(REG2, usage)
+		LOAD_IMMED_WORD(REG3, .usage-usage)
+	#endif
+
 	SYSCALL
 
 	// Non-zero return
@@ -148,6 +158,8 @@ exit_main:	
 	FUNCTION_RETURN(main,0)
 FUNCTION_END(main,0)
 
+//In PowerPC you cant have unaligned upcodes in executable segment
+#if !defined(__powerpc__)
 usage:	.asciz "Usage:\r\n\
 	ARG1 ...\r\n\
 The number of arguments determines the function which this program\r\n\
@@ -159,3 +171,4 @@ calls and how it will raise a signal/tra
 5: SIGURG ignore signal (ign_sig_urg)\r\n\
 "
 .usage:
+#endif
Index: frysk/frysk-core/frysk/pkglibdir/funit-symbols.S
===================================================================
--- frysk.orig/frysk-core/frysk/pkglibdir/funit-symbols.S
+++ frysk/frysk-core/frysk/pkglibdir/funit-symbols.S
@@ -339,8 +339,13 @@ LOCAL(small_local_at_large_local)
 
 	LOAD_IMMED_BYTE(REG0, SYS_write)
 	LOAD_IMMED_BYTE(REG1, 1)
+
+#if defined(__powerpc__)
+	#warning You cant load a LABEL as an immediate in PowerPC
+#else
 	LOAD_IMMED_WORD(REG2, usage)
 	LOAD_IMMED_WORD(REG3, .usage-usage)
+#endif
 	SYSCALL
 		// exit with a non-zero status
 	LOAD_IMMED_BYTE(REG0, 1)
@@ -348,6 +353,9 @@ LOCAL(small_local_at_large_local)
 	FUNCTION_RETURN(main,0)
 	FUNCTION_END(main,0)
 
+#if defined(__powerpc__)
+#warning In PowerPC you cant have unaligned upcodes in executable segment
+#else
 usage:	.asciz "Usage:\r\n\
 	ARG1 ...\r\n\
 The number of arguments determines the symbol at which this program\r\n\
@@ -378,3 +386,4 @@ crashes:\r\n\
 24: No symbol after local with nested zero-sized symbols\r\n\
 "
 .usage:
+#endif

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-18 12:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-18 12:31 Another patch to unit tests and frysk assembly Jose Flavio Aguilar Paulino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).