Implement WUMS 0.2

This commit is contained in:
Maschell
2021-09-17 16:17:54 +02:00
parent f461fc4539
commit c5af736523
13 changed files with 170 additions and 113 deletions

View File

@@ -1,3 +1,27 @@
int main(int argc, char** argv){
int main(int argc, char **argv) {
return 0;
}
extern __attribute__((weak)) void __wut_socket_init_devoptab();
extern __attribute__((weak)) void __wut_socket_fini_devoptab();
static int __wut_socket_devoptab_added = 0;
extern void socket_lib_init();
void __attribute__((weak)) __init_wut_socket() {
if(!&__wut_socket_init_devoptab) return;
if (!__wut_socket_devoptab_added) {
socket_lib_init();
__wut_socket_init_devoptab();
__wut_socket_devoptab_added = 1;
}
}
void __attribute__((weak)) __fini_wut_socket() {
if(!&__wut_socket_init_devoptab || !&__wut_socket_fini_devoptab) return;
if (__wut_socket_devoptab_added) {
__wut_socket_fini_devoptab();
__wut_socket_devoptab_added = 0;
}
}

View File

@@ -1,24 +1,7 @@
.extern main
.extern exit
.extern __init_wut
.extern __fini_wut
.section .crt0, "ax", @progbits
.global __wums_start
__wums_start:
stwu 1, -0x28(1)
mflr 0
stw 0, 0x2C(1)
stw 31, 0x24(1)
or 31, 1, 1
stw 3, 0x18(31)
stw 4, 0x1C(31)
bl __init_wut
lwz 4, 0x1C(31)
lwz 3, 0x18(31)
bl main
addi 11, 31, 0x28
lwz 0, 0x4(11)
mtlr 0
lwz 31, -0x4(11)
or 1, 11, 11
blr
b main