2 * Licensed to the .NET Foundation under one or more agreements.
3 * The .NET Foundation licenses this file to you under the MIT license.
4 * See the LICENSE file in the project root for more information.
7 #include "mini-runtime.h"
9 #include <mono/metadata/abi-details.h>
10 #include <mono/utils/mono-sigcontext.h>
20 start
= code
= mono_global_codeman_reserve (0x50);
23 riscv_addi (code
, RISCV_X0
, RISCV_X0
, 0);
25 mono_arch_flush_icache (start
, code
- start
);
31 mono_arch_get_restore_context (MonoTrampInfo
**info
, gboolean aot
)
38 mono_arch_get_call_filter (MonoTrampInfo
**info
, gboolean aot
)
45 mono_arch_get_throw_exception (MonoTrampInfo
**info
, gboolean aot
)
52 mono_arch_get_rethrow_exception (MonoTrampInfo
**info
, gboolean aot
)
59 mono_arch_get_rethrow_preserve_exception (MonoTrampInfo
**info
, gboolean aot
)
66 mono_arch_get_throw_corlib_exception (MonoTrampInfo
**info
, gboolean aot
)
75 mono_arch_get_restore_context (MonoTrampInfo
**info
, gboolean aot
)
77 g_assert_not_reached ();
82 mono_arch_get_call_filter (MonoTrampInfo
**info
, gboolean aot
)
84 g_assert_not_reached ();
89 mono_arch_get_call_filter (MonoTrampInfo
**info
, gboolean aot
)
91 g_assert_not_reached ();
96 mono_arch_get_throw_exception (MonoTrampInfo
**info
, gboolean aot
)
98 g_assert_not_reached ();
103 mono_arch_get_rethrow_exception (MonoTrampInfo
**info
, gboolean aot
)
105 g_assert_not_reached ();
110 mono_arch_get_throw_corlib_exception (MonoTrampInfo
**info
, gboolean aot
)
112 g_assert_not_reached ();
119 mono_arch_exceptions_init (void)
125 mono_arch_unwind_frame (MonoDomain
*domain
, MonoJitTlsData
*jit_tls
, MonoJitInfo
*ji
,
126 MonoContext
*ctx
, MonoContext
*new_ctx
, MonoLMF
**lmf
,
127 host_mgreg_t
**save_locations
, StackFrameInfo
*frame
)
134 handle_signal_exception (gpointer obj
)
136 MonoJitTlsData
*jit_tls
= mono_tls_get_jit_tls ();
137 MonoContext ctx
= jit_tls
->ex_ctx
;
139 mono_handle_exception (&ctx
, obj
);
140 mono_restore_context (&ctx
);
144 mono_arch_handle_exception (void *ctx
, gpointer obj
)
146 MonoJitTlsData
*jit_tls
= mono_tls_get_jit_tls ();
148 mono_sigctx_to_monoctx (ctx
, &jit_tls
->ex_ctx
);
150 // Call handle_signal_exception () on the normal stack.
151 UCONTEXT_GREGS (ctx
) [RISCV_A0
] = (long) obj
;
152 UCONTEXT_REG_PC (ctx
) = (long) handle_signal_exception
;
158 mono_arch_ip_from_context (void *sigctx
)
160 return (gpointer
) UCONTEXT_REG_PC (sigctx
);
164 mono_arch_setup_async_callback (MonoContext
*ctx
, void (*async_cb
)(void *fun
), gpointer user_data
)
166 // Allocate a stack frame and redirect PC.
167 MONO_CONTEXT_SET_SP (ctx
, (host_mgreg_t
) MONO_CONTEXT_GET_SP (ctx
) - 32);
169 mono_arch_setup_resume_sighandler_ctx (ctx
, async_cb
);
173 mono_arch_setup_resume_sighandler_ctx (MonoContext
*ctx
, gpointer func
)
175 MONO_CONTEXT_SET_IP (ctx
, func
);
179 mono_arch_undo_ip_adjustment (MonoContext
*context
)
185 mono_arch_do_ip_adjustment (MonoContext
*context
)
187 g_assert_not_reached ();