Page MenuHomeFreeBSD

D22767.id65564.diff
No OneTemporary

D22767.id65564.diff

Index: sys/gdb/gdb_main.c
===================================================================
--- sys/gdb/gdb_main.c
+++ sys/gdb/gdb_main.c
@@ -131,6 +131,35 @@
gdb_tx_err(EIO);
}
+#ifdef __powerpc__
+extern vm_offset_t __startkernel;
+
+static void
+gdb_do_offsets(void)
+{
+ /*
+ * On PowerPC, .text starts at KERNBASE + SIZEOF_HEADERS and
+ * text segment at KERNBASE - SIZEOF_HEADERS.
+ * On PowerPC64, .text starts at KERNBASE and text segment at
+ * KERNBASE - 0x100.
+ * In both cases, the text segment offset is aligned to 64KB.
+ *
+ * The __startkernel variable holds the relocated KERNBASE offset.
+ * Thus, as long as SIZEOF_HEADERS doesn't get bigger than 0x100
+ * (which would lead to other issues), aligning __startkernel to
+ * 64KB gives the text segment offset.
+ *
+ * TODO: Add DataSeg to response. On PowerPC64 all sections reside
+ * in a single LOAD segment, but on PowerPC modifiable data reside
+ * in a separate segment, that GDB should also relocate.
+ */
+ gdb_tx_begin(0);
+ gdb_tx_str("TextSeg=");
+ gdb_tx_varhex(__startkernel & ~0xffff);
+ gdb_tx_end();
+}
+#endif
+
static void
gdb_do_threadinfo(struct thread **thr_iter)
{
@@ -769,6 +798,10 @@
do_qXfer();
} else if (gdb_rx_equal("Search:memory:")) {
gdb_do_mem_search();
+#ifdef __powerpc__
+ } else if (gdb_rx_equal("Offsets")) {
+ gdb_do_offsets();
+#endif
} else if (!gdb_cpu_query())
gdb_tx_empty();
break;

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 6, 10:37 PM (18 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34771702
Default Alt Text
D22767.id65564.diff (1 KB)

Event Timeline