PERFORCE change 54755 for review
Marcel Moolenaar
marcel at FreeBSD.org
Sat Jun 12 22:20:33 GMT 2004
http://perforce.freebsd.org/chv.cgi?CH=54755
Change 54755 by marcel at marcel_nfs on 2004/06/12 22:19:59
Don't directly dereference the trapframe pointer. It's a
kernel VA.
Affected files ...
.. //depot/projects/gdb/usr.bin/kgdb/md_i386.c#4 edit
Differences ...
==== //depot/projects/gdb/usr.bin/kgdb/md_i386.c#4 (text+ko) ====
@@ -40,11 +40,20 @@
#include "kgdb.h"
+static int
+getreg(int *addr)
+{
+ int val;
+
+ kvm_read(kvm, (uintptr_t)addr, &val, sizeof(val));
+ return (val);
+}
+
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{
- static register_t synth;
struct trapframe *tf = curkthr->td_frame;
+ int cs;
*regsz = gdb_cpu_regsz(regnum);
switch (regnum) {
@@ -61,11 +70,11 @@
case 12: return (&tf->tf_ds);
case 13: return (&tf->tf_es);
case 4:
- synth = (!ISPL(tf->tf_cs)) ? tf->tf_ebp : tf->tf_esp;
- return (&synth);
+ cs = getreg(&tf->tf_cs);
+ return (!ISPL(cs)) ? &tf->tf_ebp : &tf->tf_esp;
case 11:
- synth = (!ISPL(tf->tf_cs)) ? tf->tf_ds : tf->tf_ss;
- return (&synth);
+ cs = getreg(&tf->tf_cs);
+ return (!ISPL(cs)) ? &tf->tf_ds : &tf->tf_ss;
}
return (NULL);
}
More information about the p4-projects
mailing list