This should bring the kernel to a working state.
Don't forget that the interrupts.c file absolutely must be compiled with -mgeneral-regs-only.
All the other files absolutely must be compiled with -mavx2.
:)
All ISR/IRQ stuff moved into its own header and source.
Comments added on all major parts.
Some optimisations in important functions.
All ASM removed for ISR and IRQ, instead using new GCC directives.