Exemplo n.º 1
0
CAMLprim value stub_xenctrlext_get_boot_cpufeatures(value xch)
{
	CAMLparam1(xch);
#if defined(XENCTRL_HAS_GET_CPUFEATURES)
	CAMLlocal1(v);
	uint32_t a, b, c, d, e, f, g, h;
	int ret;

	ret = xc_get_boot_cpufeatures(_H(xch), &a, &b, &c, &d, &e, &f, &g, &h);
	if (ret < 0)
	  failwith_xc(_H(xch));

	v = caml_alloc_tuple(8);
	Store_field(v, 0, caml_copy_int32(a));
	Store_field(v, 1, caml_copy_int32(b));
	Store_field(v, 2, caml_copy_int32(c));
	Store_field(v, 3, caml_copy_int32(d));
	Store_field(v, 4, caml_copy_int32(e));
	Store_field(v, 5, caml_copy_int32(f));
	Store_field(v, 6, caml_copy_int32(g));
	Store_field(v, 7, caml_copy_int32(h));

	CAMLreturn(v);
#else
	caml_failwith("XENCTRL_HAS_GET_CPUFEATURES not defined");
#endif
}
Exemplo n.º 2
0
CAMLprim value stub_xenctrlext_get_runstate_info(value xch, value domid)
{
	CAMLparam2(xch, domid);
#if defined(XENCTRL_HAS_GET_RUNSTATE_INFO)
	CAMLlocal1(result);
	xc_runstate_info_t info;
	int retval;

	retval = xc_get_runstate_info(_H(xch), _D(domid), &info);
	if (retval < 0)
		failwith_xc(_H(xch));

	/* Store
	   0 : state (int32)
	   1 : missed_changes (int32)
	   2 : state_entry_time (int64)
	   3-8 : times (int64s)
	*/
	result = caml_alloc_tuple(9);
	Store_field(result, 0, caml_copy_int32(info.state));
	Store_field(result, 1, caml_copy_int32(info.missed_changes));
	Store_field(result, 2, caml_copy_int64(info.state_entry_time));
	Store_field(result, 3, caml_copy_int64(info.time[0]));
	Store_field(result, 4, caml_copy_int64(info.time[1]));
	Store_field(result, 5, caml_copy_int64(info.time[2]));
	Store_field(result, 6, caml_copy_int64(info.time[3]));
	Store_field(result, 7, caml_copy_int64(info.time[4]));
	Store_field(result, 8, caml_copy_int64(info.time[5]));

	CAMLreturn(result);
#else
	caml_failwith("XENCTRL_HAS_GET_RUNSTATE_INFO not defined");
#endif
}
Exemplo n.º 3
0
/*****************************************************************************
 * FUNCTION
 *  HDIa_widgetRelease
 * DESCRIPTION
 *  
 * PARAMETERS
 *  handle      [IN]        
 * RETURNS
 *  
 *****************************************************************************/
int HDIa_widgetRelease(MSF_UINT32 handle)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    widget_header_struct *node;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (!handle)
    {
        return 0;
    }
    if (IS_FLAG_STATIC(handle))
    {
        return 0;
    }

    if (IS_ACCESSKEY_TYPE(handle))
    {
        WAP_DBG_ASSERT(0);
        return 0;
    }

    /*
     * Prevent HDIa_widgetRelease the same widgets for more than one time
     * (Teleca code might HDIa_widgetRelease the same widget twice.)
     *
     * Note: this only reduce the chance of memory corruption, but not eliminate it.
     * It is possible to allocate another widget at the same memory address, which is HDIa_widgetRelease()-ed
     * for the previous widget.
     *
     */
    if (_H(handle)->data_type == WIDGET_MAX_TYPE)
    {
        WAP_DBG_ASSERT(0);
        return 1;
    }

    /* a screen and window only have one parent */
    if (IS_SCREEN_TYPE(handle) || IS_WINDOW_TYPE(handle))
    {
        NO_REF(handle);
    }
    DEC_REF(handle);
    if (HAS_REF(handle))
    {
        return 1;
    }

    widget_pause_paint();

    // TODO: should we do this in widget_free?
    foreach_childs(handle, node,
                   {
                   if (!IS_FLAG_STATIC(node)) widget_remove_childs(_H(handle), node);}
    );
