Rev 219 | Rev 226 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 219 | Rev 224 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | 34 | ||
35 | 35 | ||
36 | void asm_delay_loop(__u32 t); |
36 | void asm_delay_loop(__u32 t); |
37 | void asm_fake_loop(__u32 t); |
37 | void asm_fake_loop(__u32 t); |
38 | 38 | ||
39 | - | ||
40 | /* TODO: implement the real stuff */ |
39 | /* TODO: implement the real stuff */ |
41 | static inline __address get_stack_base(void) |
40 | static inline __address get_stack_base(void) |
42 | { |
41 | { |
43 | return NULL; |
42 | return NULL; |
44 | } |
43 | } |
45 | 44 | ||
46 | static inline void cpu_sleep(void) { __asm__("hlt"); }; |
45 | static inline void cpu_sleep(void) { __asm__("hlt"); }; |
- | 46 | static inline void cpu_halt(void) { __asm__("hlt"); }; |
|
47 | 47 | ||
48 | 48 | ||
49 | static inline __u8 inb(__u16 port) |
49 | static inline __u8 inb(__u16 port) |
50 | { |
50 | { |
51 | __u8 out; |
51 | __u8 out; |
Line 135... | Line 135... | ||
135 | * |
135 | * |
136 | * Return value in CR2 |
136 | * Return value in CR2 |
137 | * |
137 | * |
138 | * @return Value read. |
138 | * @return Value read. |
139 | */ |
139 | */ |
140 | static inline __u32 read_cr2(void) { __u64 v; __asm__ volatile ("movq %%cr2,%0" : "=r" (v)); return v; } |
140 | static inline __u64 read_cr2(void) { __u64 v; __asm__ volatile ("movq %%cr2,%0" : "=r" (v)); return v; } |
141 | 141 | ||
142 | /** Write CR3 |
142 | /** Write CR3 |
143 | * |
143 | * |
144 | * Write value to CR3. |
144 | * Write value to CR3. |
145 | * |
145 | * |
Line 151... | Line 151... | ||
151 | * |
151 | * |
152 | * Return value in CR3 |
152 | * Return value in CR3 |
153 | * |
153 | * |
154 | * @return Value read. |
154 | * @return Value read. |
155 | */ |
155 | */ |
156 | static inline __u32 read_cr3(void) { __u64 v; __asm__ volatile ("movq %%cr3,%0" : "=r" (v)); return v; } |
156 | static inline __u64 read_cr3(void) { __u64 v; __asm__ volatile ("movq %%cr3,%0" : "=r" (v)); return v; } |
157 | - | ||
158 | /** Set priority level low |
- | |
159 | * |
- | |
160 | * Enable interrupts and return previous |
- | |
161 | * value of EFLAGS. |
- | |
162 | */ |
- | |
163 | - | ||
164 | 157 | ||
165 | 158 | ||
166 | extern size_t interrupt_handler_size; |
159 | extern size_t interrupt_handler_size; |
167 | extern void interrupt_handlers(void); |
160 | extern void interrupt_handlers(void); |
168 | 161 |