]> xenbits.xensource.com Git - unikraft/unikraft.git/commit
plat/kvm/x86: Make SMP init code resolve its own `start16` relocations
authorSergiu Moga <sergiu.moga@protonmail.com>
Wed, 22 Mar 2023 18:57:22 +0000 (20:57 +0200)
committerUnikraft <monkey@unikraft.io>
Fri, 11 Aug 2023 08:11:27 +0000 (08:11 +0000)
commitcf8cc65cb0ae62f3f590f292f332d00c3d2c8836
tree00fb90293ff52313eb826b174bf9d389e25c4150
parentd9bee3f82ff05e477224ab5f26207fbe5f831b79
plat/kvm/x86: Make SMP init code resolve its own `start16` relocations

Before waking up the secondary cores, the SMP initialization code copies
the, now position independent through `uk_reloc`, 16-bit and 32-bit
bootstrapping code to a physical page, in the lower 1 Mib of physical
memory. Since, at this point of execution, the immediate values used by
this bootstrapping code take the form of `UK_RELOC_PLACEHOLDER`, they
will need to be properly resolved after being moved into lower memory.

Therefore, add a new locally defined `struct uk_reloc` array holding the
hardcoded corresponding entries of these relocations, adapted to
reference the desired relocation address. Use this array after memory
copying the bootstrapping code to lower memory to resolve its
corresponding `start16` relocations.

Encode these entries with the help of `start16` related macro's and
since these definitions are starting to visually occupy a lot of space,
move everything to `start16_helpers.h`, a separate header file.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Dragos Petre <dragos.petre27@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #772
plat/common/x86/lcpu.c
plat/common/x86/start16_helpers.h [new file with mode: 0644]
plat/kvm/x86/lcpu_start.S