summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2005-09-22 20:08:44 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-09-22 20:08:44 +0000
commita2e5511b5d1eb3faffb47e92fa11136df715aaff (patch)
tree83af1de1bc097949bff7e565897f3158c11fe54c
parent621435e9d05ed716c1261bc3851fc85d60586b0f (diff)
parent153ada05e0051228c641736634c255bc18962e81 (diff)
merge of 3918e04d271278074bcf12fe4c07ea259cbc92b0
and ba30bfad08ba6c051b42fb8b245a2323db4719d9
-rw-r--r--packages/gdb/gdb-6.3/thumb-breakpoint.patch41
-rw-r--r--packages/gdb/gdb_6.3.bb4
-rw-r--r--packages/linux/nslu2-kernel/2.6/thumb-swi.patch19
-rw-r--r--packages/linux/nslu2-kernel_2.6.12.2.bb1
4 files changed, 65 insertions, 0 deletions
diff --git a/packages/gdb/gdb-6.3/thumb-breakpoint.patch b/packages/gdb/gdb-6.3/thumb-breakpoint.patch
new file mode 100644
index 0000000000..cd678b0b93
--- /dev/null
+++ b/packages/gdb/gdb-6.3/thumb-breakpoint.patch
@@ -0,0 +1,41 @@
+# This patch causes gdb to use thumb swi(1) on linux for a thumb breakpoint
+# rather than the default, swi(254). To stand any chance of making this
+# work a linux kernel patch is required to read the swi number on a thumb
+# swi. In the absence of this patch gdb will effectively insert a random
+# swi because the kernel reads the swi number from r7...
+#
+--- gdb-6.3/gdb/arm-linux-tdep.c.orig 2005-09-19 13:55:16.486702426 -0700
++++ gdb-6.3/gdb/arm-linux-tdep.c 2005-09-19 13:57:44.127992906 -0700
+@@ -44,6 +44,12 @@
+
+ static const char arm_linux_arm_be_breakpoint[] = { 0xef, 0x9f, 0x00, 0x01 };
+
++/* The following requires the corresponding patch to the kernel to recognise
++ * this SWI as a breakpoint.
++ */
++static const char arm_linux_thumb_le_breakpoint[] = {0x01, 0xdf};
++static const char arm_linux_thumb_be_breakpoint[] = {0xdf, 0x01};
++
+ /* Description of the longjmp buffer. */
+ #define ARM_LINUX_JB_ELEMENT_SIZE INT_REGISTER_SIZE
+ #define ARM_LINUX_JB_PC 21
+@@ -463,10 +469,17 @@
+
+ tdep->lowest_pc = 0x8000;
+ if (info.byte_order == BFD_ENDIAN_BIG)
+- tdep->arm_breakpoint = arm_linux_arm_be_breakpoint;
++ {
++ tdep->arm_breakpoint = arm_linux_arm_be_breakpoint;
++ tdep->thumb_breakpoint = arm_linux_thumb_be_breakpoint;
++ }
+ else
+- tdep->arm_breakpoint = arm_linux_arm_le_breakpoint;
++ {
++ tdep->arm_breakpoint = arm_linux_arm_le_breakpoint;
++ tdep->thumb_breakpoint = arm_linux_thumb_le_breakpoint;
++ }
+ tdep->arm_breakpoint_size = sizeof (arm_linux_arm_le_breakpoint);
++ tdep->thumb_breakpoint_size = sizeof (arm_linux_thumb_le_breakpoint);
+
+ tdep->fp_model = ARM_FLOAT_FPA;
+
diff --git a/packages/gdb/gdb_6.3.bb b/packages/gdb/gdb_6.3.bb
index fcabfdc5f3..cbd7d3ff15 100644
--- a/packages/gdb/gdb_6.3.bb
+++ b/packages/gdb/gdb_6.3.bb
@@ -6,6 +6,7 @@ PRIORITY = "optional"
MAINTAINER = "Pawel Osiczko <p.osiczko@tetrapyloctomy.org>"
DEPENDS = "ncurses readline"
RDEPENDS_openmn = "libthread-db1"
+PR = "r1"
PACKAGES =+ 'gdbserver '
FILES_gdbserver = '${bindir}/gdbserver'
@@ -16,6 +17,9 @@ SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.gz \
file://uclibc.patch;patch=1 \
file://gdbserver-cflags-last.diff;patch=1;pnum=0"
+# Patch the swi gdb is using for arm thumb code
+SRC_URI += "file://thumb-breakpoint.patch;patch=1"
+
LDFLAGS_append = " -s"
export CC_FOR_BUILD = "${BUILD_CC}"
export CXX_FOR_BUILD = "${BUILD_CXX}"
diff --git a/packages/linux/nslu2-kernel/2.6/thumb-swi.patch b/packages/linux/nslu2-kernel/2.6/thumb-swi.patch
new file mode 100644
index 0000000000..2e73bb103f
--- /dev/null
+++ b/packages/linux/nslu2-kernel/2.6/thumb-swi.patch
@@ -0,0 +1,19 @@
+# This patch changes the thumb swi handling for any thumb swi with
+# an immediate value != 0, those swis are mapped into the arm
+# specific swis. This implements a thumb breakpoint swi.
+--- linux-2.6.12.2/arch/arm/kernel/entry-common.S.orig 2005-09-19 12:48:42.323365573 -0700
++++ linux-2.6.12.2/arch/arm/kernel/entry-common.S 2005-09-19 13:31:19.004247358 -0700
+@@ -137,8 +137,11 @@
+ */
+ #ifdef CONFIG_ARM_THUMB
+ tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs
+- addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in
+- ldreq scno, [lr, #-4]
++ ldrneh ip, [lr, #-2] @ thumb swi instruction
++ ldreq scno, [lr, #-4] @ arm swi instruction
++ addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in to thumb r7 value
++ bicnes ip, ip, #0xff00 @ clear thumb swi bits
++ addne scno, ip, #__ARM_NR_BASE @ thumb swi0->r7, swi!0->arm swi
+ #else
+ ldr scno, [lr, #-4] @ get SWI instruction
+ #endif
diff --git a/packages/linux/nslu2-kernel_2.6.12.2.bb b/packages/linux/nslu2-kernel_2.6.12.2.bb
index e574f86d56..7e1a6f293d 100644
--- a/packages/linux/nslu2-kernel_2.6.12.2.bb
+++ b/packages/linux/nslu2-kernel_2.6.12.2.bb
@@ -25,4 +25,5 @@ N2K_PATCHES = "\
file://timer.patch;patch=1 \
file://nslu2-io_rpbutton.patch;patch=1 \
file://disk_led_blinking.patch;patch=1 \
+ file://thumb-swi.patch;patch=1 \
"