Browse Source

kind of progress with timers might need to reference meomry to syscall?

Phil 5 years ago
parent
commit
2a8739a4da
1 changed files with 19 additions and 2 deletions
  1. 19 2
      timer.asm

+ 19 - 2
timer.asm

@@ -5,6 +5,7 @@ SYS_TIMERFD_SETTIME equ 0x145
 section .bss
 	tfd RESB 4
 	tst RESB 4
+	tsr RESB 4
 	lt RESB 1
 
 section .data
@@ -28,16 +29,32 @@ _start:
 	;get timer fd
 	mov [tfd], eax
 
-	mov [tst], dword 0x0
+	;init timer
+	;mov [tst], dword 0x0
+	;mov [tst], dword 0x01000100
+
+	;nanosec
+	mov [tsr], byte 0x0
+	mov [tsr+1], byte 0x0
+	mov [tsr+2], byte 0x0
+	mov [tsr+3], byte 0x0
+
+
+	;sec
+	mov [tst], byte 0x1
+	mov [tst+1], byte 0x0
+	mov [tst+2], byte 0x0
+	mov [tst+3], byte 0x0
 
 	;settime sys_timerfd_settime
 	mov eax, SYS_TIMERFD_SETTIME
 	mov ebx, [tfd]
 	mov ecx, dword 0x0
 	mov edx, tst
-	mov esi, tst
+	mov esi, tsr
 	int 0x80
 
+	jmp exit
 poll:
 	;get time
 	mov eax, SYS_TIMERFD_GETTIME