Thank you vey much Kovin, Sorry about that, let me then complement the code to make it more accurate to the one I am using.
On Thu, Mar 15, 2012 at 9:42 PM, Kevin O'Connor <[email protected]> wrote: > On Thu, Mar 15, 2012 at 07:33:10PM +0900, Daniel Castro wrote: >> Kevin, I greatly appreciate your help. Sorry to bother you again. >> >> Could you please check the following sample code, I am sure I am doing >> something wrong, but I am on the right path: > > It would help if you sent actual code samples. The details are > important. > >> I have: >> struct xendrive_s * xd = conteiner_of(op->drive_g,...) > > GET_GLOBAL(op->drive_g) -- as that is a memory access. > >> struct blk_info * bi = GLOBALFLAT2GLOBAL($(GET_GLOBALFLAT(xd)->info); > > I don't know what $ does. Sorry that was a typo it is a "&" I am trying to create a pointer to a struct inside the parent of drive_g; The struct xendrive_s has two structs: drive and blk_info; xendrive_g was created using mallow_fseg. Inside xendrive_g there is blk_info which have two pointers to structs created through xen macros, they were created with memalign_alow(4096,4096). I have to do macros access to those to structs. Like this: RING_GET_REQUEST(bi->private,bi->private->req_prod_pvt); //this changes some indexes inside and returns a pointer to indicate where to put the request. Should I just but the GET_GLOBALs and hope for the best, if does not work I should expand the macro and rewrite it, right? Thanks again Kevin, your are being the most helpful. Daniel > >> To test I do: >> dprintf(1,"DEBUG test xendrive %p and an int >> %d.\n",GET_GLOBALFLAT(xd),GET_GLOBALFLAT(GET_GLOBALFLAT(bi)->buffer_gref)); > > Neither "bi" nor "xd" is a non-stack memory access so they shouldn't > be wrapped. "bi->buffer_gref" is a memory access. So it should look > like dprintf("...", xd, GET_GLOBALFLAT(bi->buffer_gref)). (This is > assuming the pointer in buffer_gref was obtained via malloc_fseg.) Only when I initialize the stack variables with memory addresses and memory address access do I requiere GET_GLOBAL, GET_GLOBALFLAT or GLOBALFLAT2GLOBAL. RIght? > > -Kevin -- +-=====---------------------------+ | +---------------------------------+ | This space intentionally blank for notetaking. | | | Daniel Castro, | | | | Consultant/Programmer.| | | | U Andes | +-------------------------------------+ _______________________________________________ SeaBIOS mailing list [email protected] http://www.seabios.org/mailman/listinfo/seabios
