Port-m68k archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Some fixes for m68k users (incl/ for FPU emulation)



> On Nov 2, 2026, at 9:32 AM, Jason Thorpe <thorpej%me.com@localhost> wrote:
> 
> Have I missed something?

Ok, I’m waiting to catch a plane, so I sketched out by hand what I think happens:

SP -> TOP OF STACK A6=0

-- call function1 --

      TOP OF STACK  SP->  return address0  A6=0

-- function1 prof-prologue link %a6,#0 --

      TOP OF STACK
      return address0
SP->  saved A6 -> 0   A6=SP1

-- function1 prof-prologue jbsr __mcount --

      TOP OF STACK
      return address0
      saved A6 -> 0   A6=SP1
SP->  return address1

-- __mcount prologue link %a6,#0 --

      TOP OF STACK
      return address0
      saved A6 -> 0      SP1
      return address1
SP->  saved A6 -> SP1 A6=SP2

__mcount then does (effectively - written as it is on the 68010 because it lacks the indirect addressing mode that 68020+ are using):

      movl %a6@(4) -> selfpc -- that's SP2@4 -> return address1
      movl %a6@(0),%a0       -- %a0 = SP1
      movl %a0@(4) -> frompc -- that's SP1@4 -> return address0

So, I’m having trouble seeing where things are going off the rails… both of those frame-pointer relative loads should point to valid stack addresses.

Again, am I missing something?

-- thorpej



Home | Main Index | Thread Index | Old Index