View Single Post
Old 16 June 2019, 16:23   #1
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476
Misaligned stack

Target: bare 68k.
I was writing code using the stack to store some temporary data and by mistake I made the stack odd aligned and called a subroutine.
I'm expecting a crash, but to my surprise nothing..

So investigated and there is no crash in WinUAE for this cases!
A little snippet, reducing the code to the minimum:
Code:
sq	subq.l	#1,sp
	bsr.b	.x
	addq.l	#1,sp
.x	rts
As I've not a real machine I cannot test it, so attached a hunk exe binary.

Yes, wrong section if is a WinUAE oddity, but I'm not sure so..
Maybe I miss something obvious (no, stack not auto-align on subq, and no, impossible for a prefetch behavior).

And yes, WinUAE debugger displays the right return code in a misaligned location.

Cheers.
Attached Files
File Type: 68k sq.68k (44 Bytes, 65 views)

Last edited by ross; 16 June 2019 at 17:36. Reason: typos..
ross is offline  
 
Page generated in 0.08118 seconds with 12 queries