diff options
Diffstat (limited to 'arch/i386/test_gdt.cc')
-rw-r--r-- | arch/i386/test_gdt.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/i386/test_gdt.cc b/arch/i386/test_gdt.cc new file mode 100644 index 0000000..3501ae9 --- /dev/null +++ b/arch/i386/test_gdt.cc @@ -0,0 +1,25 @@ +#include <gtest/gtest.h> + +extern "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); +} |