[SeaBIOS] [PATCH 09/23] Move definition of struct segoff_s from farptr.h to types.h.

Kevin O'Connor kevin at koconnor.net
Sun Sep 15 07:10:09 CEST 2013


The segoff_s definition is used by a number of header files that would
not otherwise need farptr.h, so move it to a more central location.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/bregs.h  |  1 -
 src/disk.h   |  2 --
 src/farptr.h | 10 ----------
 src/hw/pic.h |  1 -
 src/pmm.c    |  1 -
 src/types.h  | 11 +++++++++++
 src/vbe.h    |  1 -
 7 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/src/bregs.h b/src/bregs.h
index 009db99..3df7d9f 100644
--- a/src/bregs.h
+++ b/src/bregs.h
@@ -8,7 +8,6 @@
 #define __BREGS_H
 
 #include "types.h" // u16
-#include "farptr.h" // struct segoff_s
 #include "x86.h" // F_CF
 
 
diff --git a/src/disk.h b/src/disk.h
index 8e49124..48496da 100644
--- a/src/disk.h
+++ b/src/disk.h
@@ -7,8 +7,6 @@
 #define __DISK_H
 
 #include "types.h" // u8
-#include "config.h" // CONFIG_*
-#include "farptr.h" // struct segoff_s
 
 #define DISK_RET_SUCCESS       0x00
 #define DISK_RET_EPARAM        0x01
diff --git a/src/farptr.h b/src/farptr.h
index 5b6c5c1..b64567e 100644
--- a/src/farptr.h
+++ b/src/farptr.h
@@ -196,16 +196,6 @@ static inline void outsl_fl(u16 port, void *ptr_fl, u16 count) {
 
 #endif
 
-// Definition for common 16bit segment/offset pointers.
-struct segoff_s {
-    union {
-        struct {
-            u16 offset;
-            u16 seg;
-        };
-        u32 segoff;
-    };
-};
 #define SEGOFF(s,o) ({struct segoff_s __so; __so.offset=(o); __so.seg=(s); __so;})
 
 static inline struct segoff_s FLATPTR_TO_SEGOFF(void *p) {
diff --git a/src/hw/pic.h b/src/hw/pic.h
index 19aecba..2a89e3f 100644
--- a/src/hw/pic.h
+++ b/src/hw/pic.h
@@ -8,7 +8,6 @@
 #define __PIC_H
 
 #include "ioport.h" // PORT_PIC*
-#include "farptr.h" // struct segoff_s
 
 // PORT_PIC1 bitdefs
 #define PIC1_IRQ0  (1<<0)
diff --git a/src/pmm.c b/src/pmm.c
index e87cfd1..cce0f29 100644
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -6,7 +6,6 @@
 
 #include "biosvar.h" // FUNC16
 #include "config.h" // CONFIG_*
-#include "farptr.h" // struct segoff_s
 #include "malloc.h" // _malloc
 #include "output.h" // dprintf
 #include "string.h" // checksum
diff --git a/src/types.h b/src/types.h
index 9e22ab5..3466b3a 100644
--- a/src/types.h
+++ b/src/types.h
@@ -21,6 +21,17 @@ union u64_u32_u {
     u64 val;
 };
 
+// Definition for common 16bit segment/offset pointers.
+struct segoff_s {
+    union {
+        struct {
+            u16 offset;
+            u16 seg;
+        };
+        u32 segoff;
+    };
+};
+
 #ifdef MANUAL_NO_JUMP_TABLE
 # define default case 775324556: asm(""); default
 #endif
diff --git a/src/vbe.h b/src/vbe.h
index 386613c..94b4ad8 100644
--- a/src/vbe.h
+++ b/src/vbe.h
@@ -2,7 +2,6 @@
 #define __VBE_H
 
 #include "types.h" // u8
-#include "farptr.h" // struct segoff_s
 
 #define VESA_SIGNATURE 0x41534556 // VESA
 #define VBE2_SIGNATURE 0x32454256 // VBE2
-- 
1.8.3.1




More information about the SeaBIOS mailing list