This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] 16 bit real-mode for the i386


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]