This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] libgloss/m68k: Fix semihosting.


Hi,

Attached is a patch to fix semihosting.

We have a gdb stub detecting the seuqence of "nop,halt,sentinel", but
we require this to be 4-byte aligned.  If we need to add padding, we
should be adding nop, not zeros.

This patch fixes the problem by using .balignw instead of .align.

Tested by running "Hello, world".  OK to apply?

Kazu Hirata

libgloss/
2006-12-22  Kazu Hirata  <kazu@codesourcery.com>

	Merge from newlib-csl-20060320-branch:
	2006-12-22  Nathan Sidwell  <nathan@codesourcery.com>

	* m68k/cf-hosted.S (__hosted): Adjust semihosting.

Index: libgloss/m68k/cf-hosted.S
===================================================================
RCS file: /cvs/src/src/libgloss/m68k/cf-hosted.S,v
retrieving revision 1.2
diff -u -d -p -r1.2 cf-hosted.S
--- libgloss/m68k/cf-hosted.S	11 Dec 2006 19:58:01 -0000	1.2
+++ libgloss/m68k/cf-hosted.S	22 Dec 2006 16:59:35 -0000
@@ -22,17 +22,15 @@ __hosted:
 	linkw %fp,#0
 	movel %fp@(8),%d0
 	movel %fp@(12),%d1
-	.align 4
 
-	/* The halt sequence must be 'nop; halt' and aligned to a 4 byte
-	    boundary.  */
+	/* The semihosting sequence is 'nop; halt;sentinel' aligned to
+	   a 4 byte boundary.  The sentinel is an ill formed instruction
+	   (movec %sp,0).  The debugger will adjust the pc, so it is never
+	    executed.  */
+	.balignw 4,0x4e71
 	nop
 	halt
-	
-	/* This sentinel instruction value must be immediately after
-	   the halt instruction.  The debugger will adjust the pc, so
-	   that it is never executed.  This instruction is
-	   'movec %sp,0'.  */
 	.long 0x4e7bf000
+
 	unlk %fp
 	rts


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]