Exemplo n.º 4
0
CAMLprim value stub_xenctrlext_domain_set_timer_mode(value xch, value id, value mode)
{
	CAMLparam3(xch, id, mode);
	int ret;

	ret = xcext_domain_set_timer_mode(_H(xch), _D(id), Int_val(mode));
	if (ret < 0)
		failwith_xc(_H(xch));
	CAMLreturn(Val_unit);
}
Exemplo n.º 5
0
CAMLprim value stub_xc_domain_dumpcore(value handle, value domid, value file)
{
    CAMLparam3(handle, domid, file);
    int r;

    r = xc_domain_dumpcore(_H(handle), _D(domid), String_val(file));
    if (r)
        failwith_oss_xc(_H(handle), "xc_domain_dumpcore");
    CAMLreturn(Val_unit);
}
Exemplo n.º 6
0
CAMLprim value stub_xenctrlext_domain_suppress_spurious_page_faults(value xch,
                                                           value domid)
{
	CAMLparam2(xch, domid);

	int retval = xc_domain_suppress_spurious_page_faults(_H(xch), _D(domid));
	if (retval)
		failwith_xc(_H(xch));
	CAMLreturn(Val_unit);
}
Exemplo n.º 7
0
CAMLprim value stub_xenctrlext_domain_set_target(value xch,
					 value domid,
					 value target)
{
	CAMLparam3(xch, domid, target);

	int retval = xc_domain_set_target(_H(xch), _D(domid), _D(target));
	if (retval)
		failwith_xc(_H(xch));
	CAMLreturn(Val_unit);
}
Exemplo n.º 8
0
/* this is the slow version of resume for uncooperative domain,
 * the fast version is available in close source xc */
CAMLprim value stub_xc_domain_resume_slow(value handle, value domid)
{
    CAMLparam2(handle, domid);
    int r;

    /* hard code fast to 0, we only want to expose the slow version here */
    r = xc_domain_resume(_H(handle), _D(domid), 0);
    if (r)
        failwith_oss_xc(_H(handle), "xc_domain_resume");
    CAMLreturn(Val_unit);
}
Exemplo n.º 9
0
CAMLprim value stub_xenctrlext_domain_get_acpi_s_state(value xch, value domid)
{
	CAMLparam2(xch, domid);
	unsigned long v;
	int ret;

	ret = xc_get_hvm_param(_H(xch), _D(domid), HVM_PARAM_ACPI_S_STATE, &v);
	if (ret != 0)
		failwith_xc(_H(xch));

	CAMLreturn(Val_int(v));
}
Exemplo n.º 10
0
CAMLprim value stub_xenctrlext_get_max_nr_cpus(value xch)
{
	CAMLparam1(xch);
	xc_physinfo_t c_physinfo;
	int r;

	caml_enter_blocking_section();
	r = xc_physinfo(_H(xch), &c_physinfo);
	caml_leave_blocking_section();

	if (r)
		failwith_xc(_H(xch));

	CAMLreturn(Val_int(c_physinfo.max_cpu_id + 1));
}
Exemplo n.º 11
0
linAccModel::linAccModel() {
    valid = true;
    type = "constAcceleration";

    printf("linAccModel::init:start \n");
    rowA = 2;
    colA = 2;
    Matrix _A(2,2);
    Matrix _B(2,1);
    Matrix _H(2,2);
    A = _A;
    B = _B;
    H = _H;
    A.zero();
    B.zero();
    H.zero();    
    
    //discratisation with sampling rate 0.01
    A(0,0) = 1; A(0,1) = 0.01;
    A(1,1) = 1;
    B(0,1) = 5e-05;
    B(1,0) = 0.01;
    H(1,1) = 1;
    
    printf("linAccModel::init:stop \n");

}
Exemplo n.º 12
0
/*****************************************************************************
 * FUNCTION
 *  widget_paint_editor
 * DESCRIPTION
 *  
 * PARAMETERS
 *  editor      [?]     
 *  size        [?]     
 *  pos         [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void widget_paint_editor(widget_editor_struct *editor, MsfSize *size, MsfPosition *pos)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (WEDITOR_CTX->current_state == FULLSCREEN_EDITOR_WANT_EXECUTE)
    {
        void *buffer;

    #ifdef __MMI_WCSS_INPUT_FORMAT_SUPPORT__
        widget_init_input_CSS_pattern((const char *)L"*m");
    #endif 

        buffer = widget_string_content(editor->text);
        widget_setup_fullscreen_editor(
            _H(editor),
            buffer,
            editor->input_max_size + 1,
            editor->text_type,
            0,
            editor->title,
            (const char *)L"*m");
        widget_enter_fullscreen_editor();
    }
}
Exemplo n.º 13
0
/*****************************************************************************
 * FUNCTION
 *  HDIa_widgetHasFocus
 * DESCRIPTION
 *  
 * PARAMETERS
 *  handle      [IN]        
 * RETURNS
 *  
 *****************************************************************************/
