Draft: Simplify the GSBASE pointer
Previously, the KPCR including the TSS was stored as a regular thread-local variable, thus in the .tdata section at KERNEL_PERCPU_OFFSET. However, to simplify calculation in situations where GSBASE is unavailable, i.e. in paranoid entries, this will move the KPCR out of #[thread_local] and hardcode its offset to KERNEL_PERCPU_OFFSET + cpu_id * KERNEL_PERCPU_SIZE. The TLS sections moved one page past the KPCR start.
Alternatively, the KPCR could be stored the way it currently is, but that would require two fake GDT entries as opposed to one, or impose alignment. It also fixes a kernel bug when running the acid ptrace
test.
It also removes some duplicate code by generating getters for link-time offsets using a macro.
Edited by Jacob Lorentzon