mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
Exosphere: Fix carveout saving (warmboot now works on 5.1.0)
This commit is contained in:
parent
a0deea8ae0
commit
46f68fcbff
1 changed files with 15 additions and 2 deletions
|
@ -4,6 +4,16 @@
|
||||||
#include "mc.h"
|
#include "mc.h"
|
||||||
#include "exocfg.h"
|
#include "exocfg.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint64_t address;
|
||||||
|
uint64_t size;
|
||||||
|
} saved_carveout_info_t;
|
||||||
|
|
||||||
|
static saved_carveout_info_t g_saved_carveouts[2] = {
|
||||||
|
{0x80060000ull, KERNEL_CARVEOUT_SIZE_MAX},
|
||||||
|
{0x00000000ull, 0x00000000ull}
|
||||||
|
};
|
||||||
|
|
||||||
volatile security_carveout_t *get_carveout_by_id(unsigned int carveout) {
|
volatile security_carveout_t *get_carveout_by_id(unsigned int carveout) {
|
||||||
if (CARVEOUT_ID_MIN <= carveout && carveout <= CARVEOUT_ID_MAX) {
|
if (CARVEOUT_ID_MIN <= carveout && carveout <= CARVEOUT_ID_MAX) {
|
||||||
return (volatile security_carveout_t *)(MC_BASE + 0xC08ull + 0x50 * (carveout - CARVEOUT_ID_MIN));
|
return (volatile security_carveout_t *)(MC_BASE + 0xC08ull + 0x50 * (carveout - CARVEOUT_ID_MIN));
|
||||||
|
@ -67,10 +77,10 @@ void configure_default_carveouts(void) {
|
||||||
/* Configure default Kernel carveouts based on 2.0.0+. */
|
/* Configure default Kernel carveouts based on 2.0.0+. */
|
||||||
if (exosphere_get_target_firmware() >= EXOSPHERE_TARGET_FIRMWARE_200) {
|
if (exosphere_get_target_firmware() >= EXOSPHERE_TARGET_FIRMWARE_200) {
|
||||||
/* Configure Carveout 4 (KERNEL_BUILTINS) */
|
/* Configure Carveout 4 (KERNEL_BUILTINS) */
|
||||||
configure_kernel_carveout(4, 0x80060000, KERNEL_CARVEOUT_SIZE_MAX);
|
configure_kernel_carveout(4, g_saved_carveouts[0].address, g_saved_carveouts[0].size);
|
||||||
|
|
||||||
/* Configure Carveout 5 (KERNEL_UNUSED) */
|
/* Configure Carveout 5 (KERNEL_UNUSED) */
|
||||||
configure_kernel_carveout(5, 0, 0);
|
configure_kernel_carveout(5, g_saved_carveouts[1].address, g_saved_carveouts[1].size);
|
||||||
} else {
|
} else {
|
||||||
for (unsigned int i = 4; i <= 5; i++) {
|
for (unsigned int i = 4; i <= 5; i++) {
|
||||||
carveout = get_carveout_by_id(i);
|
carveout = get_carveout_by_id(i);
|
||||||
|
@ -96,6 +106,9 @@ void configure_kernel_carveout(unsigned int carveout_id, uint64_t address, uint6
|
||||||
if (carveout_id != 4 && carveout_id != 5) {
|
if (carveout_id != 4 && carveout_id != 5) {
|
||||||
generic_panic();
|
generic_panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_saved_carveouts[carveout_id-4].address = address;
|
||||||
|
g_saved_carveouts[carveout_id-4].size = size;
|
||||||
|
|
||||||
volatile security_carveout_t *carveout = get_carveout_by_id(carveout_id);
|
volatile security_carveout_t *carveout = get_carveout_by_id(carveout_id);
|
||||||
carveout->paddr_low = (uint32_t)(address & 0xFFFFFFFF);
|
carveout->paddr_low = (uint32_t)(address & 0xFFFFFFFF);
|
||||||
|
|
Loading…
Reference in a new issue