rust-osdev / x86_64

Library to program x86_64 hardware.
https://docs.rs/x86_64
Apache License 2.0
797 stars 132 forks source link

Make GlobalDescriptorTable const generic #443

Closed MechSlayer closed 10 months ago

MechSlayer commented 1 year ago

To avoid breaking compatibility, renamed to BasicGlobalDescriptorTable, and made GlobalDescriptorTable be an alias with 8 entreis.

Went with the rename + alias approach due to this issue.

phil-opp commented 10 months ago

Thanks for submitting and sorry for the long delay!

This looks good overall, but I'm not sure if I like the rename+alias approach. Another solution could be to use a default sie and implement the new and from_raw_slices only for GlobalDescriptorTable<8>. Then we could add separate methods for constructing tables with other sizes. This way, we should still be backwards compatible.

Alternatively, we could also accept the small breaking change and target the upcoming v0.15 release, which we wanted to publish for some quite some time.

@josephlr @Freax13 What do you think?

Freax13 commented 10 months ago

This looks good overall, but I'm not sure if I like the rename+alias approach. Another solution could be to use a default sie and implement the new and from_raw_slices only for GlobalDescriptorTable<8>. Then we could add separate methods for constructing tables with other sizes. This way, we should still be backwards compatible.

If this works, I'd prefer this.

phil-opp commented 10 months ago

It turns out that we already merged a PR to make the GDT const generic in #360. This feature will be available once #446 is merged.

@MechSlayer Thanks for your contribution anyway and sorry for the chaos!