haiku_loader: Fix wrong size of gBootGDT on x86_64.

The BOOT_GDT_SEGMENT_COUNT was based on USER_DATA_SEGMENT on both
x86 and x86_64. However, on x86_64 the order of the segments is
different, leading to a too small gBootGDT array. Move the define to
the arch specific headers so they can be setup correctly in either case.
Also add a STATIC_ASSERT() to check that the descriptors fit into the
array.

Pointed out by CID 1210898.
This commit is contained in:
Michael Lotz
2014-10-22 21:06:07 +02:00
parent b137575c46
commit e9922e775f
5 changed files with 14 additions and 3 deletions
@@ -16,6 +16,8 @@
#define USER_CODE_SEGMENT 3
#define USER_DATA_SEGMENT 4
#define BOOT_GDT_SEGMENT_COUNT (USER_DATA_SEGMENT + 1)
#define APM_CODE32_SEGMENT 5
#define APM_CODE16_SEGMENT 6
#define APM_DATA_SEGMENT 7
@@ -13,6 +13,8 @@
#define USER_DATA_SEGMENT 3
#define USER_CODE_SEGMENT 4
#define BOOT_GDT_SEGMENT_COUNT (USER_CODE_SEGMENT + 1)
#define KERNEL_CODE_SELECTOR ((KERNEL_CODE_SEGMENT << 3) | DPL_KERNEL)
#define KERNEL_DATA_SELECTOR ((KERNEL_DATA_SEGMENT << 3) | DPL_KERNEL)