[SeaBIOS] Wrong address returned by container _of macro

Daniel Castro evil.dani at gmail.com
Wed Apr 4 09:04:54 CEST 2012


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.

Thanks you all,

Daniel





-- 
+-=====---------------------------+
| +---------------------------------+ | This space intentionally blank
for notetaking.
| |   | Daniel Castro,                |
| |   | Consultant/Programmer.|
| |   | U Andes                         |
+-------------------------------------+



More information about the SeaBIOS mailing list