Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156693438
D2743.id6114.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D2743.id6114.diff
View Options
Index: sys/amd64/amd64/gdb_machdep.c
===================================================================
--- sys/amd64/amd64/gdb_machdep.c
+++ sys/amd64/amd64/gdb_machdep.c
@@ -48,6 +48,8 @@
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{
+ static uint32_t _kcodesel = GSEL(GCODE_SEL, SEL_KPL);
+ static uint32_t _kdatasel = GSEL(GDATA_SEL, SEL_KPL);
*regsz = gdb_cpu_regsz(regnum);
@@ -76,6 +78,8 @@
case 14: return (&kdb_thrctx->pcb_r14);
case 15: return (&kdb_thrctx->pcb_r15);
case 16: return (&kdb_thrctx->pcb_rip);
+ case 18: return (&_kcodesel);
+ case 19: return (&_kdatasel);
}
return (NULL);
}
Index: sys/i386/i386/gdb_machdep.c
===================================================================
--- sys/i386/i386/gdb_machdep.c
+++ sys/i386/i386/gdb_machdep.c
@@ -45,14 +45,22 @@
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{
+ static uint32_t _kcodesel = GSEL(GCODE_SEL, SEL_KPL);
+ static uint32_t _kdatasel = GSEL(GDATA_SEL, SEL_KPL);
+ static uint32_t _kprivsel = GSEL(GPRIV_SEL, SEL_KPL);
*regsz = gdb_cpu_regsz(regnum);
- if (kdb_thread == curthread) {
+ if (kdb_thread == curthread) {
switch (regnum) {
case 0: return (&kdb_frame->tf_eax);
case 1: return (&kdb_frame->tf_ecx);
case 2: return (&kdb_frame->tf_edx);
+ case 9: return (&kdb_frame->tf_eflags);
+ case 10: return (&kdb_frame->tf_cs);
+ case 12: return (&kdb_frame->tf_ds);
+ case 13: return (&kdb_frame->tf_es);
+ case 14: return (&kdb_frame->tf_fs);
}
}
switch (regnum) {
@@ -62,6 +70,12 @@
case 6: return (&kdb_thrctx->pcb_esi);
case 7: return (&kdb_thrctx->pcb_edi);
case 8: return (&kdb_thrctx->pcb_eip);
+ case 10: return (&_kcodesel);
+ case 11: return (&_kdatasel);
+ case 12: return (&_kdatasel);
+ case 13: return (&_kdatasel);
+ case 14: return (&_kprivsel);
+ case 15: return (&kdb_thrctx->pcb_gs);
}
return (NULL);
}
Index: sys/i386/i386/machdep.c
===================================================================
--- sys/i386/i386/machdep.c
+++ sys/i386/i386/machdep.c
@@ -2867,6 +2867,7 @@
pcb->pcb_ebx = tf->tf_ebx;
pcb->pcb_eip = tf->tf_eip;
pcb->pcb_esp = (ISPL(tf->tf_cs)) ? tf->tf_esp : (int)(tf + 1) - 8;
+ pcb->pcb_gs = rgs();
}
int
Index: sys/i386/include/gdb_machdep.h
===================================================================
--- sys/i386/include/gdb_machdep.h
+++ sys/i386/include/gdb_machdep.h
@@ -30,7 +30,7 @@
#define _MACHINE_GDB_MACHDEP_H_
#define GDB_BUFSZ 400
-#define GDB_NREGS 14
+#define GDB_NREGS 16
#define GDB_REG_PC 8
static __inline size_t
Index: sys/i386/include/kdb.h
===================================================================
--- sys/i386/include/kdb.h
+++ sys/i386/include/kdb.h
@@ -54,6 +54,10 @@
static __inline void
kdb_cpu_trap(int type, int code)
{
+ kdb_frame->tf_cs &= 0xffff;
+ kdb_frame->tf_ds &= 0xffff;
+ kdb_frame->tf_es &= 0xffff;
+ kdb_frame->tf_fs &= 0xffff;
}
#endif /* _MACHINE_KDB_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 16, 5:46 PM (3 m, 5 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33142149
Default Alt Text
D2743.id6114.diff (2 KB)
Attached To
Mode
D2743: Report the values of x86 segment registers to remote debuggers.
Attached
Detach File
Event Timeline
Log In to Comment