-
Notifications
You must be signed in to change notification settings - Fork 1
/
skl_nasm.h
88 lines (71 loc) · 1.97 KB
/
skl_nasm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
;/********************************************************
; * Some code. Copyright (C) 2003 by Pascal Massimino. *
; * All Rights Reserved. (http://skal.planet-d.net) *
; * For Educational/Academic use ONLY. See 'LICENSE.TXT'.*
; ********************************************************/
;//////////////////////////////////////////////////////////
;// NASM macros
;//////////////////////////////////////////////////////////
%ifdef LINUX
;//////////////////////////////////////////////////////////
; LINUX / egcs / macros
;//////////////////////////////////////////////////////////
%macro extrn 1
extern %1
%define %1 %1
%endmacro
%macro globl 1
global %1
%define %1 %1
%endmacro
%macro DATA 0
[section data align=16 write alloc USE32]
%endmacro
%macro TEXT 0
[section text align=16 nowrite alloc exec USE32]
%endmacro
%endif ; LINUX
;//////////////////////////////////////////////////////////
%ifdef WIN32
%macro extrn 1
extern _%1
%define %1 _%1
%endmacro
%macro globl 1
global _%1
%define %1 _%1
%endmacro
%macro DATA 0
[section .data align=16 write alloc USE32]
%endmacro
%macro TEXT 0
[section .text align=16 nowrite alloc exec USE32]
%endmacro
%endif ; WIN32
;//////////////////////////////////////////////////////////
;
; MACRO for timing. NASM.
; Total additional code size is 0xb0.
; this keep code alignment right.
;extrn Skl_Cur_Count_
;extrn Skl_Print_Tics
%macro SKL_USE_RDSTC 0
extrn SKL_RDTSC_0_ASM
extrn SKL_RDTSC_1_ASM
extrn SKL_RDTSC_2_ASM
%endmacro
%define SKL_RDTSC_OFFSET 15 ; check value with skl_rdtsc.h...
%macro SKL_RDTSC_IN 0
SKL_USE_RDSTC
call SKL_RDTSC_0_ASM
.Skl_RDTSC_Loop_:
call SKL_RDTSC_1_ASM
%endmacro
;%macro SKL_RDTSC_OUT 0
; call SKL_RDTSC_2_ASM
; dec dword [Skl_Cur_Count_]
; jge near .Skl_RDTSC_Loop_
; push dword 53
; call Skl_Print_Tics
;%endmacro
;//////////////////////////////////////////////////////////