-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
small fixes to
__start
and __ppc_eabi_init
- Loading branch information
Showing
4 changed files
with
51 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef void (*funcPtr) (void); | ||
__declspec(section ".ctors") extern funcPtr _ctors[]; | ||
__declspec(section ".dtors") extern funcPtr _dtors[]; | ||
extern void exit(int); | ||
static void __init_cpp(void); | ||
|
||
extern void __OSCacheInit(void); | ||
extern void __OSFPRInit(void); | ||
extern void __OSPSInit(void); | ||
|
||
/* written in assembly to generate the frame allocations */ | ||
asm void __init_user(void) { | ||
fralloc | ||
bl __init_cpp | ||
frfree | ||
blr | ||
} | ||
|
||
static void __init_cpp(void) { | ||
funcPtr* ctor; | ||
|
||
for (ctor = _ctors; *ctor; ctor++) { | ||
(*ctor)(); | ||
} | ||
} | ||
|
||
static void __fini_cpp(void) { | ||
funcPtr* dtor; | ||
|
||
for (dtor = _dtors; *dtor; dtor++) { | ||
(*dtor)(); | ||
} | ||
} | ||
|
||
void exit(int status) { | ||
__fini_cpp(); | ||
PPCHalt(); | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters