- // fill hdidmap
- u8 hdcount = GET_BDA(hdcount);
- if (hdcount >= ARRAY_SIZE(Drives.idmap[0]))
- return;
- dprintf(3, "Mapping hd drive %p to %d\n", drive_g, hdcount);
- int driveid = drive_g - Drives.drives;
- SET_GLOBAL(Drives.idmap[EXTTYPE_HD][hdcount], driveid);
- SET_BDA(hdcount, hdcount + 1);
+ ASSERT32FLAT();
+ struct bios_data_area_s *bda = MAKE_FLATPTR(SEG_BDA, 0);
+ int hdid = bda->hdcount;
+ dprintf(3, "Mapping hd drive %p to %d\n", drive_g, hdid);
+ add_drive(IDMap[EXTTYPE_HD], &bda->hdcount, drive_g);
+
+ // Setup disk geometry translation.
+ setup_translation(drive_g);