Skip to content
Snippets Groups Projects

Prevent possible UB, and use naked functions correctly.

Merged Jacob Lorentzon requested to merge 4lDO2/kernel:switch_to_safer into master
  1. Feb 13, 2021
    • Jacob Lorentzon's avatar
      Rewrite signal_handler_wrapper as single asm block. · a706a0da
      Jacob Lorentzon authored
      The reason for these types of rewrites, is that more recent Rust
      compilers have started to deprecate naked functions that consist of more
      than only a single asm block, as they can trigger all sorts of UB.
      Verified
      a706a0da
    • Jacob Lorentzon's avatar
      Fix context switching. · 47c3b226
      Jacob Lorentzon authored
      Previously there was a triple fault, due to a combination of reasons
      (e.g. rsp and rbp being ordered in the struct and in the assembly).
      
      Now, the locks will be held __all the way until the new context__ has
      been switched to, which completely eliminates any possibility that the
      "pcid fault" originates here.
      
      While I am unsure whether this will work, this could also be an
      opportunity to be able to remove CONTEXT_SWITCH_LOCK fully.
      Verified
      47c3b226
    • Jacob Lorentzon's avatar
      WIP: Attempt to rewrite switch_to in assembly. · ef4270e4
      Jacob Lorentzon authored
      This is due to a warning in more recent compilers, which forbid anything
      but a single inline assembly block, in naked functions. It does
      unfortunately triple fault right now, but I hope I may be able to fix it
      soon.
      Verified
      ef4270e4
Loading