1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-24 03:06:17 +00:00

kern: ensure InitArguments do not cross page boundaries

This commit is contained in:
Michael Scire 2021-06-17 12:49:25 -07:00
parent 8a6afe7909
commit e423aef033
2 changed files with 5 additions and 2 deletions

View file

@ -18,7 +18,7 @@
namespace ams::kern::init { namespace ams::kern::init {
struct KInitArguments { struct alignas(util::CeilingPowerOfTwo(INIT_ARGUMENTS_SIZE)) KInitArguments {
u64 ttbr0; u64 ttbr0;
u64 ttbr1; u64 ttbr1;
u64 tcr; u64 tcr;
@ -32,7 +32,8 @@ namespace ams::kern::init {
u64 setup_function; u64 setup_function;
u64 exception_stack; u64 exception_stack;
}; };
static_assert(sizeof(KInitArguments) == INIT_ARGUMENTS_SIZE); static_assert(alignof(KInitArguments) == util::CeilingPowerOfTwo(INIT_ARGUMENTS_SIZE));
static_assert(sizeof(KInitArguments) == std::max(INIT_ARGUMENTS_SIZE, util::CeilingPowerOfTwo(INIT_ARGUMENTS_SIZE)));
static_assert(__builtin_offsetof(KInitArguments, ttbr0) == INIT_ARGUMENTS_TTBR0); static_assert(__builtin_offsetof(KInitArguments, ttbr0) == INIT_ARGUMENTS_TTBR0);
static_assert(__builtin_offsetof(KInitArguments, ttbr1) == INIT_ARGUMENTS_TTBR1); static_assert(__builtin_offsetof(KInitArguments, ttbr1) == INIT_ARGUMENTS_TTBR1);

View file

@ -24,6 +24,8 @@
namespace ams::kern::init { namespace ams::kern::init {
static_assert(util::IsPowerOfTwo(alignof(KInitArguments)) && util::IsPowerOfTwo(sizeof(KInitArguments)));
KPhysicalAddress GetInitArgumentsAddress(s32 core_id); KPhysicalAddress GetInitArgumentsAddress(s32 core_id);
} }