Kaydet (Commit) eb263680 authored tarafından Jack Jansen's avatar Jack Jansen

Ported to CW8

üst 56ed26ed
...@@ -7,15 +7,30 @@ ...@@ -7,15 +7,30 @@
#include <setjmp.h> #include <setjmp.h>
#ifdef PRE_CW8
extern jmp_buf __program_exit; /* exit() does a longjmp() to here */ extern jmp_buf __program_exit; /* exit() does a longjmp() to here */
extern void (*__atexit_hook)(void); /* atexit() sets this up if it is ever called */ extern void (*__atexit_hook)(void); /* atexit() sets this up if it is ever called */
extern void (*___atexit_hook)(void); /* _atexit() sets this up if it is ever called */ extern void (*___atexit_hook)(void); /* _atexit() sets this up if it is ever called */
extern int __aborting; /* abort() sets this and longjmps to __program_exit */ extern int __aborting; /* abort() sets this and longjmps to __program_exit */
#endif
/*
* clear_stackframe_backlink - set 0(SP) to 0
*
*/
static asm void clear_stackframe_backlink(void)
{
li r3,0
stw r3,0(SP)
blr
}
void __start(void) void __start(void)
{ {
char *argv = 0; char *argv = 0;
#ifdef PRE_CW8
if (setjmp(__program_exit) == 0) { // set up jmp_buf for exit() if (setjmp(__program_exit) == 0) { // set up jmp_buf for exit()
main(0, &argv); // call main(argc, argv) main(0, &argv); // call main(argc, argv)
if (__atexit_hook) if (__atexit_hook)
...@@ -26,4 +41,9 @@ void __start(void) ...@@ -26,4 +41,9 @@ void __start(void)
___atexit_hook(); // call _atexit() procs ___atexit_hook(); // call _atexit() procs
} }
// ExitToShell(); // ExitToShell();
#else
clear_stackframe_backlink();
main(0, &argv);
exit(0);
#endif
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment