aboutsummaryrefslogtreecommitdiffstats
path: root/roms/qboot/include/segment.h
diff options
context:
space:
mode:
Diffstat (limited to 'roms/qboot/include/segment.h')
-rw-r--r--roms/qboot/include/segment.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/roms/qboot/include/segment.h b/roms/qboot/include/segment.h
new file mode 100644
index 000000000..18afb5310
--- /dev/null
+++ b/roms/qboot/include/segment.h
@@ -0,0 +1,19 @@
+#ifndef BIOS_SEGMENT_H
+#define BIOS_SEGMENT_H
+
+static inline uint32_t segment_to_flat(uint16_t selector, uint16_t offset)
+{
+ return ((uint32_t)selector << 4) + (uint32_t) offset;
+}
+
+static inline uint16_t flat_to_seg16(uint32_t address)
+{
+ return (address >> 4) & 0xf000;
+}
+
+static inline uint16_t flat_to_off16(uint32_t address)
+{
+ return address & 65535;
+}
+
+#endif /* KVM_SEGMENT_H */