Enforcer Help
9 messages in this thread
Can anyone help with a problem I am having?
I have an A1200 with an M1230 XA accelerator. Since this has an MMU I have
been using enforcer and mungwall to check some of my old programs. One of them
causes an error. I have deleted parts until I found the offending piece of code
but now I am stumped because I do not understand what enforcer is telling me.
All the code does is open then close the dos library. The full program has no
startup code and I have kept this the same. The saveds keyword seems to be
causing the problem. Here is the code and subsequent enforcer output.
Hope someone can help and thanks in advance.
Nev.
#include <proto/dos.h> #include <proto/exec.h> #include <exec/types.h>
/*#include <exec/memory.h>*/
#define DOSVER 37L
void __saveds main(void) {
struct DosLibrary *DOSBase = NULL;
if (!(DOSBase = (struct DosLibrary
*)OpenLibrary("dos.library",DOSVER)))
{
;
}
if (DOSBase)
CloseLibrary((struct Library *)DOSBase); }
This is compiled with no startup code.(SAS 6) The enforcer mungwall combination
gave the following output:
Program Counter (approximate)= 8106B04 Fault address = 0 User
stack pointer = 810E4C4 DOS process address = 810FFD8 Data: 0810E4BC
02041ABF 00003E80 0811141C 00000001 00000001 0204466B 08106AFC Addr: 0811141C
0810A650 0800BD0C 08106AFC 0810E4C8 00F96460 00F96454 001FFFA0 Stck: 00F96C8C
00003E80 081109CC BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB READ-LONG
(—)(-)(-) SR=0008 SSW=0749 Shell Process, "dire", Hunk #0, Offset $4
I have found that it is the saveds keyword that is causing the enforcer hit.
Can anyone tell me why? The program will not work properly without saveds.
Nevil,
With no startup code, there isn't any initialization of ExecBase, from
which the OpenLibrary() function vectors.
Hope this helps….
– BobR
(Motorola Inside!)
Bob,
How'd he get it linked withOUT c.o???
Bob
thanks for the reply. Im afraid its a case of RTFM, I reread the
guidelines in the manual and realised I had not turned stack checking
off.
Nev.
Nevil,
Hmmm, compiles AND runs for me (SAS 6.3) both with and withOUT the
__saveds. I think you're going to need to be a little more specific about
what options you compiled with….from the manual page 154:
__saveds
loads the global data register at the entry to the function. The
method used depends on the compiler options you specify.
Vic,
thanks for the reply. Im afraid its a case of RTFM, I reread the
guidelines in the manual and realised I had not turned stack checking
off.
Nev.
Hi Nevil,
Since you're compiling with no startup code, you must make sure that
SysBase is set up correctly. You need to add this:
struct ExecBase *SysBase;
void main(void)
{
…
SysBase = *(struct ExecBase **)4;
…
}
I assume you are defining __USE_SYSBASE or causing the libcall
pragmas to get pulled in somehow, because if you were using syscall
pragmas, the code would be referencing location 4 each time instead of
jumping relative to location 0.
–Doug
Doug,
thanks for the reply. Im afraid its a case of RTFM, I reread the
guidelines in the manual and realised I had not turned stack checking
off.
Nev.
a point of etiquette. Repeating the same message three times to
three different persons is generally unnecessary in the AmigaFora.
Generally, posting it once, possibly with added names to the body, is
usually sufficient. While this is not an issue here in AmigaTech, it
could become one in a forum with a very high scroll rate (i.e. areas
with a very high traffic in messages), such as AmigaUser.
Just a thought. BTW, congrats on finding the error. Sometimes it
is the obvious that is missed. I've done that enough times <g>.