-
Notifications
You must be signed in to change notification settings - Fork 148
derive Clone and Copy for InterruptStackFrame #572
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
base: master
Are you sure you want to change the base?
Conversation
|
Thank you for your contribution! I'm not sure if we want to implement these traits because I think the lack of implementations for those is intentional. The idea behind Admittedly, What's your use-case for implementing |
|
I'm trying to implement a task system. Currently I construct an
I don't see how that would be possible. The inner value is still private so it can't be changed. Also it is currently not possible to construct the wrapper from the frame value. I could see an argument for only implementing |
|
Not sure this is a good argument. It is a bit philosophical but I think it still counts. If you use the "x86-interrupt" abi with Take something like this Here we move |
Yeah, you're right, my point didn't make much sense.
Yeah, the semantics of the parameters for the
Are you using a |
From what I gather the way the abi works changed in llvm as well and the more I look at it the less I understand it.
Not really? Kinda? I am using a naked function written in assembly instead so I get access to the In the assembbly I construct a reference to the InterruptStackFrame and pass that as an argument to rust (same as registers and xsave area).
I don't agree.
|
fn foo(frame: &mut InterruptStackFrame) {
*frame = InterruptStackFrame::new(todo!(), todo!(), todo!(), todo!(), todo!());
}
The way I currently see it is that For your use-case, could use have |
Maybe I misunderstood the way
Yeah. I can change my code to use That said I think there is room for improvement of the |
Here's another angle to look at this: It's not so much that
👍
I wouldn't any behavior around moving an
Yes, you're right that doesn't work. When I wrote that comment I mistakenly thought that
There's an RFC for interrupts ABIs. You could leave a comment over there. AFAICT the RFC doesn't go into much detail regarding interrupt stack frames, but some of the example code also show the interrupt stack frame being taken by reference. Taking by reference used to work, but newer LLVM releases don't support that. |
|
It's been a few years since I wrote that code, but I think the main reason for this There are a few caveats to this:
Let's take another look at the example you posted above:
The problem with this example is that the Ideally, we would forbid moves of the value, but I don't know how that is possible. The signature of the On a general note, I'm no longer sold on the |
InterruptStackFrameis a wrapper aroundInterruptStackFrameValuewhich already implementsCloneandCopy.This just extends this to the wrapper type.