tape-kernel 1.0
a modular modern independent kernel
Loading...
Searching...
No Matches
cpuh.s
Go to the documentation of this file.
1.section .text
2.code32
3
4#int __cpuid_supported(void)
5.global __cpuid_supported
6__cpuid_supported:
7 pushf
8 popl %eax
9 movl %eax, %ecx
10 xorl $0x200000, %eax
11 pushl %eax
12 popf
13 pushf
14 popl %eax
15 pushl %ecx
16 popf
17 cmpl %eax, %ecx
18 setne %al
19 movzbl %al, %eax
20 ret
21
22#void __cpuid_get_vendor(uint32_t *ebx_out, uint32_t *edx_out, uint32_t *ecx_out)
23.global __cpuid_get_vendor
24__cpuid_get_vendor:
25 pushl %ebp
26 movl %esp, %ebp
27 pushl %ebx
28 pushl %esi
29
30 movl $0, %eax
31 cpuid
32
33 movl 8(%ebp), %esi #ebx_out
34 movl %ebx, (%esi)
35 movl 12(%ebp), %esi #edx_out
36 movl %edx, (%esi)
37 movl 16(%ebp), %esi #ecx_out
38 movl %ecx, (%esi)
39
40 popl %esi
41 popl %ebx
42 popl %ebp
43 ret
44
45#uint32_t __cpuid_get_features(void)
46.global __cpuid_get_features
47__cpuid_get_features:
48 pushl %ebx
49 pushl %ecx
50 pushl %edx
51
52 movl $1, %eax
53 cpuid
54
55 #eax already has the return value
56 popl %edx
57 popl %ecx
58 popl %ebx
59 ret
60
61