Rev 106 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 106 | Rev 115 | ||
---|---|---|---|
Line 28... | Line 28... | ||
28 | 28 | ||
29 | ## very low and hardware-level functions |
29 | ## very low and hardware-level functions |
30 | 30 | ||
31 | .text |
31 | .text |
32 | 32 | ||
33 | .global cpu_priority_high |
- | |
34 | .global cpu_priority_low |
- | |
35 | .global cpu_priority_restore |
- | |
36 | .global cpu_priority_read |
- | |
37 | .global cpu_halt |
33 | .global cpu_halt |
38 | .global cpu_sleep |
34 | .global cpu_sleep |
39 | .global paging_on |
35 | .global paging_on |
40 | .global cpu_read_dba |
- | |
41 | .global cpu_write_dba |
- | |
42 | .global cpu_read_cr2 |
- | |
43 | .global enable_l_apic_in_msr |
36 | .global enable_l_apic_in_msr |
44 | .global interrupt_handlers |
37 | .global interrupt_handlers |
45 | .global inb |
38 | .global inb |
46 | .global inw |
39 | .global inw |
47 | .global inl |
40 | .global inl |
Line 52... | Line 45... | ||
52 | .global memsetb |
45 | .global memsetb |
53 | .global memsetw |
46 | .global memsetw |
54 | .global memcmp |
47 | .global memcmp |
55 | 48 | ||
56 | 49 | ||
57 | ## Set priority level high |
- | |
58 | # |
- | |
59 | # Disable interrupts and return previous |
- | |
60 | # EFLAGS in EAX. |
- | |
61 | # |
- | |
62 | cpu_priority_high: |
- | |
63 | pushf |
- | |
64 | pop %eax |
- | |
65 | cli |
- | |
66 | ret |
- | |
67 | - | ||
68 | - | ||
69 | ## Set priority level low |
- | |
70 | # |
- | |
71 | # Enable interrupts and return previous |
- | |
72 | # EFLAGS in EAX. |
- | |
73 | # |
- | |
74 | cpu_priority_low: |
- | |
75 | pushf |
- | |
76 | pop %eax |
- | |
77 | sti |
- | |
78 | ret |
- | |
79 | - | ||
80 | - | ||
81 | ## Restore priority level |
- | |
82 | # |
- | |
83 | # Restore EFLAGS. |
- | |
84 | # |
- | |
85 | cpu_priority_restore: |
- | |
86 | push 4(%esp) |
- | |
87 | popf |
- | |
88 | ret |
- | |
89 | - | ||
90 | ## Return raw priority level |
- | |
91 | # |
- | |
92 | # Return EFLAFS in EAX. |
- | |
93 | # |
- | |
94 | cpu_priority_read: |
- | |
95 | pushf |
- | |
96 | pop %eax |
- | |
97 | ret |
- | |
98 | - | ||
99 | - | ||
100 | ## Halt the CPU |
- | |
101 | # |
- | |
102 | # Halt the CPU using HLT. |
- | |
103 | # |
- | |
104 | cpu_halt: |
- | |
105 | cpu_sleep: |
- | |
106 | hlt |
- | |
107 | ret |
- | |
108 | - | ||
109 | - | ||
110 | ## Turn paging on |
50 | ## Turn paging on |
111 | # |
51 | # |
112 | # Enable paging and write-back caching in CR0. |
52 | # Enable paging and write-back caching in CR0. |
113 | # |
53 | # |
114 | paging_on: |
54 | paging_on: |
Line 121... | Line 61... | ||
121 | 0: |
61 | 0: |
122 | popl %eax |
62 | popl %eax |
123 | ret |
63 | ret |
124 | 64 | ||
125 | 65 | ||
126 | ## Read CR3 |
- | |
127 | # |
- | |
128 | # Store CR3 in EAX. |
- | |
129 | # |
- | |
130 | cpu_read_dba: |
- | |
131 | movl %cr3,%eax |
- | |
132 | ret |
- | |
133 | - | ||
134 | - | ||
135 | ## Write CR3 |
- | |
136 | # |
- | |
137 | # Set CR3. |
- | |
138 | # |
- | |
139 | cpu_write_dba: |
- | |
140 | pushl %eax |
- | |
141 | movl 8(%esp),%eax |
- | |
142 | movl %eax,%cr3 |
- | |
143 | popl %eax |
- | |
144 | ret |
- | |
145 | - | ||
146 | - | ||
147 | ## Read CR2 |
- | |
148 | # |
- | |
149 | # Store CR2 in EAX. |
- | |
150 | # |
- | |
151 | cpu_read_cr2: |
- | |
152 | movl %cr2,%eax |
- | |
153 | ret |
- | |
154 | - | ||
155 | - | ||
156 | ## Enable local APIC |
66 | ## Enable local APIC |
157 | # |
67 | # |
158 | # Enable local APIC in MSR. |
68 | # Enable local APIC in MSR. |
159 | # |
69 | # |
160 | enable_l_apic_in_msr: |
70 | enable_l_apic_in_msr: |