(msvc-unb version) thread seemingly overflows its stack if too many system calls are made
Opened this issue · 0 comments
NirvaCx commented
This issue can be easily verified by using the following code, which is a prototype for the tickrate setting in a game that uses the time
[30] system call
This also makes it such that any program that uses system calls and runs for a long time will eventually crash
.data
currentTick:
.word 0
.text
# init time for first frame
li a7, 30
ecall
sw a0, currentTick, s0
runtimeLoop:
li a7, 30
ecall
lw t0, currentTick
addi t0, t0, 50
# run next tick if 50ms or more have passed since the last one
bge a0, t0, gameLoop
j runtimeLoop
gameLoop:
# set the time for the current tick
li a7, 30
ecall
sw a0, currentTick, s0
addi s5, s5, 50
j runtimeLoop
Furthermore, for the code below, any number greater than specifically 8604 for t0 throws the same error
.text
li s0, 0
loop:
li t0, 8604
bge s0, t0, noloop
li a7, 30
ecall
addi s0, s0, 1
j loop
noloop:
li a7, 10
ecall