Subversion Repositories HelenOS-historic

Rev

Rev 242 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 242 Rev 251
Line 37... Line 37...
37
#include <arch/pm.h>
37
#include <arch/pm.h>
38
	
38
	
39
.text
39
.text
40
.global interrupt_handlers
40
.global interrupt_handlers
41
.global panic_printf
41
.global panic_printf
-
 
42
.global cpuid
42
 
43
 
43
panic_printf:
44
panic_printf:
44
	movq $halt, (%rsp)
45
	movq $halt, (%rsp)
45
	jmp printf
46
	jmp printf
46
 
47
 
47
.global has_cpuid
48
.global has_cpuid
48
.global rdtsc
49
.global rdtsc
49
 
-
 
-
 
50
.global read_efer_flag
-
 
51
.global set_efer_flag
50
 
52
	
51
## Determine CPUID support
53
## Determine CPUID support
52
#
54
#
53
# Return 0 in EAX if CPUID is not support, 1 if supported.
55
# Return 0 in EAX if CPUID is not support, 1 if supported.
54
#
56
#
55
has_cpuid:
57
has_cpuid:
Line 68... Line 70...
68
	xorl %ebx,%eax		# 0 if not supported, 1 if supported
70
	xorl %ebx,%eax		# 0 if not supported, 1 if supported
69
	
71
	
70
	popq %rbx
72
	popq %rbx
71
	ret
73
	ret
72
 
74
 
-
 
75
cpuid:
-
 
76
	movq %rbx, %r10  # we have to preserve rbx across function calls
-
 
77
 
-
 
78
	movl %edi,%eax	# load the command into %eax
-
 
79
 
-
 
80
	cpuid	
-
 
81
	movl %eax,0(%rsi)
-
 
82
	movl %ebx,4(%rsi)
-
 
83
	movl %ecx,8(%rsi)
-
 
84
	movl %edx,12(%rsi)
-
 
85
 
-
 
86
	movq %r10, %rbx
-
 
87
	ret
73
 
88
 
74
rdtsc:
89
rdtsc:
75
	xorq %rax,%rax
90
	xorq %rax,%rax
76
	rdtsc
91
	rdtsc
77
	ret
92
	ret
-
 
93
 
-
 
94
set_efer_flag:
-
 
95
	movq $0xc0000080, %rcx
-
 
96
	rdmsr
-
 
97
	btsl %edi, %eax
-
 
98
	wrmsr
-
 
99
	ret
78
	
100
	
-
 
101
read_efer_flag:	
-
 
102
	movq $0xc0000080, %rcx
-
 
103
	rdmsr
-
 
104
	ret 		
79
 
105
 
80
# Push all general purpose registers on stack except %rbp, %rsp
106
# Push all general purpose registers on stack except %rbp, %rsp
81
.macro push_all_gpr
107
.macro push_all_gpr
82
	pushq %rax 
108
	pushq %rax 
83
	pushq %rbx
109
	pushq %rbx