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

Get rid of some mutable global statics #224

Merged
merged 5 commits into from
Jan 25, 2024

Conversation

joergroedel
Copy link
Member

Add decent implementations for the GDT, IDT and SecretsPage which require proper locking to make modifications.

This fixes a couple of warnings triggered by the latest Rust nightly compiler.

Make this code a method of struct X86Tss and remove it from the open
coded function.

Signed-off-by: Joerg Roedel <[email protected]>
Fix the unsafe mutable accesses to the static GDT by wrapping it into
a structure and add methods for manipulation. The structure is now
protected by a lock which serializes mutable accesses.

Signed-off-by: Joerg Roedel <[email protected]>
Replace the GLOBAL_IDT static variable with a non-public global struct
which can only be accessed via safe locking. This removes all mutable
accesses to a global static for the IDT case.

Signed-off-by: Joerg Roedel <[email protected]>
Remove handling around SECRETS_PAGE and replace it with a decent
struct and locking. That gets rid the accesses to the global mutable
SECRETE_PAGE variable.

Signed-off-by: Joerg Roedel <[email protected]>
With recent nightly compilers this warning appears:

warning: field `0` is never read
    --> src/mm/alloc.rs:1321:28
     |
1321 | pub struct TestRootMem<'a>(LockGuard<'a, ()>);
     |            -----------     ^^^^^^^^^^^^^^^^^
     |            |
     |            field in this struct
     |

Silence this warning.

Signed-off-by: Joerg Roedel <[email protected]>
@joergroedel joergroedel marked this pull request as ready for review January 24, 2024 12:12
@joergroedel joergroedel merged commit c6bd164 into coconut-svsm:main Jan 25, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant