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

User-mode console support #551

Merged
merged 12 commits into from
Dec 13, 2024
Merged

Conversation

joergroedel
Copy link
Member

@joergroedel joergroedel commented Dec 5, 2024

This PR implements console output support for user-mode processes. In user-mode code the print! and println! macros can now be used to print messages to the SVSM console.

It depends on PRs #539 and #548 and is here for testing and initial review. I will keep it in draft state until the dependencies have been merged.

@joergroedel joergroedel force-pushed the user-console branch 6 times, most recently from 8e9203f to 2451ac6 Compare December 11, 2024 11:47
@joergroedel joergroedel marked this pull request as ready for review December 11, 2024 11:47
@joergroedel
Copy link
Member Author

The file-system syscalls PR is getting closer to being merged, so review on this can be started.

Implement the console_write() function which will take a u8 slice and
write it to the console. This will be used to allow user-space code to
write to the console.

Signed-off-by: Joerg Roedel <[email protected]>
Define a setup function which is only called for user tasks.

Signed-off-by: Joerg Roedel <[email protected]>
Copy link
Contributor

@vijaydhanraj vijaydhanraj left a comment

Choose a reason for hiding this comment

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

Just a few nits but the changes look good to me.
Tested this PR with our internal TDP branch and can successfully launch the dm.

kernel/src/task/tasks.rs Outdated Show resolved Hide resolved
kernel/src/task/tasks.rs Outdated Show resolved Hide resolved
kernel/src/fs/console.rs Outdated Show resolved Hide resolved
user/lib/src/locking.rs Outdated Show resolved Hide resolved
Add a method to struct Task to add an object with a defined handle.

Signed-off-by: Joerg Roedel <[email protected]>
Add a string to struct Task representing the name of the task.

Signed-off-by: Joerg Roedel <[email protected]>
Use the file name of the binary as the name of the task.

Signed-off-by: Joerg Roedel <[email protected]>
Add a file type for writing to the console. This will be wired up to
user-space to allow modules to write messages to the console.

Signed-off-by: Joerg Roedel <[email protected]>
Implement a function to open a console and return a file handle.

Signed-off-by: Joerg Roedel <[email protected]>
Attach a handle to a console file to every user task, so that they can
write to the console.

Signed-off-by: Joerg Roedel <[email protected]>
Create a static FSObjHandle which is used to write to the console and
a function to perform the writes.

Signed-off-by: Joerg Roedel <[email protected]>
Add a simple SpinLock implementation to the user library to protect
access to global state. At some point this needs to be replaces with a
non-busy waiting locking implementation.

Signed-off-by: Joerg Roedel <[email protected]>
Implement console access and provide the the print! and println!
macros. Use the new macros to print a message in the panic handler.

Signed-off-by: Joerg Roedel <[email protected]>
Use the console support to print a startup message from the init
process.

Signed-off-by: Joerg Roedel <[email protected]>
user/lib/src/locking.rs Show resolved Hide resolved
@joergroedel joergroedel merged commit b50c35d into coconut-svsm:main Dec 13, 2024
4 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.

2 participants