Rename MAKE_32_PTR to MAKE_FARPTR.
Rename PTR_TO_SEG to FARPTR_TO_SEG.
Rename PTR_TO_OFFSET to FARPTR_TO_OFFSET.
SET_EBDA(ata.trsfbytes,0L);
// Send command to device
- outsw_far(iobase1, MAKE_32_PTR(GET_SEG(SS), (u32)cmdbuf), cmdlen / 2);
+ outsw_far(iobase1, MAKE_FARPTR(GET_SEG(SS), (u32)cmdbuf), cmdlen / 2);
u8 status;
u16 loops = 0;
memset(buffer, 0, sizeof(buffer));
u16 ret = ata_cmd_data(devid, ATA_CMD_IDENTIFY_DEVICE_PACKET
, 1, 1
- , MAKE_32_PTR(GET_SEG(SS), (u32)buffer));
+ , MAKE_FARPTR(GET_SEG(SS), (u32)buffer));
if (ret != 0)
BX_PANIC("ata-detect: Failed to detect ATAPI device\n");
memset(buffer, 0, sizeof(buffer));
u16 ret = ata_cmd_data(devid, ATA_CMD_IDENTIFY_DEVICE
, 1, 1
- , MAKE_32_PTR(GET_SEG(SS), (u32)buffer));
+ , MAKE_FARPTR(GET_SEG(SS), (u32)buffer));
if (ret)
BX_PANIC("ata-detect: Failed to detect ATA device\n");
atacmd[4] = sizeof(buffer);
u16 ret = ata_cmd_packet(device, atacmd, sizeof(atacmd)
, 0, sizeof(buffer)
- , MAKE_32_PTR(GET_SEG(SS), (u32)buffer));
+ , MAKE_FARPTR(GET_SEG(SS), (u32)buffer));
if (ret != 0)
return 0x0002;
}
u16 ret = ata_cmd_packet(device, packet, sizeof(packet)
, 0, sizeof(buf)
- , MAKE_32_PTR(GET_SEG(SS), (u32)buf));
+ , MAKE_FARPTR(GET_SEG(SS), (u32)buf));
if (ret == 0)
break;
// Read the Boot Record Volume Descriptor
u8 buffer[2048];
ret = cdrom_read(device, 0x11, 2048
- , MAKE_32_PTR(GET_SEG(SS), (u32)buffer), 0);
+ , MAKE_FARPTR(GET_SEG(SS), (u32)buffer), 0);
if (ret)
return 3;
// And we read the Boot Catalog
ret = cdrom_read(device, lba, 2048
- , MAKE_32_PTR(GET_SEG(SS), (u32)buffer), 0);
+ , MAKE_FARPTR(GET_SEG(SS), (u32)buffer), 0);
if (ret)
return 7;
// And we read the image in memory
ret = cdrom_read(device, lba, nbsectors*512
- , MAKE_32_PTR(boot_segment, 0), 0);
+ , MAKE_FARPTR(boot_segment, 0), 0);
if (ret)
return 12;
+ (u32)sector - 1);
irq_enable();
u8 status = ata_cmd_data(device, command, lba, count
- , MAKE_32_PTR(segment, offset));
+ , MAKE_FARPTR(segment, offset));
irq_disable();
// Set nb of sector transferred
irq_enable();
u8 status = cdrom_read(device, lba, count*512
- , MAKE_32_PTR(segment, offset), before*512);
+ , MAKE_FARPTR(segment, offset), before*512);
irq_disable();
if (status != 0) {
BX_INFO("int13_harddisk: function %02x, error %02x !\n"
u8 status;
if (type == ATA_TYPE_ATA)
status = ata_cmd_data(device, command, lba, count
- , MAKE_32_PTR(segment, offset));
+ , MAKE_FARPTR(segment, offset));
else
status = cdrom_read(device, lba, count*2048
- , MAKE_32_PTR(segment, offset), 0);
+ , MAKE_FARPTR(segment, offset), 0);
irq_disable();
// Macros for converting to/from 32bit style pointers to their
// equivalent 16bit segment/offset values.
-#define PTR_TO_SEG(p) (((u32)(p)) >> 4)
-#define PTR_TO_OFFSET(p) (((u32)(p)) & 0xf)
-#define MAKE_32_PTR(seg,off) ((void*)(((seg)<<4)+(off)))
+#define FARPTR_TO_SEG(p) (((u32)(p)) >> 4)
+#define FARPTR_TO_OFFSET(p) (((u32)(p)) & 0xf)
+#define MAKE_FARPTR(seg,off) ((void*)(((seg)<<4)+(off)))
#ifdef MODE16
#define SET_FARPTR(ptr, val) __SET_FARPTR((ptr), (val))
static inline void insb_far(u16 port, void *farptr, u16 count) {
- SET_SEG(ES, PTR_TO_SEG(farptr));
- insb(port, (u8*)PTR_TO_OFFSET(farptr), count);
+ SET_SEG(ES, FARPTR_TO_SEG(farptr));
+ insb(port, (u8*)FARPTR_TO_OFFSET(farptr), count);
}
static inline void insw_far(u16 port, void *farptr, u16 count) {
- SET_SEG(ES, PTR_TO_SEG(farptr));
- insw(port, (u16*)PTR_TO_OFFSET(farptr), count);
+ SET_SEG(ES, FARPTR_TO_SEG(farptr));
+ insw(port, (u16*)FARPTR_TO_OFFSET(farptr), count);
}
static inline void insl_far(u16 port, void *farptr, u16 count) {
- SET_SEG(ES, PTR_TO_SEG(farptr));
- insl(port, (u32*)PTR_TO_OFFSET(farptr), count);
+ SET_SEG(ES, FARPTR_TO_SEG(farptr));
+ insl(port, (u32*)FARPTR_TO_OFFSET(farptr), count);
}
static inline void outsb_far(u16 port, void *farptr, u16 count) {
- SET_SEG(ES, PTR_TO_SEG(farptr));
- outsb(port, (u8*)PTR_TO_OFFSET(farptr), count);
+ SET_SEG(ES, FARPTR_TO_SEG(farptr));
+ outsb(port, (u8*)FARPTR_TO_OFFSET(farptr), count);
}
static inline void outsw_far(u16 port, void *farptr, u16 count) {
- SET_SEG(ES, PTR_TO_SEG(farptr));
- outsw(port, (u16*)PTR_TO_OFFSET(farptr), count);
+ SET_SEG(ES, FARPTR_TO_SEG(farptr));
+ outsw(port, (u16*)FARPTR_TO_OFFSET(farptr), count);
}
static inline void outsl_far(u16 port, void *farptr, u16 count) {
- SET_SEG(ES, PTR_TO_SEG(farptr));
- outsl(port, (u32*)PTR_TO_OFFSET(farptr), count);
+ SET_SEG(ES, FARPTR_TO_SEG(farptr));
+ outsl(port, (u32*)FARPTR_TO_OFFSET(farptr), count);
}
#else
// In 32-bit mode there is no need to mess with the segments.
#define GET_FARVAR(seg, var) \
- (*((typeof(&(var)))MAKE_32_PTR((seg), (u32)&(var))))
+ (*((typeof(&(var)))MAKE_FARPTR((seg), (u32)&(var))))
#define SET_FARVAR(seg, var, val) \
do { GET_FARVAR((seg), (var)) = (val); } while (0)
#define GET_VAR(seg, var) (var)
if (checksum(rom, len) != 0)
continue;
p = (u8*)(((u32)p + len) / 2048 * 2048);
- callrom(PTR_TO_SEG(rom), PTR_TO_OFFSET(rom + 3));
+ callrom(FARPTR_TO_SEG(rom), FARPTR_TO_OFFSET(rom + 3));
// Look at the ROM's PnP Expansion header. Properly, we're supposed
// to init all the ROMs and then go back and build an IPL table of
struct ipl_entry_s *ip = &ipl->table[ipl->count];
ip->type = IPL_TYPE_BEV;
- ip->vector = (PTR_TO_SEG(rom) << 16) | entry;
+ ip->vector = (FARPTR_TO_SEG(rom) << 16) | entry;
u16 desc = *(u16*)&rom[0x1a+0x10];
if (desc)
- ip->description = (PTR_TO_SEG(rom) << 16) | desc;
+ ip->description = (FARPTR_TO_SEG(rom) << 16) | desc;
ipl->count++;
}