Date: Sat, 12 Jun 2004 22:20:06 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 54755 for review Message-ID: <200406122220.i5CMK6r2020697@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=54755 Change 54755 by marcel@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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406122220.i5CMK6r2020697>