Skip to content

Sync with upstream box64 - #1

Open
github-actions[bot] wants to merge 156 commits into
mainfrom
upstream-main
Open

github-actions[bot] wants to merge 156 commits into
mainfrom
upstream-main

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

upstream-main has 156 commits that are not in main.

Newest upstream commit: 25d0e4c [WRAPPER] Fixed my_execve path check for wrapped libc allocations (#4687)

Merge this PR with a merge commit (not squash or rebase) so that main keeps the upstream history.

ksco and others added 30 commits October 7, 2026 09:47
* [LA64_DYNAREC] Refined vector registers restore

* [LA64_DYNAREC] Fixed x87 stack count not synced when leaving a block
…F 13 (#4537)

Also change loogarch movhps 0f 17 opcode.
…count 0 (#4541)

The flags are not generated when the count is 0 (they are left untouched), so
native flags cannot be forwarded from those instructions.
…#4538)

* [DYNAREC] Fixed x87 cache transform not syncing pending stack count

* [DYNAREC] Fixed x87 cache transform applying pending stack count twice
For openssl 1.0.2,
```
PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, STACK_OF(X509) *ca,
                      int nid_key, int nid_cert, int iter, int mac_iter, int keytype);
```

For openssl 3.0,
```
PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey,
                      X509 *cert, STACK_OF(X509) *ca,
                      int nid_key, int nid_cert, int iter, int mac_iter, int keytype);
```
…e (#4543)

A write faulting on a protected page, with the target not inside the running block, only
unprotected the page and let the block continue. The page then stays writable for the rest
of that block, so a later write of the same block can silently modify code it is going to
execute, and the stale translation gets executed.

So also get out of the block when the target is in the same page as the block, and mark the
write instruction as internal smc so the rebuilt block is cut there. That mark is also used
to not get out a second time, so the write can complete instead of looping.
…ate to the guest (#4550)

BTCpuResetToConsistentState truncated the host PC to 32 bits before the JIT
lookup, so faults in JIT code above 4GB were not handled and Wine spun in
RtlVirtualUnwind. Also sync the WOW64 context with the guest registers at
the fault, since Wow64PassExceptionToGuest builds the guest context from it.

Fixes #4549
* [RV64_DYNAREC] Use ADDSL to replace shxadd pattern

* [RV64_DYNAREC] Use ADDSL to replace SLLI+ADD pattern
```
ADDI(x1, x1, 0xffff) -> addi x1, x1, -1
ANDI(x1, x1, 0xffff) -> andi x1, x1, -1
```

1. Zero-extend ADC16 results before testing for zero in d_adc16 and d_adc16b.
`ANDI(x4, x1, 0xffff)` may retain the upper bits.

2. Replace ANDI 0xffff masks with ZEXTH for AAM/AAD operands.

3. Use MOV32w to load the VPHMINPOSUW initial minimum explicitly as 0xffff.
* [RV64_DYNAREC] Added a few more opcodes

* fix
Use vmerge.vvm to reduce instruction counts for vmaxps family opcodes.
* [RV64_DYNAREC] Fixed HSUBPS !fastnan handling

* [RV64_DYNAREC] Fixed a missing up32 marker

* [RV64_DYNAREC] Fixed a few scalar AVX GETEX offsets

* [RV64_DYNAREC] Fixed MARKF confliction
…used opcodes (#4561)

No code is emitted for the unused opcodes, so the native registers keep their live values across them. The fpu cache state used to be dropped there, so those live values could not be written back when a block was left on a fault (like a write to a protected code page): the cached x87/mmx/sse registers were lost.

Write the dirty registers back to emu right before the next emitted instruction runs, keeping the cache valid (next=1). The write back is emitted at that instruction entry, so a jump to it runs it too.
…nabled (#4562)

1. Save the sp value in PUSHAD by using the pending rsp_entry offset instead
of the stale xRSP value if rsp_merge is enabled.

2. During signal recovery, use the `arch` entry for `ninst` when restoring rsp/up32,
and the `prev_arch` entry for `ninst-1` when restoring FPU.
ksco and others added 30 commits November 1, 2026 22:22
* [BOX64EC] Add the ARM64EC register mapping to the Dynarec

x18 is the TEB and x6 is guest R9 there, so the scratch registers are x1 to x5.

* [BOX64EC] Keep guest R9 out of the Dynarec scratch registers

x6 is R9 in the ARM64EC mapping, so the emitters use x1 to x5 only, with the same code on every target where it is the same size.

* [BOX64EC] Pass PCMPESTRx REX.W without clobbering guest R9

REX.W goes in bit 8 of the imm8 argument, which a small wrapper unpacks.

* [BOX64EC] Adapt Dynarec helper calls to the ARM64EC register map

C calls use LR for the call address, spill R10 and R11 and reload x18 as the TEB, and checkCRC keeps emu on the stack instead of in x6.

* [BOX64EC] Compile Dynarec sources without linking them

The DLL still runs the interpreter.
…nges the context (#4679)

* [SIGNAL] Restore FPU state and drop deferred flags when a handler changes the context

When a guest signal handler returns a modified context, my_sigactionhandler_oldcode_64
leaves through native_next or siglongjmp, and neither goes back through
my_sigactionhandler_oldcode, where the emu state is saved and restored around the
handler. The interrupted code then resumed with the handler's SSE/AVX/x87 registers and
its deferred-flags record. Restore the FPU state from the frame, as sigreturn would, and
drop the deferred flags, since eflags is loaded from the context.

CoreCLR does this on every GC suspension that moves an object a thread holds in a
register (seen as wrong vectorised string compares and wrongly taken bounds checks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* [SIGNAL] Remove comment in context change path

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* [ARM64_DYNAREC] Fix native flags record in signal arch info

The one-bit fields of arch_flags_t were assigned flags&NF_xx directly; only
NF_EQ is bit 0, so SF, OF, CF and PF were always recorded as clear, and a
signal landing on a conditional jump got those flags from emu->df or x26
instead of NZCV. Also drop a stale emu->df when the record isn't deferred,
so the caller's CHECK_FLAGS doesn't recompute the native bits from it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* [ARM64_DYNAREC] Remove comment in adjust_arch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* global GNU_SOURCE

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* global lfs

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: use fseeko

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: use ino_t, off_t

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: mmap

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: fsblkcnt_t, fsfilcnt_t

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: stat

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: dirent

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: alphasort

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: f/open

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: l/f/stat, fstatat, statfs

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: get/setrlimit, struct rlimit

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: n/ftw

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: scandir/at, readdir

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* lfs: glob, globfree, glob_t

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

* replace legacy isnanf/isinff with isnan/isinf

Signed-off-by: Pepper Gray <hello@peppergray.xyz>

---------

Signed-off-by: Pepper Gray <hello@peppergray.xyz>
Co-authored-by: ptitSeb <sebastien.chev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants