/*---------------------------------------------------------------------*/ void bgl_init_objects() { /* initialize the preloading */ bmem_init(); /* initialize the runtime system */ ____bgl_init_objects(); unknown_ident = string_to_symbol( "unknown_function" ); mark_function( unknown_ident, 0, ante_bgl_init_dsz, 0, -1, -1, -1 ); bgl_socket_accept_symbol = string_to_symbol( "$socket-accept" ); ((esymbol_t *)(CREF(bgl_socket_accept_symbol)))->class_alloc = HOSTENT_TYPE_NUM; bgl_socket_accept_many_symbol = string_to_symbol( "$socket-accept-many" ); ((esymbol_t *)(CREF(bgl_socket_accept_many_symbol)))->class_alloc = HOSTENT_TYPE_NUM; bgl_make_input_port_symbol = string_to_symbol( "$make-input-port" ); ((esymbol_t *)(CREF(bgl_make_input_port_symbol)))->class_alloc = UNKNOWN_ATOMIC_TYPE_NUM; /* signal registration */ signal( 2, bmem_dump ); /* exit registration */ atexit( (void (*)(void))bmem_dump ); }
/*---------------------------------------------------------------------*/ void bglfth_setup_bmem() { void *hdl; char bigloothread_lib[ 1000 ]; static void (*____bglthread_setup_bmem)(); bmem_thread = 1; /* Hello world */ fprintf( stderr, "Bmem Fthread initialization...\n" ); if( getenv( "BMEMLIBBIGLOOTHREAD" ) ) { strcpy( bigloothread_lib, getenv( "BMEMLIBBIGLOOTHREAD" ) ); } else { sprintf( bigloothread_lib, "%s/libbigloofth_s-%s.%s", LIBRARY_DIRECTORY, BGL_RELEASE_NUMBER, SHARED_LIB_SUFFIX ); } fprintf( stderr, "Loading thread library %s...\n", bigloothread_lib ); hdl = open_shared_library( bigloothread_lib ); ____bglthread_setup_bmem = (void (*)())get_function( hdl, "bglfth_setup_bmem" ); ____bglthread_new = (void *(*)( void * ))get_function( hdl, "bglfth_thread_new" ); ____bglthread_new = (void *(*)( void * ))get_function( hdl, "bglthread_new" ); ____bglthread_new_with_name = (void *(*)( void *, void * ))get_function( hdl, "bglthread_new_with_name" ); ____scheduler_start = get_function( hdl, "BGl_schedulerzd2startz12zc0zz__ft_schedulerz00" ); ____scheduler_react = get_function( hdl, "BGl_schedulerzd2reactz12zc0zz__ft_schedulerz00" ); ____bglthread_id_get = get_function( hdl, "bglthread_id_get" ); ____bglthread_switch = (void (*)( void *, void * ))get_function( hdl, "bglthread_switch" ); ____bglasync_scheduler_notify = (void (*)( void * ))get_function( hdl, "bglasync_scheduler_notify" ); ____pthread_getspecific = get_function( hdl, "bglfth_pthread_getspecific" ); ____pthread_setspecific = (int (*)())get_function( hdl, "bglfth_pthread_setspecific" ); ____pthread_key_create = (int (*)())get_function( hdl, "bglfth_pthread_key_create" ); ____pthread_mutex_init = (int (*)())get_function( hdl, "bglfth_pthread_mutex_init" ); if( ____pthread_key_create( &bmem_key, 0L ) ) { FAIL( IDENT, "Can't get thread key", "bmem_key" ); exit( -2 ); } if( ____pthread_mutex_init( &bmem_mutex, 0L ) ) { FAIL( IDENT, "Can't get thread key", "bmem_key" ); exit( -2 ); } ____bglthread_setup_bmem(); bmem_init(); }
/*---------------------------------------------------------------------*/ void bglpth_setup_bmem() { void *hdl; char bigloothread_lib[ 1000 ]; static void (*____bglthread_setup_bmem)(); bmem_thread = 2; /* Hello world */ fprintf( stderr, "Bmem Pthread initialization...\n" ); if( getenv( "BMEMLIBBIGLOOTHREAD" ) ) { strcpy( bigloothread_lib, getenv( "BMEMLIBBIGLOOTHREAD" ) ); } else { sprintf( bigloothread_lib, "%s/libbigloopth_s-%s.%s", LIBRARY_DIRECTORY, BGL_RELEASE_NUMBER, SHARED_LIB_SUFFIX ); } fprintf( stderr, "Loading thread library %s...\n", bigloothread_lib ); hdl = open_shared_library( bigloothread_lib ); ____bglthread_setup_bmem = (void (*)())get_function( hdl, "bglpth_setup_bmem" ); ____bglthread_new = (void *(*)( void * ))get_function( hdl, "bglpth_thread_new" ); ____pthread_getspecific = get_function( hdl, "bglpth_pthread_getspecific" ); ____pthread_setspecific = (int (*)())get_function( hdl, "bglpth_pthread_setspecific" ); ____pthread_key_create = (int (*)())get_function( hdl, "bglpth_pthread_key_create" ); ____pthread_mutex_init = (int (*)())get_function( hdl, "bglpth_pthread_mutex_init" ); if( ____pthread_key_create( &bmem_key, 0L ) ) { FAIL( IDENT, "Can't get thread key", "bmem_key" ); exit( -2 ); } if( ____pthread_mutex_init( &bmem_mutex, 0L ) ) { FAIL( IDENT, "Can't get thread key", "bmem_key" ); exit( -2 ); } ____bglthread_setup_bmem(); bmem_init(); }
static void bios_init(void) { KDEBUG(("bios_init()\n")); /* initialize Native Features, if available * do it as soon as possible so that kprintf can make use of them */ #if DETECT_NATIVE_FEATURES KDEBUG(("natfeat_init()\n")); natfeat_init(); #endif #if STONX_NATIVE_PRINT KDEBUG(("stonx_kprintf_init()\n")); stonx_kprintf_init(); #endif #if CONF_WITH_UAE KDEBUG(("amiga_uaelib_init()\n")); amiga_uaelib_init(); #endif /* Initialize the processor */ KDEBUG(("processor_init()\n")); processor_init(); /* Set CPU type, longframe and FPU type */ KDEBUG(("vecs_init()\n")); vecs_init(); /* setup all exception vectors (above) */ KDEBUG(("init_delay()\n")); init_delay(); /* set 'reasonable' default values for delay */ /* Detect optional hardware (video, sound, etc.) */ KDEBUG(("machine_detect()\n")); machine_detect(); /* detect hardware */ KDEBUG(("machine_init()\n")); machine_init(); /* initialise machine-specific stuff */ /* Initialize the screen */ KDEBUG(("screen_init()\n")); screen_init(); /* detect monitor type, ... */ /* Initialize the BIOS memory management */ KDEBUG(("bmem_init()\n")); bmem_init(); /* this must be done after screen_init() */ KDEBUG(("cookie_init()\n")); cookie_init(); /* sets a cookie jar */ KDEBUG(("fill_cookie_jar()\n")); fill_cookie_jar(); /* detect hardware features and fill the cookie jar */ /* Set up the BIOS console output */ KDEBUG(("linea_init()\n")); linea_init(); /* initialize screen related line-a variables */ font_init(); /* initialize font ring (requires cookie_akp) */ font_set_default(-1);/* set default font */ vt52_init(); /* initialize the vt52 console */ /* Now kcprintf() will also send debug info to the screen */ KDEBUG(("after vt52_init()\n")); /* misc. variables */ dumpflg = -1; sysbase = (LONG) os_entry; savptr = (LONG) trap_save_area; etv_timer = (void(*)(int)) just_rts; etv_critic = default_etv_critic; etv_term = just_rts; /* setup VBL queue */ nvbls = 8; vblqueue = vbl_list; { int i; for(i = 0 ; i < 8 ; i++) { vbl_list[i] = 0; } } #if CONF_WITH_MFP KDEBUG(("mfp_init()\n")); mfp_init(); #endif #if CONF_WITH_TT_MFP if (has_tt_mfp) { KDEBUG(("tt_mfp_init()\n")); tt_mfp_init(); } #endif /* Initialize the system 200 Hz timer */ KDEBUG(("init_system_timer()\n")); init_system_timer(); /* Initialize the RS-232 port(s) */ KDEBUG(("chardev_init()\n")); chardev_init(); /* Initialize low-memory bios vectors */ boot_status |= CHARDEV_AVAILABLE; /* track progress */ KDEBUG(("init_serport()\n")); init_serport(); boot_status |= RS232_AVAILABLE; /* track progress */ #if CONF_WITH_SCC if (has_scc) boot_status |= SCC_AVAILABLE; /* track progress */ #endif /* The sound init must be done before allowing MFC interrupts, * because of dosound stuff in the timer C interrupt routine. */ #if CONF_WITH_DMASOUND KDEBUG(("dmasound_init()\n")); dmasound_init(); #endif KDEBUG(("snd_init()\n")); snd_init(); /* Reset Soundchip, deselect floppies */ /* Init the two ACIA devices (MIDI and KBD). The three actions below can * be done in any order provided they happen before allowing MFP * interrupts. */ KDEBUG(("kbd_init()\n")); kbd_init(); /* init keyboard, disable mouse and joystick */ KDEBUG(("midi_init()\n")); midi_init(); /* init MIDI acia so that kbd acia irq works */ KDEBUG(("init_acia_vecs()\n")); init_acia_vecs(); /* Init the ACIA interrupt vector and related stuff */ KDEBUG(("after init_acia_vecs()\n")); boot_status |= MIDI_AVAILABLE; /* track progress */ /* Now we can enable the interrupts. * We need a timer for DMA timeouts in floppy and harddisk initialisation. * The VBL processing will be enabled later with the vblsem semaphore. */ #if CONF_WITH_ATARI_VIDEO /* Keep the HBL disabled */ set_sr(0x2300); #else set_sr(0x2000); #endif KDEBUG(("calibrate_delay()\n")); calibrate_delay(); /* determine values for delay() function */ /* - requires interrupts to be enabled */ KDEBUG(("blkdev_init()\n")); blkdev_init(); /* floppy and harddisk initialisation */ KDEBUG(("after blkdev_init()\n")); /* initialize BIOS components */ KDEBUG(("parport_init()\n")); parport_init(); /* parallel port */ //mouse_init(); /* init mouse driver */ KDEBUG(("clock_init()\n")); clock_init(); /* init clock */ KDEBUG(("after clock_init()\n")); #if CONF_WITH_NLS KDEBUG(("nls_init()\n")); nls_init(); /* init native language support */ nls_set_lang(get_lang_name()); #endif /* set start of user interface */ #if WITH_AES exec_os = ui_start; #elif WITH_CLI exec_os = coma_start; #else exec_os = NULL; #endif KDEBUG(("osinit()\n")); osinit(); /* initialize BDOS */ KDEBUG(("after osinit()\n")); boot_status |= DOS_AVAILABLE; /* track progress */ /* Enable VBL processing */ vblsem = 1; #if CONF_WITH_CARTRIDGE { WORD save_hz = v_hz_rez, save_vt = v_vt_rez, save_pl = v_planes; /* Run all boot applications from the application cartridge. * Beware: Hatari features a special cartridge which is used * for GEMDOS drive emulation. It will hack drvbits and hook Pexec(). * It will also hack Line A variables to enable extended VDI video modes. */ KDEBUG(("run_cartridge_applications(3)\n")); run_cartridge_applications(3); /* Type "Execute prior to bootdisk" */ KDEBUG(("after run_cartridge_applications()\n")); if ((v_hz_rez != save_hz) || (v_vt_rez != save_vt) || (v_planes != save_pl)) { set_rez_hacked(); font_set_default(-1); /* set default font */ vt52_init(); /* initialize the vt52 console */ } } #endif #if CONF_WITH_ALT_RAM #if CONF_WITH_FASTRAM /* add TT-RAM that was detected in memory.S */ if (ramtop != NULL) { KDEBUG(("xmaddalt()\n")); xmaddalt(FASTRAM_START, ramtop - FASTRAM_START); } #endif #if CONF_WITH_MONSTER /* Add MonSTer alt-RAM detected in machine.c */ if (has_monster) { /* Dummy read from MonSTer register to initiate write sequence. */ unsigned short monster_reg = *(volatile unsigned short *)MONSTER_REG; /* Only enable 6Mb when on a Mega STE due to address conflict with VME bus. Todo: This should be made configurable. */ if (has_vme) monster_reg = 6; else monster_reg = 8; /* Register write sequence: read - write - write */ *(volatile unsigned short *)MONSTER_REG = monster_reg; *(volatile unsigned short *)MONSTER_REG = monster_reg; KDEBUG(("xmaddalt()\n")); xmaddalt((UBYTE *)0x400000L, monster_reg*0x100000L); } #endif #ifdef MACHINE_AMIGA KDEBUG(("amiga_add_alt_ram()\n")); amiga_add_alt_ram(); #endif #endif /* CONF_WITH_ALT_RAM */ KDEBUG(("bios_init() end\n")); }