Minor internal cleanup

This commit is contained in:
fincs 2020-06-12 14:15:18 +02:00
parent 1442eef9e4
commit 8e3c9f9784
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60
5 changed files with 10 additions and 24 deletions

View File

@ -29,7 +29,7 @@ before_deploy:
- sh .travis/exportdoc.sh
deploy:
provider: pages:git
provider: pages
deploy_key: .travis/id_travis_deploy
edge: true
keep_history: false

View File

@ -10,12 +10,7 @@ extern u32 __ctru_linear_heap_size;
extern void (*__system_retAddr)(void);
void envDestroyHandles(void);
void __appExit();
void __libc_fini_array(void);
Result __sync_fini(void) __attribute__((weak));
Result __sync_fini(void);
void __attribute__((weak)) __attribute__((noreturn)) __libctru_exit(int rc)
{
@ -30,8 +25,8 @@ void __attribute__((weak)) __attribute__((noreturn)) __libctru_exit(int rc)
// Close some handles
envDestroyHandles();
if (__sync_fini)
__sync_fini();
// Finalize the synchronization subsystem
__sync_fini();
// Jump to the loader if it provided a callback
if (__system_retAddr)

View File

@ -8,12 +8,10 @@
void (*__system_retAddr)(void);
Result __sync_init(void);
void __system_initSyscalls(void);
void __system_allocateHeaps(void);
void __system_initArgv(void);
void __appInit(void);
Result __sync_init(void);
void __attribute__((weak)) __libctru_init(void (*retAddr)(void))
{

View File

@ -1,7 +1,5 @@
#include <3ds/asminc.h>
.arm
BEGIN_ASM_FUNC initSystem, weak
ldr r2, =saved_stack
str sp, [r2]
@ -19,7 +17,6 @@ BEGIN_ASM_FUNC initSystem, weak
bics sp, sp, #7
str sp, [r2]
bl __appInit
bl __libc_init_array
@ -37,16 +34,13 @@ BEGIN_ASM_FUNC __ctru_exit, weak
b __libctru_exit
END_ASM_FUNC
.data
.section .data.__stacksize__, "aw"
.align 2
__stacksize__:
.word 32 * 1024
.weak __stacksize__
.bss
.section .bss.saved_stack.42, "aw", %nobits
.align 2
saved_stack:
.space 8

View File

@ -17,7 +17,7 @@ extern const u8 __tdata_lma[];
extern const u8 __tdata_lma_end[];
extern u8 __tls_start[];
static struct _reent* __ctru_get_reent()
static struct _reent* __libctru_get_reent()
{
ThreadVars* tv = getThreadVars();
if (tv->magic != THREADVARS_MAGIC)
@ -34,13 +34,12 @@ static int __libctru_nanosleep(const struct timespec *req, struct timespec *rem)
return 0;
}
void __attribute__((weak)) __system_initSyscalls(void)
void __system_initSyscalls(void)
{
// Register newlib syscalls
__syscalls.exit = __ctru_exit;
__syscalls.gettod_r = __libctru_gtod;
__syscalls.getreent = __ctru_get_reent;
__syscalls.getreent = __libctru_get_reent;
__syscalls.nanosleep = __libctru_nanosleep;
// Register locking syscalls