On Wed, Apr 4, 2012 at 4:04 PM, Daniel Castro evil.dani@gmail.com wrote:
Hello All,
I have a little problem, when I try to get my drive on boot (16bit) I am getting the wrong address:
This code: struct xendrive_s * xendrive = GLOBALFLAT2GLOBAL(container_of(GET_GLOBAL(op->drive_g), struct xendrive_s, drive)); dprintf(1,"Xendrive at:%p\n",xendrive); Returns this: Xendrive at:0xfff10000
But it should be this instead: dprintf(1,"TEST drive 0 %p \n",i,GET_GLOBAL(xendrives[0])); returns this: TEST drive 0 0x000fd620
This last address is the address returned when done this: struct xendrive_s *xd = malloc_fseg(sizeof(struct xendrive_s*)); SET_FLATPTR(xendrives[count_drives],xd); The xd pointer is later used for: boot_add_hd(&xd->drive,desc,drives);
Any tip to solve this will be greatly appreciated.
I found a way around it, I create a global array with the drives as I add them to the boot, when the read operation is called, I compare the op->drive address to the ones I have registered, that way I can recover the struct that contains the drive and my custom struct for the drive.
Thanks you all,
Daniel
-- +-=====---------------------------+ | +---------------------------------+ | This space intentionally blank for notetaking. | | | Daniel Castro, | | | | Consultant/Programmer.| | | | U Andes | +-------------------------------------+