|
2 | 2 |
|
3 | 3 | initSystem.c -- Code for initialising the DS |
4 | 4 |
|
5 | | -Copyright (C) 2007 - 2010 |
| 5 | +Copyright (C) 2007 - 2021 |
6 | 6 | Dave Murphy (WinterMute) |
7 | 7 |
|
8 | 8 | This software is provided 'as-is', without any express or implied |
@@ -44,9 +44,32 @@ distribution. |
44 | 44 |
|
45 | 45 | void __libnds_exit(int rc); |
46 | 46 | bool __dsimode; // set in crt0 |
47 | | -extern time_t *punixTime; |
48 | 47 |
|
49 | | -int __libnds_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz); |
| 48 | +time_t *punixTime; |
| 49 | + |
| 50 | +//--------------------------------------------------------------------------------- |
| 51 | +int __SYSCALL(gettod_r)(struct _reent *ptr, struct timeval *tp, struct timezone *tz) { |
| 52 | +//--------------------------------------------------------------------------------- |
| 53 | + |
| 54 | + if (tp != NULL) { |
| 55 | + tp->tv_sec = *punixTime; |
| 56 | + tp->tv_usec = 0; |
| 57 | + } |
| 58 | + if (tz != NULL) { |
| 59 | + tz->tz_minuteswest = 0; |
| 60 | + tz->tz_dsttime = 0; |
| 61 | + } |
| 62 | + |
| 63 | + return 0; |
| 64 | +} |
| 65 | + |
| 66 | + |
| 67 | +//--------------------------------------------------------------------------------- |
| 68 | +void __SYSCALL(exit)(int rc) { |
| 69 | +//--------------------------------------------------------------------------------- |
| 70 | + __libnds_exit(rc); |
| 71 | +} |
| 72 | + |
50 | 73 |
|
51 | 74 | //--------------------------------------------------------------------------------- |
52 | 75 | // Reset the DS registers to sensible defaults |
@@ -93,9 +116,6 @@ void __attribute__((weak)) initSystem(void) { |
93 | 116 |
|
94 | 117 | punixTime = (time_t*)memUncached((void *)&__transferRegion()->unixTime); |
95 | 118 |
|
96 | | - __syscalls.exit = __libnds_exit; |
97 | | - __syscalls.gettod_r = __libnds_gtod; |
98 | | - |
99 | 119 | extern char *fake_heap_end; |
100 | 120 | __transferRegion()->bootcode = (struct __bootstub *)fake_heap_end; |
101 | 121 | irqEnable(IRQ_VBLANK); |
|
0 commit comments