From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: C Macros and Xen RING Macros Questions Date: Fri, 6 Apr 2012 15:54:15 -0400 Message-ID: <20120406195414.GA13732@phenom.dumpdata.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Daniel Castro Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Fri, Apr 06, 2012 at 07:20:13PM +0900, Daniel Castro wrote: > hello All, > = > I am still working on the PV Drivers for SeaBIOS using upstream qemu. > And, I have two questions. > 1. > Here is the location of all relevant data structs: > blkfront_info:0x000fd620 shared_ring:0x0009a000 private_ring:0x0009b000 I surmise this is the guest PFNs. > DEBUG Read op private ring at 0x0009b000-0x000ab000, idx 63478 > Here is my problem, when I do: > ring_req =3D > GLOBALFLAT2GLOBAL(RING_GET_REQUEST(GET_GLOBALFLAT(bi->private),GLOBALFLAT= 2GLOBAL(GET_GLOBALFLAT(bi->private)->req_prod_pvt))); > //please ignore the MACROS for now, or read further down. > I get: > After RING_GET_REQUEST operation ring request is at 0xe18ea40f id:0 > But I have the feeling that the request should be between > 0x0009b000-0x000ab000. Right? That would imply a physical address - but if you are running with pagetables (which I think you are?) then it would be virtual address. You should have some basic macros to translate from virtual to physical and vice-versa. > = > 2. > As you can see in the above code I use some SeaBIOS macros to access > 32Bit addresses in 16Bit code. My second questions is: How the memory 16-bit code. Refresh my memory - does that mean you can only use segments and no paging? So you need to move a 16-bit window around to get to your 32-bit address? > access macros affect the RING macros? Do I need to rewrite the ring > macros to use the memory macros inside, for example: It should fit within a 16-bit (64K) contingous memory space. I don't think it matters where that the block is - as long as you have a segment selector activated for that 16-bit block. > /* How big is this ring? */ > #define RING_SIZE(_r) \ > ((_r)->nr_ents) That tells you just how many entries are on it. Not how big the structure is. For that it is sizeof(struct ..). > = > Should be instead: > /* How big is this ring? */ > #define RING_SIZE(_r) \ > (GET_GLOBAL((_r)->nr_ents)) > = > SeaBIOS macros need to be around ALL memory accesses. > = > This is a short message for something that might be to complex to > explain briefly, so please ask any questions that you deem necessary > to understand. Right now, I am developing the first stage of boot when > the BIOS requests address 7c00 to get the Boot sector. Once I get this > working we should have a working prototype for PV-drivers in seabios. > = > Thank you all for your interest, > = > Daniel > = > -- = > +-=3D=3D=3D=3D=3D---------------------------+ > | +---------------------------------+ | This space intentionally blank > for notetaking. > | |=A0=A0 | Daniel Castro,=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | > | |=A0=A0 | Consultant/Programmer.| > | |=A0=A0 | U Andes=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 | > +-------------------------------------+ > = > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel