gdt: make add_entry const#191
Conversation
This requires making the push method const as well, which means we need the `const_panic` feature (not too much of a risk as this feature is failly well along). I also moved the pointer calculation (for GDT and IDT) into their own (currently private) methods. Eventually these methods can be public, but that's only useful if they can be const, which would require a breaking change. The caclulation for the GDT pointer was also updated to use: ```rust self.next_free * size_of::<u64>() - 1 ``` instead of ```rust self.table.len() * size_of::<u64>() - 1 ``` Signed-off-by: Joe Richey <joerichey@google.com>
phil-opp
left a comment
There was a problem hiding this comment.
Looks all reasonable to me, thanks!
Could you clarify which change would be breaking? |
To make My current idea for a later PR:
|
|
Sounds good to me! However, I think we can make the |
|
Ideally, I would want to make the |
This requires making the push method const as well, which means we need
the
const_panicfeature (not too much of a risk as this feature isfailly well along).
I also moved the pointer calculation (for GDT and IDT) into their own
(currently private) methods. Eventually these methods can be public, but
that's only useful if they can be const, which would require a breaking change.
The caclulation for the GDT pointer was also updated to use:
instead of
Signed-off-by: Joe Richey joerichey@google.com