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: "Eli Zaretskii" <eliz at is dot elta dot co dot il>
- To: drow at mvista dot com
- Cc: ac131313 at ges dot redhat dot com, gdb-patches at sources dot redhat dot com
- Date: Fri, 30 Aug 2002 22:11:52 +0300
- Subject: Re: [rfc] 16 bit real-mode for the i386
- References: <3D6E8453.5080306@ges.redhat.com> <20020829213653.GA24048@nevyn.them.org>
- Reply-to: Eli Zaretskii <eliz at is dot elta dot co dot il>
> Date: Thu, 29 Aug 2002 17:36:53 -0400
> From: Daniel Jacobowitz <drow@mvista.com>
>
> > +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.
It's true that PC can be more than 4 bits, but the code above is still
correct. That's why real mode can only access 20 bit addresses:
16+4=20.
You can look at this issue this way: for each linear 2-bit address,
there are many CS:PC combination that all point to that address.