[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] Mintlib based Software running under plain TOS
the only real problems that I had until now was Getcookie()
I have personally rewritten Getcookie() in assembly language last year for
ColdFire compatibility. It is used by the startup code of every program
compiled with GCC, and it works fine, in any case.
What problem do you encounter ?
Now NetSurf runs with TOS 2.06.
Excellent !
The Problem is: during an rts instruction I get an Bus-Error.
An RTS belonging to which function ?
The causes can be:
- corrupted stack, for example using Super() to return to user mode without
the trick I have posted here.
- stack overflow on the user stack (try to increase it using the "stack"
tool, it works for TOS, too).
- stack overflow on the system stack inside USERDEFs or Supexec().
- buffer overflow on some local variable of the current function
- a6 clobbered unexpectedly by some function call
- register or stack clobbered by an interrupt (improbable)
- or something else
LINK.W A6, #-$0038
.... many instructions here ....
UNLNK A6
RTS <- BUS ERROR happens here.
There are LINK/UNLNK instructions, in order to use A6 as the frame pointer.
They are useful only to GDB for providing the call stack feature. It is
usually best to compile release programs with -fomit-frame-pointer to get
rid of these LINK/UNLNK and optimize the code a bit more.
One thing I find interesting and suspicious, is the value of A6: $01000
At which point ?
Before LINK ?
After LINK ?
Afer UNLNK ?
This looks wrong. A6 should point to your own stack, and that value can't be
correct. You should try to see when A6 goes wrong.
This one is bad to debug, because you have to restart your system after the
bug is triggered (further attempts to start the executable result in early
bail out with bizarre return values...)
This is what happens when the system/AES stack overflows.
I had same trouble when debugging USERDEFs.
--
Vincent Rivière