Skip to content

Conversation

@jibee
Copy link

@jibee jibee commented Dec 23, 2025

On 68000, the movem instruction is the primary way to save registers on the stack. It comes in word (size 2) and long (size 4) flavors.

This patch corrects the modeling of the word variant of movem.

Per 68000 manual, when in word mode, increment (respectively decrement) is 2, and 4 in long mode. For word mode, the various registers masks are handled by m2rfw0, r2mbw0, and r2mfw0.

This patch corrects the pointer increment for r2mbw0 to 2 from 4, making it consistent with m2rfw0 and r2mfw0 (both correctly using 2 increments).

This corrects analysis of code blocks bookended by movem.w's. Before I would have the stack depth move from 0 to 4 then to 2; now it moves from 0 to 2 and back to 0.

(Edited 24th Dec '25 - post correction stack depth is zero as expected)

movem exists in 2 symmetrical variants, register to memory (save to stack) and memory to register (pull from stack).
Per 68000 manual, when in word mode, increment (respectively decrement) is 2, and 4 in long mode.
For word mode, the various registers masks are handled by m2rfw0, r2mbw0, and r2mfw0. 

This patch corrects the pointer increment for r2mbw0 to 2, aligning it to  m2rfw0 and r2mfw0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature: Processor/68000 Status: Triage Information is being gathered

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants