mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-22 20:06:40 +00:00
fusee: fixup extents for chainloader/stack
This commit is contained in:
parent
2b81ed7315
commit
3b05315616
5 changed files with 16 additions and 16 deletions
|
@ -14,14 +14,14 @@ MEMORY
|
|||
{
|
||||
NULL : ORIGIN = 0x00000000, LENGTH = 0x1000
|
||||
main : ORIGIN = 0x40008000, LENGTH = 0x28000
|
||||
low_iram : ORIGIN = 0x40003000, LENGTH = 0x1000
|
||||
low_iram : ORIGIN = 0x40000000, LENGTH = 0x6000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
PROVIDE(__start__ = 0x40008000);
|
||||
PROVIDE(__stack_top__ = 0x40008000);
|
||||
PROVIDE(__stack_bottom__ = 0x40004000);
|
||||
PROVIDE(__stack_bottom__ = 0x40006000);
|
||||
PROVIDE(__heap_start__ = 0);
|
||||
PROVIDE(__heap_end__ = 0);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define CHAINLOADER_ARG_DATA_MAX_SIZE 0x640
|
||||
#define CHAINLOADER_ARG_DATA_MAX_SIZE 0x5400
|
||||
#define CHAINLOADER_MAX_ENTRIES 128
|
||||
|
||||
typedef struct chainloader_entry_t {
|
||||
|
|
|
@ -58,21 +58,21 @@ static int stage2_ini_handler(void *user, const char *section, const char *name,
|
|||
static bool run_mtc(const char *mtc_path, uintptr_t mtc_address) {
|
||||
FILINFO info;
|
||||
size_t size;
|
||||
|
||||
|
||||
/* Check if the MTC binary is present. */
|
||||
if (f_stat(mtc_path, &info) != FR_OK) {
|
||||
print(SCREEN_LOG_LEVEL_WARNING, "Stage2's MTC binary not found!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
size = (size_t)info.fsize;
|
||||
|
||||
|
||||
/* Try to read the MTC binary. */
|
||||
if (read_from_file((void *)mtc_address, size, mtc_path) != size) {
|
||||
print(SCREEN_LOG_LEVEL_WARNING, "Failed to read stage2's MTC binary (%s)!\n", mtc_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
ScreenLogLevel mtc_log_level = log_get_log_level();
|
||||
bool mtc_res = false;
|
||||
int mtc_argc = 1;
|
||||
|
@ -81,13 +81,13 @@ static bool run_mtc(const char *mtc_path, uintptr_t mtc_address) {
|
|||
|
||||
/* Setup argument data. */
|
||||
memcpy(&mtc_args->log_level, &mtc_log_level, sizeof(mtc_log_level));
|
||||
|
||||
|
||||
/* Run the MTC binary. */
|
||||
mtc_res = (((int (*)(int, void *))mtc_address)(mtc_argc, mtc_arg_data) == 0);
|
||||
|
||||
|
||||
/* Cleanup right away. */
|
||||
memset((void *)mtc_address, 0, size);
|
||||
|
||||
|
||||
return mtc_res;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ void load_stage2(const char *bct0) {
|
|||
if (!check_32bit_address_loadable(config.load_address)) {
|
||||
fatal_error("Stage2's load address is invalid!\n");
|
||||
}
|
||||
|
||||
|
||||
print(SCREEN_LOG_LEVEL_DEBUG, "Stage 2 Config:\n");
|
||||
print(SCREEN_LOG_LEVEL_DEBUG | SCREEN_LOG_LEVEL_NO_PREFIX, " File Path: %s\n", config.path);
|
||||
print(SCREEN_LOG_LEVEL_DEBUG | SCREEN_LOG_LEVEL_NO_PREFIX, " MTC File Path: %s\n", config.mtc_path);
|
||||
|
@ -152,7 +152,7 @@ void load_stage2(const char *bct0) {
|
|||
} else {
|
||||
tmp_addr = config.load_address;
|
||||
}
|
||||
|
||||
|
||||
/* Try to read stage2. */
|
||||
if (read_from_file((void *)tmp_addr, size, config.path) != size) {
|
||||
fatal_error("Failed to read stage2 (%s)!\n", config.path);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FUSEE_STAGE2_H
|
||||
#define FUSEE_STAGE2_H
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
#define STAGE2_ADDRESS_KEY "stage2_addr"
|
||||
#define STAGE2_ENTRYPOINT_KEY "stage2_entrypoint"
|
||||
|
||||
#define BCTO_MAX_SIZE 0x5800
|
||||
#define BCTO_MAX_SIZE 0x5000
|
||||
|
||||
typedef struct {
|
||||
char path[0x100];
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FUSEE_STAGE2_H
|
||||
#define FUSEE_STAGE2_H
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
|||
#define STAGE2_ARGV_ARGUMENT_STRUCT 1
|
||||
#define STAGE2_ARGC 2
|
||||
|
||||
#define BCTO_MAX_SIZE 0x5800
|
||||
#define BCTO_MAX_SIZE 0x5000
|
||||
|
||||
typedef struct {
|
||||
uint32_t version;
|
||||
|
|
Loading…
Reference in a new issue