Rename MAKE_FARPTR (and similar) to MAKE_FLATPTR.
authorKevin O'Connor <kevin@koconnor.net>
Mon, 19 Jan 2009 20:44:44 +0000 (15:44 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 19 Jan 2009 20:44:44 +0000 (15:44 -0500)
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".

16 files changed:
src/ata.c
src/biosvar.h
src/boot.c
src/cdrom.c
src/disk.c
src/disk.h
src/farptr.h
src/floppy.c
src/misc.c
src/optionroms.c
src/pcibios.c
src/post.c
src/resume.c
src/system.c
src/util.c
src/util.h

index 0b0bdc1fd80031de1bca88022870a29529d95c3b..17bfda04caa355652b8710db9c1e2c8d788bd3a9 100644 (file)
--- 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");
index 239175913f1fc8977f1458b9ac5f08d2776f6bbb..4d3b3f0d205eb5d26d6e0f377ab087d0006f5ef5 100644 (file)
@@ -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)
index e0fb67a33fbff35837354e5242af613c3e383e3d..142544bea311049735d6cc54c4b0ee4c0f7a2281 100644 (file)
@@ -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);
index a7cf6c25c11a47acb1530bd9f4674a787eb991b1..fdef873ba84a2c20ed3af7def5ef1712a0c8af5f 100644 (file)
@@ -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;
index 762d5a44af6d1e57dc3b924a1cbceb65a80d3b81..248c839ad73c0cb5b7de79c0100b7382895d89f4 100644 (file)
@@ -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);
 }
index ea42cf88a5777160cda2a515361c6dec52c52d5d..fae66e3b4eae41acdd808a5f82c59859373a8040 100644 (file)
@@ -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();
 
index a32bf730faca7a919203cd56ea5694d7d4e75f0e..3256848b65fe4fe8a25552f86da95611ea2ea9af 100644 (file)
@@ -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
 
index 43e6c1eb9713334f46b9cbc68051bfa36a13a360..584bf5834f99a92fa8d6a3d464e29798da1f849e 100644 (file)
@@ -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;
index ec152626e01fd0d19c3985fae322b19bf84b1fac..2557eb927fbc4570acfe8fc9e873897da739b643 100644 (file)
@@ -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),
 };
 
 
index c2a563b56bd8b8e0d162f9e26c8a6ffeb7e5252b..97e9d42b7a7521b03c9ff8cdf327a3096c5ebf5a 100644 (file)
@@ -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++;
 }
index d156518a3c0464f2f785373fb50dfa3abe23fcf7..950871cc549b884c68237c62f79406a768c55bb8 100644 (file)
@@ -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);
index c8e0669cfee01ce284443ac820cf1cc39fc07f76..6b42e3441eaad3372e7f7db612951bda7540790e 100644 (file)
@@ -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);
 
index f141ea3f164a99629216d241ffe3e80ce8824836..aab52edc1162f7f066caa9ab2739a73a82d58ad1 100644 (file)
@@ -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.
index 1d0b23bebef979f71aa43d044b875884ff511d8a..5f39a985a5a6bbbf8d7a288a46b949c74e463bd5 100644 (file)
@@ -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
index 9d85b29b5b03ad008b97b4da4fcf809282ca8af2..0a60e171a7837e43af6c43c1be1c1ed6e4e26eac 100644 (file)
@@ -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<len; i++)
-        sum += GET_FARPTR(far_data[i]);
+        sum += GET_FLATPTR(buf_fl[i]);
     return sum;
 }
 
@@ -117,18 +117,18 @@ memset(void *s, int c, size_t n)
 }
 
 void *
-memcpy_far(void *far_d1, const void *far_s1, size_t len)
+memcpy_fl(void *d_fl, const void *s_fl, size_t len)
 {
-    u8 *d = far_d1;
-    u8 *s = (u8*)far_s1;
+    u8 *d = d_fl;
+    u8 *s = (u8*)s_fl;
 
     while (len--) {
-        SET_FARPTR(*d, GET_FARPTR(*s));
+        SET_FLATPTR(*d, GET_FLATPTR(*s));
         d++;
         s++;
     }
 
-    return far_d1;
+    return d_fl;
 }
 
 void *
index 6893b48f00d24501ae272027cb6a2f2bd340e493..78812cb9773a8bd46a27b83a4eb4bc3c3a29dd2e 100644 (file)
@@ -67,10 +67,10 @@ static inline u64 rdtscll(void)
 
 // util.c
 inline u32 stack_hop(u32 eax, u32 edx, u32 ecx, void *func);
-u8 checksum(u8 *far_data, u32 len);
+u8 checksum(u8 *buf_fl, u32 len);
 void *memset(void *s, int c, size_t n);
 void *memcpy(void *d1, const void *s1, size_t len);
-void *memcpy_far(void *far_d1, const void *far_s1, size_t len);
+void *memcpy_fl(void *d_fl, const void *s_fl, size_t len);
 void *memmove(void *d, const void *s, size_t len);
 struct bregs;
 inline void call16(struct bregs *callregs);