bootloader elf: fix misaligned access
The elf region structure is packed. So it's not possible to use a pointer to one of its fields on sparc. Use a temporary variable that's properly aligned. Change-Id: I9dd9b9f2b1d14821e34bc2f5b3da661086ef3fef Reviewed-on: https://review.haiku-os.org/c/haiku/+/3567 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -296,10 +296,14 @@ ELFLoader<Class>::Load(int fd, preloaded_image* _image)
|
|||||||
// can automatically allocate an address, but shall prefer the specified
|
// can automatically allocate an address, but shall prefer the specified
|
||||||
// base address.
|
// base address.
|
||||||
totalSize = secondRegion->start + secondRegion->size - firstRegion->start;
|
totalSize = secondRegion->start + secondRegion->size - firstRegion->start;
|
||||||
if (Class::AllocateRegion(&firstRegion->start, totalSize,
|
{
|
||||||
B_READ_AREA | B_WRITE_AREA, &mappedRegion) != B_OK) {
|
AddrType address = firstRegion->start;
|
||||||
status = B_NO_MEMORY;
|
if (Class::AllocateRegion(&address, totalSize,
|
||||||
goto error1;
|
B_READ_AREA | B_WRITE_AREA, &mappedRegion) != B_OK) {
|
||||||
|
status = B_NO_MEMORY;
|
||||||
|
goto error1;
|
||||||
|
}
|
||||||
|
firstRegion->start = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize the region pointers to the allocated region
|
// initialize the region pointers to the allocated region
|
||||||
|
|||||||
Reference in New Issue
Block a user