diff options
Diffstat (limited to 'arch/x86/lguest/boot.c')
-rw-r--r-- | arch/x86/lguest/boot.c | 126 |
1 files changed, 76 insertions, 50 deletions
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 960a8d9c049c..e94a11e42f98 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -107,7 +107,7 @@ static void async_hcall(unsigned long call, unsigned long arg1, | |||
107 | local_irq_save(flags); | 107 | local_irq_save(flags); |
108 | if (lguest_data.hcall_status[next_call] != 0xFF) { | 108 | if (lguest_data.hcall_status[next_call] != 0xFF) { |
109 | /* Table full, so do normal hcall which will flush table. */ | 109 | /* Table full, so do normal hcall which will flush table. */ |
110 | hcall(call, arg1, arg2, arg3); | 110 | kvm_hypercall3(call, arg1, arg2, arg3); |
111 | } else { | 111 | } else { |
112 | lguest_data.hcalls[next_call].arg0 = call; | 112 | lguest_data.hcalls[next_call].arg0 = call; |
113 | lguest_data.hcalls[next_call].arg1 = arg1; | 113 | lguest_data.hcalls[next_call].arg1 = arg1; |
@@ -134,13 +134,32 @@ static void async_hcall(unsigned long call, unsigned long arg1, | |||
134 | * | 134 | * |
135 | * So, when we're in lazy mode, we call async_hcall() to store the call for | 135 | * So, when we're in lazy mode, we call async_hcall() to store the call for |
136 | * future processing: */ | 136 | * future processing: */ |
137 | static void lazy_hcall(unsigned long call, | 137 | static void lazy_hcall1(unsigned long call, |
138 | unsigned long arg1) | ||
139 | { | ||
140 | if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) | ||
141 | kvm_hypercall1(call, arg1); | ||
142 | else | ||
143 | async_hcall(call, arg1, 0, 0); | ||
144 | } | ||
145 | |||
146 | static void lazy_hcall2(unsigned long call, | ||
147 | unsigned long arg1, | ||
148 | unsigned long arg2) | ||
149 | { | ||
150 | if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) | ||
151 | kvm_hypercall2(call, arg1, arg2); | ||
152 | else | ||
153 | async_hcall(call, arg1, arg2, 0); | ||
154 | } | ||
155 | |||
156 | static void lazy_hcall3(unsigned long call, | ||
138 | unsigned long arg1, | 157 | unsigned long arg1, |
139 | unsigned long arg2, | 158 | unsigned long arg2, |
140 | unsigned long arg3) | 159 | unsigned long arg3) |
141 | { | 160 | { |
142 | if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) | 161 | if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) |
143 | hcall(call, arg1, arg2, arg3); | 162 | kvm_hypercall3(call, arg1, arg2, arg3); |
144 | else | 163 | else |
145 | async_hcall(call, arg1, arg2, arg3); | 164 | async_hcall(call, arg1, arg2, arg3); |
146 | } | 165 | } |
@@ -150,7 +169,7 @@ static void lazy_hcall(unsigned long call, | |||
150 | static void lguest_leave_lazy_mode(void) | 169 | static void lguest_leave_lazy_mode(void) |
151 | { | 170 | { |
152 | paravirt_leave_lazy(paravirt_get_lazy_mode()); | 171 | paravirt_leave_lazy(paravirt_get_lazy_mode()); |
153 | hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0); | 172 | kvm_hypercall0(LHCALL_FLUSH_ASYNC); |
154 | } | 173 | } |
155 | 174 | ||
156 | /*G:033 | 175 | /*G:033 |
@@ -173,24 +192,29 @@ static unsigned long save_fl(void) | |||
173 | { | 192 | { |
174 | return lguest_data.irq_enabled; | 193 | return lguest_data.irq_enabled; |
175 | } | 194 | } |
195 | PV_CALLEE_SAVE_REGS_THUNK(save_fl); | ||
176 | 196 | ||
177 | /* restore_flags() just sets the flags back to the value given. */ | 197 | /* restore_flags() just sets the flags back to the value given. */ |
178 | static void restore_fl(unsigned long flags) | 198 | static void restore_fl(unsigned long flags) |
179 | { | 199 | { |
180 | lguest_data.irq_enabled = flags; | 200 | lguest_data.irq_enabled = flags; |
181 | } | 201 | } |
202 | PV_CALLEE_SAVE_REGS_THUNK(restore_fl); | ||
182 | 203 | ||
183 | /* Interrupts go off... */ | 204 | /* Interrupts go off... */ |
184 | static void irq_disable(void) | 205 | static void irq_disable(void) |
185 | { | 206 | { |
186 | lguest_data.irq_enabled = 0; | 207 | lguest_data.irq_enabled = 0; |
187 | } | 208 | } |
209 | PV_CALLEE_SAVE_REGS_THUNK(irq_disable); | ||
188 | 210 | ||
189 | /* Interrupts go on... */ | 211 | /* Interrupts go on... */ |
190 | static void irq_enable(void) | 212 | static void irq_enable(void) |
191 | { | 213 | { |
192 | lguest_data.irq_enabled = X86_EFLAGS_IF; | 214 | lguest_data.irq_enabled = X86_EFLAGS_IF; |
193 | } | 215 | } |
216 | PV_CALLEE_SAVE_REGS_THUNK(irq_enable); | ||
217 | |||
194 | /*:*/ | 218 | /*:*/ |
195 | /*M:003 Note that we don't check for outstanding interrupts when we re-enable | 219 | /*M:003 Note that we don't check for outstanding interrupts when we re-enable |
196 | * them (or when we unmask an interrupt). This seems to work for the moment, | 220 | * them (or when we unmask an interrupt). This seems to work for the moment, |
@@ -224,7 +248,7 @@ static void lguest_write_idt_entry(gate_desc *dt, | |||
224 | /* Keep the local copy up to date. */ | 248 | /* Keep the local copy up to date. */ |
225 | native_write_idt_entry(dt, entrynum, g); | 249 | native_write_idt_entry(dt, entrynum, g); |
226 | /* Tell Host about this new entry. */ | 250 | /* Tell Host about this new entry. */ |
227 | hcall(LHCALL_LOAD_IDT_ENTRY, entrynum, desc[0], desc[1]); | 251 | kvm_hypercall3(LHCALL_LOAD_IDT_ENTRY, entrynum, desc[0], desc[1]); |
228 | } | 252 | } |
229 | 253 | ||
230 | /* Changing to a different IDT is very rare: we keep the IDT up-to-date every | 254 | /* Changing to a different IDT is very rare: we keep the IDT up-to-date every |
@@ -236,7 +260,7 @@ static void lguest_load_idt(const struct desc_ptr *desc) | |||
236 | struct desc_struct *idt = (void *)desc->address; | 260 | struct desc_struct *idt = (void *)desc->address; |
237 | 261 | ||
238 | for (i = 0; i < (desc->size+1)/8; i++) | 262 | for (i = 0; i < (desc->size+1)/8; i++) |
239 | hcall(LHCALL_LOAD_IDT_ENTRY, i, idt[i].a, idt[i].b); | 263 | kvm_hypercall3(LHCALL_LOAD_IDT_ENTRY, i, idt[i].a, idt[i].b); |
240 | } | 264 | } |
241 | 265 | ||
242 | /* | 266 | /* |
@@ -256,8 +280,8 @@ static void lguest_load_idt(const struct desc_ptr *desc) | |||
256 | */ | 280 | */ |
257 | static void lguest_load_gdt(const struct desc_ptr *desc) | 281 | static void lguest_load_gdt(const struct desc_ptr *desc) |
258 | { | 282 | { |
259 | BUG_ON((desc->size+1)/8 != GDT_ENTRIES); | 283 | BUG_ON((desc->size + 1) / 8 != GDT_ENTRIES); |
260 | hcall(LHCALL_LOAD_GDT, __pa(desc->address), GDT_ENTRIES, 0); | 284 | kvm_hypercall2(LHCALL_LOAD_GDT, __pa(desc->address), GDT_ENTRIES); |
261 | } | 285 | } |
262 | 286 | ||
263 | /* For a single GDT entry which changes, we do the lazy thing: alter our GDT, | 287 | /* For a single GDT entry which changes, we do the lazy thing: alter our GDT, |
@@ -267,7 +291,7 @@ static void lguest_write_gdt_entry(struct desc_struct *dt, int entrynum, | |||
267 | const void *desc, int type) | 291 | const void *desc, int type) |
268 | { | 292 | { |
269 | native_write_gdt_entry(dt, entrynum, desc, type); | 293 | native_write_gdt_entry(dt, entrynum, desc, type); |
270 | hcall(LHCALL_LOAD_GDT, __pa(dt), GDT_ENTRIES, 0); | 294 | kvm_hypercall2(LHCALL_LOAD_GDT, __pa(dt), GDT_ENTRIES); |
271 | } | 295 | } |
272 | 296 | ||
273 | /* OK, I lied. There are three "thread local storage" GDT entries which change | 297 | /* OK, I lied. There are three "thread local storage" GDT entries which change |
@@ -278,8 +302,8 @@ static void lguest_load_tls(struct thread_struct *t, unsigned int cpu) | |||
278 | /* There's one problem which normal hardware doesn't have: the Host | 302 | /* There's one problem which normal hardware doesn't have: the Host |
279 | * can't handle us removing entries we're currently using. So we clear | 303 | * can't handle us removing entries we're currently using. So we clear |
280 | * the GS register here: if it's needed it'll be reloaded anyway. */ | 304 | * the GS register here: if it's needed it'll be reloaded anyway. */ |
281 | loadsegment(gs, 0); | 305 | lazy_load_gs(0); |
282 | lazy_hcall(LHCALL_LOAD_TLS, __pa(&t->tls_array), cpu, 0); | 306 | lazy_hcall2(LHCALL_LOAD_TLS, __pa(&t->tls_array), cpu); |
283 | } | 307 | } |
284 | 308 | ||
285 | /*G:038 That's enough excitement for now, back to ploughing through each of | 309 | /*G:038 That's enough excitement for now, back to ploughing through each of |
@@ -377,7 +401,7 @@ static void lguest_cpuid(unsigned int *ax, unsigned int *bx, | |||
377 | static unsigned long current_cr0; | 401 | static unsigned long current_cr0; |
378 | static void lguest_write_cr0(unsigned long val) | 402 | static void lguest_write_cr0(unsigned long val) |
379 | { | 403 | { |
380 | lazy_hcall(LHCALL_TS, val & X86_CR0_TS, 0, 0); | 404 | lazy_hcall1(LHCALL_TS, val & X86_CR0_TS); |
381 | current_cr0 = val; | 405 | current_cr0 = val; |
382 | } | 406 | } |
383 | 407 | ||
@@ -391,7 +415,7 @@ static unsigned long lguest_read_cr0(void) | |||
391 | * the vowels have been optimized out. */ | 415 | * the vowels have been optimized out. */ |
392 | static void lguest_clts(void) | 416 | static void lguest_clts(void) |
393 | { | 417 | { |
394 | lazy_hcall(LHCALL_TS, 0, 0, 0); | 418 | lazy_hcall1(LHCALL_TS, 0); |
395 | current_cr0 &= ~X86_CR0_TS; | 419 | current_cr0 &= ~X86_CR0_TS; |
396 | } | 420 | } |
397 | 421 | ||
@@ -413,7 +437,7 @@ static bool cr3_changed = false; | |||
413 | static void lguest_write_cr3(unsigned long cr3) | 437 | static void lguest_write_cr3(unsigned long cr3) |
414 | { | 438 | { |
415 | lguest_data.pgdir = cr3; | 439 | lguest_data.pgdir = cr3; |
416 | lazy_hcall(LHCALL_NEW_PGTABLE, cr3, 0, 0); | 440 | lazy_hcall1(LHCALL_NEW_PGTABLE, cr3); |
417 | cr3_changed = true; | 441 | cr3_changed = true; |
418 | } | 442 | } |
419 | 443 | ||
@@ -485,11 +509,17 @@ static void lguest_write_cr4(unsigned long val) | |||
485 | * into a process' address space. We set the entry then tell the Host the | 509 | * into a process' address space. We set the entry then tell the Host the |
486 | * toplevel and address this corresponds to. The Guest uses one pagetable per | 510 | * toplevel and address this corresponds to. The Guest uses one pagetable per |
487 | * process, so we need to tell the Host which one we're changing (mm->pgd). */ | 511 | * process, so we need to tell the Host which one we're changing (mm->pgd). */ |
512 | static void lguest_pte_update(struct mm_struct *mm, unsigned long addr, | ||
513 | pte_t *ptep) | ||
514 | { | ||
515 | lazy_hcall3(LHCALL_SET_PTE, __pa(mm->pgd), addr, ptep->pte_low); | ||
516 | } | ||
517 | |||
488 | static void lguest_set_pte_at(struct mm_struct *mm, unsigned long addr, | 518 | static void lguest_set_pte_at(struct mm_struct *mm, unsigned long addr, |
489 | pte_t *ptep, pte_t pteval) | 519 | pte_t *ptep, pte_t pteval) |
490 | { | 520 | { |
491 | *ptep = pteval; | 521 | *ptep = pteval; |
492 | lazy_hcall(LHCALL_SET_PTE, __pa(mm->pgd), addr, pteval.pte_low); | 522 | lguest_pte_update(mm, addr, ptep); |
493 | } | 523 | } |
494 | 524 | ||
495 | /* The Guest calls this to set a top-level entry. Again, we set the entry then | 525 | /* The Guest calls this to set a top-level entry. Again, we set the entry then |
@@ -498,8 +528,8 @@ static void lguest_set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
498 | static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval) | 528 | static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval) |
499 | { | 529 | { |
500 | *pmdp = pmdval; | 530 | *pmdp = pmdval; |
501 | lazy_hcall(LHCALL_SET_PMD, __pa(pmdp)&PAGE_MASK, | 531 | lazy_hcall2(LHCALL_SET_PMD, __pa(pmdp) & PAGE_MASK, |
502 | (__pa(pmdp)&(PAGE_SIZE-1))/4, 0); | 532 | (__pa(pmdp) & (PAGE_SIZE - 1)) / 4); |
503 | } | 533 | } |
504 | 534 | ||
505 | /* There are a couple of legacy places where the kernel sets a PTE, but we | 535 | /* There are a couple of legacy places where the kernel sets a PTE, but we |
@@ -515,7 +545,7 @@ static void lguest_set_pte(pte_t *ptep, pte_t pteval) | |||
515 | { | 545 | { |
516 | *ptep = pteval; | 546 | *ptep = pteval; |
517 | if (cr3_changed) | 547 | if (cr3_changed) |
518 | lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0); | 548 | lazy_hcall1(LHCALL_FLUSH_TLB, 1); |
519 | } | 549 | } |
520 | 550 | ||
521 | /* Unfortunately for Lguest, the pv_mmu_ops for page tables were based on | 551 | /* Unfortunately for Lguest, the pv_mmu_ops for page tables were based on |
@@ -531,7 +561,7 @@ static void lguest_set_pte(pte_t *ptep, pte_t pteval) | |||
531 | static void lguest_flush_tlb_single(unsigned long addr) | 561 | static void lguest_flush_tlb_single(unsigned long addr) |
532 | { | 562 | { |
533 | /* Simply set it to zero: if it was not, it will fault back in. */ | 563 | /* Simply set it to zero: if it was not, it will fault back in. */ |
534 | lazy_hcall(LHCALL_SET_PTE, lguest_data.pgdir, addr, 0); | 564 | lazy_hcall3(LHCALL_SET_PTE, lguest_data.pgdir, addr, 0); |
535 | } | 565 | } |
536 | 566 | ||
537 | /* This is what happens after the Guest has removed a large number of entries. | 567 | /* This is what happens after the Guest has removed a large number of entries. |
@@ -539,7 +569,7 @@ static void lguest_flush_tlb_single(unsigned long addr) | |||
539 | * have changed, ie. virtual addresses below PAGE_OFFSET. */ | 569 | * have changed, ie. virtual addresses below PAGE_OFFSET. */ |
540 | static void lguest_flush_tlb_user(void) | 570 | static void lguest_flush_tlb_user(void) |
541 | { | 571 | { |
542 | lazy_hcall(LHCALL_FLUSH_TLB, 0, 0, 0); | 572 | lazy_hcall1(LHCALL_FLUSH_TLB, 0); |
543 | } | 573 | } |
544 | 574 | ||
545 | /* This is called when the kernel page tables have changed. That's not very | 575 | /* This is called when the kernel page tables have changed. That's not very |
@@ -547,7 +577,7 @@ static void lguest_flush_tlb_user(void) | |||
547 | * slow), so it's worth separating this from the user flushing above. */ | 577 | * slow), so it's worth separating this from the user flushing above. */ |
548 | static void lguest_flush_tlb_kernel(void) | 578 | static void lguest_flush_tlb_kernel(void) |
549 | { | 579 | { |
550 | lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0); | 580 | lazy_hcall1(LHCALL_FLUSH_TLB, 1); |
551 | } | 581 | } |
552 | 582 | ||
553 | /* | 583 | /* |
@@ -684,7 +714,7 @@ static int lguest_clockevent_set_next_event(unsigned long delta, | |||
684 | } | 714 | } |
685 | 715 | ||
686 | /* Please wake us this far in the future. */ | 716 | /* Please wake us this far in the future. */ |
687 | hcall(LHCALL_SET_CLOCKEVENT, delta, 0, 0); | 717 | kvm_hypercall1(LHCALL_SET_CLOCKEVENT, delta); |
688 | return 0; | 718 | return 0; |
689 | } | 719 | } |
690 | 720 | ||
@@ -695,7 +725,7 @@ static void lguest_clockevent_set_mode(enum clock_event_mode mode, | |||
695 | case CLOCK_EVT_MODE_UNUSED: | 725 | case CLOCK_EVT_MODE_UNUSED: |
696 | case CLOCK_EVT_MODE_SHUTDOWN: | 726 | case CLOCK_EVT_MODE_SHUTDOWN: |
697 | /* A 0 argument shuts the clock down. */ | 727 | /* A 0 argument shuts the clock down. */ |
698 | hcall(LHCALL_SET_CLOCKEVENT, 0, 0, 0); | 728 | kvm_hypercall0(LHCALL_SET_CLOCKEVENT); |
699 | break; | 729 | break; |
700 | case CLOCK_EVT_MODE_ONESHOT: | 730 | case CLOCK_EVT_MODE_ONESHOT: |
701 | /* This is what we expect. */ | 731 | /* This is what we expect. */ |
@@ -770,8 +800,8 @@ static void lguest_time_init(void) | |||
770 | static void lguest_load_sp0(struct tss_struct *tss, | 800 | static void lguest_load_sp0(struct tss_struct *tss, |
771 | struct thread_struct *thread) | 801 | struct thread_struct *thread) |
772 | { | 802 | { |
773 | lazy_hcall(LHCALL_SET_STACK, __KERNEL_DS|0x1, thread->sp0, | 803 | lazy_hcall3(LHCALL_SET_STACK, __KERNEL_DS | 0x1, thread->sp0, |
774 | THREAD_SIZE/PAGE_SIZE); | 804 | THREAD_SIZE / PAGE_SIZE); |
775 | } | 805 | } |
776 | 806 | ||
777 | /* Let's just say, I wouldn't do debugging under a Guest. */ | 807 | /* Let's just say, I wouldn't do debugging under a Guest. */ |
@@ -830,20 +860,21 @@ static u32 lguest_apic_safe_wait_icr_idle(void) | |||
830 | return 0; | 860 | return 0; |
831 | } | 861 | } |
832 | 862 | ||
833 | static struct apic_ops lguest_basic_apic_ops = { | 863 | static void set_lguest_basic_apic_ops(void) |
834 | .read = lguest_apic_read, | 864 | { |
835 | .write = lguest_apic_write, | 865 | apic->read = lguest_apic_read; |
836 | .icr_read = lguest_apic_icr_read, | 866 | apic->write = lguest_apic_write; |
837 | .icr_write = lguest_apic_icr_write, | 867 | apic->icr_read = lguest_apic_icr_read; |
838 | .wait_icr_idle = lguest_apic_wait_icr_idle, | 868 | apic->icr_write = lguest_apic_icr_write; |
839 | .safe_wait_icr_idle = lguest_apic_safe_wait_icr_idle, | 869 | apic->wait_icr_idle = lguest_apic_wait_icr_idle; |
870 | apic->safe_wait_icr_idle = lguest_apic_safe_wait_icr_idle; | ||
840 | }; | 871 | }; |
841 | #endif | 872 | #endif |
842 | 873 | ||
843 | /* STOP! Until an interrupt comes in. */ | 874 | /* STOP! Until an interrupt comes in. */ |
844 | static void lguest_safe_halt(void) | 875 | static void lguest_safe_halt(void) |
845 | { | 876 | { |
846 | hcall(LHCALL_HALT, 0, 0, 0); | 877 | kvm_hypercall0(LHCALL_HALT); |
847 | } | 878 | } |
848 | 879 | ||
849 | /* The SHUTDOWN hypercall takes a string to describe what's happening, and | 880 | /* The SHUTDOWN hypercall takes a string to describe what's happening, and |
@@ -853,7 +884,8 @@ static void lguest_safe_halt(void) | |||
853 | * rather than virtual addresses, so we use __pa() here. */ | 884 | * rather than virtual addresses, so we use __pa() here. */ |
854 | static void lguest_power_off(void) | 885 | static void lguest_power_off(void) |
855 | { | 886 | { |
856 | hcall(LHCALL_SHUTDOWN, __pa("Power down"), LGUEST_SHUTDOWN_POWEROFF, 0); | 887 | kvm_hypercall2(LHCALL_SHUTDOWN, __pa("Power down"), |
888 | LGUEST_SHUTDOWN_POWEROFF); | ||
857 | } | 889 | } |
858 | 890 | ||
859 | /* | 891 | /* |
@@ -863,7 +895,7 @@ static void lguest_power_off(void) | |||
863 | */ | 895 | */ |
864 | static int lguest_panic(struct notifier_block *nb, unsigned long l, void *p) | 896 | static int lguest_panic(struct notifier_block *nb, unsigned long l, void *p) |
865 | { | 897 | { |
866 | hcall(LHCALL_SHUTDOWN, __pa(p), LGUEST_SHUTDOWN_POWEROFF, 0); | 898 | kvm_hypercall2(LHCALL_SHUTDOWN, __pa(p), LGUEST_SHUTDOWN_POWEROFF); |
867 | /* The hcall won't return, but to keep gcc happy, we're "done". */ | 899 | /* The hcall won't return, but to keep gcc happy, we're "done". */ |
868 | return NOTIFY_DONE; | 900 | return NOTIFY_DONE; |
869 | } | 901 | } |
@@ -904,7 +936,7 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count) | |||
904 | len = sizeof(scratch) - 1; | 936 | len = sizeof(scratch) - 1; |
905 | scratch[len] = '\0'; | 937 | scratch[len] = '\0'; |
906 | memcpy(scratch, buf, len); | 938 | memcpy(scratch, buf, len); |
907 | hcall(LHCALL_NOTIFY, __pa(scratch), 0, 0); | 939 | kvm_hypercall1(LHCALL_NOTIFY, __pa(scratch)); |
908 | 940 | ||
909 | /* This routine returns the number of bytes actually written. */ | 941 | /* This routine returns the number of bytes actually written. */ |
910 | return len; | 942 | return len; |
@@ -914,7 +946,7 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count) | |||
914 | * Launcher to reboot us. */ | 946 | * Launcher to reboot us. */ |
915 | static void lguest_restart(char *reason) | 947 | static void lguest_restart(char *reason) |
916 | { | 948 | { |
917 | hcall(LHCALL_SHUTDOWN, __pa(reason), LGUEST_SHUTDOWN_RESTART, 0); | 949 | kvm_hypercall2(LHCALL_SHUTDOWN, __pa(reason), LGUEST_SHUTDOWN_RESTART); |
918 | } | 950 | } |
919 | 951 | ||
920 | /*G:050 | 952 | /*G:050 |
@@ -991,10 +1023,10 @@ __init void lguest_init(void) | |||
991 | 1023 | ||
992 | /* interrupt-related operations */ | 1024 | /* interrupt-related operations */ |
993 | pv_irq_ops.init_IRQ = lguest_init_IRQ; | 1025 | pv_irq_ops.init_IRQ = lguest_init_IRQ; |
994 | pv_irq_ops.save_fl = save_fl; | 1026 | pv_irq_ops.save_fl = PV_CALLEE_SAVE(save_fl); |
995 | pv_irq_ops.restore_fl = restore_fl; | 1027 | pv_irq_ops.restore_fl = PV_CALLEE_SAVE(restore_fl); |
996 | pv_irq_ops.irq_disable = irq_disable; | 1028 | pv_irq_ops.irq_disable = PV_CALLEE_SAVE(irq_disable); |
997 | pv_irq_ops.irq_enable = irq_enable; | 1029 | pv_irq_ops.irq_enable = PV_CALLEE_SAVE(irq_enable); |
998 | pv_irq_ops.safe_halt = lguest_safe_halt; | 1030 | pv_irq_ops.safe_halt = lguest_safe_halt; |
999 | 1031 | ||
1000 | /* init-time operations */ | 1032 | /* init-time operations */ |
@@ -1034,10 +1066,12 @@ __init void lguest_init(void) | |||
1034 | pv_mmu_ops.read_cr3 = lguest_read_cr3; | 1066 | pv_mmu_ops.read_cr3 = lguest_read_cr3; |
1035 | pv_mmu_ops.lazy_mode.enter = paravirt_enter_lazy_mmu; | 1067 | pv_mmu_ops.lazy_mode.enter = paravirt_enter_lazy_mmu; |
1036 | pv_mmu_ops.lazy_mode.leave = lguest_leave_lazy_mode; | 1068 | pv_mmu_ops.lazy_mode.leave = lguest_leave_lazy_mode; |
1069 | pv_mmu_ops.pte_update = lguest_pte_update; | ||
1070 | pv_mmu_ops.pte_update_defer = lguest_pte_update; | ||
1037 | 1071 | ||
1038 | #ifdef CONFIG_X86_LOCAL_APIC | 1072 | #ifdef CONFIG_X86_LOCAL_APIC |
1039 | /* apic read/write intercepts */ | 1073 | /* apic read/write intercepts */ |
1040 | apic_ops = &lguest_basic_apic_ops; | 1074 | set_lguest_basic_apic_ops(); |
1041 | #endif | 1075 | #endif |
1042 | 1076 | ||
1043 | /* time operations */ | 1077 | /* time operations */ |
@@ -1052,14 +1086,6 @@ __init void lguest_init(void) | |||
1052 | * lguest_init() where the rest of the fairly chaotic boot setup | 1086 | * lguest_init() where the rest of the fairly chaotic boot setup |
1053 | * occurs. */ | 1087 | * occurs. */ |
1054 | 1088 | ||
1055 | /* The native boot code sets up initial page tables immediately after | ||
1056 | * the kernel itself, and sets init_pg_tables_end so they're not | ||
1057 | * clobbered. The Launcher places our initial pagetables somewhere at | ||
1058 | * the top of our physical memory, so we don't need extra space: set | ||
1059 | * init_pg_tables_end to the end of the kernel. */ | ||
1060 | init_pg_tables_start = __pa(pg0); | ||
1061 | init_pg_tables_end = __pa(pg0); | ||
1062 | |||
1063 | /* As described in head_32.S, we map the first 128M of memory. */ | 1089 | /* As described in head_32.S, we map the first 128M of memory. */ |
1064 | max_pfn_mapped = (128*1024*1024) >> PAGE_SHIFT; | 1090 | max_pfn_mapped = (128*1024*1024) >> PAGE_SHIFT; |
1065 | 1091 | ||