Browse Source

Moved TIMESPEC data out of BSS

Yann Weber 5 years ago
parent
commit
a6f66401cb
1 changed files with 14 additions and 11 deletions
  1. 14
    11
      wtfstopw.asm

+ 14
- 11
wtfstopw.asm View File

38
 
38
 
39
 %macro TIMESPEC 1
39
 %macro TIMESPEC 1
40
 	%1: ISTRUC TIMESPEC_STRUC
40
 	%1: ISTRUC TIMESPEC_STRUC
41
-		at TIMESPEC_STRUC.tv_sec, resq 1
42
-		at TIMESPEC_STRUC.tv_nsec, resq 1
41
+		at TIMESPEC_STRUC.tv_sec, dq 0
42
+		at TIMESPEC_STRUC.tv_nsec, dq 0
43
 	IEND
43
 	IEND
44
 	%define %1.tv_sec %1+TIMESPEC_STRUC.tv_sec
44
 	%define %1.tv_sec %1+TIMESPEC_STRUC.tv_sec
45
 	%define %1.tv_nsec %1+TIMESPEC_STRUC.tv_nsec
45
 	%define %1.tv_nsec %1+TIMESPEC_STRUC.tv_nsec
68
 
68
 
69
 section .bss
69
 section .bss
70
 align 8
70
 align 8
71
-	TIMESPEC ts_start
72
-	TIMESPEC ts_cur
73
-	TIMESPEC ts_sleep
74
 	buf: resb 1
71
 	buf: resb 1
75
 
72
 
76
 section .data
73
 section .data
74
+align 8
75
+	TIMESPEC ts_start
76
+	TIMESPEC ts_cur
77
+	TIMESPEC ts_sleep
77
 
78
 
78
-	time_res: dq 2 ; 2 digits bellow seconds can grow to 8
79
-	fcntl_flag: dq 0
80
-	SIGACTION sigaction
81
-
82
-	align 8
83
 	hours: times 8 db '0' ; 8 digits is the max for hours
79
 	hours: times 8 db '0' ; 8 digits is the max for hours
84
 	timestr: db ":00:00." 
80
 	timestr: db ":00:00." 
85
 		times 8 db '0' ; 8 digits for nanoseconds
81
 		times 8 db '0' ; 8 digits for nanoseconds
89
 	timestrlen: equ timestrend - timestr
85
 	timestrlen: equ timestrend - timestr
90
 	%define HOURSLEN 8
86
 	%define HOURSLEN 8
91
 
87
 
88
+	time_res: dq 2 ; 2 digits bellow seconds can grow to 8
89
+
90
+	fcntl_flag: dq 0
91
+	SIGACTION sigaction
92
+
92
 	lapsmsg: db "Lap : "
93
 	lapsmsg: db "Lap : "
93
 	lapsmsglen: equ $ - lapsmsg
94
 	lapsmsglen: equ $ - lapsmsg
94
 
95
 
182
 
183
 
183
 ; set value for ts_sleep.tv_nsec given time_res
184
 ; set value for ts_sleep.tv_nsec given time_res
184
 ; div sleep time by 10 for each digits added bellow seconds
185
 ; div sleep time by 10 for each digits added bellow seconds
185
-mov qword [ts_sleep.tv_sec], 0
186
 mov rax, 100000000
186
 mov rax, 100000000
187
 mov r8, [time_res]
187
 mov r8, [time_res]
188
 mov r9, 10
188
 mov r9, 10
268
 	mov rdi, 0 ; exit OK
268
 	mov rdi, 0 ; exit OK
269
 	jmp exit
269
 	jmp exit
270
 
270
 
271
+
272
+
273
+align 32
271
 ;
274
 ;
272
 ; Print current time on FD and add a leading char CHR
275
 ; Print current time on FD and add a leading char CHR
273
 ; push FD & push CHR to set arguments
276
 ; push FD & push CHR to set arguments

Loading…
Cancel
Save