-
Notifications
You must be signed in to change notification settings - Fork 13
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
todo-bot: touch TLS todos #415
Conversation
Because the TLS PR is so big, todobot bailed on it. Make a PR that only touches every `// todo:` we opened in sunriseos#339, so todobot picks them again.
per-cpu TSSs / GDTThere are multiple things that aren't ideal about the way we handle TSSs. InitializationTSSs must always be initialized with an iopb_offset of `size_of::<TSS>()`, so that the TSS's data is not interpreted as the iopb. Per-cpuBut we will likely want a MAIN and DOUBLE_FAULT TSS per core. However, they cannot trivially be put behind a `#[thread_local]`, as they are initialized with the GDT, before cpu-locals are initialized. It might be possible to make them `#[thread_local]` with some post-initialization routine that switches to using the MAIN and DOUBLE_FAULT_TASK in the cpu-local memory area instead of the static early one, after cpu-local have been initialized, for core 0. The static early one could do without an iopb, since we're not going to userspace with it. LockingSince the TSSs are supposed to be cpu-local, there is no reason for them to have a mutex around them. An ideal design would be lock-less, which can either be achieved with `#[thread_local]`, or some custom wrapper around an UnsafeCell just for TSSs. DOUBLE_FAULT's cr3The DOUBLE_FAULT TSS(s)'s cr3 must point to a valid page directory, which will remain valid (i.e. not be freed) for the entire lifetime of the kernel, and possibly updated when kernel page tables are modified. SunriseOS/kernel/src/i386/gdt.rs Lines 449 to 459 in 7333eaf
This comment was generated by todo based on a
|
expose current page directory's address in an arch-independant way.SunriseOS/kernel/src/paging/arch/mod.rs Lines 10 to 11 in 7333eaf
This comment was generated by todo based on a
|
permanently_disable_interrupts shouldn't be unsafe.disabling interrupts doesn't break any safety guidelines, and is perfectly safe as far as rustc is concerned. Lines 64 to 68 in 7333eaf
This comment was generated by todo based on a
|
Kernel Stack dump updateUpdate the kernel stack dump functions to be compatible the new and improved kernel panic. Lines 186 to 194 in 7333eaf
This comment was generated by todo based on a
|
Libuser Thread stack guardCurrently the stack of every non-main thread is allocated in the heap, and no page guard protects from stack-overflowing and rewriting all the heap. SunriseOS/libuser/src/threads.rs Lines 209 to 219 in 7333eaf
This comment was generated by todo based on a
|
Properly free resource after thread detachWhen detaching a thread, we should ensure that the associated resources (stack, handle, context, etc...) are properly freed before the Process exits. This can be done by adding the ThreadContext to a global Vec<> of ThreadContext that gets freed when the main thread (or the last thread alive?) exits. SunriseOS/libuser/src/threads.rs Lines 297 to 304 in 7333eaf
This comment was generated by todo based on a
|
This case swap is a terrible hack. I love it. |
Because the TLS PR is so big, todobot bailed on it.
Make a PR that only touches every
// todo:
we opened in #339, so todobot picks them again.