The file as is is the maze of #ifdef passages, all slightly different. Divorcing i386 and amd64 version actually makes changing the code easier, also no changes for i386 are planned.
amd64 wakeup: rework trampoline page allocation
There is no need to restrict trampoline page table to low 1M, it should work with any pages below 4G. Only wakeup code itself should be below 1M.
Do not waste level 5 page when LA48 mode is used.