%include "MY_IO.h" SYS_GETRANDOM equ 318 SYS_TIME equ 201 SIZE equ 8 section .data label1 db "rdtes: " size1 equ $ - label1 label2 db "getrandom: " size2 equ $ - label2 label3 db "time: " size3 equ $ - label3 time_return dq 0 section .bss result resb SIZE section .text global _start _start: call PRINT_NEWLINE ; rdtsc reads a time from the intel chip ; the value is returned in rax rdtsc ; save the result mov r15, rax mov rax, 1 mov rdi, 1 mov rsi, label1 mov rdx, size1 syscall mov rdi, r15 call PRINT_INT call PRINT_NEWLINE ; call gettimeofday ; rdi is the place to store the results. ; rsi is an optional time zone argument. mov rax, SYS_TIME lea rdi, time_return syscall mov rax, 1 mov rdi, 1 mov rsi, label3 mov rdx, size3 syscall mov rdi, [time_return] call PRINT_INT call PRINT_NEWLINE ; system call to getrandom (see man getrandom) ; rdi is the address for the results. ; rsi is the size of the address ; xxx are flags to control the code mov rax, SYS_GETRANDOM mov rdi, result mov rsi, SIZE mov rdx, 0 syscall mov rax, 1 mov rdi, 1 mov rsi, label2 mov rdx, size2 syscall mov rdi, [result] call PRINT_INT call PRINT_NEWLINE call PRINT_NEWLINE mov eax, SYS_EXIT mov edx, SUCCESS syscall