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

Make the standard library work in kernel mode #11829

Closed
brson opened this issue Jan 27, 2014 · 3 comments
Closed

Make the standard library work in kernel mode #11829

brson opened this issue Jan 27, 2014 · 3 comments
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

Comments

@brson
Copy link
Contributor

brson commented Jan 27, 2014

It would be very nice for the standard library, or significant parts of it, to work in kernel mode. There's a lot of refactoring and design necessary for this.

std will probably need a good bit of refactoring, the addition of some sort of platform abstraction layer, the introduction of conditional compilation (profiles) to cut out parts that are irrelevant to kernel-space, and the stubbing out of parts that would be kernel-specific, like tasks and runtime services.

cc #11828 - refactoring
cc #7282 - profiles

@edwardw
Copy link
Contributor

edwardw commented Jan 29, 2014

Second the proposal.

I tried this several times for a toy kernel written in Rust. Getting libstd to compile in free-standing mode is surprisingly easy; simply commenting out the dependency to rtdeps in std/lib.rs will do. But making it really work is another story all together. Two things blocked my effort so far:

  • The assert! and similar macros. They pull in all sort of platform specific dependencies, std::rt::unwind, std::fmt, etc.
  • The std::fmt, in turn, needs memory allocation (read: ~str and io::MemWriter) and condition! macro, which depends on tls.

So yes, profiles part of the proposal should be relatively easy. But macro and owned box are used everywhere, it requires some serious refactoring.

@aturon
Copy link
Member

aturon commented Jun 3, 2014

Note: the ongoing facade effort (#13851) should take care of the refactoring part of this issue.

@alexcrichton
Copy link
Member

I believe that this is entirely contained within the facade effort. The core library, libcore, is entirely usable in kernel mode, as well as all libraries which are only dependent on libcore. I believe we've sliced out about as much as we're going to in order to get the standard library working in kernel mod, so I'm going to close this issue as being as complete as it can be.

flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 16, 2023
new lint to detect infinite loop

closes: rust-lang#11438

changelog: add new lint to detect infinite loop

~*I'll change the lint name*~. Should I name it  `infinite_loop` or `infinite_loops` is fine? Ahhhh, English is hard...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Projects
None yet
Development

No branches or pull requests

4 participants