From 35ae726530432c478a0955532e7e6c8b32c4bfef Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 19 Jan 2009 15:44:44 -0500 Subject: [PATCH] Rename MAKE_FARPTR (and similar) to MAKE_FLATPTR. The term "far pointer" is used in many 16bit specs, and it is different from what MAKE_FARPTR creates. So, use the term "flat pointer" in the code to distinguish between the two meanings. Also, use the suffix "_fl" consistently when working with "flat pointers". --- src/ata.c | 36 +++++++++---------- src/biosvar.h | 2 +- src/boot.c | 6 ++-- src/cdrom.c | 8 ++--- src/disk.c | 16 ++++----- src/disk.h | 4 +-- src/farptr.h | 92 ++++++++++++++++++++++++------------------------ src/floppy.c | 2 +- src/misc.c | 6 ++-- src/optionroms.c | 8 ++--- src/pcibios.c | 6 ++-- src/post.c | 6 ++-- src/resume.c | 4 +-- src/system.c | 6 ++-- src/util.c | 16 ++++----- src/util.h | 4 +-- 16 files changed, 111 insertions(+), 111 deletions(-) diff --git a/src/ata.c b/src/ata.c index 0b0bdc1..17bfda0 100644 --- a/src/ata.c +++ b/src/ata.c @@ -232,12 +232,12 @@ insx_discard(int mode, int iobase1, int bytes) // large number of parameters would consume a lot of stack space. static __always_inline int ata_transfer(int driveid, int iswrite, int count, int blocksize - , int skipfirst, int skiplast, void *far_buffer) + , int skipfirst, int skiplast, void *buf_fl) { dprintf(16, "ata_transfer id=%d write=%d count=%d bs=%d" " skipf=%d skipl=%d buf=%p\n" , driveid, iswrite, count, blocksize - , skipfirst, skiplast, far_buffer); + , skipfirst, skiplast, buf_fl); // Reset count of transferred data SET_EBDA(sector_count, 0); @@ -259,20 +259,20 @@ ata_transfer(int driveid, int iswrite, int count, int blocksize if (iswrite) { // Write data to controller - dprintf(16, "Write sector id=%d dest=%p\n", driveid, far_buffer); + dprintf(16, "Write sector id=%d dest=%p\n", driveid, buf_fl); if (mode == ATA_MODE_PIO32) - outsl_far(iobase1, far_buffer, bsize / 4); + outsl_fl(iobase1, buf_fl, bsize / 4); else - outsw_far(iobase1, far_buffer, bsize / 2); + outsw_fl(iobase1, buf_fl, bsize / 2); } else { // Read data from controller - dprintf(16, "Read sector id=%d dest=%p\n", driveid, far_buffer); + dprintf(16, "Read sector id=%d dest=%p\n", driveid, buf_fl); if (mode == ATA_MODE_PIO32) - insl_far(iobase1, far_buffer, bsize / 4); + insl_fl(iobase1, buf_fl, bsize / 4); else - insw_far(iobase1, far_buffer, bsize / 2); + insw_fl(iobase1, buf_fl, bsize / 2); } - far_buffer += bsize; + buf_fl += bsize; if (skiplast && current == count-1) insx_discard(mode, iobase1, skiplast); @@ -314,14 +314,14 @@ static noinline int ata_transfer_disk(const struct disk_op_s *op) { return ata_transfer(op->driveid, op->command == ATA_CMD_WRITE_SECTORS - , op->count, IDE_SECTOR_SIZE, 0, 0, op->far_buffer); + , op->count, IDE_SECTOR_SIZE, 0, 0, op->buf_fl); } static noinline int ata_transfer_cdrom(const struct disk_op_s *op) { return ata_transfer(op->driveid, 0, op->count, CDROM_SECTOR_SIZE - , 0, 0, op->far_buffer); + , 0, 0, op->buf_fl); } static noinline int @@ -329,7 +329,7 @@ ata_transfer_cdemu(const struct disk_op_s *op, int before, int after) { int vcount = op->count * 4 - before - after; int ret = ata_transfer(op->driveid, 0, op->count, CDROM_SECTOR_SIZE - , before*512, after*512, op->far_buffer); + , before*512, after*512, op->buf_fl); if (ret) { SET_EBDA(sector_count, 0); return ret; @@ -412,7 +412,7 @@ send_atapi_cmd(int driveid, u8 *cmdbuf, u8 cmdlen, u16 blocksize) return ret; // Send command to device - outsw_far(iobase1, MAKE_FARPTR(GET_SEG(SS), (u32)cmdbuf), cmdlen / 2); + outsw_fl(iobase1, MAKE_FLATPTR(GET_SEG(SS), cmdbuf), cmdlen / 2); int status = pause_await_ide(NOT_BSY_DRQ, iobase1, iobase2, IDE_TIMEOUT); if (status < 0) @@ -467,7 +467,7 @@ cdrom_read_512(struct disk_op_s *op) dprintf(16, "cdrom_read_512: id=%d vlba=%d vcount=%d buf=%p lba=%d elba=%d" " count=%d before=%d after=%d\n" - , op->driveid, vlba, vcount, op->far_buffer, lba, elba + , op->driveid, vlba, vcount, op->buf_fl, lba, elba , op->count, before, after); int ret = send_cmd_cdrom(op); @@ -480,13 +480,13 @@ cdrom_read_512(struct disk_op_s *op) // Send a simple atapi command to a drive. int ata_cmd_packet(int driveid, u8 *cmdbuf, u8 cmdlen - , u32 length, void *far_buffer) + , u32 length, void *buf_fl) { int ret = send_atapi_cmd(driveid, cmdbuf, cmdlen, length); if (ret) return ret; - return ata_transfer(driveid, 0, 1, length, 0, 0, far_buffer); + return ata_transfer(driveid, 0, 1, length, 0, 0, buf_fl); } @@ -548,7 +548,7 @@ init_drive_atapi(int driveid) dop.command = ATA_CMD_IDENTIFY_DEVICE_PACKET; dop.count = 1; dop.lba = 1; - dop.far_buffer = MAKE_FARPTR(GET_SEG(SS), (u32)buffer); + dop.buf_fl = MAKE_FLATPTR(GET_SEG(SS), buffer); u16 ret = ata_cmd_data(&dop); if (ret != 0) BX_PANIC("ata-detect: Failed to detect ATAPI device\n"); @@ -730,7 +730,7 @@ init_drive_ata(int driveid) dop.command = ATA_CMD_IDENTIFY_DEVICE; dop.count = 1; dop.lba = 1; - dop.far_buffer = MAKE_FARPTR(GET_SEG(SS), (u32)buffer); + dop.buf_fl = MAKE_FLATPTR(GET_SEG(SS), buffer); u16 ret = ata_cmd_data(&dop); if (ret) BX_PANIC("ata-detect: Failed to detect ATA device\n"); diff --git a/src/biosvar.h b/src/biosvar.h index 2391759..4d3b3f0 100644 --- a/src/biosvar.h +++ b/src/biosvar.h @@ -237,7 +237,7 @@ get_ebda_ptr() extern void *__force_link_error__get_ebda_ptr_only_in_32bit(); if (MODE16) return __force_link_error__get_ebda_ptr_only_in_32bit(); - return (void*)MAKE_FARPTR(get_ebda_seg(), 0); + return MAKE_FLATPTR(get_ebda_seg(), 0); } #define GET_EBDA2(eseg, var) \ GET_FARVAR(eseg, ((struct extended_bios_data_area_s *)0)->var) diff --git a/src/boot.c b/src/boot.c index e0fb67a..142544b 100644 --- a/src/boot.c +++ b/src/boot.c @@ -36,11 +36,11 @@ printf_bootdev(u16 bootdev) printf("%s", drivetypes[type]); /* print product string if BEV */ - char *far_description = IPL.table[bootdev].description; - if (type == 4 && far_description != 0) { + char *description_fl = IPL.table[bootdev].description; + if (type == 4 && description_fl != 0) { char description[33]; /* first 32 bytes are significant */ - memcpy_far(MAKE_FARPTR(GET_SEG(SS), description), far_description, 32); + memcpy_fl(MAKE_FLATPTR(GET_SEG(SS), description), description_fl, 32); /* terminate string */ description[32] = 0; printf(" [%.s]", description); diff --git a/src/cdrom.c b/src/cdrom.c index a7cf6c2..fdef873 100644 --- a/src/cdrom.c +++ b/src/cdrom.c @@ -307,7 +307,7 @@ atapi_get_sense(u16 device, u8 *asc, u8 *ascq) atacmd[0] = ATA_CMD_REQUEST_SENSE; atacmd[4] = sizeof(buffer); int ret = ata_cmd_packet(device, atacmd, sizeof(atacmd), sizeof(buffer) - , MAKE_FARPTR(GET_SEG(SS), (u32)buffer)); + , MAKE_FLATPTR(GET_SEG(SS), buffer)); if (ret != 0) return ret; @@ -343,7 +343,7 @@ atapi_is_ready(u16 device) return -1; } int ret = ata_cmd_packet(device, packet, sizeof(packet), sizeof(buf) - , MAKE_FARPTR(GET_SEG(SS), (u32)buf)); + , MAKE_FLATPTR(GET_SEG(SS), buf)); if (ret == 0) break; @@ -438,7 +438,7 @@ cdrom_boot() dop.driveid = device; dop.lba = 0x11; dop.count = 1; - dop.far_buffer = MAKE_FARPTR(GET_SEG(SS), (u32)buffer); + dop.buf_fl = MAKE_FLATPTR(GET_SEG(SS), buffer); ret = cdrom_read(&dop); if (ret) return 3; @@ -494,7 +494,7 @@ cdrom_boot() // And we read the image in memory dop.lba = lba * 4; dop.count = nbsectors; - dop.far_buffer = MAKE_FARPTR(boot_segment, 0); + dop.buf_fl = MAKE_FLATPTR(boot_segment, 0); ret = cdrom_read_512(&dop); if (ret) return 12; diff --git a/src/disk.c b/src/disk.c index 762d5a4..248c839 100644 --- a/src/disk.c +++ b/src/disk.c @@ -44,12 +44,12 @@ static int __send_disk_op(struct disk_op_s *op_p, u16 op_s) { struct disk_op_s dop; - memcpy_far(MAKE_FARPTR(GET_SEG(SS), &dop) - , MAKE_FARPTR(op_s, op_p) - , sizeof(dop)); + memcpy_fl(MAKE_FLATPTR(GET_SEG(SS), &dop) + , MAKE_FLATPTR(op_s, op_p) + , sizeof(dop)); dprintf(DEBUG_HDL_13, "disk_op d=%d lba=%d buf=%p count=%d cmd=%d\n" - , dop.driveid, (u32)dop.lba, dop.far_buffer + , dop.driveid, (u32)dop.lba, dop.buf_fl , dop.count, dop.command); irq_enable(); @@ -132,7 +132,7 @@ basic_access(struct bregs *regs, u8 device, u16 command) u16 segment = regs->es; u16 offset = regs->bx; - dop.far_buffer = MAKE_FARPTR(segment, offset); + dop.buf_fl = MAKE_FLATPTR(segment, offset); int status = send_disk_op(&dop); @@ -176,7 +176,7 @@ extended_access(struct bregs *regs, u8 device, u16 command) u16 segment = GET_INT13EXT(regs, segment); u16 offset = GET_INT13EXT(regs, offset); - dop.far_buffer = MAKE_FARPTR(segment, offset); + dop.buf_fl = MAKE_FLATPTR(segment, offset); dop.count = GET_INT13EXT(regs, count); int status = send_disk_op(&dop); @@ -486,7 +486,7 @@ disk_1348(struct bregs *regs, u8 device) SET_EBDA2(ebda_seg, dpte.reserved, 0); SET_EBDA2(ebda_seg, dpte.revision, 0x11); - u8 *p = MAKE_FARPTR(ebda_seg + u8 *p = MAKE_FLATPTR(ebda_seg , offsetof(struct extended_bios_data_area_s, dpte)); SET_EBDA2(ebda_seg, dpte.checksum, -checksum(p, 15)); @@ -522,7 +522,7 @@ disk_1348(struct bregs *regs, u8 device) SET_INT13DPT(regs, device_path, slave); - SET_INT13DPT(regs, checksum, -checksum(MAKE_FARPTR(regs->ds, 30), 35)); + SET_INT13DPT(regs, checksum, -checksum(MAKE_FLATPTR(regs->ds, 30), 35)); disk_ret(regs, DISK_RET_SUCCESS); } diff --git a/src/disk.h b/src/disk.h index ea42cf8..fae66e3 100644 --- a/src/disk.h +++ b/src/disk.h @@ -109,7 +109,7 @@ void __disk_ret(struct bregs *regs, u32 linecode, const char *fname); struct disk_op_s { u64 lba; - void *far_buffer; + void *buf_fl; u16 count; u8 driveid; u8 command; @@ -173,7 +173,7 @@ int ata_cmd_data(struct disk_op_s *op); int cdrom_read(struct disk_op_s *op); int cdrom_read_512(struct disk_op_s *op); int ata_cmd_packet(int driveid, u8 *cmdbuf, u8 cmdlen - , u32 length, void *far_buffer); + , u32 length, void *buf_fl); void ata_reset(int driveid); void hard_drive_setup(); diff --git a/src/farptr.h b/src/farptr.h index a32bf73..3256848 100644 --- a/src/farptr.h +++ b/src/farptr.h @@ -99,25 +99,25 @@ extern void __force_link_error__unknown_type(); SET_VAR(ES, (var), __sfv_val); \ } while (0) -// Macros for accesssing a 32bit pointer from 16bit real mode. (They -// automatically update the %es segment, break the pointer into -// segment/offset, and then make the access.) -#define __GET_FARPTR(ptr) ({ \ - typeof(&(ptr)) __ptr = &(ptr); \ - GET_FARVAR(FARPTR_TO_SEG(__ptr) \ - , *(typeof(__ptr))FARPTR_TO_OFFSET(__ptr)); }) -#define __SET_FARPTR(ptr, val) do { \ - typeof (&(ptr)) __ptr = &(ptr); \ - SET_FARVAR(FARPTR_TO_SEG(__ptr) \ - , *(typeof(__ptr))FARPTR_TO_OFFSET(__ptr) \ - , (val)); \ +// Macros for accesssing a 32bit flat mode pointer from 16bit real +// mode. (They automatically update the %es segment, break the +// pointer into segment/offset, and then make the access.) +#define __GET_FLATPTR(ptr) ({ \ + typeof(&(ptr)) __ptr = &(ptr); \ + GET_FARVAR(FLATPTR_TO_SEG(__ptr) \ + , *(typeof(__ptr))FLATPTR_TO_OFFSET(__ptr)); }) +#define __SET_FLATPTR(ptr, val) do { \ + typeof (&(ptr)) __ptr = &(ptr); \ + SET_FARVAR(FLATPTR_TO_SEG(__ptr) \ + , *(typeof(__ptr))FLATPTR_TO_OFFSET(__ptr) \ + , (val)); \ } while (0) -// Macros for converting to/from 32bit style pointers to their +// Macros for converting to/from 32bit flat mode pointers to their // equivalent 16bit segment/offset values. -#define FARPTR_TO_SEG(p) (((u32)(p)) >> 4) -#define FARPTR_TO_OFFSET(p) (((u32)(p)) & 0xf) -#define MAKE_FARPTR(seg,off) ((void*)(((u32)(seg)<<4)+(u32)(off))) +#define FLATPTR_TO_SEG(p) (((u32)(p)) >> 4) +#define FLATPTR_TO_OFFSET(p) (((u32)(p)) & 0xf) +#define MAKE_FLATPTR(seg,off) ((void*)(((u32)(seg)<<4)+(u32)(off))) #if MODE16 == 1 @@ -129,54 +129,54 @@ extern void __force_link_error__unknown_type(); #define SET_VAR(seg, var, val) __SET_VAR(seg, (var), (val)) #define SET_SEG(SEG, value) __SET_SEG(SEG, (value)) #define GET_SEG(SEG) __GET_SEG(SEG) -#define GET_FARPTR(ptr) __GET_FARPTR(ptr) -#define SET_FARPTR(ptr, val) __SET_FARPTR((ptr), (val)) +#define GET_FLATPTR(ptr) __GET_FLATPTR(ptr) +#define SET_FLATPTR(ptr, val) __SET_FLATPTR((ptr), (val)) -static inline void insb_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, FARPTR_TO_SEG(farptr)); - insb(port, (u8*)FARPTR_TO_OFFSET(farptr), count); +static inline void insb_fl(u16 port, void *ptr_fl, u16 count) { + SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl)); + insb(port, (u8*)FLATPTR_TO_OFFSET(ptr_fl), count); } -static inline void insw_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, FARPTR_TO_SEG(farptr)); - insw(port, (u16*)FARPTR_TO_OFFSET(farptr), count); +static inline void insw_fl(u16 port, void *ptr_fl, u16 count) { + SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl)); + insw(port, (u16*)FLATPTR_TO_OFFSET(ptr_fl), count); } -static inline void insl_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, FARPTR_TO_SEG(farptr)); - insl(port, (u32*)FARPTR_TO_OFFSET(farptr), count); +static inline void insl_fl(u16 port, void *ptr_fl, u16 count) { + SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl)); + insl(port, (u32*)FLATPTR_TO_OFFSET(ptr_fl), count); } -static inline void outsb_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, FARPTR_TO_SEG(farptr)); - outsb(port, (u8*)FARPTR_TO_OFFSET(farptr), count); +static inline void outsb_fl(u16 port, void *ptr_fl, u16 count) { + SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl)); + outsb(port, (u8*)FLATPTR_TO_OFFSET(ptr_fl), count); } -static inline void outsw_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, FARPTR_TO_SEG(farptr)); - outsw(port, (u16*)FARPTR_TO_OFFSET(farptr), count); +static inline void outsw_fl(u16 port, void *ptr_fl, u16 count) { + SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl)); + outsw(port, (u16*)FLATPTR_TO_OFFSET(ptr_fl), count); } -static inline void outsl_far(u16 port, void *farptr, u16 count) { - SET_SEG(ES, FARPTR_TO_SEG(farptr)); - outsl(port, (u32*)FARPTR_TO_OFFSET(farptr), count); +static inline void outsl_fl(u16 port, void *ptr_fl, u16 count) { + SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl)); + outsl(port, (u32*)FLATPTR_TO_OFFSET(ptr_fl), count); } #else // In 32-bit mode there is no need to mess with the segments. #define GET_FARVAR(seg, var) \ - (*((typeof(&(var)))MAKE_FARPTR((seg), (u32)&(var)))) + (*((typeof(&(var)))MAKE_FLATPTR((seg), &(var)))) #define SET_FARVAR(seg, var, val) \ do { GET_FARVAR((seg), (var)) = (val); } while (0) #define GET_VAR(seg, var) (var) #define SET_VAR(seg, var, val) do { (var) = (val); } while (0) #define SET_SEG(SEG, value) ((void)(value)) #define GET_SEG(SEG) 0 -#define GET_FARPTR(ptr) (ptr) -#define SET_FARPTR(ptr, val) do { (ptr) = (val); } while (0) - -#define insb_far(port, farptr, count) insb(port, farptr, count) -#define insw_far(port, farptr, count) insw(port, farptr, count) -#define insl_far(port, farptr, count) insl(port, farptr, count) -#define outsb_far(port, farptr, count) outsb(port, farptr, count) -#define outsw_far(port, farptr, count) outsw(port, farptr, count) -#define outsl_far(port, farptr, count) outsl(port, farptr, count) +#define GET_FLATPTR(ptr) (ptr) +#define SET_FLATPTR(ptr, val) do { (ptr) = (val); } while (0) + +#define insb_fl(port, ptr_fl, count) insb(port, ptr_fl, count) +#define insw_fl(port, ptr_fl, count) insw(port, ptr_fl, count) +#define insl_fl(port, ptr_fl, count) insl(port, ptr_fl, count) +#define outsb_fl(port, ptr_fl, count) outsb(port, ptr_fl, count) +#define outsw_fl(port, ptr_fl, count) outsw(port, ptr_fl, count) +#define outsl_fl(port, ptr_fl, count) outsl(port, ptr_fl, count) #endif diff --git a/src/floppy.c b/src/floppy.c index 43e6c1e..584bf58 100644 --- a/src/floppy.c +++ b/src/floppy.c @@ -223,7 +223,7 @@ static int floppy_cmd(struct bregs *regs, u16 count, u8 *cmd, u8 cmdlen) { // es:bx = pointer to where to place information from diskette - u32 addr = (u32)MAKE_FARPTR(regs->es, regs->bx); + u32 addr = (u32)MAKE_FLATPTR(regs->es, regs->bx); // check for 64K boundary overrun u32 last_addr = addr + count; diff --git a/src/misc.c b/src/misc.c index ec15262..2557eb9 100644 --- a/src/misc.c +++ b/src/misc.c @@ -137,7 +137,7 @@ struct descloc_s { // Real mode IDT descriptor struct descloc_s rmode_IDT_info VAR16_32 = { .length = sizeof(struct rmode_IVT) - 1, - .addr = (u32)MAKE_FARPTR(SEG_IVT, 0), + .addr = (u32)MAKE_FLATPTR(SEG_IVT, 0), }; // Dummy IDT that forces a machine shutdown if an irq happens in @@ -147,7 +147,7 @@ u8 dummy_IDT VAR16_32; // Protected mode IDT descriptor struct descloc_s pmode_IDT_info VAR16_32 = { .length = sizeof(dummy_IDT) - 1, - .addr = (u32)MAKE_FARPTR(SEG_BIOS, &dummy_IDT), + .addr = (u32)MAKE_FLATPTR(SEG_BIOS, &dummy_IDT), }; // GDT @@ -171,7 +171,7 @@ u64 rombios32_gdt[] VAR16_32 __aligned(8) = { // GDT descriptor struct descloc_s rombios32_gdt_48 VAR16_32 = { .length = sizeof(rombios32_gdt) - 1, - .addr = (u32)MAKE_FARPTR(SEG_BIOS, rombios32_gdt), + .addr = (u32)MAKE_FLATPTR(SEG_BIOS, rombios32_gdt), }; diff --git a/src/optionroms.c b/src/optionroms.c index c2a563b..97e9d42 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -6,7 +6,7 @@ // This file may be distributed under the terms of the GNU LGPLv3 license. #include "bregs.h" // struct bregs -#include "farptr.h" // FARPTR_TO_SEG +#include "farptr.h" // FLATPTR_TO_SEG #include "config.h" // CONFIG_* #include "util.h" // dprintf #include "pci.h" // pci_find_class @@ -83,7 +83,7 @@ static u32 next_rom; static void callrom(struct rom_header *rom, u16 offset, u16 bdf) { - u16 seg = FARPTR_TO_SEG(rom); + u16 seg = FLATPTR_TO_SEG(rom); dprintf(1, "Running option rom at %x:%x\n", seg, offset); struct bregs br; @@ -163,11 +163,11 @@ add_ipl(struct rom_header *rom, struct pnp_data *pnp) struct ipl_entry_s *ip = &IPL.table[IPL.count]; ip->type = IPL_TYPE_BEV; - ip->vector = (FARPTR_TO_SEG(rom) << 16) | pnp->bev; + ip->vector = (FLATPTR_TO_SEG(rom) << 16) | pnp->bev; u16 desc = pnp->productname; if (desc) - ip->description = MAKE_FARPTR(FARPTR_TO_SEG(rom), desc); + ip->description = MAKE_FLATPTR(FLATPTR_TO_SEG(rom), desc); IPL.count++; } diff --git a/src/pcibios.c b/src/pcibios.c index d156518..950871c 100644 --- a/src/pcibios.c +++ b/src/pcibios.c @@ -148,9 +148,9 @@ handle_1ab10e(struct bregs *regs) u16 destseg = GET_FARVAR(regs->es, *(u16*)(regs->di+4)); // Memcpy pir table slots to dest buffer. - memcpy_far(MAKE_FARPTR(destseg, d) - , MAKE_FARPTR(SEG_BIOS, pirtable_g->slots) - , pirsize); + memcpy_fl(MAKE_FLATPTR(destseg, d) + , MAKE_FLATPTR(SEG_BIOS, pirtable_g->slots) + , pirsize); // XXX - bochs bios sets bx to (1 << 9) | (1 << 11) regs->bx = GET_GLOBAL(pirtable_g->exclusive_irqs); diff --git a/src/post.c b/src/post.c index c8e0669..6b42e34 100644 --- a/src/post.c +++ b/src/post.c @@ -72,12 +72,12 @@ init_bda() { dprintf(3, "init bda\n"); - struct bios_data_area_s *bda = MAKE_FARPTR(SEG_BDA, 0); + struct bios_data_area_s *bda = MAKE_FLATPTR(SEG_BDA, 0); memset(bda, 0, sizeof(*bda)); int esize = DIV_ROUND_UP(sizeof(struct extended_bios_data_area_s), 1024); SET_BDA(mem_size_kb, 640 - esize); - u16 eseg = FARPTR_TO_SEG((640 - esize) * 1024); + u16 eseg = FLATPTR_TO_SEG((640 - esize) * 1024); SET_BDA(ebda_seg, eseg); struct extended_bios_data_area_s *ebda = get_ebda_ptr(); @@ -122,7 +122,7 @@ ram_probe(void) // Mark known areas as reserved. u16 ebda_seg = get_ebda_seg(); - add_e820((u32)MAKE_FARPTR(ebda_seg, 0), GET_EBDA2(ebda_seg, size) * 1024 + add_e820((u32)MAKE_FLATPTR(ebda_seg, 0), GET_EBDA2(ebda_seg, size) * 1024 , E820_RESERVED); add_e820(BUILD_BIOS_ADDR, BUILD_BIOS_SIZE, E820_RESERVED); diff --git a/src/resume.c b/src/resume.c index f141ea3..aab52ed 100644 --- a/src/resume.c +++ b/src/resume.c @@ -113,8 +113,8 @@ s3_resume() memset(&br, 0, sizeof(br)); if (s3_resume_vector) { dprintf(1, "Jump to resume vector (%x)\n", s3_resume_vector); - br.ip = FARPTR_TO_OFFSET(s3_resume_vector); - br.cs = FARPTR_TO_SEG(s3_resume_vector); + br.ip = FLATPTR_TO_OFFSET(s3_resume_vector); + br.cs = FLATPTR_TO_SEG(s3_resume_vector); } else { dprintf(1, "No resume vector set!\n"); // Jump to the post vector to restart with a normal boot. diff --git a/src/system.c b/src/system.c index 1d0b23b..5f39a98 100644 --- a/src/system.c +++ b/src/system.c @@ -279,9 +279,9 @@ handle_15e820(struct bregs *regs) return; } - memcpy_far(MAKE_FARPTR(regs->es, regs->di) - , MAKE_FARPTR(SEG_BIOS, &e820_list[regs->bx]) - , sizeof(e820_list[0])); + memcpy_fl(MAKE_FLATPTR(regs->es, regs->di) + , MAKE_FLATPTR(SEG_BIOS, &e820_list[regs->bx]) + , sizeof(e820_list[0])); if (regs->bx == count-1) regs->ebx = 0; else diff --git a/src/util.c b/src/util.c index 9d85b29..0a60e17 100644 --- a/src/util.c +++ b/src/util.c @@ -7,7 +7,7 @@ #include "util.h" // usleep #include "bregs.h" // struct bregs #include "config.h" // SEG_BIOS -#include "farptr.h" // GET_FARPTR +#include "farptr.h" // GET_FLATPTR #include "biosvar.h" // get_ebda_seg // Call a function with a specified register state. Note that on @@ -99,12 +99,12 @@ stack_hop(u32 eax, u32 edx, u32 ecx, void *func) // Sum the bytes in the specified area. u8 -checksum(u8 *far_data, u32 len) +checksum(u8 *buf_fl, u32 len) { u32 i; u8 sum = 0; for (i=0; i