CAMLprim value stub_eventchn_fd(value xce_val)
{
CAMLparam1(xce_val);
- CAMLlocal1(result);
xenevtchn_handle *xce = xce_of_val(xce_val);
int fd;
+ /* Don't drop the GC lock. This is a simple read out of memory */
fd = xenevtchn_fd(xce);
if (fd == -1)
caml_failwith("evtchn fd failed");
- result = Val_int(fd);
-
- CAMLreturn(result);
+ CAMLreturn(Val_int(fd));
}
CAMLprim value stub_eventchn_notify(value xce_val, value port)
value remote_port)
{
CAMLparam3(xce_val, domid, remote_port);
- CAMLlocal1(port);
xenevtchn_handle *xce = xce_of_val(xce_val);
xenevtchn_port_or_error_t rc;
caml_enter_blocking_section();
- rc = xenevtchn_bind_interdomain(xce, Int_val(domid), Int_val(remote_port));
+ rc = xenevtchn_bind_interdomain(xce, Int_val(domid),
+ Int_val(remote_port));
caml_leave_blocking_section();
if (rc == -1)
caml_failwith("evtchn bind_interdomain failed");
- port = Val_int(rc);
- CAMLreturn(port);
+ CAMLreturn(Val_int(rc));
}
-CAMLprim value stub_eventchn_bind_virq(value xce_val, value virq_type)
+CAMLprim value stub_eventchn_bind_virq(value xce_val, value virq)
{
- CAMLparam2(xce_val, virq_type);
- CAMLlocal1(port);
+ CAMLparam2(xce_val, virq);
xenevtchn_handle *xce = xce_of_val(xce_val);
xenevtchn_port_or_error_t rc;
caml_enter_blocking_section();
- rc = xenevtchn_bind_virq(xce, Int_val(virq_type));
+ rc = xenevtchn_bind_virq(xce, Int_val(virq));
caml_leave_blocking_section();
if (rc == -1)
caml_failwith("evtchn bind_virq failed");
- port = Val_int(rc);
- CAMLreturn(port);
+ CAMLreturn(Val_int(rc));
}
CAMLprim value stub_eventchn_unbind(value xce_val, value port)
CAMLprim value stub_eventchn_pending(value xce_val)
{
CAMLparam1(xce_val);
- CAMLlocal1(result);
xenevtchn_handle *xce = xce_of_val(xce_val);
- xenevtchn_port_or_error_t port;
+ xenevtchn_port_or_error_t rc;
caml_enter_blocking_section();
- port = xenevtchn_pending(xce);
+ rc = xenevtchn_pending(xce);
caml_leave_blocking_section();
- if (port == -1)
+ if (rc == -1)
caml_failwith("evtchn pending failed");
- result = Val_int(port);
- CAMLreturn(result);
+ CAMLreturn(Val_int(rc));
}
-CAMLprim value stub_eventchn_unmask(value xce_val, value _port)
+CAMLprim value stub_eventchn_unmask(value xce_val, value port)
{
- CAMLparam2(xce_val, _port);
+ CAMLparam2(xce_val, port);
xenevtchn_handle *xce = xce_of_val(xce_val);
- evtchn_port_t port;
int rc;
- port = Int_val(_port);
-
caml_enter_blocking_section();
- rc = xenevtchn_unmask(xce, port);
+ rc = xenevtchn_unmask(xce, Int_val(port));
caml_leave_blocking_section();
- if (rc)
+ if (rc == -1)
caml_failwith("evtchn unmask failed");
+
CAMLreturn(Val_unit);
}