/* u2_cm_rind(): open and produce a new jump buffer.
*/
void*
u2_cm_rind()
{
  u2_ray kit_r = u2_rl_ralloc(u2_Wire, c3_wiseof(u2_loom_kite));

  u2_kite_par_r(kit_r) = u2_wire_kit_r(u2_Wire);
  u2_wire_kit_r(u2_Wire) = kit_r;

  //  Save the old stack and actions.
  //
  u2_kite_tax(kit_r) = u2k(u2_wire_tax(u2_Wire));
  u2_kite_don(kit_r) = u2k(u2_wrac_at(u2_Wire, duz.don));

  return u2_at_cord(u2_kite_buf_r(kit_r), c3_wiseof(jmp_buf));
}
Пример #2
0
/* 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;
}