int HDIa_widgetHasFocus(MSF_UINT32 handle)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    widget_header_struct *node;
    widget_header_struct *w = _H(handle);
    widget_header_struct *p;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    while (w && w->parent)
    {
        p = w->parent;
        widget_get_active_childs(node, p);
        if (node != w)
        {
            return 0;
        }
        if (IS_SCREEN_TYPE(node))
        {
            return 1;
        }

        w = p;
    }
    return 0;
}
Exemplo n.º 14
0
CAMLprim value stub_xc_hvm_build_native(value xc_handle, value domid,
                                        value mem_max_mib, value mem_start_mib, value image_name, value store_evtchn, value console_evtchn)
{
    CAMLparam5(xc_handle, domid, mem_max_mib, mem_start_mib, image_name);
    CAMLxparam2(store_evtchn, console_evtchn);
    CAMLlocal1(result);

    char *image_name_c = strdup(String_val(image_name));
    char *error[256];
    xc_interface *xch;

    unsigned long store_mfn=0;
    unsigned long console_mfn=0;
    int r;
    struct flags f;
    /* The xenguest interface changed and was backported to XCP: */
#if defined(XENGUEST_HAS_HVM_BUILD_ARGS) || (__XEN_LATEST_INTERFACE_VERSION__ >= 0x00040200)
    struct xc_hvm_build_args args;
#endif
    get_flags(&f, _D(domid));

    xch = _H(xc_handle);
    configure_vcpus(xch, _D(domid), f);
    configure_tsc(xch, _D(domid), f);

#if defined(XENGUEST_HAS_HVM_BUILD_ARGS) || (__XEN_LATEST_INTERFACE_VERSION__ >= 0x00040200)
    args.mem_size = (uint64_t)Int_val(mem_max_mib) << 20;
    args.mem_target = (uint64_t)Int_val(mem_start_mib) << 20;
    args.mmio_size = f.mmio_size_mib << 20;
    args.image_file_name = image_name_c;
#endif

    caml_enter_blocking_section ();
#if defined(XENGUEST_HAS_HVM_BUILD_ARGS) || (__XEN_LATEST_INTERFACE_VERSION__ >= 0x00040200)
    r = xc_hvm_build(xch, _D(domid), &args);
#else
    r = xc_hvm_build_target_mem(xch, _D(domid),
                                Int_val(mem_max_mib),
                                Int_val(mem_start_mib),
                                image_name_c);
#endif
    caml_leave_blocking_section ();

    free(image_name_c);

    if (r)
        failwith_oss_xc(xch, "hvm_build");


    r = hvm_build_set_params(xch, _D(domid), Int_val(store_evtchn), &store_mfn,
                             Int_val(console_evtchn), &console_mfn, f);
    if (r)
        failwith_oss_xc(xch, "hvm_build_params");

    result = caml_alloc_tuple(2);
    Store_field(result, 0, caml_copy_nativeint(store_mfn));
    Store_field(result, 1, caml_copy_nativeint(console_mfn));

    CAMLreturn(result);
}
CAMLprim value stub_eventchn_notify(value xce, value port)
{
  if(xc_evtchn_notify(_H(xce), Int_val(port)) == -1)
    caml_failwith("evtchn notify failed");

  return Val_unit;
}
Exemplo n.º 16
0
static void
msf_sas_progressbar_cancel_hdlr(ctk_screen_handle scrid)
{
    MsfWindowHandle window = HDIa_widgetCtkGetWindow(scrid);

    HDIc_widgetAction(_H(window)->module_id, window, 0);
    widget_send_update_event_to_wap();
}
Exemplo n.º 17
0
/*****************************************************************************
 * FUNCTION
 *  widget_is_window_gadget_displayed
 * DESCRIPTION
 *  
 * PARAMETERS
 *  msfHandle       [IN]        
 * RETURNS
 *  
 *****************************************************************************/
kal_bool widget_is_window_gadget_displayed(MSF_UINT32 msfHandle)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    widget_header_struct *h;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (msfHandle == 0)
    {
        WAP_DBG_ASSERT(0);
        return KAL_FALSE;
    }

    if (IS_GADGET_TYPE(msfHandle))
    {
        h = _H(msfHandle)->parent;
    }
    else if (IS_WINDOW_TYPE(msfHandle))
    {
        h = _H(msfHandle);
    }
    else
    {
        WAP_DBG_ASSERT(0);
        return KAL_FALSE;
    }

    if (h == NULL)
    {
        return KAL_FALSE;
    }

    if (h == (widget_header_struct*) WGUI_CTX->current_window)
    {
        return KAL_TRUE;
    }
    else
    {
        return KAL_FALSE;
    }
}
Exemplo n.º 18
0
void minJerkModel::init(double _paramA, double _paramB) {
    paramA = _paramA;
    paramB = _paramB;

    T = _paramB;
    u = _paramA;

    double T2 = T * T;
    double T3 = T2 * T;

    a = -150.765868956161/T3;
    b = -84.9812819469538/T2;
    c = -15.9669610709384/T;
    
    rowA = 3;
    colA = 3;
    Matrix _A(3,3);
    Matrix _B(3,1);
    Matrix _H(3,3);
    A = _A;
    B = _B;
    H = _H;
    A.zero();
    B.zero();
    H.zero();
    
    //discretisation with sampling rate 0.01;
    if(T==1) {          
        A(0,0) = 1.0000000; A(0,1) = 0.009986; A(0,2) = 4.741e-05;
        A(1,0) = -0.007148; A(1,1) = 0.995900; A(1,2) = 0.0092290;                 
        A(2,0) = -1.391000; A(2,1) = -0.79150; A(2,2) = 0.8486000;
        B(0,0) = 2.415e-05;
        B(1,0) = 0.0071480;
        B(2,0) = 1.391;     
        
    }
    else if (T== 2){          
        A(0,0) = 1.000000000; A(0,1) = 0.009997; A(0,2) =  4.869e-05;
        A(1,0) =  -0.0009175; A(1,1) = 0.999000; A(1,2) =   0.009608;
        A(2,0) = -0.18110000; A(2,1) = -0.20500; A(2,2) =     0.9223;       
        B(0,0) = 3.079e-06;
        B(1,0) = 0.0009175;
        B(2,0) = 0.1811;
       
    }
    else {
        // unknown T
        // A is 0
        // B is 0
    }
    
    H(0,0) = 1;
    H(1,1) = 1;
    H(2,2) = 1;

}
CAMLprim value stub_eventchn_unmask(value xce, value _port)
{
	CAMLparam2(xce, _port);
	evtchn_port_t port;

	port = Int_val(_port);
	if (xc_evtchn_unmask(_H(xce), port))
		caml_failwith("evtchn unmask failed");
	CAMLreturn(Val_unit);
}
CAMLprim value stub_eventchn_bind_dom_exc_virq(value xce)
{
  evtchn_port_or_error_t rc;

  rc = xc_evtchn_bind_virq(_H(xce), VIRQ_DOM_EXC);
  if (rc == -1)
    caml_failwith("evtchn bind_dom_exc_virq failed");

  return Val_int(rc);
}
CAMLprim value stub_eventchn_fd(value xce)
{
  int fd;

  fd = xc_evtchn_fd(_H(xce));
  if (fd == -1)
    caml_failwith("evtchn fd failed");

  return Val_int(fd);
}
CAMLprim value stub_eventchn_pending(value xce)
{
  evtchn_port_or_error_t port;

  port = xc_evtchn_pending(_H(xce));
  if (port == -1)
    caml_failwith("evtchn pending failed");

  return Val_int(port);
}
CAMLprim value stub_eventchn_bind_unbound_port(value xce, value remote_domid)
{
  evtchn_port_or_error_t rc;

  rc = xc_evtchn_bind_unbound_port(_H(xce), Int_val(remote_domid));
  if (rc == -1)
    caml_failwith("evtchn bind_unbound_port failed");

  return Val_int(rc);

}
CAMLprim value stub_eventchn_bind_interdomain(value xce, value domid,
                                              value remote_port)
{
  evtchn_port_or_error_t rc;

  rc = xc_evtchn_bind_interdomain(_H(xce), Int_val(domid), Int_val(remote_port));
  if (rc == -1)
    caml_failwith("evtchn bind_interdomain failed");

  return Val_int(rc);
}
CAMLprim value stub_eventchn_notify(value xce, value port)
{
  CAMLparam2(xce, port);
  if(xc_evtchn_notify(_H(xce), Int_val(port)) == -1)
    {
      perror("xc_evtchn_notify");
      caml_failwith(strerror(errno));
    }

  CAMLreturn(Val_unit);
}
CAMLprim value stub_eventchn_notify(value xce, value port)
{
	CAMLparam2(xce, port);
	int rc;

	rc = xc_evtchn_notify(_H(xce), Int_val(port));
	if (rc == -1)
		caml_failwith("evtchn notify failed");

	CAMLreturn(Val_unit);
}
CAMLprim value stub_eventchn_pending(value xce)
{
	CAMLparam1(xce);
	CAMLlocal1(result);
	evtchn_port_or_error_t port;

	port = xc_evtchn_pending(_H(xce));
	if (port == -1)
		caml_failwith("evtchn pending failed");
	result = Val_int(port);

	CAMLreturn(result);
}
Exemplo n.º 28
0
void genPredModel::init(double paramA, double paramB) {
    rowA = 3;
    colA = 3;
    Matrix _A(3,3);
    Matrix _B(3,3);
    Matrix _H(3,3);
    A = _A;
    B = _B;   
    H = _H;
    A.zero();
    B.zero();
    H.zero();
}
CAMLprim value stub_eventchn_bind_dom_exc_virq(value xce)
{
	CAMLparam1(xce);
	CAMLlocal1(port);
	evtchn_port_or_error_t rc;

	rc = xc_evtchn_bind_virq(_H(xce), VIRQ_DOM_EXC);
	if (rc == -1)
		caml_failwith("evtchn bind_dom_exc_virq failed");
	port = Val_int(rc);

	CAMLreturn(port);
}
CAMLprim value stub_eventchn_fd(value xce)
{
  CAMLparam1(xce);
  int fd;

  fd = xc_evtchn_fd(_H(xce));
  if (fd == -1)
    {
      perror("xc_evtchn_fd");
      caml_failwith(strerror(errno));
    }
  CAMLreturn(Val_int(fd));
}