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
On Thu, Aug 29, 2002 at 02:43:04PM -0700, Kevin Buettner wrote:
> On Aug 29, 5:36pm, Daniel Jacobowitz wrote:
>
> > 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.
>
> I think that's right. My (hazy) recollection from my days of programming
> x86 before there was an 80386 is that an address was formed by shifting
> the segment registers left by four bits and adding some other sixteen bit
> register to it.
That's positively perverse. Thanks.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer