Fixed up assembly files. If they had "|" in them, then the comment would get rid of the rest of the function.

Fixed up prototypes for amiga lib functions.
This commit is contained in:
jshepher
2004-09-12 01:16:36 +00:00
parent f8848586fd
commit e42dc803ec
26 changed files with 222 additions and 221 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ STATIC int stub(struct Isrvstr *intr asm("a1"))
(*intr->ccode)(intr->Carg); return 0; (*intr->ccode)(intr->Carg); return 0;
} }
VOID AddTOF(struct Isrvstr *intr,LONG (*code)(),LONG arg) VOID AddTOF(struct Isrvstr *intr,LONG (*code)(APTR),APTR arg)
{ APTR SysBase = *(APTR *)4L; { APTR SysBase = *(APTR *)4L;
intr->Iptr = intr; intr->Iptr = intr;
+1 -1
View File
@@ -60,7 +60,7 @@ LONG ArgInt(UBYTE **tt, STRPTR entry, long defval)
return defval; return defval;
} }
#ifdef 0 /* only a example ??? */ #if 0 /* only a example ??? */
CxObj *UserFilter(UBYTE **tt, STRPTR entry, STRPTR defstr) CxObj *UserFilter(UBYTE **tt, STRPTR entry, STRPTR defstr)
{ {
+3 -3
View File
@@ -3,8 +3,8 @@
#include <exec/devices.h> #include <exec/devices.h>
void BeginIO(struct IORequest *iorequest) void BeginIO(struct IORequest *iorequest)
{ register struct IORequest *a1 asm("a1")=iorequest; { register struct IORequest *a1 __asm("a1")=iorequest;
register struct Device *a6 asm("a6")=iorequest->io_Device; register struct Device *a6 __asm("a6")=iorequest->io_Device;
__asm __volatile ("jsr a6@(-30:W)"::"r"(a1),"r"(a6):"a0","a1","d0","d1"); __asm volatile ("jsr a6@(-30:W)" :: "r" (a1), "r" (a6));
} }
#endif #endif
+18 -18
View File
@@ -1,23 +1,23 @@
asm(" asm(
.text " .text;"
.globl _CallHook " .globl _CallHook;"
.globl _CallHookA " .globl _CallHookA;"
_CallHook: lea sp@(12:W),a1 "_CallHook: lea sp@(12:W),a1;"
jra L_CallHook " jra L_CallHook;"
_CallHookA: movel sp@(12:W),a1 "_CallHookA: movel sp@(12:W),a1;"
L_CallHook: movel a6,sp@- "L_CallHook: movel a6,sp@-;"
movel a2,sp@- " movel a2,sp@-;"
movel sp@(12:W),a0 " movel sp@(12:W),a0;"
movel sp@(16:W),a2 " movel sp@(16:W),a2;"
jbsr L_callit " jbsr L_callit;"
movel sp@+,a2 " movel sp@+,a2;"
movel sp@+,a6 " movel sp@+,a6;"
rts " rts;"
L_callit: movel a0@(8:W),sp@- "L_callit: movel a0@(8:W),sp@-;"
rts " rts;"
"); );
+19 -19
View File
@@ -1,24 +1,24 @@
asm(" asm(
.text " .text;"
.globl _CoerceMethod " .globl _CoerceMethod;"
.globl _CoerceMethodA " .globl _CoerceMethodA;"
_CoerceMethod: lea sp@(12:W),a1 "_CoerceMethod: lea sp@(12:W),a1;"
jra L_CoerceMethod " jra L_CoerceMethod;"
_CoerceMethodA: movel sp@(12:W),a1 "_CoerceMethodA: movel sp@(12:W),a1;"
L_CoerceMethod: movel a2,sp@- "L_CoerceMethod: movel a2,sp@-;"
moveml sp@(8:W),a0/a2 " moveml sp@(8:W),a0/a2;"
movel a0,d0 " movel a0,d0;"
beqs L_Null " beqs L_Null;"
movel a2,d0 " movel a2,d0;"
beqs L_Null " beqs L_Null;"
jbsr L_Invoke " jbsr L_Invoke;"
L_Null: movel sp@+,a2 "L_Null: movel sp@+,a2;"
rts " rts;"
L_Invoke: movel a0@(8:W),sp@- "L_Invoke: movel a0@(8:W),sp@-;"
rts " rts;"
"); );
+2 -2
View File
@@ -4,7 +4,7 @@
#include <proto/exec.h> #include <proto/exec.h>
#include "stabs.h" #include "stabs.h"
struct IORequest *CreateExtIO(struct MsgPort *port,LONG iosize) struct IORequest *CreateExtIO(CONST struct MsgPort *port,LONG iosize)
{ APTR SysBase = *(APTR *)4L; { APTR SysBase = *(APTR *)4L;
struct IORequest *ioreq = NULL; struct IORequest *ioreq = NULL;
@@ -16,7 +16,7 @@ struct IORequest *CreateExtIO(struct MsgPort *port,LONG iosize)
return ioreq; return ioreq;
} }
struct IOStdReq *CreateStdIO(struct MsgPort *port) struct IOStdReq *CreateStdIO(CONST struct MsgPort *port)
{ {
return (struct IOStdReq *)CreateExtIO(port,sizeof(struct IOStdReq)); return (struct IOStdReq *)CreateExtIO(port,sizeof(struct IOStdReq));
} }
+1 -1
View File
@@ -7,7 +7,7 @@
/*(l)->lh_Tail = NULL,*/ \ /*(l)->lh_Tail = NULL,*/ \
(l)->lh_TailPred = (struct Node *)&(l)->lh_Head) (l)->lh_TailPred = (struct Node *)&(l)->lh_Head)
struct MsgPort *CreatePort(STRPTR name,LONG pri) struct MsgPort *CreatePort(CONST_STRPTR name,LONG pri)
{ APTR SysBase = *(APTR *)4L; { APTR SysBase = *(APTR *)4L;
struct MsgPort *port = NULL; struct MsgPort *port = NULL;
UBYTE portsig; UBYTE portsig;
+18 -18
View File
@@ -1,23 +1,23 @@
asm(" asm(
.text " .text;"
.globl _DoMethod " .globl _DoMethod;"
.globl _DoMethodA " .globl _DoMethodA;"
_DoMethod: lea sp@(8:W),a1 "_DoMethod: lea sp@(8:W),a1;"
jra L_DoMethod " jra L_DoMethod;"
_DoMethodA: movel sp@(8:W),a1 "_DoMethodA: movel sp@(8:W),a1;"
L_DoMethod: movel sp@(4:W),d0 "L_DoMethod: movel sp@(4:W),d0;"
beqs L_Null " beqs L_Null;"
movel a2,sp@- " movel a2,sp@-;"
movel d0,a2 " movel d0,a2;"
movel a2@(-4:W),a0 " movel a2@(-4:W),a0;"
jbsr L_Invoke " jbsr L_Invoke;"
movel sp@+,a2 " movel sp@+,a2;"
L_Null: rts "L_Null: rts;"
L_Invoke: movel a0@(8:W),sp@- "L_Invoke: movel a0@(8:W),sp@-;"
rts " rts;"
"); );
+22 -22
View File
@@ -1,28 +1,28 @@
asm(" asm(
.text " .text;"
.globl _DoSuperMethod " .globl _DoSuperMethod;"
.globl _DoSuperMethodA " .globl _DoSuperMethodA;"
_DoSuperMethod: lea sp@(12:W),a1 "_DoSuperMethod: lea sp@(12:W),a1;"
jra L_DoSuperMethod " jra L_DoSuperMethod;"
_DoSuperMethodA: "_DoSuperMethodA:"
movel sp@(12:W),a1 " movel sp@(12:W),a1;"
L_DoSuperMethod: "L_DoSuperMethod:"
movel a2,sp@- " movel a2,sp@-;"
moveml sp@(8:W),a0/a2 " moveml sp@(8:W),a0/a2;"
movel a2,d0 " movel a2,d0;"
beqs L_Null " beqs L_Null;"
movel a0,d0 " movel a0,d0;"
beqs L_Null " beqs L_Null;"
movel a0@(24:W),a0 " movel a0@(24:W),a0;"
jbsr L_Invoke " jbsr L_Invoke;"
L_Null: movel sp@+,a2 "L_Null: movel sp@+,a2;"
rts " rts;"
L_Invoke: movel a0@(8:W),sp@- "L_Invoke: movel a0@(8:W),sp@-;"
rts " rts;"
"); );
+11 -11
View File
@@ -9,18 +9,18 @@ ULONG HookEntry(struct Hook *hook asm("a0"),APTR obj asm("a2"),APTR msg asm("a1"
#else #else
asm(" asm(
.text " .text;"
.globl _HookEntry " .globl _HookEntry;"
_HookEntry: movel a1,sp@- "_HookEntry: movel a1,sp@-;"
movel a2,sp@- " movel a2,sp@-;"
movel a0,sp@- " movel a0,sp@-;"
movel a0@(12:W),a0 " movel a0@(12:W),a0;"
jsr a0@ " jsr a0@;"
lea sp@(12:W),sp " lea sp@(12:W),sp;"
rts " rts;"
"); );
#endif #endif
+21 -21
View File
@@ -1,24 +1,24 @@
asm(" asm(
.text " .text;"
.globl _SetSuperAttrs " .globl _SetSuperAttrs;"
_SetSuperAttrs: movel a2,sp@- "_SetSuperAttrs: movel a2,sp@-;"
moveml sp@(8:W),a0/a2 " moveml sp@(8:W),a0/a2;"
movel a2,d0 " movel a2,d0;"
beqs L_Null " beqs L_Null;"
movel a0,d0 " movel a0,d0;"
beqs L_Null " beqs L_Null;"
clrl sp@- " clrl sp@-;"
pea sp@(20:W) " pea sp@(20:W);"
pea 259:W " pea 259:W;"
movel sp,a1 " movel sp,a1;"
movel sp@(24:W),a0 " movel sp@(24:W),a0;"
jbsr L_Invoke " jbsr L_Invoke;"
lea sp@(12:W),sp " lea sp@(12:W),sp;"
L_Null: movel sp@+,a2 "L_Null: movel sp@+,a2;"
rts " rts;"
L_Invoke: movel a0@(8:W),sp@- "L_Invoke: movel a0@(8:W),sp@-;"
rts " rts;"
"); );
+4 -4
View File
@@ -6,17 +6,17 @@ asm(
" .globl ___modsi3;" " .globl ___modsi3;"
" .globl ___divsi3;" " .globl ___divsi3;"
"| D1.L = D0.L % D1.L signed" /* D1.L = D0.L % D1.L signed */
"___modsi3: moveml sp@(4:W),d0/d1;" "___modsi3: moveml sp@(4:W),d0/d1;"
" jbsr ___divsi4;" " jbsr ___divsi4;"
" movel d1,d0;" " movel d1,d0;"
" rts;" " rts;"
"| D0.L = D0.L / D1.L signed" /* D0.L = D0.L / D1.L signed */
"_div:;" "_div:"
"_ldiv:;" "_ldiv:"
"___divsi3: moveml sp@(4:W),d0/d1;" "___divsi3: moveml sp@(4:W),d0/d1;"
"___divsi4: movel "A4(_UtilityBase)",a0;" "___divsi4: movel "A4(_UtilityBase)",a0;"
" jmp a0@(-150:W);" " jmp a0@(-150:W);"
+1 -1
View File
@@ -3,7 +3,7 @@
asm( asm(
" .globl ___mulsi3;" " .globl ___mulsi3;"
"| D0 = D0 * D1;" /* D0 = D0 * D1 */
"___mulsi3: moveml sp@(4),d0/d1;" "___mulsi3: moveml sp@(4),d0/d1;"
" movel "A4(_UtilityBase)",a0;" " movel "A4(_UtilityBase)",a0;"
+2 -2
View File
@@ -4,14 +4,14 @@ asm(
" .globl ___umodsi3;" " .globl ___umodsi3;"
" .globl ___udivsi3;" " .globl ___udivsi3;"
"| D1.L = D0.L % D1.L unsigned;" /* D1.L = D0.L % D1.L unsigned */
"___umodsi3: moveml sp@(4:W),d0/d1;" "___umodsi3: moveml sp@(4:W),d0/d1;"
" jbsr ___udivsi4;" " jbsr ___udivsi4;"
" movel d1,d0;" " movel d1,d0;"
" rts;" " rts;"
"| D0.L = D0.L / D1.L unsigned;" /* D0.L = D0.L / D1.L unsigned */
"___udivsi3: moveml sp@(4:W),d0/d1;" "___udivsi3: moveml sp@(4:W),d0/d1;"
"___udivsi4: movel "A4(_UtilityBase)",a0;" "___udivsi4: movel "A4(_UtilityBase)",a0;"
+6 -6
View File
@@ -19,20 +19,20 @@ asm(
" moveml #0x3832,sp@-;" " moveml #0x3832,sp@-;"
" movel 4:W,a6;" " movel 4:W,a6;"
" subal a1,a1;" " subal a1,a1;"
" jsr a6@(-0x126); | FindTask(a1:nam)" " jsr a6@(-0x126);" /* FindTask(a1:nam) */
" movel d0,a1;" " movel d0,a1;"
" moveq #-1,d1;" " moveq #-1,d1;"
" cmpl a1@(0xb8:W),d1;" " cmpl a1@(0xb8:W),d1;"
" jeq l_fail; | Dont put requesters up" " jeq l_fail;" /* Dont put requesters up */
" lea "A4(___intuitionname)",a1;" " lea "A4(___intuitionname)",a1;"
" moveq #0,d0;" " moveq #0,d0;"
" jsr a6@(-0x228); | OpenLibrary(a1:nam,d0:ver)" " jsr a6@(-0x228);" /* OpenLibrary(a1:nam,d0:ver) */
" movel d0,d4;" " movel d0,d4;"
" jeq l_fail;" " jeq l_fail;"
" lea "A4(ok)",a3;" " lea "A4(ok)",a3;"
" lea "A4(body)",a1;" " lea "A4(body)",a1;"
" subl a2,a2;" " subl a2,a2;"
" movel sp@(2;8),a1@(12:W);" " movel sp@(28),a1@(12:W);"
" subl a0,a0;" " subl a0,a0;"
" moveq #0,d0;" " moveq #0,d0;"
" moveq #0,d1;" " moveq #0,d1;"
@@ -40,10 +40,10 @@ asm(
" lslw #4,d2;" " lslw #4,d2;"
" moveq #72,d3;" " moveq #72,d3;"
" exg d4,a6;" " exg d4,a6;"
" jsr a6@(-0x15c); | AutoRequest(a0,a1,a2,a3,d0,d1,d2,d3)" " jsr a6@(-0x15c);" /* AutoRequest(a0,a1,a2,a3,d0,d1,d2,d3) */
" movel a6,a1;" " movel a6,a1;"
" movel d4,a6;" " movel d4,a6;"
" jsr a6@(-0x19e); | CloseLibrary(a1:lib)" " jsr a6@(-0x19e);" /* CloseLibrary(a1:lib) */
"l_fail: moveml sp@+,#0x4c1c;" "l_fail: moveml sp@+,#0x4c1c;"
" rts;" " rts;"
); );
+7 -7
View File
@@ -4,13 +4,13 @@ asm(
" .globl _longjmp;" " .globl _longjmp;"
"_longjmp:;" "_longjmp:;"
" addql #4,sp | returns to another address;" " addql #4,sp;" /* returns to another address */
" movel sp@+,a0 | get address of jmp_buf;" " movel sp@+,a0;" /* get address of jmp_buf */
" movel sp@+,d0 | get returncode;" " movel sp@+,d0;" /* get returncode */
" jne l0 | != 0 -> ok;" " jne l0;" /* != 0 -> ok */
" moveql #1,d0;" " moveql #1,d0;"
"l0: movel a0@(48:W),sp | restore sp;" "l0: movel a0@(48:W),sp;" /* restore sp */
" movel a0@+,sp@ | set returnaddress;" " movel a0@+,sp@;" /* set returnaddress */
" moveml a0@,d2-d7/a2-a6 | restore all registers except scratch and sp;" " moveml a0@,d2-d7/a2-a6;" /* restore all registers except scratch and sp */
" rts;" " rts;"
); );
+5 -5
View File
@@ -3,10 +3,10 @@ asm(
" .even;" " .even;"
" .globl _setjmp;" " .globl _setjmp;"
"_setjmp:;" "_setjmp:"
" movel sp@(4),a0 | get address of jmp_buf;" " movel sp@(4),a0;" /* get address of jmp_buf */
" movel sp@,a0@+ | store returnaddress;" " movel sp@,a0@+;" /* store returnaddress */
" moveml d2-d7/a2-a6/sp,a0@ | store all registers except scratch;" " moveml d2-d7/a2-a6/sp,a0@;" /* store all registers except scratch */
" moveql #0,d0 | return 0;" " moveql #0,d0;" /* return 0 */
" rts;" " rts;"
); );
+2 -2
View File
@@ -4,14 +4,14 @@ asm(
" .globl ___modsi3;" " .globl ___modsi3;"
" .globl ___divsi3;" " .globl ___divsi3;"
" | D1.L = D0.L % D1.L signed;" /* D1.L = D0.L % D1.L signed */
"___modsi3: moveml sp@(4:W),d0/d1;" "___modsi3: moveml sp@(4:W),d0/d1;"
" jbsr ___divsi4;" " jbsr ___divsi4;"
" movel d1,d0;" " movel d1,d0;"
" rts;" " rts;"
"| D0.L = D0.L / D1.L signed;" /* D0.L = D0.L / D1.L signed */
"_div:;" "_div:;"
"_ldiv:;" "_ldiv:;"
+1 -1
View File
@@ -1,7 +1,7 @@
asm( asm(
" .globl ___mulsi3;" " .globl ___mulsi3;"
"| D0 = D0 * D1;" /* D0 = D0 * D1 */
"___mulsi3: moveml sp@(4),d0/d1;" "___mulsi3: moveml sp@(4),d0/d1;"
" movel d3,sp@-;" " movel d3,sp@-;"
+2 -2
View File
@@ -3,14 +3,14 @@ asm(
" .globl ___udivsi3;" " .globl ___udivsi3;"
" .globl ___udivsi4;" " .globl ___udivsi4;"
"| D1.L = D0.L % D1.L unsigned;" /* D1.L = D0.L % D1.L unsigned */
"___umodsi3: moveml sp@(4:W),d0/d1;" "___umodsi3: moveml sp@(4:W),d0/d1;"
" jbsr ___udivsi4;" " jbsr ___udivsi4;"
" movel d1,d0;" " movel d1,d0;"
" rts;" " rts;"
"| D0.L = D0.L / D1.L unsigned;" /* D0.L = D0.L / D1.L unsigned */
"___udivsi3: moveml sp@(4:W),d0/d1;" "___udivsi3: moveml sp@(4:W),d0/d1;"
"___udivsi4: movel d3,sp@-;" "___udivsi4: movel d3,sp@-;"
+7 -7
View File
@@ -4,15 +4,15 @@ asm(
" .globl _longjmp;" " .globl _longjmp;"
"_longjmp:" "_longjmp:"
" addql #4,sp | returns to another address" " addql #4,sp;" /* returns to another address */
" movel sp@+,a0 | get address of jmp_buf" " movel sp@+,a0;" /* get address of jmp_buf */
" movel sp@+,d2 | get returncode" " movel sp@+,d2;" /* get returncode */
" movel a0@(48:W),d0;" " movel a0@(48:W),d0;"
" jbsr ___stkrst | restore sp" " jbsr ___stkrst;" /* restore sp */
" movel d2,d0;" " movel d2,d0;"
" jne l0 | != 0 -> ok" " jne l0;" /* != 0 -> ok */
" moveql #1,d0;" " moveql #1,d0;"
"l0: movel a0@+,sp@ | set returnaddress" "l0: movel a0@+,sp@;" /* set returnaddress */
" moveml a0@,#0x7cfc | restore all registers except scratch and sp" " moveml a0@,#0x7cfc;" /* restore all registers except scratch and sp */
" rts" " rts"
); );
+42 -42
View File
@@ -11,32 +11,32 @@ asm(
"___stkext_f:;" "___stkext_f:;"
" movel a0,sp@-;" " movel a0,sp@-;"
" movel sp,a0 | memorize sp;" " movel sp,a0;" /* memorize sp*/
" moveml #0xc062,sp@- | preserves all registers;" " moveml #0xc062,sp@-;" /* preserves all registers*/
" movel sp,a2 | memorize sp;" " movel sp,a2;" /* memorize sp*/
" addl #28:W,d1 | Used by this function itself;" " addl #28:W,d1;" /* Used by this function itself*/
" movel "A4(___stackborders)",a1| get upper border of stack in a1;" " movel "A4(___stackborders)",a1;"/* get upper border of stack in a1*/
" movel a1@(4:W),a1;" " movel a1@(4:W),a1;"
" tstl "A4(___used_stack)";" " tstl "A4(___used_stack)";"
" bne l0;" " bne l0;"
" movel "A4(___SaveSP)",a1;" " movel "A4(___SaveSP)",a1;"
"l0: jbsr ___stkext | change to a stackframe with d0 bytes;" "l0: jbsr ___stkext;" /* change to a stackframe with d0 bytes*/
" movel "A4(___used_stack)",a6 | fix stored sp;" " movel "A4(___used_stack)",a6;" /* fix stored sp*/
" addl d1,a6@(12:W);" " addl d1,a6@(12:W);"
" movel a2,d0 | calculate number of bytes to copy;" " movel a2,d0;" /* calculate number of bytes to copy*/
" addl "A4(___stk_argbytes)",d0| to new stackframe in d0;" " addl "A4(___stk_argbytes)",d0;"/* to new stackframe in d0*/
" addl d1,d0;" " addl d1,d0;"
" cmpl a1,d0 | never copy over the bottom of the stack;" " cmpl a1,d0;" /* never copy over the bottom of the stack*/
" jls l1;" " jls l1;"
" movel a1,d0;" " movel a1,d0;"
"l1: subl a0,d0 | copy;" "l1: subl a0,d0;" /* copy*/
" subl d0,sp;" " subl d0,sp;"
" movel sp,a1;" " movel sp,a1;"
" movel "A4(_SysBase)",a6;" " movel "A4(_SysBase)",a6;"
" jsr a6@(-0x270) | CopyMem(src:a0,dst:a1,siz:d0);" " jsr a6@(-0x270);" /* CopyMem(src:a0,dst:a1,siz:d0)*/
" movel a2,a0;" " movel a2,a0;"
" moveml a0@+,#0x4603;" " moveml a0@+,#0x4603;"
" movel sp,a0 | Prepare cleanup;" " movel sp,a0;" /* Prepare cleanup*/
" addl d1,a0;" " addl d1,a0;"
" movel #___stkrst_f,a0@(8:W);" " movel #___stkrst_f,a0@(8:W);"
" movel sp@+,a0;" " movel sp@+,a0;"
@@ -44,7 +44,7 @@ asm(
"___stkext:;" "___stkext:;"
" movel a0,sp@-;" " movel a0,sp@-;"
" moveml #0xf072,sp@- | preserves all registers;" " moveml #0xf072,sp@-;" /* preserves all registers*/
" movel "A4(___stk_safezone)",d3;" " movel "A4(___stk_safezone)",d3;"
" lea "A4(___stk_limit)",a2;" " lea "A4(___stk_limit)",a2;"
" lea "A4(___used_stack)",a3;" " lea "A4(___used_stack)",a3;"
@@ -52,53 +52,53 @@ asm(
" movel "A4(_SysBase)",a6;" " movel "A4(_SysBase)",a6;"
" movel d0,d2;" " movel d0,d2;"
" addl d3,d2;" " addl d3,d2;"
" addl "A4(___stk_argbytes)",d2| required stack;" " addl "A4(___stk_argbytes)",d2;"/* required stack*/
" movel a3@,d0 | Look for a spare stackframe;" " movel a3@,d0;" /* Look for a spare stackframe*/
" jeq l4;" " jeq l4;"
"l3: movel d0,a0;" "l3: movel d0,a0;"
" movel a0@,a3@ | Remove spare stackframe from list;" " movel a0@,a3@;" /* Remove spare stackframe from list*/
" movel a0@(8:W),d0 | Test spare stackframe;" " movel a0@(8:W),d0;" /* Test spare stackframe*/
" subl a0@(4:W),d0;" " subl a0@(4:W),d0;"
" cmpl d0,d2;" " cmpl d0,d2;"
" jls l7;" " jls l7;"
" moveq #20,d1 | Not big enough;" " moveq #20,d1;" /* Not big enough*/
" addl d1,d0;" " addl d1,d0;"
" movel a0,a1;" " movel a0,a1;"
" jsr a6@(-0xd2) | FreeMem(mem:a1,siz:d0);" " jsr a6@(-0xd2);" /* FreeMem(mem:a1,siz:d0)*/
" movel a3@,d0;" " movel a3@,d0;"
" jne l3;" " jne l3;"
"l4: moveq #20,d0;" "l4: moveq #20,d0;"
" addl d0,d2 | no more stackframes - allocate a new one;" " addl d0,d2;" /* no more stackframes - allocate a new one*/
" movel "A4(___stk_minframe)",d0;" " movel "A4(___stk_minframe)",d0;"
" cmpl d0,d2;" " cmpl d0,d2;"
" jge l5;" " jge l5;"
" movel d0,d2;" " movel d0,d2;"
"l5: movel d2,d0;" "l5: movel d2,d0;"
" moveql #1,d1 | MEMF_PUBLIC;" " moveql #1,d1;" /* MEMF_PUBLIC*/
" jsr a6@(-0xc6) | AllocMem(siz:d0,typ:d1);" " jsr a6@(-0xc6);" /* AllocMem(siz:d0,typ:d1) */
" movel d0,a0;" " movel d0,a0;"
" movel a0,d0;" " movel a0,d0;"
" jne l6;" " jne l6;"
" jbsr ___stkovf | allocation failed;" " jbsr ___stkovf;" /* allocation failed*/
"l6: moveq #20,d0;" "l6: moveq #20,d0;"
" addl a0,d0;" " addl a0,d0;"
" movel d0,a0@(4:W);" " movel d0,a0@(4:W);"
" addl a0,d2 | prepare new frame for use;" " addl a0,d2;" /* prepare new frame for use*/
" movel d2,a0@(8:W);" " movel d2,a0@(8:W);"
"l7: movel a3@-,a0@ | Add it to the used list;" "l7: movel a3@-,a0@;" /* Add it to the used list*/
" movel a0,a3@;" " movel a0,a3@;"
" addql #4,a0;" " addql #4,a0;"
" movel a2@,a0@(12:W);" " movel a2@,a0@(12:W);"
" movel a0@,a2@ | Prepare ___top_of_stackframe variable;" " movel a0@,a2@;" /* Prepare ___top_of_stackframe variable*/
" addl d3,a2@;" " addl d3,a2@;"
" lea a0@(4:W),a2;" " lea a0@(4:W),a2;"
" movel a2@+,a2@ | Prepare target sp;" " movel a2@+,a2@;" /* Prepare target sp*/
" jsr a6@(-0x2dc) | StackSwap(sss:a0);" " jsr a6@(-0x2dc);" /* StackSwap(sss:a0)*/
" moveq #40,d0;" " moveq #40,d0;"
" movel a2@,a0;" " movel a2@,a0;"
" addl d0,a2@ | Fix stored sp;" " addl d0,a2@;" /* Fix stored sp*/
" moveml a0@+,#0x4e0f;" " moveml a0@+,#0x4e0f;"
" movel a0@(4:W),sp@- | prepare returnaddress;" " movel a0@(4:W),sp@-;" /* prepare returnaddress*/
" movel a0@,a0;" " movel a0@,a0;"
" rts;" " rts;"
@@ -106,29 +106,29 @@ asm(
" tstl "A4(___used_stack)";" " tstl "A4(___used_stack)";"
" jeq ___stk_free;" " jeq ___stk_free;"
" lea sp@(12:W),a0;" " lea sp@(12:W),a0;"
" movel "A4(___SaveSP)",d0 | Go back to first stackframe;" " movel "A4(___SaveSP)",d0;" /* Go back to first stackframe*/
" jbsr ___stkrst;" " jbsr ___stkrst;"
" movel a0@,sp@- | restore argument of exit();" " movel a0@,sp@-;" /* restore argument of exit()*/
" movel a0@-,sp@- | returnaddress for exit();" " movel a0@-,sp@-;" /* returnaddress for exit()*/
" movel a0@-,sp@- | returnaddress for callfuncs();" " movel a0@-,sp@-;" /* returnaddress for callfuncs()*/
" movel a0@-,sp@- | our returnaddress;" " movel a0@-,sp@-;" /* our returnaddress */
"| jbsr ___stk_free;" " jbsr ___stk_free;"
"| rts;" " rts;"
"___stk_free:;" "___stk_free:;"
" movel a2,sp@-;" " movel a2,sp@-;"
" movel a6,sp@- | Free all unused stackframes;" " movel a6,sp@-;" /* Free all unused stackframes*/
" movel "A4(_SysBase)",a6;" " movel "A4(_SysBase)",a6;"
" lea "A4(___used_stack)",a2;" " lea "A4(___used_stack)",a2;"
" addql #4,a2;" " addql #4,a2;"
" movel a2@,d0 | Remove spare stackframe from list;" " movel a2@,d0;" /* Remove spare stackframe from list*/
" jeq l9;" " jeq l9;"
"l8: movel d0,a1;" "l8: movel d0,a1;"
" movel a1@,a2@;" " movel a1@,a2@;"
" moveq #20,d0;" " moveq #20,d0;"
" addl a1@(8:W),d0 | Calculate size;" " addl a1@(8:W),d0;" /* Calculate size*/
" subl a1@(4:W),d0;" " subl a1@(4:W),d0;"
" jsr a6@(-0xd2) | FreeMem(mem:a1,siz:d0);" " jsr a6@(-0xd2);" /* FreeMem(mem:a1,siz:d0)*/
" movel a2@,d0;" " movel a2@,d0;"
" jne l8;" " jne l8;"
"l9: movel sp@+,a6;" "l9: movel sp@+,a6;"
+1 -1
View File
@@ -6,6 +6,6 @@ asm(
" .globl ___stkovf;" " .globl ___stkovf;"
"___stkovf:;" "___stkovf:;"
" clrl "A4(___stk_limit)" | generate no more stackoverflows;" " clrl "A4(___stk_limit)";" /* generate no more stackoverflows */
" jra __XCOVF;" " jra __XCOVF;"
); );
+19 -18
View File
@@ -20,26 +20,26 @@ asm(
"| the current register set on top of the free stack. NEVER set a sp higher" "| the current register set on top of the free stack. NEVER set a sp higher"
"| than the location of important data." "| than the location of important data."
"|" "|"
" .comm ___used_stack,8 | pointer to used stackframes," " .comm ___used_stack,8;" /* pointer to used stackframes */
" | pointer to unused stackframes" /* pointer to unused stackframes */
" .text;" " .text;"
" .even;" " .even;"
" .globl ___stkrst;" " .globl ___stkrst;"
"__stkrst:;" "__stkrst:;"
" exg d0,a3 | better use an address register;" " exg d0,a3;" /* better use an address register*/
" movel a2,sp@-;" " movel a2,sp@-;"
" moveml d0/d1/a0/a1/a5/a6,sp@-;" " moveml d0/d1/a0/a1/a5/a6,sp@-;"
" movel sp,a2;" " movel sp,a2;"
" lea "A4(___used_stack)",a5;" " lea "A4(___used_stack)",a5;"
" tstl a5@;" " tstl a5@;"
" jeq l0 | No previous stackframe;" " jeq l0;" /* No previous stackframe*/
"l2: movel "A4(___stackborders)",a0;" "l2: movel "A4(___stackborders)",a0;"
" cmpl a0@,a3;" " cmpl a0@,a3;"
" jcs l1;" " jcs l1;"
" cmpl a0@(4:W),a3;" " cmpl a0@(4:W),a3;"
" jle l0 | Stackpointer points to current frame;" " jle l0;" /* Stackpointer points to current frame*/
"l1: movel "A4(_SysBase)",a6 | Go to previous stack;" "l1: movel "A4(_SysBase)",a6;" /* Go to previous stack*/
" movel a5,a1;" " movel a5,a1;"
" movel a1@,a0;" " movel a1@,a0;"
" movel a0@,a1@+;" " movel a0@,a1@+;"
@@ -47,20 +47,21 @@ asm(
" movel a0,a1@;" " movel a0,a1@;"
" addql #4,a0;" " addql #4,a0;"
" movel a0@(12:W),"A4(___stk_limit)";" " movel a0@(12:W),"A4(___stk_limit)";"
" jsr a6@(-0x2dc) | StackSwap(sss:a0);" " jsr a6@(-0x2dc);" /* StackSwap(sss:a0)*/
" tstl a5@;" " tstl a5@;"
" jne l2;" " jne l2;"
"l0: moveml a2@+,d0/d1/a0/a1/a5/a6 | Restore registers;" "l0: moveml a2@+,d0/d1/a0/a1/a5/a6;" /* Restore registers*/
" movel a2@(4:W),sp@- | preserve returnaddress on current stackframe;" " movel a2@(4:W),sp@-;" /* preserve returnaddress on current stackframe*/
" movel a2@,a2 | be careful to not clobber any registers now;" " movel a2@,a2;" /* be careful to not clobber any registers now*/
" cmpl sp,a3 | Depending on whether sp moves up or down;" " cmpl sp,a3;" /* Depending on whether sp moves up or down*/
" jls l3 | use one of two possible routines;" " jls l3;" /* use one of two possible routines*/
" movel sp@,a3@- | moves up (pop): copy returnaddress first;" " movel sp@,a3@-;" /* moves up (pop): copy returnaddress first*/
" movel a3,sp | then set sp;" " movel a3,sp;" /* then set sp*/
" jra l4;" " jra l4;"
"l3: exg a3,sp | moves down (push): set sp first;" "l3: exg a3,sp;" /* moves down (push): set sp first*/
" movel a3@,sp@- | then copy returnaddress;" " movel a3@,sp@-;" /* then copy returnaddress*/
" movel sp,a3;" "l4: exg d0,a3 | move back;" " movel sp,a3;"
" addql #4,d0 | compensate for returnaddress;" "l4: exg d0,a3;" /* move back*/
" addql #4,d0;" /* compensate for returnaddress*/
" rts;" " rts;"
); );
+4 -4
View File
@@ -7,17 +7,17 @@ asm(
"___stkrst_f:;" "___stkrst_f:;"
" movel a2,sp@-;" " movel a2,sp@-;"
" moveml #0xc0c2,sp@- | Preserve all registers;" " moveml #0xc0c2,sp@-;" /* Preserve all registers; */
" movel sp,a2;" " movel sp,a2;"
" lea "A4(___used_stack)",a1 | Move current stackframe to the spares list;" " lea "A4(___used_stack)",a1;" /* Move current stackframe to the spares list */
" movel a1@,a0;" " movel a1@,a0;"
" movel a0@,a1@+;" " movel a0@,a1@+;"
" movel a1@,a0@;" " movel a1@,a0@;"
" movel a0,a1@;" " movel a0,a1@;"
" addql #4,a0 | Return to old stackframe;" " addql #4,a0;" /* Return to old stackframe */
" movel a0@(12:W),"A4(___stk_limit)";" " movel a0@(12:W),"A4(___stk_limit)";"
" movel "A4(_SysBase)",a6;" " movel "A4(_SysBase)",a6;"
" jsr a6@(-0x2dc) | StackSwap(sss:a0);" " jsr a6@(-0x2dc);" /* StackSwap(sss:a0) */
" moveml a2@+,#0x4303;" " moveml a2@+,#0x4303;"
" movel a2@,a2;" " movel a2@,a2;"
" rts;" " rts;"
+2 -2
View File
@@ -38,9 +38,9 @@ asm(
" rts;" " rts;"
"error:" "error:"
" movel a0,sp@-;" " movel a0,sp@-;"
" jsr ___request; | jbsr translates to jra which doesn't work on 68000;" " jsr ___request;" /* jbsr translates to jra which doesn't work on 68000 */
" pea 20:W;" " pea 20:W;"
" jsr _exit; | dito" " jsr _exit;" /* dito */
); );
ADD2INIT(__cpucheck,-80); /* Highest priority */ ADD2INIT(__cpucheck,-80); /* Highest priority */