- memcpy(__current->fxstate, sig_ctx->prev_context.fxstate, 512);
- __current->intr_ctx = sig_ctx->prev_context.proc_regs;
- __current->flags &= ~PROC_FINPAUSE;
- __SIGCLEAR(__current->sig_inprogress, sig_ctx->sig_num);
- schedule();
+ struct sigctx* old_ctx = ¤t_thread->sigctx;
+ memcpy(dest_ctx, old_ctx, sizeof(struct sigctx));
+}
+
+void
+signal_dup_registry(struct sigregistry* dest_reg)
+{
+ struct sigregistry* oldreg = __current->sigreg;
+ for (int i = 0; i < _SIG_NUM; i++) {
+ struct sigact* oldact = oldreg->signals[i];
+ if (!oldact) {
+ continue;
+ }
+
+ struct sigact* newact = valloc(sizeof(struct sigact));
+ memcpy(newact, oldact, sizeof(struct sigact));
+
+ dest_reg->signals[i] = newact;
+ }
+}
+
+void
+signal_reset_context(struct sigctx* sigctx) {
+ memset(sigctx, 0, sizeof(struct sigctx));
+}
+
+void
+signal_reset_registry(struct sigregistry* sigreg) {
+ for (int i = 0; i < _SIG_NUM; i++) {
+ struct sigact* act = sigreg->signals[i];
+ if (act) {
+ vfree(act);
+ sigreg->signals[i] = NULL;
+ }
+ }
+}
+
+void
+signal_free_registry(struct sigregistry* sigreg) {
+ signal_reset_registry(sigreg);
+ vfree(sigreg);