diff --git a/lib/Mathlib/asm/_d_sqrt.s b/lib/Mathlib/asm/_d_sqrt.s index 6b8042c434..e7e454f0ee 100644 --- a/lib/Mathlib/asm/_d_sqrt.s +++ b/lib/Mathlib/asm/_d_sqrt.s @@ -1,6 +1,6 @@ .include "macros/function.inc" - .extern Unk_021D0D40 + .extern errno .text @@ -122,5 +122,5 @@ _020E070C: ; .align 2, 0 _020E0728: .word 0x7FF00000 _020E072C: .word 0x7FF80000 -_020E0730: .word Unk_021D0D40 +_020E0730: .word errno arm_func_end _dsqrt \ No newline at end of file diff --git a/lib/NitroDWC/asm/auth/dwc_auth.s b/lib/NitroDWC/asm/auth/dwc_auth.s index 19461a1ba6..5648e1ba8f 100644 --- a/lib/NitroDWC/asm/auth/dwc_auth.s +++ b/lib/NitroDWC/asm/auth/dwc_auth.s @@ -2,7 +2,7 @@ .include "include/dwc_auth.inc" .extern OSi_ThreadInfo - .extern Unk_021D0D40 + .extern errno .extern Unk_ov4_0221A43C .text @@ -879,7 +879,7 @@ _021D3C3C: ; .align 2, 0 _021D3C44: .word Unk_ov4_0221A414 _021D3C48: .word Unk_ov4_02215F40 -_021D3C4C: .word Unk_021D0D40 +_021D3C4C: .word errno _021D3C50: .word Unk_ov4_02215F48 _021D3C54: .word 0x00004E85 _021D3C58: .word Unk_ov4_02215F54 diff --git a/lib/NitroDWC/asm/auth/dwc_nastime.s b/lib/NitroDWC/asm/auth/dwc_nastime.s index 570a6f57b3..6e3762c6fa 100644 --- a/lib/NitroDWC/asm/auth/dwc_nastime.s +++ b/lib/NitroDWC/asm/auth/dwc_nastime.s @@ -1,7 +1,7 @@ .include "macros/function.inc" .include "include/dwc_nastime.inc" - .extern Unk_021D0D40 + .extern errno .text @@ -144,7 +144,7 @@ _021D6C88: ldmia sp!, {r3, r4, r5, r6, r7, r8, pc} ; .align 2, 0 _021D6C94: .word Unk_ov4_02216570 -_021D6C98: .word Unk_021D0D40 +_021D6C98: .word errno _021D6C9C: .word Unk_ov4_02216540 _021D6CA0: .word Unk_ov4_0221A4B4 arm_func_end DWC_Auth_SetNasTimeDiff diff --git a/lib/NitroDWC/asm/auth/dwc_netcheck.s b/lib/NitroDWC/asm/auth/dwc_netcheck.s index 858ce5258b..13e5fdf380 100644 --- a/lib/NitroDWC/asm/auth/dwc_netcheck.s +++ b/lib/NitroDWC/asm/auth/dwc_netcheck.s @@ -2,7 +2,7 @@ .include "include/dwc_netcheck.inc" .extern OSi_ThreadInfo - .extern Unk_021D0D40 + .extern errno .extern Unk_ov4_02215EA0 .text @@ -1259,7 +1259,7 @@ _021D69C4: .word Unk_ov4_0221635C _021D69C8: .word Unk_ov4_0221A450 _021D69CC: .word OSi_ThreadInfo _021D69D0: .word Unk_ov4_02216470 -_021D69D4: .word Unk_021D0D40 +_021D69D4: .word errno _021D69D8: .word 0x0000012E _021D69DC: .word Unk_ov4_02215EA0 _021D69E0: .word 0x00004E20 diff --git a/lib/NitroDWC/asm/auth/dwc_svl.s b/lib/NitroDWC/asm/auth/dwc_svl.s index b56c90b9c3..d137cd5d23 100644 --- a/lib/NitroDWC/asm/auth/dwc_svl.s +++ b/lib/NitroDWC/asm/auth/dwc_svl.s @@ -2,7 +2,7 @@ .include "include/dwc_svl.inc" .extern OSi_ThreadInfo - .extern Unk_021D0D40 + .extern errno .extern Unk_ov4_02215EA0 .text @@ -444,7 +444,7 @@ _021D72B4: .word Unk_ov4_0221A4C8 _021D72B8: .word 0xFFFF9DF3 _021D72BC: .word Unk_ov4_022165E4 _021D72C0: .word Unk_ov4_022165EC -_021D72C4: .word Unk_021D0D40 +_021D72C4: .word errno _021D72C8: .word 0xFFFF9E58 _021D72CC: .word Unk_ov4_022165F8 _021D72D0: .word 0xFFFFA240 diff --git a/lib/msl/asm/MSL_C/e_pow.s b/lib/msl/asm/MSL_C/e_pow.s index 0429007ede..741f97ba7a 100644 --- a/lib/msl/asm/MSL_C/e_pow.s +++ b/lib/msl/asm/MSL_C/e_pow.s @@ -1,7 +1,7 @@ .include "macros/function.inc" .include "include/e_pow.inc" - .extern Unk_021D0D40 + .extern errno .text @@ -398,7 +398,7 @@ _020DD488: .word 0x43400000 _020DD48C: .word 0xFFFFFC01 _020DD490: .word 0x3FE00000 _020DD494: .word 0x021015B0 -_020DD498: .word Unk_021D0D40 +_020DD498: .word errno _020DD49C: .word 0x41E00000 _020DD4A0: .word 0x3FEFFFFF _020DD4A4: .word 0x3FD00000 diff --git a/lib/msl/asm/MSL_C/errno.s b/lib/msl/asm/MSL_C/errno.s deleted file mode 100644 index ce32e9f2ac..0000000000 --- a/lib/msl/asm/MSL_C/errno.s +++ /dev/null @@ -1,11 +0,0 @@ - .include "macros/function.inc" - - - - .bss - - - .global Unk_021D0D40 -Unk_021D0D40: ; 0x021D0D40 - .space 0x4 - diff --git a/lib/msl/asm/MSL_C/file_pos.s b/lib/msl/asm/MSL_C/file_pos.s index 7d12b7da16..1f34c6b197 100644 --- a/lib/msl/asm/MSL_C/file_pos.s +++ b/lib/msl/asm/MSL_C/file_pos.s @@ -5,7 +5,7 @@ .extern Unk_021D0920 .extern Unk_021D0944 .extern Unk_021D0968 - .extern Unk_021D0D40 + .extern errno .extern __files @@ -47,7 +47,7 @@ _020D4AA4: subhs r0, r0, r1 bx lr ; .align 2, 0 -_020D4ADC: .word Unk_021D0D40 +_020D4ADC: .word errno arm_func_end _ftell arm_func_start ftell @@ -264,7 +264,7 @@ _020D4DD0: add sp, sp, #0x10 bx lr ; .align 2, 0 -_020D4DE0: .word Unk_021D0D40 +_020D4DE0: .word errno arm_func_end _fseek arm_func_start fseek diff --git a/lib/msl/asm/MSL_C/strtold.s b/lib/msl/asm/MSL_C/strtold.s index 0fe2b09c04..b3c8bdf5fd 100644 --- a/lib/msl/asm/MSL_C/strtold.s +++ b/lib/msl/asm/MSL_C/strtold.s @@ -1,7 +1,7 @@ .include "macros/function.inc" .include "include/strtold.inc" - .extern Unk_021D0D40 + .extern errno .extern Unk_021015AC .extern Unk_021015B4 @@ -1403,7 +1403,7 @@ _020DA42C: ; .align 2, 0 _020DA43C: .word __StringRead _020DA440: .word 0x7FEFFFFF -_020DA444: .word Unk_021D0D40 +_020DA444: .word errno arm_func_end strtod arm_func_start atof diff --git a/lib/msl/asm/MSL_C/strtoul.s b/lib/msl/asm/MSL_C/strtoul.s index 2bfd1c79da..30c57f7522 100644 --- a/lib/msl/asm/MSL_C/strtoul.s +++ b/lib/msl/asm/MSL_C/strtoul.s @@ -1,7 +1,7 @@ .include "macros/function.inc" .include "include/strtoul.inc" - .extern Unk_021D0D40 + .extern errno .text @@ -541,7 +541,7 @@ _020DAD28: ldmia sp!, {r3, r4, r5, pc} ; .align 2, 0 _020DAD3C: .word __StringRead -_020DAD40: .word Unk_021D0D40 +_020DAD40: .word errno arm_func_end strtoul arm_func_start strtol @@ -599,7 +599,7 @@ _020DADF4: ldmia sp!, {r3, r4, r5, pc} ; .align 2, 0 _020DAE04: .word __StringRead -_020DAE08: .word Unk_021D0D40 +_020DAE08: .word errno arm_func_end strtol arm_func_start atoi diff --git a/lib/msl/src/MSL_C/errno.c b/lib/msl/src/MSL_C/errno.c new file mode 100644 index 0000000000..10ea7ea558 --- /dev/null +++ b/lib/msl/src/MSL_C/errno.c @@ -0,0 +1,14 @@ +#pragma ANSI_strict off + +#include +#include + +#if !_MSL_THREADSAFE || !_MSL_LOCALDATA_AVAILABLE + #if !defined(__MACH__) +int errno; + #endif + + #if ((__dest_os == __mac_os) || (__dest_os == __mac_os_x)) +short __MacOSErrNo; + #endif +#endif diff --git a/main.lsf b/main.lsf index fcaa0e2f3c..121c03065a 100644 --- a/main.lsf +++ b/main.lsf @@ -576,7 +576,7 @@ Static main Object lib/msl/asm/MSL_C/math_arm.o Object lib/msl/src/MSL_C/alloc.o Object lib/msl/src/MSL_C/ansi_files.o - Object lib/msl/asm/MSL_C/errno.o + Object lib/msl/src/MSL_C/errno.o Object lib/msl/src/MSL_C/arith.o Object lib/msl/src/MSL_C/assert.o Object lib/msl/src/MSL_C/buffer_io.o