FEX-Emu / FEX-Emu/FEX

Deferred signals investigation

Open
#1,666 5 comments 0 reactions 1 assignee Assigned to @skmp View on GitHub
Dominant language
C++
Stars
8k
Forks
351
Avg merge
12h 31m
Merged PRs (30d)
102

Description

## Overview
This has interesting complications and can resolve unity problems.

## Current high level idea

Add a new config option or two that enables "deferred/safe signal handling"
- Introduce the concept of "exit points" in the JIT, places where we can handle state
- Sprinkle "exit points" around in blocks in such a way that there is a bounded time between them
- Modify signal setters to block all signals on signals entry
- Modify signal handlers to resume JIT execution up to the next "exit point", and then handle the signal
- Edge cases: signals on syscalls, signals in non-jit code
- Add a signal torture test or two to our tests

## Other related ideas
- Add signal safe mode for all locks

## Curent low level ideas for first implementation
- use `ldb/stb [ctx-1], #0` + a guard page before the context for low cost handling of "should we exit from exit point" checks

(Description updated by @skmp)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.