xref: /haiku/src/system/kernel/arch/x86/32/cpuid.S (revision e5d65858f2361fe0552495b61620c84dcee6bc00)
1/*
2 * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Copyright 2001, Travis Geiselbrecht. All rights reserved.
6 * Distributed under the terms of the NewOS License.
7 */
8
9#include <asm_defs.h>
10
11
12.text
13
14/* void get_current_cpuid(cpuid_info *info, uint32 eaxRegister) */
15FUNCTION(get_current_cpuid):
16 	pushl	%ebx
17 	pushl	%edi
18 	movl	12(%esp),%edi	/* first arg points to the cpuid_info structure */
19 	movl	16(%esp),%eax	/* second arg sets up eax */
20 	cpuid
21 	movl	%eax,0(%edi)	/* copy the regs into the cpuid_info structure */
22 	movl	%ebx,4(%edi)
23 	movl	%edx,8(%edi)
24 	movl	%ecx,12(%edi)
25 	popl	%edi
26 	popl	%ebx
27 	xorl	%eax, %eax		/* return B_OK */
28 	ret
29FUNCTION_END(get_current_cpuid)
30
31
32/* unsigned int get_eflags(void) */
33FUNCTION(get_eflags):
34 	pushfl
35 	popl	%eax
36 	ret
37FUNCTION_END(get_eflags)
38
39
40/* void set_eflags(unsigned int val) */
41FUNCTION(set_eflags):
42 	pushl	4(%esp)
43 	popfl
44	ret
45FUNCTION_END(set_eflags)
46