diff options
Diffstat (limited to 'arch/x86/kernel/vmi_32.c')
-rw-r--r-- | arch/x86/kernel/vmi_32.c | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c index 18673e0f193b..67cea5c2e3e0 100644 --- a/arch/x86/kernel/vmi_32.c +++ b/arch/x86/kernel/vmi_32.c | |||
@@ -134,21 +134,21 @@ static unsigned vmi_patch(u8 type, u16 clobbers, void *insns, | |||
134 | unsigned long eip, unsigned len) | 134 | unsigned long eip, unsigned len) |
135 | { | 135 | { |
136 | switch (type) { | 136 | switch (type) { |
137 | case PARAVIRT_PATCH(irq_disable): | 137 | case PARAVIRT_PATCH(pv_irq_ops.irq_disable): |
138 | return patch_internal(VMI_CALL_DisableInterrupts, len, | 138 | return patch_internal(VMI_CALL_DisableInterrupts, len, |
139 | insns, eip); | 139 | insns, eip); |
140 | case PARAVIRT_PATCH(irq_enable): | 140 | case PARAVIRT_PATCH(pv_irq_ops.irq_enable): |
141 | return patch_internal(VMI_CALL_EnableInterrupts, len, | 141 | return patch_internal(VMI_CALL_EnableInterrupts, len, |
142 | insns, eip); | 142 | insns, eip); |
143 | case PARAVIRT_PATCH(restore_fl): | 143 | case PARAVIRT_PATCH(pv_irq_ops.restore_fl): |
144 | return patch_internal(VMI_CALL_SetInterruptMask, len, | 144 | return patch_internal(VMI_CALL_SetInterruptMask, len, |
145 | insns, eip); | 145 | insns, eip); |
146 | case PARAVIRT_PATCH(save_fl): | 146 | case PARAVIRT_PATCH(pv_irq_ops.save_fl): |
147 | return patch_internal(VMI_CALL_GetInterruptMask, len, | 147 | return patch_internal(VMI_CALL_GetInterruptMask, len, |
148 | insns, eip); | 148 | insns, eip); |
149 | case PARAVIRT_PATCH(iret): | 149 | case PARAVIRT_PATCH(pv_cpu_ops.iret): |
150 | return patch_internal(VMI_CALL_IRET, len, insns, eip); | 150 | return patch_internal(VMI_CALL_IRET, len, insns, eip); |
151 | case PARAVIRT_PATCH(irq_enable_sysexit): | 151 | case PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit): |
152 | return patch_internal(VMI_CALL_SYSEXIT, len, insns, eip); | 152 | return patch_internal(VMI_CALL_SYSEXIT, len, insns, eip); |
153 | default: | 153 | default: |
154 | break; | 154 | break; |
@@ -690,9 +690,9 @@ do { \ | |||
690 | reloc = call_vrom_long_func(vmi_rom, get_reloc, \ | 690 | reloc = call_vrom_long_func(vmi_rom, get_reloc, \ |
691 | VMI_CALL_##vmicall); \ | 691 | VMI_CALL_##vmicall); \ |
692 | if (rel->type == VMI_RELOCATION_CALL_REL) \ | 692 | if (rel->type == VMI_RELOCATION_CALL_REL) \ |
693 | paravirt_ops.opname = (void *)rel->eip; \ | 693 | opname = (void *)rel->eip; \ |
694 | else if (rel->type == VMI_RELOCATION_NOP) \ | 694 | else if (rel->type == VMI_RELOCATION_NOP) \ |
695 | paravirt_ops.opname = (void *)vmi_nop; \ | 695 | opname = (void *)vmi_nop; \ |
696 | else if (rel->type != VMI_RELOCATION_NONE) \ | 696 | else if (rel->type != VMI_RELOCATION_NONE) \ |
697 | printk(KERN_WARNING "VMI: Unknown relocation " \ | 697 | printk(KERN_WARNING "VMI: Unknown relocation " \ |
698 | "type %d for " #vmicall"\n",\ | 698 | "type %d for " #vmicall"\n",\ |
@@ -712,7 +712,7 @@ do { \ | |||
712 | VMI_CALL_##vmicall); \ | 712 | VMI_CALL_##vmicall); \ |
713 | BUG_ON(rel->type == VMI_RELOCATION_JUMP_REL); \ | 713 | BUG_ON(rel->type == VMI_RELOCATION_JUMP_REL); \ |
714 | if (rel->type == VMI_RELOCATION_CALL_REL) { \ | 714 | if (rel->type == VMI_RELOCATION_CALL_REL) { \ |
715 | paravirt_ops.opname = wrapper; \ | 715 | opname = wrapper; \ |
716 | vmi_ops.cache = (void *)rel->eip; \ | 716 | vmi_ops.cache = (void *)rel->eip; \ |
717 | } \ | 717 | } \ |
718 | } while (0) | 718 | } while (0) |
@@ -732,11 +732,11 @@ static inline int __init activate_vmi(void) | |||
732 | } | 732 | } |
733 | savesegment(cs, kernel_cs); | 733 | savesegment(cs, kernel_cs); |
734 | 734 | ||
735 | paravirt_ops.paravirt_enabled = 1; | 735 | pv_info.paravirt_enabled = 1; |
736 | paravirt_ops.kernel_rpl = kernel_cs & SEGMENT_RPL_MASK; | 736 | pv_info.kernel_rpl = kernel_cs & SEGMENT_RPL_MASK; |
737 | pv_info.name = "vmi"; | ||
737 | 738 | ||
738 | paravirt_ops.patch = vmi_patch; | 739 | pv_init_ops.patch = vmi_patch; |
739 | paravirt_ops.name = "vmi"; | ||
740 | 740 | ||
741 | /* | 741 | /* |
742 | * Many of these operations are ABI compatible with VMI. | 742 | * Many of these operations are ABI compatible with VMI. |
@@ -754,26 +754,26 @@ static inline int __init activate_vmi(void) | |||
754 | */ | 754 | */ |
755 | 755 | ||
756 | /* CPUID is special, so very special it gets wrapped like a present */ | 756 | /* CPUID is special, so very special it gets wrapped like a present */ |
757 | para_wrap(cpuid, vmi_cpuid, cpuid, CPUID); | 757 | para_wrap(pv_cpu_ops.cpuid, vmi_cpuid, cpuid, CPUID); |
758 | 758 | ||
759 | para_fill(clts, CLTS); | 759 | para_fill(pv_cpu_ops.clts, CLTS); |
760 | para_fill(get_debugreg, GetDR); | 760 | para_fill(pv_cpu_ops.get_debugreg, GetDR); |
761 | para_fill(set_debugreg, SetDR); | 761 | para_fill(pv_cpu_ops.set_debugreg, SetDR); |
762 | para_fill(read_cr0, GetCR0); | 762 | para_fill(pv_cpu_ops.read_cr0, GetCR0); |
763 | para_fill(read_cr2, GetCR2); | 763 | para_fill(pv_mmu_ops.read_cr2, GetCR2); |
764 | para_fill(read_cr3, GetCR3); | 764 | para_fill(pv_mmu_ops.read_cr3, GetCR3); |
765 | para_fill(read_cr4, GetCR4); | 765 | para_fill(pv_cpu_ops.read_cr4, GetCR4); |
766 | para_fill(write_cr0, SetCR0); | 766 | para_fill(pv_cpu_ops.write_cr0, SetCR0); |
767 | para_fill(write_cr2, SetCR2); | 767 | para_fill(pv_mmu_ops.write_cr2, SetCR2); |
768 | para_fill(write_cr3, SetCR3); | 768 | para_fill(pv_mmu_ops.write_cr3, SetCR3); |
769 | para_fill(write_cr4, SetCR4); | 769 | para_fill(pv_cpu_ops.write_cr4, SetCR4); |
770 | para_fill(save_fl, GetInterruptMask); | 770 | para_fill(pv_irq_ops.save_fl, GetInterruptMask); |
771 | para_fill(restore_fl, SetInterruptMask); | 771 | para_fill(pv_irq_ops.restore_fl, SetInterruptMask); |
772 | para_fill(irq_disable, DisableInterrupts); | 772 | para_fill(pv_irq_ops.irq_disable, DisableInterrupts); |
773 | para_fill(irq_enable, EnableInterrupts); | 773 | para_fill(pv_irq_ops.irq_enable, EnableInterrupts); |
774 | 774 | ||
775 | para_fill(wbinvd, WBINVD); | 775 | para_fill(pv_cpu_ops.wbinvd, WBINVD); |
776 | para_fill(read_tsc, RDTSC); | 776 | para_fill(pv_cpu_ops.read_tsc, RDTSC); |
777 | 777 | ||
778 | /* The following we emulate with trap and emulate for now */ | 778 | /* The following we emulate with trap and emulate for now */ |
779 | /* paravirt_ops.read_msr = vmi_rdmsr */ | 779 | /* paravirt_ops.read_msr = vmi_rdmsr */ |
@@ -781,29 +781,29 @@ static inline int __init activate_vmi(void) | |||
781 | /* paravirt_ops.rdpmc = vmi_rdpmc */ | 781 | /* paravirt_ops.rdpmc = vmi_rdpmc */ |
782 | 782 | ||
783 | /* TR interface doesn't pass TR value, wrap */ | 783 | /* TR interface doesn't pass TR value, wrap */ |
784 | para_wrap(load_tr_desc, vmi_set_tr, set_tr, SetTR); | 784 | para_wrap(pv_cpu_ops.load_tr_desc, vmi_set_tr, set_tr, SetTR); |
785 | 785 | ||
786 | /* LDT is special, too */ | 786 | /* LDT is special, too */ |
787 | para_wrap(set_ldt, vmi_set_ldt, _set_ldt, SetLDT); | 787 | para_wrap(pv_cpu_ops.set_ldt, vmi_set_ldt, _set_ldt, SetLDT); |
788 | 788 | ||
789 | para_fill(load_gdt, SetGDT); | 789 | para_fill(pv_cpu_ops.load_gdt, SetGDT); |
790 | para_fill(load_idt, SetIDT); | 790 | para_fill(pv_cpu_ops.load_idt, SetIDT); |
791 | para_fill(store_gdt, GetGDT); | 791 | para_fill(pv_cpu_ops.store_gdt, GetGDT); |
792 | para_fill(store_idt, GetIDT); | 792 | para_fill(pv_cpu_ops.store_idt, GetIDT); |
793 | para_fill(store_tr, GetTR); | 793 | para_fill(pv_cpu_ops.store_tr, GetTR); |
794 | paravirt_ops.load_tls = vmi_load_tls; | 794 | pv_cpu_ops.load_tls = vmi_load_tls; |
795 | para_fill(write_ldt_entry, WriteLDTEntry); | 795 | para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry); |
796 | para_fill(write_gdt_entry, WriteGDTEntry); | 796 | para_fill(pv_cpu_ops.write_gdt_entry, WriteGDTEntry); |
797 | para_fill(write_idt_entry, WriteIDTEntry); | 797 | para_fill(pv_cpu_ops.write_idt_entry, WriteIDTEntry); |
798 | para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack); | 798 | para_wrap(pv_cpu_ops.load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack); |
799 | para_fill(set_iopl_mask, SetIOPLMask); | 799 | para_fill(pv_cpu_ops.set_iopl_mask, SetIOPLMask); |
800 | para_fill(io_delay, IODelay); | 800 | para_fill(pv_cpu_ops.io_delay, IODelay); |
801 | para_wrap(set_lazy_mode, vmi_set_lazy_mode, set_lazy_mode, SetLazyMode); | 801 | para_wrap(pv_misc_ops.set_lazy_mode, vmi_set_lazy_mode, set_lazy_mode, SetLazyMode); |
802 | 802 | ||
803 | /* user and kernel flush are just handled with different flags to FlushTLB */ | 803 | /* user and kernel flush are just handled with different flags to FlushTLB */ |
804 | para_wrap(flush_tlb_user, vmi_flush_tlb_user, _flush_tlb, FlushTLB); | 804 | para_wrap(pv_mmu_ops.flush_tlb_user, vmi_flush_tlb_user, _flush_tlb, FlushTLB); |
805 | para_wrap(flush_tlb_kernel, vmi_flush_tlb_kernel, _flush_tlb, FlushTLB); | 805 | para_wrap(pv_mmu_ops.flush_tlb_kernel, vmi_flush_tlb_kernel, _flush_tlb, FlushTLB); |
806 | para_fill(flush_tlb_single, InvalPage); | 806 | para_fill(pv_mmu_ops.flush_tlb_single, InvalPage); |
807 | 807 | ||
808 | /* | 808 | /* |
809 | * Until a standard flag format can be agreed on, we need to | 809 | * Until a standard flag format can be agreed on, we need to |
@@ -819,41 +819,41 @@ static inline int __init activate_vmi(void) | |||
819 | #endif | 819 | #endif |
820 | 820 | ||
821 | if (vmi_ops.set_pte) { | 821 | if (vmi_ops.set_pte) { |
822 | paravirt_ops.set_pte = vmi_set_pte; | 822 | pv_mmu_ops.set_pte = vmi_set_pte; |
823 | paravirt_ops.set_pte_at = vmi_set_pte_at; | 823 | pv_mmu_ops.set_pte_at = vmi_set_pte_at; |
824 | paravirt_ops.set_pmd = vmi_set_pmd; | 824 | pv_mmu_ops.set_pmd = vmi_set_pmd; |
825 | #ifdef CONFIG_X86_PAE | 825 | #ifdef CONFIG_X86_PAE |
826 | paravirt_ops.set_pte_atomic = vmi_set_pte_atomic; | 826 | pv_mmu_ops.set_pte_atomic = vmi_set_pte_atomic; |
827 | paravirt_ops.set_pte_present = vmi_set_pte_present; | 827 | pv_mmu_ops.set_pte_present = vmi_set_pte_present; |
828 | paravirt_ops.set_pud = vmi_set_pud; | 828 | pv_mmu_ops.set_pud = vmi_set_pud; |
829 | paravirt_ops.pte_clear = vmi_pte_clear; | 829 | pv_mmu_ops.pte_clear = vmi_pte_clear; |
830 | paravirt_ops.pmd_clear = vmi_pmd_clear; | 830 | pv_mmu_ops.pmd_clear = vmi_pmd_clear; |
831 | #endif | 831 | #endif |
832 | } | 832 | } |
833 | 833 | ||
834 | if (vmi_ops.update_pte) { | 834 | if (vmi_ops.update_pte) { |
835 | paravirt_ops.pte_update = vmi_update_pte; | 835 | pv_mmu_ops.pte_update = vmi_update_pte; |
836 | paravirt_ops.pte_update_defer = vmi_update_pte_defer; | 836 | pv_mmu_ops.pte_update_defer = vmi_update_pte_defer; |
837 | } | 837 | } |
838 | 838 | ||
839 | vmi_ops.allocate_page = vmi_get_function(VMI_CALL_AllocatePage); | 839 | vmi_ops.allocate_page = vmi_get_function(VMI_CALL_AllocatePage); |
840 | if (vmi_ops.allocate_page) { | 840 | if (vmi_ops.allocate_page) { |
841 | paravirt_ops.alloc_pt = vmi_allocate_pt; | 841 | pv_mmu_ops.alloc_pt = vmi_allocate_pt; |
842 | paravirt_ops.alloc_pd = vmi_allocate_pd; | 842 | pv_mmu_ops.alloc_pd = vmi_allocate_pd; |
843 | paravirt_ops.alloc_pd_clone = vmi_allocate_pd_clone; | 843 | pv_mmu_ops.alloc_pd_clone = vmi_allocate_pd_clone; |
844 | } | 844 | } |
845 | 845 | ||
846 | vmi_ops.release_page = vmi_get_function(VMI_CALL_ReleasePage); | 846 | vmi_ops.release_page = vmi_get_function(VMI_CALL_ReleasePage); |
847 | if (vmi_ops.release_page) { | 847 | if (vmi_ops.release_page) { |
848 | paravirt_ops.release_pt = vmi_release_pt; | 848 | pv_mmu_ops.release_pt = vmi_release_pt; |
849 | paravirt_ops.release_pd = vmi_release_pd; | 849 | pv_mmu_ops.release_pd = vmi_release_pd; |
850 | } | 850 | } |
851 | 851 | ||
852 | /* Set linear is needed in all cases */ | 852 | /* Set linear is needed in all cases */ |
853 | vmi_ops.set_linear_mapping = vmi_get_function(VMI_CALL_SetLinearMapping); | 853 | vmi_ops.set_linear_mapping = vmi_get_function(VMI_CALL_SetLinearMapping); |
854 | #ifdef CONFIG_HIGHPTE | 854 | #ifdef CONFIG_HIGHPTE |
855 | if (vmi_ops.set_linear_mapping) | 855 | if (vmi_ops.set_linear_mapping) |
856 | paravirt_ops.kmap_atomic_pte = vmi_kmap_atomic_pte; | 856 | pv_mmu_ops.kmap_atomic_pte = vmi_kmap_atomic_pte; |
857 | #endif | 857 | #endif |
858 | 858 | ||
859 | /* | 859 | /* |
@@ -863,17 +863,17 @@ static inline int __init activate_vmi(void) | |||
863 | * the backend. They are performance critical anyway, so requiring | 863 | * the backend. They are performance critical anyway, so requiring |
864 | * a patch is not a big problem. | 864 | * a patch is not a big problem. |
865 | */ | 865 | */ |
866 | paravirt_ops.irq_enable_sysexit = (void *)0xfeedbab0; | 866 | pv_cpu_ops.irq_enable_sysexit = (void *)0xfeedbab0; |
867 | paravirt_ops.iret = (void *)0xbadbab0; | 867 | pv_cpu_ops.iret = (void *)0xbadbab0; |
868 | 868 | ||
869 | #ifdef CONFIG_SMP | 869 | #ifdef CONFIG_SMP |
870 | para_wrap(startup_ipi_hook, vmi_startup_ipi_hook, set_initial_ap_state, SetInitialAPState); | 870 | para_wrap(pv_apic_ops.startup_ipi_hook, vmi_startup_ipi_hook, set_initial_ap_state, SetInitialAPState); |
871 | #endif | 871 | #endif |
872 | 872 | ||
873 | #ifdef CONFIG_X86_LOCAL_APIC | 873 | #ifdef CONFIG_X86_LOCAL_APIC |
874 | para_fill(apic_read, APICRead); | 874 | para_fill(pv_apic_ops.apic_read, APICRead); |
875 | para_fill(apic_write, APICWrite); | 875 | para_fill(pv_apic_ops.apic_write, APICWrite); |
876 | para_fill(apic_write_atomic, APICWrite); | 876 | para_fill(pv_apic_ops.apic_write_atomic, APICWrite); |
877 | #endif | 877 | #endif |
878 | 878 | ||
879 | /* | 879 | /* |
@@ -891,15 +891,15 @@ static inline int __init activate_vmi(void) | |||
891 | vmi_timer_ops.set_alarm = vmi_get_function(VMI_CALL_SetAlarm); | 891 | vmi_timer_ops.set_alarm = vmi_get_function(VMI_CALL_SetAlarm); |
892 | vmi_timer_ops.cancel_alarm = | 892 | vmi_timer_ops.cancel_alarm = |
893 | vmi_get_function(VMI_CALL_CancelAlarm); | 893 | vmi_get_function(VMI_CALL_CancelAlarm); |
894 | paravirt_ops.time_init = vmi_time_init; | 894 | pv_time_ops.time_init = vmi_time_init; |
895 | paravirt_ops.get_wallclock = vmi_get_wallclock; | 895 | pv_time_ops.get_wallclock = vmi_get_wallclock; |
896 | paravirt_ops.set_wallclock = vmi_set_wallclock; | 896 | pv_time_ops.set_wallclock = vmi_set_wallclock; |
897 | #ifdef CONFIG_X86_LOCAL_APIC | 897 | #ifdef CONFIG_X86_LOCAL_APIC |
898 | paravirt_ops.setup_boot_clock = vmi_time_bsp_init; | 898 | pv_apic_ops.setup_boot_clock = vmi_time_bsp_init; |
899 | paravirt_ops.setup_secondary_clock = vmi_time_ap_init; | 899 | pv_apic_ops.setup_secondary_clock = vmi_time_ap_init; |
900 | #endif | 900 | #endif |
901 | paravirt_ops.sched_clock = vmi_sched_clock; | 901 | pv_time_ops.sched_clock = vmi_sched_clock; |
902 | paravirt_ops.get_cpu_khz = vmi_cpu_khz; | 902 | pv_time_ops.get_cpu_khz = vmi_cpu_khz; |
903 | 903 | ||
904 | /* We have true wallclock functions; disable CMOS clock sync */ | 904 | /* We have true wallclock functions; disable CMOS clock sync */ |
905 | no_sync_cmos_clock = 1; | 905 | no_sync_cmos_clock = 1; |
@@ -908,7 +908,7 @@ static inline int __init activate_vmi(void) | |||
908 | disable_vmi_timer = 1; | 908 | disable_vmi_timer = 1; |
909 | } | 909 | } |
910 | 910 | ||
911 | para_fill(safe_halt, Halt); | 911 | para_fill(pv_irq_ops.safe_halt, Halt); |
912 | 912 | ||
913 | /* | 913 | /* |
914 | * Alternative instruction rewriting doesn't happen soon enough | 914 | * Alternative instruction rewriting doesn't happen soon enough |