extern "C" void boot2(){ dln printd("memset\r\n"); delay_cpu(10); for (int i = (int) _bss_start; i < (int)_bss_end; i++) { *((char*) i)=0; } dln printd("boot2\r\n"); delay_cpu(10); debug_serial_printhex_int((int)&__preinit_array_start);dln debug_serial_printhex_int((int)&__preinit_array_end);dln debug_serial_printhex_int((int)&__init_array_start);dln debug_serial_printhex_int((int)&__init_array_end);dln debug_serial_printhex_int((int)&_ctor_start);dln debug_serial_printhex_int((int)&_ctor_end);dln // BEGIN C++ support (2/2) //Call C++ global constructors call_constructors(&__preinit_array_start, &__preinit_array_end); call_constructors(&__init_array_start, &__init_array_end); call_constructors(&_ctor_start, &_ctor_end); // END C++ support (2/2) dln printd("callconstrend\r\n"); delay_cpu(10); second_init(); drivers_init(); hmain(); systemError("MAIN FUNCTION END. Kernel bewilderment :)"); }
int pre_main(const char *argv) { int i; bool Only1Arg; parse_cmdline(argv); Only1Arg = (strcmp(ARGUV[0],"hatari") == 0) ? 0 : 1; for (i = 0; i<64; i++) xargv_cmd[i] = NULL; // Add_Option("hatari"); if(Only1Arg) { Add_Option("hatari"); Add_Option("--disk-a"); Add_Option(RPATH/*ARGUV[0]*/); } else { // Pass all cmdline args for(i = 0; i < ARGUC; i++) Add_Option(ARGUV[i]); } for (i = 0; i < PARAMCOUNT; i++) { xargv_cmd[i] = (char*)(XARGV[i]); printf("%2d %s\n",i,XARGV[i]); } hmain(PARAMCOUNT,( char **)xargv_cmd); xargv_cmd[PARAMCOUNT - 2] = NULL; }
int main (int argc, char const * const * argv) { c41_ma_t ma; c41_smt_t smt; c41_fsi_t fsi; c41_fspi_t fspi; c41_cli_t cli; uint8_t h; uint_t hs; if (!C41_LIB_IS_COMPATIBLE()) { fprintf(stderr, "Error: incompatible c41 lib\n"); return 0x40; } if (!HBS1_LIB_IS_COMPATIBLE()) { fprintf(stderr, "Error: incompatible hbs1 lib\n"); return 0x41; } C41_VAR_ZERO(cli); hs = hbs1_ma_init(&ma); if (hs) { fprintf(stderr, "Error: failed initialising memory allocator " "(%s, code %u)", hbs1_status_name(hs), hs); return 0x42; } hs = hbs1_smt_init(&smt, NULL); if (hs) { fprintf(stderr, "Error: failed initialising multithreading support " "(%s, code %u)", hbs1_status_name(hs), hs); return 0x42; } hs = hbs1_stdin(&cli.stdin_p); if (hs) { fprintf(stderr, "Error: failed obtaining std input object " "(%s, code %u)", hbs1_status_name(hs), hs); return 0x42; } hs = hbs1_stdout(&cli.stdout_p); if (hs) { fprintf(stderr, "Error: failed obtaining std output object " "(%s, code %u)", hbs1_status_name(hs), hs); return 0x43; } hs = hbs1_stderr(&cli.stderr_p); if (hs) { fprintf(stderr, "Error: failed obtaining std error object " "(%s, code %u)", hbs1_status_name(hs), hs); return 0x43; } hs = hbs1_fsi_init(&fsi, &fspi); if (hs) { fprintf(stderr, "Error: failed initialising file system interface " "(%s, code %u)", hbs1_status_name(hs), hs); return 0x42; } cli.ma_p = &ma; cli.smt_p = ⪪ cli.fsi_p = &fsi; cli.fspi_p = &fspi; cli.program = argv[0]; cli.arg_a = argv + 1; cli.arg_n = argc - 1; h = hmain(&cli); if (h >= 0x40) { fprintf(stderr, "Error: bad return code 0x%02X\n", h); h = 0x7F; } hs = hbs1_fsi_finish(&fsi); if (hs) { fprintf(stderr, "Warning: failed finalising file system interface " "(%s, code %u)", hbs1_status_name(hs), hs); } hs = hbs1_ma_finish(&ma); if (hs) { fprintf(stderr, "Warning: failed finalising memory allocator " "(%s, code %u)", hbs1_status_name(hs), hs); return 0x42; } return h; }