int main(int argc, char **argv) { //this is the bootstrap copy of the domain if (strcmp(argv[argc - 1], "SpAwNeD") != 0) { bsp_datagatherer = true; } else { bsp_datagatherer = false; } core_id = disp_get_core_id(); skb_client_connect(); #ifdef SPAWN_YOUR_SELF if (bsp_datagatherer) { spawnmyself(); } #endif //gather different types of data //run cpuid gather_cpuid_data(core_id); //get the number of running cores and their APIC IDs from the monitor if (bsp_datagatherer) { gather_nr_running_cores(get_monitor_binding()); } else { nr_cores_done = true; } //adding the numer of cores is the last operation performed by the datagatherer. //therefore the domain can exit after this. process events as long as the number //of cores has not yet been added to the SKB. struct waitset *ws = get_default_waitset(); while (!nr_cores_done) { errval_t err = event_dispatch(ws); if (err_is_fail(err)) { DEBUG_ERR(err, "in event_dispatch"); break; } } skb_add_fact("datagatherer_done."); if (bsp_datagatherer) { int length = nr_of_running_cores + 1; while (length != nr_of_running_cores) { skb_execute_query("findall(X, datagatherer_done, L),length(L,Len),write(Len)."); skb_read_output("%d", &length); thread_yield(); } errval_t err = nameservice_register("datagatherer_done", 0); if (err_is_fail(err)) { DEBUG_ERR(err, "nameservice_register failed"); } } return 0; }
static int skb(int argc, char *argv[]) { static bool init = false; if(argc < 2) { printf("Usage: %s <program>\n", argv[0]); return 1; } if(!init) { skb_client_connect(); init = true; } char *result = NULL, *str_err = NULL; int32_t int_err; skb_evaluate(argv[1], &result, &str_err, &int_err); if (int_err != 0 || (str_err != NULL && str_err[0] != '\0')) { printf("SKB error returned: %"PRIu32" %s\n", int_err, str_err); } else { printf("SKB returned: %s\n", result); } free(result); free(str_err); return 0; }
int main(int argc, char **argv) { coreid_t *cores; int core_count; int c_idx; uint8_t memory; int payloadsz = 64; int nocache = 0; int read_incoming = 0; int head_idx_wb = 1; errval_t err; sleep_init(); // Connect to SKB to get info err = skb_client_connect(); assert(err_is_ok(err)); // Get information about available cores get_cores_skb(&cores, &core_count); printf("Net latency benchmark start\n"); printf("%%\"core\",\"memory\",\"payload\",\"nocache\",\"touch\",\"hiwb\"," "\"rtt\",\"time\"\n"); for (c_idx = 0; c_idx < core_count; c_idx++) { for (memory = 0; memory < 16; memory += 4) { for (payloadsz = 64; payloadsz < 1500; payloadsz *= 4) { for (nocache = 0; nocache <= 1; nocache++) { for (read_incoming = 0; read_incoming <= 1; read_incoming++) { for (head_idx_wb = 0; head_idx_wb <= 1; head_idx_wb++) { start_run(cores[c_idx], memory, payloadsz, nocache, read_incoming, head_idx_wb); } } } } } } printf("Net latency benchmark done\n"); return 0; }
int main(int argc, char** argv) { vfs_init(); init_environ(); errval_t err; my_core_id = disp_get_core_id(); parse_arguments(argc, argv); err = oct_init(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Initialize octopus service."); } KALUGA_DEBUG("Kaluga: parse boot modules...\n"); err = init_boot_modules(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Parse boot modules."); } add_start_function_overrides(); #ifdef __x86__ // We need to run on core 0 // (we are responsible for booting all the other cores) assert(my_core_id == BSP_CORE_ID); KALUGA_DEBUG("Kaluga running on x86.\n"); err = skb_client_connect(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Connect to SKB."); } // Make sure the driver db is loaded err = skb_execute("[device_db]."); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Device DB not loaded."); } // The current boot protocol needs us to have // knowledge about how many CPUs are available at boot // time in order to start-up properly. char* record = NULL; err = oct_barrier_enter("barrier.acpi", &record, 2); KALUGA_DEBUG("Kaluga: watch_for_cores\n"); err = watch_for_cores(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Watching cores."); } KALUGA_DEBUG("Kaluga: pci_root_bridge\n"); err = watch_for_pci_root_bridge(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Watching PCI root bridges."); } KALUGA_DEBUG("Kaluga: pci_devices\n"); err = watch_for_pci_devices(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Watching PCI devices."); } KALUGA_DEBUG("Kaluga: wait_for_all_spawnds\n"); err = wait_for_all_spawnds(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Unable to wait for spawnds failed."); } #elif __pandaboard__ debug_printf("Kaluga running on Pandaboard.\n"); err = init_cap_manager(); assert(err_is_ok(err)); err = oct_set("all_spawnds_up { iref: 0 }"); assert(err_is_ok(err)); struct module_info* mi = find_module("fdif"); if (mi != NULL) { err = mi->start_function(0, mi, "hw.arm.omap44xx.fdif {}"); assert(err_is_ok(err)); } mi = find_module("mmchs"); if (mi != NULL) { err = mi->start_function(0, mi, "hw.arm.omap44xx.mmchs {}"); assert(err_is_ok(err)); } mi = find_module("mmchs2"); if (mi != NULL) { err = mi->start_function(0, mi, "hw.arm.omap44xx.mmchs {}"); assert(err_is_ok(err)); } mi = find_module("prcm"); if (mi != NULL) { err = mi->start_function(0, mi, "hw.arm.omap44xx.prcm {}"); assert(err_is_ok(err)); } mi = find_module("serial"); if (mi != NULL) { err = mi->start_function(0, mi, "hw.arm.omap44xx.uart {}"); assert(err_is_ok(err)); } mi = find_module("sdma"); if (mi != NULL) { err = mi->start_function(0, mi, "hw.arm.omap44xx.sdma {}"); assert(err_is_ok(err)); } mi = find_module("usb_manager"); if (mi != NULL) { #define USB_ARM_EHCI_IRQ 109 char *buf = malloc(255); uint8_t offset = 0; mi->cmdargs = buf; mi->argc = 3; mi->argv[0] = mi->cmdargs + 0; snprintf(buf + offset, 255 - offset, "ehci\0"); offset += strlen(mi->argv[0]) + 1; mi->argv[1] = mi->cmdargs + offset; snprintf(buf + offset, 255 - offset, "%u\0", 0xC00); offset += strlen(mi->argv[1]) + 1; mi->argv[2] = mi->cmdargs + offset; snprintf(buf+offset, 255-offset, "%u\0", USB_ARM_EHCI_IRQ); // XXX Use customized start function or add to module info err = mi->start_function(0, mi, "hw.arm.omap44xx.usb {}"); assert(err_is_ok(err)); } #elif __gem5__ printf("Kaluga running on GEM5 armv8.\n"); err = init_cap_manager(); assert(err_is_ok(err)); err = oct_set("all_spawnds_up { iref: 0 }"); assert(err_is_ok(err)); struct module_info* mi = find_module("serial"); if (mi != NULL) { err = mi->start_function(0, mi, "hw.arm.gem5.uart {}"); assert(err_is_ok(err)); } #endif THCFinish(); return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { errval_t err; // Parse CMD Arguments bool got_apic_id = false; bool do_video_init = false; vtd_force_off = false; for (int i = 1; i < argc; i++) { if(sscanf(argv[i], "apicid=%" PRIuPTR, &my_apic_id) == 1) { got_apic_id = true; } if (strcmp(argv[i], "video_init") == 0) { do_video_init = true; } else if (strncmp(argv[i], "vtd_force_off", strlen("vtd_force_off")) == 0) { vtd_force_off = true; } } if(got_apic_id == false) { fprintf(stderr, "Usage: %s APIC_ID\n", argv[0]); fprintf(stderr, "Wrong monitor version?\n"); return EXIT_FAILURE; } err = oct_init(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Initialize dist"); } //connect to the SKB ACPI_DEBUG("acpi: connecting to the SKB...\n"); skb_client_connect(); skb_execute("[pci_queries]."); err = setup_skb_info(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Populating SKB failed."); } err = init_allocators(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Init memory allocator"); } err = copy_bios_mem(); if (err_is_fail(err)) { USER_PANIC_ERR(err, "Copy BIOS Memory"); } int r = init_acpi(); assert(r == 0); buttons_init(); if (do_video_init) { video_init(); } start_service(); messages_handler_loop(); }