/* u2_sh_find(): find chip by core. */ u2_weak u2_sh_find(u2_ray wir_r, u2_noun cor) { u2_ray bas_r; if ( 0 == (bas_r = u2_wire_bas_r(wir_r)) ) { return u2_none; } if ( u2_no == u2_dust(cor) ) { return u2_none; } else { u2_noun bat = u2_t(cor); if ( !u2_fly_is_dog(bat) ) { return u2_none; } else { u2_ray bat_r = u2_dog_a(bat); u2_ray rut_r = u2_rail_rut_r(bas_r); u2_ray hat_r = u2_rail_hat_r(bas_r); if ( (bat_r < rut_r) || (bat_r >= hat_r) ) { return u2_none; } else { u2_chip xip = u2_ch_find(u2_bask_hag_r(bas_r), bat); if ( u2_none == xip ) { #if 0 printf("bat_r %d.%x; hat_r %d.%x; rut_r %d.%x\n", u2_ray_a(bat_r), u2_ray_b(bat_r), u2_ray_a(hat_r), u2_ray_b(hat_r), u2_ray_a(rut_r), u2_ray_b(rut_r)); u2_ho_warn_here(); #endif return u2_none; } else { if ( u2_yes == _sh_good(cor, xip) ) { return xip; } else { u2_ho_warn_here(); return u2_none; } } } } } }
/* u2_wr_init(): ** ** Install an empty wire within `hat_r` and `mat_r` in the loom, ** with memory model `hip`. ** ** Returns ray to wire, which always equalls the passed `mat_r`. */ u2_ray u2_wr_init(c3_m hip_m, u2_ray hat_r, u2_ray mat_r) { u2_ray wir_r; wir_r = u2_rl_init(hip_m, hat_r, mat_r); u2_rail_hat_r(wir_r) += (c3_wiseof(u2_loom_wire) - c3_wiseof(u2_loom_rail)); #if 1 u2_wire_bas_r(wir_r) = 0; #endif u2_wire_kit_r(wir_r) = 0; u2_cs_init(u2_wire_des_r(wir_r)); /* Trace stack, garbage. */ { u2_wire_tax(wir_r) = u2_nul; u2_wire_lan(wir_r) = u2_yes; } /* Permanent basket = 1/16 of address space. */ { u2_ray bas_r; bas_r = u2_rl_leap_part(wir_r, c3__sand, 1, 16, 0); u2_wire_bas_r(wir_r) = bas_r; #if 0 fprintf(stderr, "bas_r %d, hat %d, mat %d, cap %d, rut %d\n", bas_r >> LoomPageWords, u2_rail_hat_r(bas_r) >> LoomPageWords, u2_rail_mat_r(bas_r) >> LoomPageWords, u2_rail_cap_r(bas_r) >> LoomPageWords, u2_rail_rut_r(bas_r) >> LoomPageWords); fprintf(stderr, "wir_r %d, hat %d, mat %d, cap %d, rut %d\n", wir_r >> LoomPageWords, u2_rail_hat_r(wir_r) >> LoomPageWords, u2_rail_mat_r(wir_r) >> LoomPageWords, u2_rail_cap_r(wir_r) >> LoomPageWords, u2_rail_rut_r(wir_r) >> LoomPageWords); #endif // u2_ba_init(wir_r, 0); } #if 1 /* Host control. */ { u2_ho_push(); } #endif /* Basic performance tracking. */ { u2_wire_bex_r(wir_r) = u2_rl_ralloc(wir_r, c3_wiseof(u2_loom_benx)); u2_bx_boot(wir_r); } /* New performance tracking. */ { u2_wire_rac_r(wir_r) = u2_tx_init(wir_r); } /* Global namespace. */ { u2_wire_hev_r(wir_r) = u2_hv_init(wir_r); } /* OS kernel. */ { u2_wire_arv_r(wir_r) = u2_rl_ralloc(wir_r, c3_wiseof(u2_reck)); } return wir_r; }