[Mono-list] Exception handling in Mono

Victor victorx@asu.edu
Wed, 19 Feb 2003 17:25:11 -0700


This is a multi-part message in MIME format.

--Boundary_(ID_5D0vyE8RTsuOAPahQnVf7w)
Content-type: text/plain;	charset="gb2312"
Content-transfer-encoding: quoted-printable

Hi, all

I'm working on a project related to Mono. In this project, I want to =
translate a external event (such as timer expires in OS) to an exception =
of Mono's managed code:

Timer expires-> ISR -> some function in Mono runtime -> exception thrown =
to=20

I found some functions in /mono-0.19/mono/jit/exception.c and =
/mono-0.19/mono/jit/codegen-x86.c. I'm wondering if I can call =
mono_burg_emit_14() to throw the exception. But I don't know what the =
parameters s->code and thre->left->reg1 mean.

static void /* stmt: THROW(reg) */
mono_burg_emit_14 (MBTREE_TYPE *tree, MBCGEN_TYPE *s)
{

    gpointer target;

    x86_push_reg (s->code, tree->left->reg1);
    target =3D arch_get_throw_exception ();
    mono_add_jump_info (s, s->code, MONO_JUMP_INFO_ABS, target);
    x86_call_code (s->code, target);
   =20
}


Could anybody give me some advice or recommend some materials for me?

Thanks a lot!

Victor=

--Boundary_(ID_5D0vyE8RTsuOAPahQnVf7w)
Content-type: text/html;	charset="gb2312"
Content-transfer-encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>Hi, all</FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>I'm working on a project =
related to=20
Mono.&nbsp;In this project, I want to translate a external event (such =
as timer=20
expires in OS) to an exception of Mono's managed code:</FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>Timer expires-&gt; ISR -&gt; =
some=20
function in Mono runtime -&gt; exception thrown to </FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>I&nbsp;found some functions =
in <FONT=20
face=3D"Times New Roman">/mono-0.19/mono/jit/exception.c </FONT><FONT=20
face=3D"Comic Sans MS">and&nbsp;<FONT=20
face=3D"Times New Roman">/mono-0.19/mono/jit/codegen-x86.c.</FONT> I'm =
wondering=20
if I can call </FONT><FONT face=3D"Courier New">mono_burg_emit_14() =
</FONT><FONT=20
face=3D"Comic Sans MS">to throw the exception. But I don't =
know&nbsp;what the=20
parameters s-&gt;code and thre-&gt;left-&gt;reg1 =
mean.</FONT></FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>static void /* stmt: THROW(reg) =

*/<BR>mono_burg_emit_14 (MBTREE_TYPE *tree, MBCGEN_TYPE =
*s)<BR>{</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>&nbsp;&nbsp;&nbsp; gpointer=20
target;</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>&nbsp;&nbsp;&nbsp; x86_push_reg =

(s-&gt;code, tree-&gt;left-&gt;reg1);<BR>&nbsp;&nbsp;&nbsp; target =3D=20
arch_get_throw_exception ();<BR>&nbsp;&nbsp;&nbsp; mono_add_jump_info =
(s,=20
s-&gt;code, MONO_JUMP_INFO_ABS, target);<BR>&nbsp;&nbsp;&nbsp; =
x86_call_code=20
(s-&gt;code, target);<BR>&nbsp;&nbsp;&nbsp; <BR>}<BR></FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>Could anybody give me some =
advice or=20
recommend some materials for me?</FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>Thanks a lot!</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS" =
size=3D2>Victor</FONT></DIV></BODY></HTML>

--Boundary_(ID_5D0vyE8RTsuOAPahQnVf7w)--