made return value of topsize an unsigned. Some 2/4 back-ends do

not implement BLS 4
This commit is contained in:
ceriel 1989-03-10 14:03:34 +00:00
parent 162b824030
commit 183942e70c
2 changed files with 20 additions and 26 deletions

View file

@ -19,20 +19,16 @@
#include <m2_traps.h>
#if EM_WSIZE == EM_PSIZE
#define ptrsiz unsigned
#else
#define ptrsiz unsigned long
#endif
#define MAXMAIN 2048
struct proc {
ptrsiz size; /* size of saved stackframe(s) */
unsigned size; /* size of saved stackframe(s) */
int (*proc)(); /* address of coroutine procedure */
char *brk; /* stack break of this coroutine */
};
extern unsigned topsize();
static struct proc mainproc[MAXMAIN/sizeof(struct proc) + 1];
static struct proc *curproc = 0;/* current coroutine */
@ -54,7 +50,7 @@ _SYSTEM__NEWPROCESS(p, a, n, p1)
must be level 0 procedures without parameters.
*/
char *brk = 0;
ptrsiz sz = topsize(&brk);
unsigned sz = topsize(&brk);
if (sz + sizeof(struct proc) > n) {
/* not enough space */
@ -86,7 +82,7 @@ _SYSTEM__TRANSFER(a, b)
descriptor in the space indicated by "a", and transfering to
the coroutine in descriptor "b".
*/
ptrsiz size;
unsigned size;
if (! curproc) {
/* the current coroutine is the main process;

View file

@ -21,7 +21,7 @@
; This implementation assumes a continuous stack growing downwards
exp $topsize
pro $topsize, 2*EM_WSIZE+4*EM_PSIZE
pro $topsize, 3*EM_WSIZE+3*EM_PSIZE
; local space for line-number, ignoremask, filename, stack-break, size,
; and stack-pointer (see the topsave routine)
mes 11
@ -46,9 +46,9 @@
; the whole frame.
lor 1 ; stack-break SP
sbs EM_PSIZE ; stack-break-SP
ret EM_PSIZE ; return size of block to be saved
end 2*EM_WSIZE+4*EM_PSIZE
sbs EM_WSIZE ; stack-break-SP
ret EM_WSIZE ; return size of block to be saved
end 3*EM_WSIZE+3*EM_PSIZE
exp $topsave
pro $topsave, 0
@ -62,20 +62,18 @@
loi EM_PSIZE ; stack-break
lpb
lor 1
sbs EM_PSIZE
loc EM_PSIZE
adu EM_PSIZE ; gives size
dup EM_PSIZE
lal 0
sti EM_PSIZE ; save size
sbs EM_WSIZE
loc EM_WSIZE
adu EM_WSIZE ; gives size
dup EM_WSIZE
stl 0 ; save size
lor 1 ; SP (the SP BEFORE pushing)
lor 1 ; SP (address of stack top to save)
lal EM_PSIZE ; area
loi EM_PSIZE
lal 0 ; size
loi EM_PSIZE
bls EM_PSIZE ; move whole block
asp 4*EM_PSIZE+2*EM_WSIZE ; remove the lot from the stack
lol 0 ; size
bls EM_WSIZE ; move whole block
asp 3*EM_PSIZE+3*EM_WSIZE ; remove the lot from the stack
loc 1
ret EM_WSIZE ; return 1
end 0
@ -117,10 +115,10 @@ sv
lae sv
loi EM_PSIZE
adp EM_PSIZE
loi EM_PSIZE ; size of block
bls EM_PSIZE ; move block back (SP becomes the SP AFTER again,
loi EM_WSIZE ; size of block
bls EM_WSIZE ; move block back (SP becomes the SP AFTER again,
; because of the asp -EM_PSIZE!)
asp 2*EM_PSIZE ; drop size + SP
asp EM_PSIZE+EM_WSIZE ; drop size + SP
str 0 ; restore local base
sim ; ignore mask
lae 4