diff options
author | aqua <aqua@iserlohn-fortress.net> | 2023-03-05 14:38:54 +0200 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2023-03-05 14:38:54 +0200 |
commit | 787c1a6016dd2fdb51f20fcb5ca0ac5e461892d6 (patch) | |
tree | 7db9f5102adc3d50ca85a8175ce67465256b8908 /i686/test_gdt.cc | |
parent | Add TARGETBIN and TARGETLIB rules (diff) | |
download | kernel-master.tar.xz |
Diffstat (limited to 'i686/test_gdt.cc')
-rw-r--r-- | i686/test_gdt.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/i686/test_gdt.cc b/i686/test_gdt.cc new file mode 100644 index 0000000..d596c3a --- /dev/null +++ b/i686/test_gdt.cc @@ -0,0 +1,25 @@ +#include <gtest/gtest.h> + +#define _Static_assert static_assert +#include "gdt.c" +#include "gdt.h" + +TEST(i686GDT, KnownAccessByteValues) +{ + EXPECT_EQ(*(uint8_t *)&null_access, 0x00); + EXPECT_EQ(*(uint8_t *)&ktext_access, 0x9a); + EXPECT_EQ(*(uint8_t *)&kdata_access, 0x92); +} + +TEST(i686GDT, NullSegmentDescriptor) +{ + struct SegmentDescriptor_t d; + SegmentDescriptor(&d, 0, 0, 0); + EXPECT_EQ(*(uint64_t *)&d, 0); +} + +TEST(i686GDT, SegmentIndex) +{ + EXPECT_EQ(ktextDescriptor, 0x10); + EXPECT_EQ(kdataDescriptor, 0x18); +} |