many speed-up changes, resulting in 20-25% speedup, and fixed

serious floating point handling bug
This commit is contained in:
ceriel 1989-11-13 15:36:12 +00:00
parent 776233c718
commit 3868470366
21 changed files with 251 additions and 193 deletions

View file

@ -1,3 +1,10 @@
13-Nov-89 Ceriel Jacobs (ceriel) at ceriel
Many changes for speed-up (resulting speed-up: 20-25%).
Also fixed serious problem in floating point handling: the existing
code assumed that the low order 4 bytes of a double could be used as
a float (4 bytes). This is NOT true for most floating point
implementations, notably IEEE ones.
3-Oct-88 Dick Grune (dick) at dick 3-Oct-88 Dick Grune (dick) at dick
Since the definitions of VERSION and MAGIC are now available from Since the definitions of VERSION and MAGIC are now available from
standard include files, e.out.h can be simplified. standard include files, e.out.h can be simplified.

View file

@ -60,7 +60,7 @@ newHP(ap)
if (in_stack(p)) { if (in_stack(p)) {
wtrap(WHPSTACK, EHEAP); wtrap(WHPSTACK, EHEAP);
} }
if (!is_aligned(p, wsize)) { if (!is_wordaligned(p)) {
wtrap(WHPODD, EHEAP); wtrap(WHPODD, EHEAP);
} }
if (maxheap) { if (maxheap) {
@ -99,61 +99,61 @@ newHP(ap)
************************************************************************/ ************************************************************************/
dt_stdp(addr, ap) dt_stdp(addr, ap)
ptr addr, ap; register ptr addr;
ptr ap;
{ {
register int i; register int i;
register long p = (long) ap; register long p = (long) ap;
LOG(("@g6 dt_stdp(%lu, %lu)", addr, p)); LOG(("@g6 dt_stdp(%lu, %lu)", addr, p));
ch_in_data(addr, psize); ch_in_data(addr, psize);
ch_aligned(addr, wsize); ch_wordaligned(addr);
for (i = 0; i < (int) psize; i++) { for (i = (int) psize; i > 0; i--, addr++) {
ch_dt_prot(addr + i); ch_dt_prot(addr);
data_loc(addr + i) = (char) (p); data_loc(addr) = (char) (p);
dt_dp(addr + i); dt_dp(addr);
p = p>>8; p = p>>8;
} }
} }
dt_stip(addr, ap) dt_stip(addr, ap)
ptr addr, ap; register ptr addr;
ptr ap;
{ {
register int i; register int i;
register long p = (long) ap; register long p = (long) ap;
LOG(("@g6 dt_stip(%lu, %lu)", addr, p)); LOG(("@g6 dt_stip(%lu, %lu)", addr, p));
ch_in_data(addr, psize); ch_in_data(addr, psize);
ch_aligned(addr, wsize); ch_wordaligned(addr);
for (i = 0; i < (int) psize; i++) { for (i = (int) psize; i > 0; i--, addr++) {
ch_dt_prot(addr + i); ch_dt_prot(addr);
data_loc(addr + i) = (char) (p); data_loc(addr) = (char) (p);
dt_ip(addr + i); dt_ip(addr);
p = p>>8; p = p>>8;
} }
} }
dt_stn(addr, al, n) dt_stn(addr, al, n)
ptr addr; register ptr addr;
long al; long al;
size n; size n;
{ {
register int i; register int i;
register long l = al; register long l = al;
#ifdef LOGGING
/* a psize zero is ambiguous */
int sh_flags = (l == 0 && n == psize) ? (SH_INT|SH_DATAP) : SH_INT;
#endif LOGGING
LOG(("@g6 dt_stn(%lu, %lu, %lu)", addr, l, n)); LOG(("@g6 dt_stn(%lu, %lu, %lu)", addr, l, n));
ch_in_data(addr, n); ch_in_data(addr, n);
ch_aligned(addr, n); ch_aligned(addr, n);
for (i = 0; i < (int) n; i++) { for (i = (int) n; i > 0; i--, addr++) {
ch_dt_prot(addr + i); ch_dt_prot(addr);
data_loc(addr + i) = (char) l; data_loc(addr) = (char) l;
#ifdef LOGGING #ifdef LOGGING
if (al == 0 && n == psize) { dt_sh(addr) = sh_flags;
/* a psize zero, ambiguous */
dt_sh(addr + i) = (SH_INT|SH_DATAP);
}
else {
dt_sh(addr + i) = SH_INT;
}
#endif LOGGING #endif LOGGING
l = l>>8; l = l>>8;
} }
@ -161,20 +161,25 @@ dt_stn(addr, al, n)
#ifndef NOFLOAT #ifndef NOFLOAT
dt_stf(addr, f, n) dt_stf(addr, f, n)
ptr addr; register ptr addr;
double f; double f;
size n; register size n;
{ {
register char *cp = (char *) &f; register char *cp = (char *) &f;
register int i; register int i;
float fl;
LOG(("@g6 dt_stf(%lu, %g, %lu)", addr, f, n)); LOG(("@g6 dt_stf(%lu, %g, %lu)", addr, f, n));
ch_in_data(addr, n); ch_in_data(addr, n);
ch_aligned(addr, wsize); ch_wordaligned(addr);
for (i = 0; i < (int) n; i++) { if ((int) n == 4) {
ch_dt_prot(addr + i); fl = f;
data_loc(addr + i) = *cp++; cp = (char *) &fl;
dt_fl(addr + i); }
for (i = (int) n; i > 0; i--, addr++) {
ch_dt_prot(addr);
data_loc(addr) = *cp++;
dt_fl(addr);
} }
} }
#endif NOFLOAT #endif NOFLOAT
@ -191,14 +196,14 @@ dt_stf(addr, f, n)
************************************************************************/ ************************************************************************/
ptr dt_lddp(addr) ptr dt_lddp(addr)
ptr addr; register ptr addr;
{ {
register ptr p; register ptr p;
LOG(("@g6 dt_lddp(%lu)", addr)); LOG(("@g6 dt_lddp(%lu)", addr));
ch_in_data(addr, psize); ch_in_data(addr, psize);
ch_aligned(addr, wsize); ch_wordaligned(addr);
#ifdef LOGGING #ifdef LOGGING
if (!is_dt_set(addr, psize, SH_DATAP)) { if (!is_dt_set(addr, psize, SH_DATAP)) {
warning(WGDPEXP); warning(WGDPEXP);
@ -212,14 +217,14 @@ ptr dt_lddp(addr)
} }
ptr dt_ldip(addr) ptr dt_ldip(addr)
ptr addr; register ptr addr;
{ {
register ptr p; register ptr p;
LOG(("@g6 dt_ldip(%lu)", addr)); LOG(("@g6 dt_ldip(%lu)", addr));
ch_in_data(addr, psize); ch_in_data(addr, psize);
ch_aligned(addr, wsize); ch_wordaligned(addr);
#ifdef LOGGING #ifdef LOGGING
if (!is_dt_set(addr, psize, SH_INSP)) { if (!is_dt_set(addr, psize, SH_INSP)) {
warning(WGIPEXP); warning(WGIPEXP);
@ -233,7 +238,7 @@ ptr dt_ldip(addr)
} }
unsigned long dt_ldu(addr, n) unsigned long dt_ldu(addr, n)
ptr addr; register ptr addr;
size n; size n;
{ {
register int i; register int i;
@ -258,7 +263,7 @@ unsigned long dt_ldu(addr, n)
} }
long dt_lds(addr, n) long dt_lds(addr, n)
ptr addr; register ptr addr;
size n; size n;
{ {
register int i; register int i;
@ -295,42 +300,42 @@ long dt_lds(addr, n)
************************************************************************/ ************************************************************************/
dt_mvd(d2, d1, n) /* d1 -> d2 */ dt_mvd(d2, d1, n) /* d1 -> d2 */
ptr d2, d1; register ptr d2, d1;
size n; size n;
{ {
register int i; register int i;
ch_in_data(d1, n); ch_in_data(d1, n);
ch_aligned(d1, wsize); ch_wordaligned(d1);
ch_in_data(d2, n); ch_in_data(d2, n);
ch_aligned(d2, wsize); ch_wordaligned(d2);
for (i = 0; i < (int) n; i++) { for (i = (int) n; i > 0; i--, d1++, d2++) {
ch_dt_prot(d2 + i); ch_dt_prot(d2);
data_loc(d2 + i) = data_loc(d1 + i); data_loc(d2) = data_loc(d1);
#ifdef LOGGING #ifdef LOGGING
dt_sh(d2 + i) = dt_sh(d1 + i) & ~SH_PROT; dt_sh(d2) = dt_sh(d1) & ~SH_PROT;
#endif LOGGING #endif LOGGING
} }
} }
dt_mvs(d, s, n) /* s -> d */ dt_mvs(d, s, n) /* s -> d */
ptr d, s; register ptr d, s;
size n; size n;
{ {
register int i; register int i;
ch_in_stack(s, n); ch_in_stack(s, n);
ch_aligned(s, wsize); ch_wordaligned(s);
ch_in_data(d, n); ch_in_data(d, n);
ch_aligned(d, wsize); ch_wordaligned(d);
for (i = 0; i < (int) n; i++) { for (i = (int) n; i > 0; i--, d++, s++) {
ch_dt_prot(d + i); ch_dt_prot(d);
ch_st_prot(s + i); ch_st_prot(s);
data_loc(d + i) = stack_loc(s + i); data_loc(d) = stack_loc(s);
#ifdef LOGGING #ifdef LOGGING
dt_sh(d + i) = st_sh(s + i) & ~SH_PROT; dt_sh(d) = st_sh(s) & ~SH_PROT;
#endif LOGGING #endif LOGGING
} }
} }
@ -338,8 +343,8 @@ dt_mvs(d, s, n) /* s -> d */
#ifdef LOGGING #ifdef LOGGING
PRIVATE warn_dtbits(addr, n) PRIVATE warn_dtbits(addr, n)
ptr addr; register ptr addr;
size n; register size n;
{ {
register int or_bits = 0; register int or_bits = 0;
register int and_bits = 0xff; register int and_bits = 0xff;

View file

@ -32,7 +32,7 @@ DoCMIl2(arg)
LOG(("@T6 DoCMIl2(%ld)", l)); LOG(("@T6 DoCMIl2(%ld)", l));
spoilFRA(); spoilFRA();
npush((long)(t < s ? 1 : t > s ? -1 : 0), wsize); wpush((long)(t < s ? 1 : t > s ? -1 : 0));
} }
DoCMIm(arg) DoCMIm(arg)
@ -45,7 +45,7 @@ DoCMIm(arg)
LOG(("@T6 DoCMIm(%ld)", l)); LOG(("@T6 DoCMIm(%ld)", l));
spoilFRA(); spoilFRA();
npush((long)(t < s ? 1 : t > s ? -1 : 0), wsize); wpush((long)(t < s ? 1 : t > s ? -1 : 0));
} }
DoCMIz() DoCMIz()
@ -57,7 +57,7 @@ DoCMIz()
LOG(("@T6 DoCMIz(%ld)", l)); LOG(("@T6 DoCMIz(%ld)", l));
spoilFRA(); spoilFRA();
npush((long)(t < s ? 1 : t > s ? -1 : 0), wsize); wpush((long)(t < s ? 1 : t > s ? -1 : 0));
} }
DoCMFl2(arg) DoCMFl2(arg)
@ -71,7 +71,7 @@ DoCMFl2(arg)
LOG(("@T6 DoCMFl2(%ld)", l)); LOG(("@T6 DoCMFl2(%ld)", l));
spoilFRA(); spoilFRA();
npush((long)(t < s ? 1 : t > s ? -1 : 0), wsize); wpush((long)(t < s ? 1 : t > s ? -1 : 0));
#else NOFLOAT #else NOFLOAT
arg = arg; arg = arg;
nofloat(); nofloat();
@ -90,7 +90,7 @@ DoCMFs(hob, wfac)
LOG(("@T6 DoCMFs(%ld)", l)); LOG(("@T6 DoCMFs(%ld)", l));
spoilFRA(); spoilFRA();
npush((long)(t < s ? 1 : t > s ? -1 : 0), wsize); wpush((long)(t < s ? 1 : t > s ? -1 : 0));
#else NOFLOAT #else NOFLOAT
hob = hob; hob = hob;
wfac = wfac; wfac = wfac;
@ -108,7 +108,7 @@ DoCMFz()
LOG(("@T6 DoCMFz(%ld)", l)); LOG(("@T6 DoCMFz(%ld)", l));
spoilFRA(); spoilFRA();
npush((long)(t < s ? 1 : t > s ? -1 : 0), wsize); wpush((long)(t < s ? 1 : t > s ? -1 : 0));
#else NOFLOAT #else NOFLOAT
nofloat(); nofloat();
#endif NOFLOAT #endif NOFLOAT
@ -124,7 +124,7 @@ DoCMUl2(arg)
LOG(("@T6 DoCMUl2(%ld)", l)); LOG(("@T6 DoCMUl2(%ld)", l));
spoilFRA(); spoilFRA();
npush((long)(t < s ? 1 : t > s ? -1 : 0), wsize); wpush((long)(t < s ? 1 : t > s ? -1 : 0));
} }
DoCMUz() DoCMUz()
@ -136,7 +136,7 @@ DoCMUz()
LOG(("@T6 DoCMUz(%ld)", l)); LOG(("@T6 DoCMUz(%ld)", l));
spoilFRA(); spoilFRA();
npush((long)(t < s ? 1 : t > s ? -1 : 0), wsize); wpush((long)(t < s ? 1 : t > s ? -1 : 0));
} }
DoCMSl2(arg) DoCMSl2(arg)
@ -181,7 +181,7 @@ DoCMPz()
spoilFRA(); spoilFRA();
t = dppop(); t = dppop();
s = dppop(); s = dppop();
npush((long)(t < s ? 1 : t > s ? -1 : 0), wsize); wpush((long)(t < s ? 1 : t > s ? -1 : 0));
} }
DoTLTz() DoTLTz()
@ -189,7 +189,7 @@ DoTLTz()
/* TLT -: True if less, i.e. iff top of stack < 0 */ /* TLT -: True if less, i.e. iff top of stack < 0 */
LOG(("@T6 DoTLTz()")); LOG(("@T6 DoTLTz()"));
spoilFRA(); spoilFRA();
npush((long)(wpop() < 0 ? 1 : 0), wsize); wpush((long)(wpop() < 0 ? 1 : 0));
} }
DoTLEz() DoTLEz()
@ -197,7 +197,7 @@ DoTLEz()
/* TLE -: True if less or equal, i.e. iff top of stack <= 0 */ /* TLE -: True if less or equal, i.e. iff top of stack <= 0 */
LOG(("@T6 DoTLEz()")); LOG(("@T6 DoTLEz()"));
spoilFRA(); spoilFRA();
npush((long)(wpop() <= 0 ? 1 : 0), wsize); wpush((long)(wpop() <= 0 ? 1 : 0));
} }
DoTEQz() DoTEQz()
@ -205,7 +205,7 @@ DoTEQz()
/* TEQ -: True if equal, i.e. iff top of stack = 0 */ /* TEQ -: True if equal, i.e. iff top of stack = 0 */
LOG(("@T6 DoTEQz()")); LOG(("@T6 DoTEQz()"));
spoilFRA(); spoilFRA();
npush((long)(wpop() == 0 ? 1 : 0), wsize); wpush((long)(wpop() == 0 ? 1 : 0));
} }
DoTNEz() DoTNEz()
@ -213,7 +213,7 @@ DoTNEz()
/* TNE -: True if not equal, i.e. iff top of stack non zero */ /* TNE -: True if not equal, i.e. iff top of stack non zero */
LOG(("@T6 DoTNEz()")); LOG(("@T6 DoTNEz()"));
spoilFRA(); spoilFRA();
npush((long)(wpop() != 0 ? 1 : 0), wsize); wpush((long)(wpop() != 0 ? 1 : 0));
} }
DoTGEz() DoTGEz()
@ -221,7 +221,7 @@ DoTGEz()
/* TGE -: True if greater or equal, i.e. iff top of stack >= 0 */ /* TGE -: True if greater or equal, i.e. iff top of stack >= 0 */
LOG(("@T6 DoTGEz()")); LOG(("@T6 DoTGEz()"));
spoilFRA(); spoilFRA();
npush((long)(wpop() >= 0 ? 1 : 0), wsize); wpush((long)(wpop() >= 0 ? 1 : 0));
} }
DoTGTz() DoTGTz()
@ -229,7 +229,7 @@ DoTGTz()
/* TGT -: True if greater, i.e. iff top of stack > 0 */ /* TGT -: True if greater, i.e. iff top of stack > 0 */
LOG(("@T6 DoTGTz()")); LOG(("@T6 DoTGTz()"));
spoilFRA(); spoilFRA();
npush((long)(wpop() > 0 ? 1 : 0), wsize); wpush((long)(wpop() > 0 ? 1 : 0));
} }
/******************************************************** /********************************************************
@ -267,5 +267,5 @@ PRIVATE compare_obj(obj_size)
} }
} }
st_dec(2 * obj_size); st_dec(2 * obj_size);
npush((long) comp_res, wsize); wpush((long) comp_res);
} }

View file

@ -461,7 +461,7 @@ PRIVATE fef(f, n)
f *= 2.0; f *= 2.0;
fpush((sign) ? -f : f, n); /* push mantissa */ fpush((sign) ? -f : f, n); /* push mantissa */
npush(exponent, wsize); /* push exponent */ wpush(exponent); /* push exponent */
} }
/* floating point service routines, to avoid having to use -lm */ /* floating point service routines, to avoid having to use -lm */

View file

@ -21,7 +21,7 @@ DoINCz()
/* INC -: Increment word on top of stack by 1 (*) */ /* INC -: Increment word on top of stack by 1 (*) */
LOG(("@Z6 DoINCz()")); LOG(("@Z6 DoINCz()"));
spoilFRA(); spoilFRA();
npush(inc(spop(wsize)), wsize); wpush(inc(spop(wsize)));
} }
DoINLm(arg) DoINLm(arg)
@ -150,7 +150,7 @@ DoDECz()
/* DEC -: Decrement word on top of stack by 1 (*) */ /* DEC -: Decrement word on top of stack by 1 (*) */
LOG(("@Z6 DoDECz()")); LOG(("@Z6 DoDECz()"));
spoilFRA(); spoilFRA();
npush(dec(spop(wsize)), wsize); wpush(dec(spop(wsize)));
} }
DoDELn2(arg) DoDELn2(arg)
@ -406,7 +406,7 @@ DoZERl2(arg)
LOG(("@Z6 DoZERl2(%ld)", l)); LOG(("@Z6 DoZERl2(%ld)", l));
spoilFRA(); spoilFRA();
for (i = arg_w(l); i; i -= wsize) for (i = arg_w(l); i; i -= wsize)
npush(0L, wsize); wpush(0L);
} }
DoZERs(hob, wfac) DoZERs(hob, wfac)
@ -419,7 +419,7 @@ DoZERs(hob, wfac)
LOG(("@Z6 DoZERs(%ld)", l)); LOG(("@Z6 DoZERs(%ld)", l));
spoilFRA(); spoilFRA();
for (i = arg_w(l); i; i -= wsize) for (i = arg_w(l); i; i -= wsize)
npush(0L, wsize); wpush(0L);
} }
DoZERz() DoZERz()
@ -430,7 +430,7 @@ DoZERz()
LOG(("@Z6 DoZERz(%ld)", l)); LOG(("@Z6 DoZERz(%ld)", l));
spoilFRA(); spoilFRA();
for (i = arg_w(l); i; i -= wsize) for (i = arg_w(l); i; i -= wsize)
npush(0L, wsize); wpush(0L);
} }
PRIVATE long inc(l) PRIVATE long inc(l)

View file

@ -24,7 +24,7 @@ DoLOCl2(arg)
LOG(("@L6 DoLOCl2(%ld)", l)); LOG(("@L6 DoLOCl2(%ld)", l));
spoilFRA(); spoilFRA();
npush(arg_c(l), wsize); wpush(arg_c(l));
} }
DoLOCl4(arg) DoLOCl4(arg)
@ -35,7 +35,7 @@ DoLOCl4(arg)
LOG(("@L6 DoLOCl4(%ld)", l)); LOG(("@L6 DoLOCl4(%ld)", l));
spoilFRA(); spoilFRA();
npush(arg_c(l), wsize); wpush(arg_c(l));
} }
DoLOCm(arg) DoLOCm(arg)
@ -46,7 +46,7 @@ DoLOCm(arg)
LOG(("@L6 DoLOCm(%ld)", l)); LOG(("@L6 DoLOCm(%ld)", l));
spoilFRA(); spoilFRA();
npush(l, wsize); wpush(l);
} }
DoLOCs(hob, wfac) DoLOCs(hob, wfac)
@ -58,7 +58,7 @@ DoLOCs(hob, wfac)
LOG(("@L6 DoLOCs(%ld)", l)); LOG(("@L6 DoLOCs(%ld)", l));
spoilFRA(); spoilFRA();
npush(arg_c(l), wsize); wpush(arg_c(l));
} }
DoLDCl2(arg) DoLDCl2(arg)

View file

@ -402,7 +402,7 @@ DoLIMz()
/* LIM -: Load 16 bit ignore mask */ /* LIM -: Load 16 bit ignore mask */
LOG(("@M6 DoLIMz()")); LOG(("@M6 DoLIMz()"));
spoilFRA(); spoilFRA();
npush(IgnMask, wsize); wpush(IgnMask);
} }
DoLINl2(arg) DoLINl2(arg)

View file

@ -102,9 +102,9 @@ PRIVATE bit_test(w)
trap(ESET); trap(ESET);
} }
} }
test_byte = stack_loc(SP + (bitno / 8)); test_byte = stack_loc(SP + (bitno >> 3));
st_dec(w); st_dec(w);
npush((long)((test_byte & BIT(bitno % 8)) ? 1 : 0), wsize); wpush((long)((test_byte & BIT(bitno & 7)) ? 1 : 0));
} }
/******************************************************** /********************************************************
@ -132,6 +132,6 @@ PRIVATE create_set(w)
trap(ESET); trap(ESET);
} }
} }
st_stn(SP + (bitno / 8), (long)BIT(bitno % 8), 1L); st_stn(SP + (bitno >> 3), (long)BIT(bitno & 7), 1L);
} }

View file

@ -117,7 +117,7 @@ std_raw(addr, rawfl)
PRIVATE std_item(addr) PRIVATE std_item(addr)
ptr addr; ptr addr;
{ {
if ( is_aligned(addr, wsize) if ( is_wordaligned(addr)
&& is_in_stack(addr, psize) && is_in_stack(addr, psize)
&& std_bytes(addr, addr + psize, SH_DATAP|SH_INSP) && std_bytes(addr, addr + psize, SH_DATAP|SH_INSP)
) { ) {
@ -129,7 +129,7 @@ PRIVATE std_item(addr)
displ_sh(st_sh(addr), stack_loc(addr)))); displ_sh(st_sh(addr), stack_loc(addr))));
} }
else else
if ( is_aligned(addr, wsize) if ( is_wordaligned(addr)
&& is_in_stack(addr, wsize) && is_in_stack(addr, wsize)
&& std_bytes(addr, addr + wsize, SH_INT) && std_bytes(addr, addr + wsize, SH_INT)
) { ) {
@ -243,7 +243,7 @@ PRIVATE FRA_dump()
PRIVATE FRA_item(addr) PRIVATE FRA_item(addr)
int addr; int addr;
{ {
if ( is_aligned(addr, wsize) if ( is_wordaligned(addr)
&& is_in_FRA(addr, psize) && is_in_FRA(addr, psize)
&& FRAd_bytes(addr, (int)(addr + psize), SH_DATAP|SH_INSP) && FRAd_bytes(addr, (int)(addr + psize), SH_DATAP|SH_INSP)
) { ) {
@ -255,7 +255,7 @@ PRIVATE FRA_item(addr)
displ_sh(FRA_sh[addr], FRA[addr]))); displ_sh(FRA_sh[addr], FRA[addr])));
} }
else else
if ( is_aligned(addr, wsize) if ( is_wordaligned(addr)
&& is_in_FRA(addr, wsize) && is_in_FRA(addr, wsize)
&& FRAd_bytes(addr, (int)(addr + wsize), SH_INT) && FRAd_bytes(addr, (int)(addr + wsize), SH_INT)
) { ) {
@ -321,7 +321,7 @@ gdad_all(low, high)
PRIVATE gdad_item(addr) PRIVATE gdad_item(addr)
ptr addr; ptr addr;
{ {
if ( is_aligned(addr, wsize) if ( is_wordaligned(addr)
&& is_in_data(addr, psize) && is_in_data(addr, psize)
&& dtd_bytes(addr, addr + psize, SH_DATAP|SH_INSP) && dtd_bytes(addr, addr + psize, SH_DATAP|SH_INSP)
) { ) {
@ -333,7 +333,7 @@ PRIVATE gdad_item(addr)
displ_sh(dt_sh(addr), data_loc(addr)))); displ_sh(dt_sh(addr), data_loc(addr))));
} }
else else
if ( is_aligned(addr, wsize) if ( is_wordaligned(addr)
&& is_in_data(addr, wsize) && is_in_data(addr, wsize)
&& dtd_bytes(addr, addr + wsize, SH_INT) && dtd_bytes(addr, addr + wsize, SH_INT)
) { ) {
@ -411,7 +411,7 @@ hpd_all()
PRIVATE hpd_item(addr) PRIVATE hpd_item(addr)
ptr addr; ptr addr;
{ {
if ( is_aligned(addr, wsize) if ( is_wordaligned(addr)
&& is_in_data(addr, psize) && is_in_data(addr, psize)
&& dtd_bytes(addr, addr + psize, SH_DATAP|SH_INSP) && dtd_bytes(addr, addr + psize, SH_DATAP|SH_INSP)
) { ) {
@ -423,7 +423,7 @@ PRIVATE hpd_item(addr)
displ_sh(dt_sh(addr), data_loc(addr)))); displ_sh(dt_sh(addr), data_loc(addr))));
} }
else else
if ( is_aligned(addr, wsize) if ( is_wordaligned(addr)
&& is_in_data(addr, wsize) && is_in_data(addr, wsize)
&& dtd_bytes(addr, addr + wsize, SH_INT) && dtd_bytes(addr, addr + wsize, SH_INT)
) { ) {

View file

@ -19,6 +19,7 @@ unsigned long i_maxuw;
long min_off; long min_off;
long max_off; long max_off;
ptr max_addr; ptr max_addr;
size wsizem1;
/******** EM program parameters ********/ /******** EM program parameters ********/
@ -62,6 +63,7 @@ char *data;
ptr HL; ptr HL;
char *stack; char *stack;
char *stackML;
ptr SL; ptr SL;

View file

@ -91,6 +91,7 @@ extern unsigned long i_maxuw; /* Max. value for unsigned integer of wsize */
extern long min_off; /* Minimum offset */ extern long min_off; /* Minimum offset */
extern long max_off; /* Maximum offset */ extern long max_off; /* Maximum offset */
extern ptr max_addr; /* Maximum address */ extern ptr max_addr; /* Maximum address */
extern size wsizem1; /* wordsize - 1 */
/******** EM program parameters ********/ /******** EM program parameters ********/
@ -139,6 +140,7 @@ extern char *data; /* global data & heap space */
extern ptr HL; /* Heap Limit */ extern ptr HL; /* Heap Limit */
extern char *stack; /* stack space and local data */ extern char *stack; /* stack space and local data */
extern char *stackML; /* stack + ML, to speed up stack accesses */
extern ptr SL; /* Stack Limit */ extern ptr SL; /* Stack Limit */

View file

@ -134,7 +134,7 @@ init(ac, av)
} }
dt_stdp(vecp, i2p(0)); /* terminating zero */ dt_stdp(vecp, i2p(0)); /* terminating zero */
npush((long) ac, wsize); /* push argc */ wpush((long) ac); /* push argc */
} }
PRIVATE size alignedstrlen(s) PRIVATE size alignedstrlen(s)
@ -177,7 +177,7 @@ PRIVATE ptr storestring(addr, s)
#ifdef LOGGING #ifdef LOGGING
dt_clear_area(from, to) dt_clear_area(from, to)
ptr from; ptr from;
ptr to; register ptr to;
{ {
/* includes *from but excludes *to */ /* includes *from but excludes *to */
register ptr a; register ptr a;
@ -189,7 +189,7 @@ dt_clear_area(from, to)
st_clear_area(from, to) st_clear_area(from, to)
ptr from; ptr from;
ptr to; register ptr to;
{ {
/* includes both *from and *to (since ML+1 is unexpressible) */ /* includes both *from and *to (since ML+1 is unexpressible) */
register ptr a; register ptr a;

View file

@ -38,6 +38,15 @@ init_signals() {
for (sn = 0; sn < NSIG+1; sn++) { for (sn = 0; sn < NSIG+1; sn++) {
/* for all signals that would cause termination */ /* for all signals that would cause termination */
if (!UNIX_trap(sn)) { if (!UNIX_trap(sn)) {
#ifdef SIGCHLD
if (sn == SIGCHLD) continue;
#endif
#ifdef SIGIO
if (sn == SIGIO) continue;
#endif
#ifdef SIGWINCH
if (sn == SIGWINCH) continue;
#endif
if (signal(sn, SIG_IGN) != SIG_IGN) { if (signal(sn, SIG_IGN) != SIG_IGN) {
/* we take our fate in our own hand */ /* we take our fate in our own hand */
signal(sn, HndlIntSig); signal(sn, HndlIntSig);

View file

@ -8,7 +8,7 @@
/******** Memory address & location defines ********/ /******** Memory address & location defines ********/
#define data_loc(a) (*(data + (p2i(a)))) #define data_loc(a) (*(data + (p2i(a))))
#define stack_loc(a) (*(stack + (ML - (a)))) #define stack_loc(a) (*(stackML - (a)))
#define mem_loc(a) (in_stack(a) ? stack_loc(a) : data_loc(a)) #define mem_loc(a) (in_stack(a) ? stack_loc(a) : data_loc(a))
#define loc_addr(o) (((o) < 0) ? (LB + (o)) : (AB + (o))) #define loc_addr(o) (((o) < 0) ? (LB + (o)) : (AB + (o)))
@ -17,9 +17,12 @@
/******** Checks on adresses and ranges ********/ /******** Checks on adresses and ranges ********/
#define is_aligned(a,n) ((p2i(a)) % (n) == 0) #define is_aligned(a,n) ((p2i(a)) % (n) == 0)
#define is_wordaligned(a) (((p2i(a)) & wsizem1) == 0)
#define ch_aligned(a,n) { if (!is_aligned(a, min(n, wsize))) \ #define ch_aligned(a,n) { if (!is_aligned(a, min(n, wsize))) \
{ trap(EBADPTR); } } { trap(EBADPTR); } }
#define ch_wordaligned(a) { if (!is_wordaligned(a)) \
{ trap(EBADPTR); } }
#define in_gda(p) ((p) < HB) #define in_gda(p) ((p) < HB)
#define in_stack(p) (SP <= (p) && (p) <= ML) #define in_stack(p) (SP <= (p) && (p) <= ML)

View file

@ -78,7 +78,7 @@ extern void sync();
#define pop_unsp() ((unsigned int) upop(psize)) #define pop_unsp() ((unsigned int) upop(psize))
#define pop_ptr() (dppop()) #define pop_ptr() (dppop())
#define push_int(a) (npush((long)(a), wsize)) #define push_int(a) (wpush((long)(a)))
#define push_i2(a) (npush((long)(a), INT2SIZE)) #define push_i2(a) (npush((long)(a), INT2SIZE))
#define push_i4(a) (npush((long)(a), INT4SIZE)) #define push_i4(a) (npush((long)(a), INT4SIZE))
#define push_unsp(a) (npush((long)(a), psize)) #define push_unsp(a) (npush((long)(a), psize))

View file

@ -87,6 +87,7 @@ rd_header()
fatal("Bad wordsize in loadfile"); fatal("Bad wordsize in loadfile");
dwsize = 2 * wsize; /* set double wordsize */ dwsize = 2 * wsize; /* set double wordsize */
wsizem1 = wsize - 1; /* wordsize - 1 used often */
psize = rd_int(2L); psize = rd_int(2L);
if (!(psize == 2 || psize == 4) || psize < wsize) if (!(psize == 2 || psize == 4) || psize < wsize)
@ -195,9 +196,7 @@ rd_close()
* * * *
* A double is 8 bytes, so it can contain 4- and 8-byte (EM) * * A double is 8 bytes, so it can contain 4- and 8-byte (EM) *
* floating point numbers. That's why a 4-byte floating point * * floating point numbers. That's why a 4-byte floating point *
* number is also stored in a double. In this case only the * * number is also stored in a double. *
* the 4 LSB's are used. These bytes contain the most important *
* information, the MSB's are just for precision. *
************************************************************************/ ************************************************************************/
PRIVATE ptr rd_repeat(pos, count, prev_pos) PRIVATE ptr rd_repeat(pos, count, prev_pos)

View file

@ -10,6 +10,7 @@
extern char *data_sh; /* shadowbytes of data space */ extern char *data_sh; /* shadowbytes of data space */
extern char *stack_sh; /* shadowbytes of stack space */ extern char *stack_sh; /* shadowbytes of stack space */
extern char *stackML_sh; /* stack_sh + ML (to speed up stack access) */
/* Bit 0, 1, 2 and 3: datatype/pointertype. */ /* Bit 0, 1, 2 and 3: datatype/pointertype. */
@ -25,7 +26,7 @@ extern char *stack_sh; /* shadowbytes of stack space */
/******** Shadowbytes, general ********/ /******** Shadowbytes, general ********/
#define dt_sh(a) (*(data_sh + (p2i(a)))) #define dt_sh(a) (*(data_sh + (p2i(a))))
#define st_sh(a) (*(stack_sh + (ML - (a)))) #define st_sh(a) (*(stackML_sh - (a)))
#define mem_sh(a) (in_stack(a) ? st_sh(a) : dt_sh(a)) #define mem_sh(a) (in_stack(a) ? st_sh(a) : dt_sh(a))
/******** Shadowbytes settings for data ********/ /******** Shadowbytes settings for data ********/

View file

@ -25,6 +25,7 @@ extern size maxstack; /* from main.c */
#ifdef LOGGING #ifdef LOGGING
char *stack_sh; /* stadowbytes */ char *stack_sh; /* stadowbytes */
char *stackML_sh; /* speed up access of stadowbytes */
#endif LOGGING #endif LOGGING
PRIVATE warn_stbits(); PRIVATE warn_stbits();
@ -38,8 +39,10 @@ init_stack() {
SL = ML + 1 - STACKSIZE; /* initialize Stack Limit */ SL = ML + 1 - STACKSIZE; /* initialize Stack Limit */
stack = Malloc(STACKSIZE, "stack space"); stack = Malloc(STACKSIZE, "stack space");
stackML = stack + ML;
#ifdef LOGGING #ifdef LOGGING
stack_sh = Malloc(STACKSIZE, "shadowspace for stack"); stack_sh = Malloc(STACKSIZE, "shadowspace for stack");
stackML_sh = stack_sh + ML;
st_clear_area(ML, SL); st_clear_area(ML, SL);
#endif LOGGING #endif LOGGING
} }
@ -63,12 +66,13 @@ newSP(ap)
if (LB < p) { if (LB < p) {
wtrap(WSPGTLB, ESTACK); wtrap(WSPGTLB, ESTACK);
} }
if (!is_wordaligned(p)) {
wtrap(WSPODD, ESTACK);
}
if (p < SP) {
if (p < HP) { if (p < HP) {
wtrap(WSPINHEAP, ESTACK); wtrap(WSPINHEAP, ESTACK);
} }
if (!is_aligned(p, wsize)) {
wtrap(WSPODD, ESTACK);
}
if (maxstack) { if (maxstack) {
/* more than allowed on command line */ /* more than allowed on command line */
if (ML - p > maxstack) { if (ML - p > maxstack) {
@ -83,17 +87,18 @@ newSP(ap)
stacksize = allocfrac(stacksize); stacksize = allocfrac(stacksize);
SL = ML + 1 - stacksize; SL = ML + 1 - stacksize;
stack = Realloc(stack, (size)(stacksize), "stack space"); stack = Realloc(stack, (size)(stacksize), "stack space");
stackML = stack + ML;
#ifdef LOGGING #ifdef LOGGING
stack_sh = Realloc(stack_sh, (size)(stacksize), stack_sh = Realloc(stack_sh, (size)(stacksize),
"shadowspace for stack"); "shadowspace for stack");
stackML_sh = stack_sh + ML;
#endif LOGGING #endif LOGGING
} }
#ifdef LOGGING #ifdef LOGGING
if (!in_stack(p)) {
st_clear_area(SP - 1, p); st_clear_area(SP - 1, p);
}
#endif LOGGING #endif LOGGING
}
SP = p; SP = p;
} }
@ -103,7 +108,7 @@ newLB(p)
if (!in_stack(p)) { if (!in_stack(p)) {
wtrap(WLBOUT, ESTACK); wtrap(WLBOUT, ESTACK);
} }
if (!is_aligned(p, wsize)) { if (!is_wordaligned(p)) {
wtrap(WLBODD, ESTACK); wtrap(WLBODD, ESTACK);
} }
if (!is_LB(p)) { if (!is_LB(p)) {
@ -126,64 +131,64 @@ newLB(p)
************************************************************************/ ************************************************************************/
st_stdp(addr, ap) st_stdp(addr, ap)
ptr addr, ap; register ptr addr;
ptr ap;
{ {
register int i; register int i;
register long p = (long) ap; register long p = (long) ap;
LOG(("@s6 st_stdp(%lu, %lu)", addr, p)); LOG(("@s6 st_stdp(%lu, %lu)", addr, p));
ch_in_stack(addr, psize); ch_in_stack(addr, psize);
ch_aligned(addr, wsize); ch_wordaligned(addr);
for (i = 0; i < (int) psize; i++) { for (i = (int) psize; i > 0; i--, addr++) {
ch_st_prot(addr + i); ch_st_prot(addr);
stack_loc(addr + i) = (char) (p); stack_loc(addr) = (char) (p);
st_dp(addr + i); st_dp(addr);
p = p>>8; p = p>>8;
} }
} }
st_stip(addr, ap) st_stip(addr, ap)
ptr addr, ap; register ptr addr;
ptr ap;
{ {
register int i; register int i;
register long p = (long) ap; register long p = (long) ap;
LOG(("@s6 st_stip(%lu, %lu)", addr, p)); LOG(("@s6 st_stip(%lu, %lu)", addr, p));
ch_in_stack(addr, psize); ch_in_stack(addr, psize);
ch_aligned(addr, wsize); ch_wordaligned(addr);
for (i = 0; i < (int) psize; i++) { for (i = (int) psize; i > 0; i--, addr++) {
ch_st_prot(addr + i); ch_st_prot(addr);
stack_loc(addr + i) = (char) (p); stack_loc(addr) = (char) (p);
st_ip(addr + i); st_ip(addr);
p = p>>8; p = p>>8;
} }
} }
st_stn(addr, al, n) st_stn(addr, al, n)
ptr addr; register ptr addr;
long al; long al;
size n; size n;
{ {
register int i; register int i;
register long l = al; register long l = al;
#ifdef LOGGING
/* a psize zero is ambiguous */
int sh_flags = (l == 0 && n == psize) ? (SH_INT|SH_DATAP) : SH_INT;
#endif
LOG(("@s6 st_stn(%lu, %ld, %lu)", addr, l, n)); LOG(("@s6 st_stn(%lu, %ld, %lu)", addr, l, n));
ch_in_stack(addr, n); ch_in_stack(addr, n);
ch_aligned(addr, n); ch_aligned(addr, n);
/* store the bytes */ /* store the bytes */
for (i = 0; i < (int) n; i++) { for (i = (int) n; i > 0; i--, addr++) {
ch_st_prot(addr + i); ch_st_prot(addr);
stack_loc(addr + i) = (char) l; stack_loc(addr) = (char) l;
#ifdef LOGGING #ifdef LOGGING
if (al == 0 && n == psize) { st_sh(addr) = sh_flags;
/* a psize zero, ambiguous */
st_sh(addr + i) = (SH_INT|SH_DATAP);
}
else {
st_sh(addr + i) = SH_INT;
}
#endif LOGGING #endif LOGGING
l = l>>8; l = l>>8;
} }
@ -191,20 +196,25 @@ st_stn(addr, al, n)
#ifndef NOFLOAT #ifndef NOFLOAT
st_stf(addr, f, n) st_stf(addr, f, n)
ptr addr; register ptr addr;
double f; double f;
size n; size n;
{ {
register char *cp = (char *) &f; register char *cp = (char *) &f;
float fl;
register int i; register int i;
LOG(("@s6 st_stf(%lu, %g, %lu)", addr, f, n)); LOG(("@s6 st_stf(%lu, %g, %lu)", addr, f, n));
ch_in_stack(addr, n); ch_in_stack(addr, n);
ch_aligned(addr, wsize); ch_wordaligned(addr);
for (i = 0; i < (int) n; i++) { if ((int) n == 4) {
ch_st_prot(addr + i); fl = f;
stack_loc(addr + i) = *(cp++); cp = (char *) &fl;
st_fl(addr + i); }
for (i = (int) n; i > 0; i--, addr++) {
ch_st_prot(addr);
stack_loc(addr) = *(cp++);
st_fl(addr);
} }
} }
#endif NOFLOAT #endif NOFLOAT
@ -222,14 +232,14 @@ st_stf(addr, f, n)
************************************************************************/ ************************************************************************/
ptr st_lddp(addr) ptr st_lddp(addr)
ptr addr; register ptr addr;
{ {
register ptr p; register ptr p;
LOG(("@s6 st_lddp(%lu)", addr)); LOG(("@s6 st_lddp(%lu)", addr));
ch_in_stack(addr, psize); ch_in_stack(addr, psize);
ch_aligned(addr, wsize); ch_wordaligned(addr);
#ifdef LOGGING #ifdef LOGGING
if (!is_st_set(addr, psize, SH_DATAP)) { if (!is_st_set(addr, psize, SH_DATAP)) {
warning(WLDPEXP); warning(WLDPEXP);
@ -243,14 +253,14 @@ ptr st_lddp(addr)
} }
ptr st_ldip(addr) ptr st_ldip(addr)
ptr addr; register ptr addr;
{ {
register ptr p; register ptr p;
LOG(("@s6 st_ldip(%lu)", addr)); LOG(("@s6 st_ldip(%lu)", addr));
ch_in_stack(addr, psize); ch_in_stack(addr, psize);
ch_aligned(addr, wsize); ch_wordaligned(addr);
#ifdef LOGGING #ifdef LOGGING
if (!is_st_set(addr, psize, SH_INSP)) { if (!is_st_set(addr, psize, SH_INSP)) {
warning(WLIPEXP); warning(WLIPEXP);
@ -264,7 +274,7 @@ ptr st_ldip(addr)
} }
unsigned long st_ldu(addr, n) unsigned long st_ldu(addr, n)
ptr addr; register ptr addr;
size n; size n;
{ {
register int i; register int i;
@ -289,7 +299,7 @@ unsigned long st_ldu(addr, n)
} }
long st_lds(addr, n) long st_lds(addr, n)
ptr addr; register ptr addr;
size n; size n;
{ {
register int i; register int i;
@ -316,17 +326,24 @@ long st_lds(addr, n)
#ifndef NOFLOAT #ifndef NOFLOAT
double st_ldf(addr, n) double st_ldf(addr, n)
ptr addr; register ptr addr;
size n; size n;
{ {
double f = 0.0; double f;
register char *cp = (char *) &f; float fl;
register char *cp;
register int i; register int i;
LOG(("@s6 st_ldf(%lu, %lu)", addr, n)); LOG(("@s6 st_ldf(%lu, %lu)", addr, n));
if ((int)n == 4) {
cp = (char *) &fl;
}
else {
cp = (char *) &f;
}
ch_in_stack(addr, n); ch_in_stack(addr, n);
ch_aligned(addr, wsize); ch_wordaligned(addr);
#ifdef LOGGING #ifdef LOGGING
if (!is_st_set(addr, n, SH_FLOAT)) { if (!is_st_set(addr, n, SH_FLOAT)) {
warning(WLFEXP); warning(WLFEXP);
@ -334,8 +351,11 @@ double st_ldf(addr, n)
} }
#endif LOGGING #endif LOGGING
for (i = 0; i < (int) n; i++) { for (i = (int) n; i > 0; i--, addr++) {
*(cp++) = stack_loc(addr + i); *(cp++) = stack_loc(addr);
}
if ((int)n == 4) {
f = fl;
} }
return (f); return (f);
} }
@ -359,42 +379,42 @@ double st_ldf(addr, n)
************************************************************************/ ************************************************************************/
st_mvs(s2, s1, n) /* s1 -> s2 */ st_mvs(s2, s1, n) /* s1 -> s2 */
ptr s2, s1; register ptr s2, s1;
size n; size n;
{ {
register int i; register int i;
ch_in_stack(s1, n); ch_in_stack(s1, n);
ch_aligned(s1, wsize); ch_wordaligned(s1);
ch_in_stack(s2, n); ch_in_stack(s2, n);
ch_aligned(s2, wsize); ch_wordaligned(s2);
for (i = 0; i < (int) n; i++) { for (i = (int) n; i > 0; i--, s1++, s2++) {
ch_st_prot(s2 + i); ch_st_prot(s2);
ch_st_prot(s1 + i); ch_st_prot(s1);
stack_loc(s2 + i) = stack_loc(s1 + i); stack_loc(s2) = stack_loc(s1);
#ifdef LOGGING #ifdef LOGGING
st_sh(s2 + i) = st_sh(s1 + i) & ~SH_PROT; st_sh(s2) = st_sh(s1) & ~SH_PROT;
#endif LOGGING #endif LOGGING
} }
} }
st_mvd(s, d, n) /* d -> s */ st_mvd(s, d, n) /* d -> s */
ptr s, d; register ptr s, d;
size n; size n;
{ {
register int i; register int i;
ch_in_data(d, n); ch_in_data(d, n);
ch_aligned(d, wsize); ch_wordaligned(d);
ch_in_stack(s, n); ch_in_stack(s, n);
ch_aligned(s, wsize); ch_wordaligned(s);
for (i = 0; i < (int) n; i++) { for (i = (int) n; i > 0; i--, s++, d++) {
ch_st_prot(s + i); ch_st_prot(s);
stack_loc(s + i) = data_loc(d + i); stack_loc(s) = data_loc(d);
#ifdef LOGGING #ifdef LOGGING
st_sh(s + i) = dt_sh(d + i) & ~SH_PROT; st_sh(s) = dt_sh(d) & ~SH_PROT;
#endif LOGGING #endif LOGGING
} }
} }
@ -495,6 +515,7 @@ long wpop()
************************************************************************ ************************************************************************
* * * *
* dppush(p) - push a data ptr, load from p. * * dppush(p) - push a data ptr, load from p. *
* wpush(l) - push a word, load from l. *
* npush(l, n) - push n bytes, load from l. * * npush(l, n) - push n bytes, load from l. *
* push_dt(d, n) - push n bytes, load from address d in data. * * push_dt(d, n) - push n bytes, load from address d in data. *
* push_st(s, n) - push n bytes, load from address s in stack. * * push_st(s, n) - push n bytes, load from address s in stack. *
@ -509,17 +530,26 @@ dppush(p)
st_stdp(SP, p); st_stdp(SP, p);
} }
npush(l, n) wpush(l)
long l; long l;
{
st_inc(wsize);
st_stn(SP, l, wsize);
}
npush(l, n)
register long l;
size n; size n;
{ {
st_inc(max(n, wsize)); size m = max(n, wsize);
st_inc(m);
if (n == 1) if (n == 1)
l &= MASK1; l &= MASK1;
else else
if (n == 2) if (n == 2)
l &= MASK2; l &= MASK2;
st_stn(SP, l, max(n, wsize)); st_stn(SP, l, m);
} }
@ -562,8 +592,8 @@ fpush(f, n)
#ifdef LOGGING #ifdef LOGGING
PRIVATE warn_stbits(addr, n) PRIVATE warn_stbits(addr, n)
ptr addr; register ptr addr;
size n; register size n;
{ {
register int or_bits = 0; register int or_bits = 0;
register int and_bits = 0xff; register int and_bits = 0xff;

View file

@ -32,7 +32,7 @@ init_text() {
************************************************************************/ ************************************************************************/
newPC(p) newPC(p)
ptr p; register ptr p;
{ {
register struct proc *pr = &proctab[PI]; register struct proc *pr = &proctab[PI];

View file

@ -80,16 +80,16 @@
#define arg_n(u) ((u > i_maxuw) ? (wtrap(WARGL, EILLINS), 0) : u) #define arg_n(u) ((u > i_maxuw) ? (wtrap(WARGL, EILLINS), 0) : u)
#define arg_s(s) ((s <= 0 || s > max_off || s % wsize) ? \ #define arg_s(s) ((s <= 0 || s > max_off || (s & wsizem1)) ? \
(trap(EODDZ), s) : s) (trap(EODDZ), s) : s)
#define arg_z(s) ((s < 0 || s > max_off || s % wsize) ? \ #define arg_z(s) ((s < 0 || s > max_off || (s & wsizem1)) ? \
(trap(EODDZ), s) : s) (trap(EODDZ), s) : s)
#define arg_o(s) ((s < 0 || s > max_off || (s%wsize && wsize%s)) ? \ #define arg_o(s) ((s < 0 || s > max_off || ((s&wsizem1) && wsize%s)) ? \
(trap(EODDZ), s) : s) (trap(EODDZ), s) : s)
#define arg_w(s) ((s <= 0 || s > max_off || s % wsize) ? \ #define arg_w(s) ((s <= 0 || s > max_off || (s & wsizem1)) ? \
(trap(EODDZ), s) : s) (trap(EODDZ), s) : s)
#define arg_p(l) ((l >= NProc) ? (wtrap(WARGP, EILLINS), 0) : l) #define arg_p(l) ((l >= NProc) ? (wtrap(WARGP, EILLINS), 0) : l)
@ -102,7 +102,7 @@
#define arg_wf(s) ((s != 4 && s != 8) ? (trap(EODDZ), s) : s) #define arg_wf(s) ((s != 4 && s != 8) ? (trap(EODDZ), s) : s)
#define arg_wi(s) (((s != 2 && s != 4) || (s % wsize)) ? \ #define arg_wi(s) (((s != 2 && s != 4) || (s & wsizem1)) ? \
(trap(EODDZ), s) : s) (trap(EODDZ), s) : s)
/* special tests */ /* special tests */

View file

@ -90,11 +90,11 @@ do_trap(nr, L, F)
/* save the Function Return Area */ /* save the Function Return Area */
pushFRA(FRASize); pushFRA(FRASize);
npush((long)FRASize, wsize); wpush((long)FRASize);
npush((long)FRA_def, wsize); wpush((long)FRA_def);
/* set up the trap number as the only parameter */ /* set up the trap number as the only parameter */
npush((long) nr, wsize); wpush((long) nr);
tpi = TrapPI; /* allowed since OnTrap == TR_TRAP */ tpi = TrapPI; /* allowed since OnTrap == TR_TRAP */
TrapPI = 0; TrapPI = 0;