The GDT can have a maxium length of 2^16 bytes, and must contain at
least one null descriptor. As MAX counts the number of u64 entries,
we must have 0 < MAX <= 2^13.
Unfortunely, we cannot do this check with a where clause, as
feature(generic_const_expers) is not yet stable. However, we can do
this check with an assert! in GlobalDescriptorTable::empty(), which
is a const fn.
The GDT can have a maxium length of 2^16 bytes, and must contain at least one null descriptor. As
MAX
counts the number ofu64
entries, we must have0 < MAX <= 2^13
.Unfortunely, we cannot do this check with a
where
clause, asfeature(generic_const_expers)
is not yet stable. However, we can do this check with anassert!
inGlobalDescriptorTable::empty()
, which is aconst fn
.Pointed out by @Freax13 in https://github.com/rust-osdev/x86_64/pull/360#discussion_r836788703
Signed-off-by: Joe Richey joerichey@google.com