Skip to content

Sync with upstream box64 - #1

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

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

Conversation

@github-actions

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

Copy link
Copy Markdown

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

Newest upstream commit: 3de7e2a [ELF] Fixed a potential crash on

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 15, 2026 12:39
* [ALLOC] Replace malloc_hack with guest-owned allocator model

Keeps guest and host memory ownership separate instead of rewriting guest allocator entry points.
The new model detects when an emulated program globally replaces malloc/free, leaves that allocator untouched, and routes guest-visible wrapper allocations through the guest's allocator while box64 and native wrapped libraries stay on the host heap. `free/realloc/usable-size` calls dispatch by pointer provenance, using guest mmap ranges plus an isolated guest brk arena for classification.

`BOX64_MALLOC_HACK` and `BOX64_LIBCEF` env vars are removed.

Tested:
- Node.js with npm
- Bun (and Claude code)
- Chromium
- Electron (and Heroic)
- WeChat

All working fine.

* Try to fix build and test
Simple wrapping breaks Electron applictions like Discord and Heroic.
* [GDBJIT] Reworked gdbjit support

* Fix build
* [PERFMAP] Enlarged perfmap buffer size

* Fix CI

* Fix CI again

* another try
This appears to be a typo between `mask` and `mask_`. The affinity wrappers
should use the internal variable `mask_` to store the data to be set.
* [RV64_DYNAREC] Refactored vector state management

* Fix

* Optimize

* Fix

* Optimize

* Fixed xhteadvector support

* Optimize

* Ported x87round_active

* Fixed 16-bit LOCK BTR and LOCK BTS
With a 0x67 prefix in 32-bit mode, LOOP/LOOPZ/LOOPNZ decrement CX while keeping
the upper half of ECX.

If CX is 0, the decremented value was sign-extended to 0xffffffffffffffff, and
wiped its upper half with zexth_rs=0.

Co-authored-by: Yang Liu <numbksco@gmail.com>
* [RV64_DYNAREC] Reduce upper register liveness analysis work

* review
…ded gameoverlayrenderer.so library if possible
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