mirror of
https://github.com/cc65/cc65.git
synced 2024-12-28 06:30:16 +00:00
sim65 cycles 32-bit range fix
long is 64-bit on some platforms, making this inconsistent, added range check to catch overflow. reduced tests requesting 5 billion cycles to 2^32-1 so they can fun on 32-bit long sim65.
This commit is contained in:
parent
a325c95652
commit
f2e7609046
@ -36,6 +36,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
#include "abend.h"
|
#include "abend.h"
|
||||||
@ -140,6 +141,10 @@ static void OptQuitXIns (const char* Opt attribute ((unused)),
|
|||||||
/* quit after MaxCycles cycles */
|
/* quit after MaxCycles cycles */
|
||||||
{
|
{
|
||||||
MaxCycles = strtoul(Arg, NULL, 0);
|
MaxCycles = strtoul(Arg, NULL, 0);
|
||||||
|
/* Guard against overflow. */
|
||||||
|
if (MaxCycles == ULONG_MAX && errno == ERANGE) {
|
||||||
|
Error("'-x parameter out of range. Max: %lu",ULONG_MAX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char ReadProgramFile (void)
|
static unsigned char ReadProgramFile (void)
|
||||||
|
@ -22,7 +22,8 @@ ifdef QUIET
|
|||||||
NULLERR = 2>$(NULLDEV)
|
NULLERR = 2>$(NULLDEV)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SIM65FLAGS = -x 5000000000
|
# sim65 can support 64-bit cycle counts on some platforms, but not all. This must fit in 32-bit.
|
||||||
|
SIM65FLAGS = -x 4294967295
|
||||||
|
|
||||||
CA65 := $(if $(wildcard ../../../bin/ca65*),..$S..$S..$Sbin$Sca65,ca65)
|
CA65 := $(if $(wildcard ../../../bin/ca65*),..$S..$S..$Sbin$Sca65,ca65)
|
||||||
LD65 := $(if $(wildcard ../../../bin/ld65*),..$S..$S..$Sbin$Sld65,ld65)
|
LD65 := $(if $(wildcard ../../../bin/ld65*),..$S..$S..$Sbin$Sld65,ld65)
|
||||||
|
@ -22,7 +22,8 @@ ifdef QUIET
|
|||||||
NULLERR = 2>$(NULLDEV)
|
NULLERR = 2>$(NULLDEV)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SIM65FLAGS = -x 5000000000 -c
|
# sim65 can support 64-bit cycle counts on some platforms, but not all. This must fit in 32-bit.
|
||||||
|
SIM65FLAGS = -x 4294967295 -c
|
||||||
|
|
||||||
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
|
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
|
||||||
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)
|
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)
|
||||||
|
@ -24,7 +24,8 @@ ifdef QUIET
|
|||||||
NULLERR = 2>$(NULLDEV)
|
NULLERR = 2>$(NULLDEV)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SIM65FLAGS = -x 5000000000 -c
|
# sim65 can support 64-bit cycle counts on some platforms, but not all. This must fit in 32-bit.
|
||||||
|
SIM65FLAGS = -x 4294967295 -c
|
||||||
|
|
||||||
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
|
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
|
||||||
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)
|
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)
|
||||||
|
Loading…
Reference in New Issue
Block a user