69c034a586068ca760ef471acf16ae19c5b6cb99
[dosdemo] / src / util_s.asm
1         section .text
2 ; foo_ are watcom functions, _foo are djgpp functions
3
4         global get_cs
5         global _get_cs
6         global get_cs_
7 get_cs:
8 _get_cs:
9 get_cs_:
10         xor eax, eax
11         mov ax, cs
12         ret
13
14         global get_msr
15         global _get_msr
16 get_msr:
17 _get_msr:
18         push ebp
19         mov ebp, esp
20         push ebx
21         mov ecx, [ebp + 8]
22         rdmsr
23         mov ebx, [ebp + 12]
24         mov [ebx], eax
25         mov ebx, [ebp + 16]
26         mov [ebx], edx
27         pop ebx
28         pop ebp
29         ret
30
31         global get_msr_
32 get_msr_:
33         push ebx
34         push edx
35         mov ecx, eax
36         rdmsr
37         pop ebx
38         mov [ebx], eax
39         pop ebx
40         mov [ebx], edx
41         ret
42
43         global set_msr
44         global _set_msr
45 set_msr:
46 _set_msr:
47         mov ecx, [esp + 4]
48         mov eax, [esp + 8]
49         mov edx, [esp + 12]
50         rdmsr
51         ret
52
53         global set_msr_
54 set_msr_:
55         mov ecx, eax
56         mov eax, edx
57         mov edx, ebx
58         wrmsr
59         ret
60
61
62 ; vi:ft=nasm: