Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement Index<u8> for IDT instead of Index<usize> #319

Merged
merged 4 commits into from
Nov 8, 2021

Conversation

Freax13
Copy link
Member

@Freax13 Freax13 commented Nov 7, 2021

This pr changes the Idx type of InterruptDescriptorTable's Index implementation from usize to u8 as discussed in #285 (comment). u8 more accurately represents the index for an InterruptDescriptorTable which always has exactly 256 entries. This change also eliminates some out of bounds panics that were possible with usize.

There was some discussion following #95 (comment) on whether it would be possible to use SliceIndex now or in the future. Following this pr this is no longer useful because SliceIndex is based around only usize not u8. Since using SliceIndex is now out of question, there shouldn't be any objections to hard coding implementations based for the range types in core and so this pr provides those implementations as well.

Copy link
Member

@phil-opp phil-opp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, looks good! I left some minor comments about the integer conversions, otherwise this seems ready to be merged.

there shouldn't be any objections to hard coding implementations based for the range types in core and so this pr provides those implementations as well.

Good idea!

src/structures/idt.rs Outdated Show resolved Hide resolved
src/structures/idt.rs Outdated Show resolved Hide resolved
src/structures/idt.rs Outdated Show resolved Hide resolved
src/structures/idt.rs Outdated Show resolved Hide resolved
@phil-opp
Copy link
Member

phil-opp commented Nov 8, 2021

@Freax13 Do you want to join our x86_64 maintenance team by any chance? Your contributions to this repo are very good and we could need some help with reviewing PRs and further progressing this crate.

@phil-opp phil-opp added the waiting-on-author Waiting for the author to act on review feedback. label Nov 8, 2021
@Freax13
Copy link
Member Author

Freax13 commented Nov 8, 2021

@Freax13 Do you want to join our x86_64 maintenance team by any chance? Your contributions to this repo are very good and we could need some help with reviewing PRs and further progressing this crate.

Sure, that sounds great! 🎉

@Freax13
Copy link
Member Author

Freax13 commented Nov 8, 2021

CI is failing because yesterdays nightly release broke const operands in asm (see rust-lang/rust#90348). They now require #![feature(asm_const)]. Luckily we only use those on the next branch, so the master branch and all releases on crates.io should be fine.

@phil-opp
Copy link
Member

phil-opp commented Nov 8, 2021

Ok great, invite sent. Welcome!

CI is failing because yesterdays nightly release broke const operands in asm (see rust-lang/rust#90348). They now require #![feature(asm_const)]. Luckily we only use those on the next branch, so the master branch and all releases on crates.io should be fine.

Thanks for investigating, sounds like asm! might be stabilized soon!

We can just switch on the new feature gates on the next branch then, right?

@Freax13
Copy link
Member Author

Freax13 commented Nov 8, 2021

Ok great, invite sent. Welcome!

Thanks!

We can just switch on the new feature gates on the next branch then, right?

Yes, I created a seperate pr for that: #320.

@Freax13
Copy link
Member Author

Freax13 commented Nov 8, 2021

After merging #320 and rebasing this now passes CI.

@Freax13 Freax13 merged commit 9ce47b3 into rust-osdev:next Nov 8, 2021
@Freax13 Freax13 deleted the index-idt-with-u8 branch November 8, 2021 10:51
phil-opp added a commit that referenced this pull request Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-author Waiting for the author to act on review feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants