Skip to content

BinTools: classify every eightbyte of small objects on System V x86_64 - #10

Open
cmer81 wants to merge 1 commit into
1.13-7427from
fix/bintools-x64-sysv-classify
Open

cmer81 wants to merge 1 commit into
1.13-7427from
fix/bintools-x64-sysv-classify

Conversation

@cmer81

@cmer81 cmer81 commented Oct 19, 2026

Copy link
Copy Markdown
Member

BinTools: classify every eightbyte of small objects on System V x86_64

Bug

On Linux x86_64, SDKCall with SDKType_Vector / SDKPass_ByValue returns z = 0. For example Weapon_ShootPosition on CS:S x64 gives 123.50 -456.25 0.00 instead of 123.50 -456.25 128.00.

ClassifyObject() walks fields two by two and never classifies an eightbyte that holds a single field. Vector { float x, y, z; } is therefore classified SSE + None, and the second return register (xmm1, which holds z) is never stored.

Upstream master has the same code (checked 2026-10-19), so this affects every SourceMod x86_64 Linux server.

Fix

Each eightbyte gets the merged class of every field laid out in it. Fields are naturally aligned and in declaration order, which is what the System V ABI says (§3.2.3). For a Vector that gives SSE + SSE → xmm0 + xmm1.

Testing

On CS:S x64 (build 11003710), SDKCall(Weapon_ShootPosition) now returns the full eye position (it matches GetClientEyePosition). Covered by plugins/testsuite/dhooks/dhooks-css-test.sp from #9.

Based on 1.13-7427 (our pin). It's independent of DHooks and worth sending upstream as well.

ClassifyObject() only looked at fields two by two and never classified an
eightbyte holding a single field, so Vector { x, y, z } was SSE + None: the z
returned in xmm1 was never stored (SDKCall returning a Vector by value got z = 0).
Merge the class of every field into the eightbyte it is laid out in instead.
@cmer81 cmer81 added the x86_64 CS:S x86_64 (64-bit srcds) support label Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

x86_64 CS:S x86_64 (64-bit srcds) support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant