aboutsummaryrefslogtreecommitdiff
path: root/src/gdt.h
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2021-03-15 21:07:59 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2021-03-15 21:07:59 +0200
commit8b88f3f7fd143fc542a5118d50a7a981464270d5 (patch)
tree86b4ca2b14b3594d3eaa7ff449db72920cad2b70 /src/gdt.h
parentEnable ThinLTO (diff)
downloadkernel.cpp-8b88f3f7fd143fc542a5118d50a7a981464270d5.tar.xz
Fix compile failure without -O2
Linking fails without lto on
Diffstat (limited to 'src/gdt.h')
-rw-r--r--src/gdt.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gdt.h b/src/gdt.h
index 6aeaa33..4deeec3 100644
--- a/src/gdt.h
+++ b/src/gdt.h
@@ -95,11 +95,13 @@ public:
unsigned int base_31_24 : 8 = 0; // high bits of segment address
} __attribute__((packed));
- enum SegmentMap { null0, kcode, kdata };
+ enum SegmentMap { null0 = 0, kcode = 1, kdata = 2 };
GDT();
~GDT() = default;
- uint16_t descriptor(SegmentMap) const;
+ static constexpr uint16_t descriptor(GDT::SegmentMap i) {
+ return static_cast<uint16_t>(i * sizeof(SegmentDescriptor));
+ }
};