~demindiro/norost-b

Fix broken memcmp

This resolves the init.toml mystery :D

It should be a fair bit faster too.
Fix boot _start not reserving enough stack space for return value

Also remove redundant `cli`
Remove old FIXME comment
Use interrupt gates for all IDT entries

Quoting nullplan from https://forum.osdev.org/viewtopic.php?f=1&t=56127:

    When an interrupt occurs, the CPU will only take it if the interrupt
    flag is set. In the IDT, you can set the "type" value of your IDT
    entries to either "trap gate" or "interrupt gate", with the difference
    being that the latter will automatically disable the IF, and the former
    will leave it unchanged. What that means in detail depends on your
    interrupt handling code.

Ergo trap and interrupt gate only refers to whether the interrupt flag
is set and has nothing to do with the "actual" type of interrupt /
exception.
Add deadlock detection to Mutex
Fix various deadlocks
Use global bits for kernel mappings, use invlpg
Return AllocateError from AddressSpace::new
Fix typos in scancodes library
Fix realloc writing into non-owned memory when shrinking

And *this* is why I hate dealing with UB and the like. Such a simple
error yet so hard to find...
Don't use contiguous frame allocations for heap allocations

The contiguous allocations are reserved for DMA. It also led to the
kernel falsely claiming it is out of memory.
Fix out-of-bounds error in FAT driver when operation size is large
Remove redundant dbg!() in ps2 driver
Fix more mutex locks while interrupts are disabled

I have given this some thought and there are two main issues:

- During init interrupts are disabled right until the very end.
- Interrupts are disabled while destroying a thread (and process, by
  extension).

The former can be fixed by creating a kernel thread to handle the
remainder of the init phase. The latter can be fixed by either creating
a kernel thread for handling cleanup or somehow "demoting" the thread
that is being destroyed to a kernel thread first, alleviating the need
to switch to the (interrupt-free) CPU-local stack.
Correctly determine FADT revision
Don't use pure in TLS functions

The compiler can't see that e.g. {set,get}_tls are related.
Merge branch 'bochs'
Fix mutex lock in interrupt-free context

The ever-increase of spinlocks worries me...
Merge branch 'emulate-unsupported-ops' into bochs
Give compiler more freedom to optimize TLS access
Next