This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfc] 16 bit real-mode for the i386
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Andrew Cagney <ac131313 at ges dot redhat dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Thu, 29 Aug 2002 17:36:53 -0400
- Subject: Re: [rfc] 16 bit real-mode for the i386
- References: <3D6E8453.5080306@ges.redhat.com>
On Thu, Aug 29, 2002 at 04:30:11PM -0400, Andrew Cagney wrote:
> Hello,
>
> The attached modifies i386-tdep.c so that there is a ``set i386
> real-mode'' command (doco to go).
>
> When real-mode is enabled, GDB computes the ``20 bit'' ``stop address''
> (aka PC but not to be confused with $pc ... :-) from both the $cs and
> $pc registers. That way, core GDB sees a cannonical PC address that
> (regardless of $cs) will match a ``20 bit'' breakpoint address.
>
> Thoughts?
>
> I'm desperatly trying to come up with a test-case mind. This is a
> rewrite of an old old patch (that hacked breakpoint.c) and the original
> testcase has been lost :-(
>
> Andrew
Now, my i386 knowledge is a bit rusty. But:
> +static CORE_ADDR
> +i386_read_pc (ptid_t ptid)
> +{
> + CORE_ADDR pc = read_register_pid (PC_REGNUM, ptid);
> + if (i386_real_mode_p)
> + {
> + CORE_ADDR cs = read_register_pid (CS_REGNUM, ptid);
> + pc = pc + (cs << 4);
> + }
> + return pc;
> +}
> +
> +static void
> +i386_write_pc (CORE_ADDR pc, ptid_t ptid)
> +{
> + if (i386_real_mode_p)
> + {
> + CORE_ADDR cs = read_register_pid (CS_REGNUM, ptid);
> + pc = pc - (cs << 4);
> + }
> + write_register_pid (PC_REGNUM, pc, ptid);
> +}
> +
Left shift of _four_? Surely the PC is more than four bits.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer