bootloader: Align boot volume structure to 8 bytes instead of 4.
This alignment is preferred e.g. on ARM when using 64-bit values. Signed-off-by: Augustin Cavalier <[email protected]>
This commit is contained in:
committed by
Augustin Cavalier
parent
fb4cc98472
commit
5effe7f3ec
@@ -132,15 +132,15 @@ main(stage2_args *args)
|
|||||||
gKernelArgs.version = CURRENT_KERNEL_ARGS_VERSION;
|
gKernelArgs.version = CURRENT_KERNEL_ARGS_VERSION;
|
||||||
|
|
||||||
// clone the boot_volume KMessage into kernel accessible memory
|
// clone the boot_volume KMessage into kernel accessible memory
|
||||||
// note, that we need to 4 byte align the buffer and thus allocate
|
// note, that we need to 8-byte align the buffer and thus allocate
|
||||||
// 3 more bytes
|
// 7 more bytes
|
||||||
void* buffer = kernel_args_malloc(gBootVolume.ContentSize() + 3);
|
void* buffer = kernel_args_malloc(gBootVolume.ContentSize() + 7);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
panic("Could not allocate memory for the boot volume kernel "
|
panic("Could not allocate memory for the boot volume kernel "
|
||||||
"arguments");
|
"arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = (void*)(((addr_t)buffer + 3) & ~(addr_t)0x3);
|
buffer = (void*)(((addr_t)buffer + 7) & ~(addr_t)0x7);
|
||||||
memcpy(buffer, gBootVolume.Buffer(), gBootVolume.ContentSize());
|
memcpy(buffer, gBootVolume.Buffer(), gBootVolume.ContentSize());
|
||||||
gKernelArgs.boot_volume = buffer;
|
gKernelArgs.boot_volume = buffer;
|
||||||
gKernelArgs.boot_volume_size = gBootVolume.ContentSize();
|
gKernelArgs.boot_volume_size = gBootVolume.ContentSize();
|
||||||
|
|||||||
Reference in New Issue
Block a user