From fd180984018793fc55dd5374c9538bebf70e56c9 Mon Sep 17 00:00:00 2001 From: Mikhail Osipov Date: Tue, 28 Sep 2021 14:51:41 +0300 Subject: add generation stat --- main.s | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'main.s') diff --git a/main.s b/main.s index 99a9609..ecdb190 100644 --- a/main.s +++ b/main.s @@ -629,6 +629,8 @@ store_val: testl %eax, %eax jnz ioctl_error + incl (ngeneration) + jmp life_loop event_handler: @@ -688,12 +690,33 @@ restore: .rest_fbopen: testb $M_FBOPEN, (prog_mode) - jz exit + jz .genstat movl $SYS_CLOSE, %eax movl (fbctl), %ebx int $0x80 +.genstat: + movl (ngeneration), %eax + testl %eax, %eax + jz exit + + pushl %ebp + movl %esp, %ebp + + subl $9, %esp + movl %esp, %esi + pushl %esi + pushl %eax + call itoa + + pushl $0 + pushl $str_ret + pushl %esi + pushl $str_genstat + call print_strings + + leave exit: movl %eax, %ebx @@ -1070,6 +1093,7 @@ fmt: .asciz "Debug: str(%d): %s\n" */ str_usage: .ascii "Usage: life \n" str_usage_len = .-str_usage +str_genstat: .asciz "die at 0x" str_ret: .asciz "\n" str_fnot: .asciz " is directory\n" str_intr: .asciz "Interrupted by signal " @@ -1119,3 +1143,4 @@ timespec: .comm binary, 4 .comm now, 8 .comm sleeptime, 8 +.comm ngeneration, 4 -- cgit v1.2.3-70-g09d2