From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18912 invoked by alias); 29 Aug 2002 21:46:04 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18890 invoked from network); 29 Aug 2002 21:46:03 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 29 Aug 2002 21:46:03 -0000 Received: from ges.redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id F09B33F38; Thu, 29 Aug 2002 17:46:00 -0400 (EDT) Message-ID: <3D6E9618.2070609@ges.redhat.com> Date: Thu, 29 Aug 2002 14:46:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.0) Gecko/20020824 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: [rfc] 16 bit real-mode for the i386 References: <3D6E8453.5080306@ges.redhat.com> <20020829213653.GA24048@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-08/txt/msg01003.txt.bz2 > 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. It is. From an ia32 manual (www.intel.com): 16.1.1. Address Translation in Real-Address Mode In real-address mode, the processor does not interpret segment selectors as indexes into a descriptor table; instead, it uses them directly to form linear addresses as the 8086 processor does. It shifts the segment selector left by 4 bits to form a 20-bit base address (see Figure 16-1). The offset into a segment is added to the base address to create a linear address that maps directly to the physical address space. Andrew