Changeset 15198 in vbox
- Timestamp:
- Dec 9, 2008 7:35:36 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWACCMR0A.asm
r14875 r15198 218 218 extern NAME(SUPR0Abs64bitKernelSS) 219 219 extern NAME(SUPR0Abs64bitKernelDS) 220 extern NAME(SUPR0AbsKernelCS) 220 221 %endif 221 222 … … 260 261 lea edx, [esp + 8] ; &u64Data 261 262 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 262 cmp byte [NAME(g_fVMXIs64bitHost)], 0 263 jne .longmode 263 cmp byte [NAME(g_fVMXIs64bitHost)], 0 264 jz .legacy_mode 265 db 0xea ; jmp far .sixtyfourbit_mode 266 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 267 .legacy_mode: 264 268 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 265 269 vmwrite ecx, [edx] ; low dword … … 281 285 282 286 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 283 .longmode: 284 ; Convert return frame into a retf frame 64-bit -> 32-bit 285 xor eax, eax 286 xchg eax, [esp] 287 push cs 288 push 0 289 push eax ; original return address. 290 ; jmp far .thunk64 291 db 0xea 292 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 293 BITS 64 294 .thunk64: 287 ALIGNCODE(16) 288 BITS 64 289 .sixtyfourbit_mode: 295 290 and edx, 0ffffffffh 296 291 and ecx, 0ffffffffh … … 301 296 mov r9d, VERR_VMX_INVALID_VMCS_PTR 302 297 cmovc eax, r9d 303 retf ; return to caller 298 jmp far [.fpret wrt rip] 299 .fpret: ; 16:32 Pointer to .the_end. 300 dd .the_end, NAME(SUPR0AbsKernelCS) 304 301 BITS 32 305 302 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL … … 331 328 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 332 329 cmp byte [NAME(g_fVMXIs64bitHost)], 0 333 jne .longmode 330 jz .legacy_mode 331 db 0xea ; jmp far .sixtyfourbit_mode 332 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 333 .legacy_mode: 334 334 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 335 335 vmread [edx], ecx ; low dword … … 351 351 352 352 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 353 .longmode: 354 ; Convert return frame into a retf frame 64-bit -> 32-bit 355 xor eax, eax 356 xchg eax, [esp] 357 push cs 358 push 0 359 push eax ; original return address. 360 ; jmp far .thunk64 361 db 0xea 362 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 363 BITS 64 364 .thunk64: 353 ALIGNCODE(16) 354 BITS 64 355 .sixtyfourbit_mode: 365 356 and edx, 0ffffffffh 366 357 and ecx, 0ffffffffh … … 371 362 mov r9d, VERR_VMX_INVALID_VMCS_PTR 372 363 cmovc eax, r9d 373 retf ; return to caller 364 jmp far [.fpret wrt rip] 365 .fpret: ; 16:32 Pointer to .the_end. 366 dd .the_end, NAME(SUPR0AbsKernelCS) 374 367 BITS 32 375 368 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL … … 403 396 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 404 397 cmp byte [NAME(g_fVMXIs64bitHost)], 0 405 jne .longmode 398 jz .legacy_mode 399 db 0xea ; jmp far .sixtyfourbit_mode 400 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 401 .legacy_mode: 406 402 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 407 403 xor eax, eax … … 418 414 419 415 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 420 .longmode: 421 ; Convert return frame into a retf frame 64-bit -> 32-bit 422 xor eax, eax 423 xchg eax, [esp] 424 push cs 425 push 0 426 push eax ; original return address. 427 ; jmp far .thunk64 428 db 0xea 429 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 430 BITS 64 431 .thunk64: 416 ALIGNCODE(16) 417 BITS 64 418 .sixtyfourbit_mode: 432 419 and edx, 0ffffffffh 433 420 and ecx, 0ffffffffh … … 439 426 mov r9d, VERR_VMX_INVALID_VMCS_PTR 440 427 cmovc eax, r9d 441 retf ; return to caller 428 jmp far [.fpret wrt rip] 429 .fpret: ; 16:32 Pointer to .the_end. 430 dd .the_end, NAME(SUPR0AbsKernelCS) 442 431 BITS 32 443 432 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL … … 471 460 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 472 461 cmp byte [NAME(g_fVMXIs64bitHost)], 0 473 jne .longmode 462 jz .legacy_mode 463 db 0xea ; jmp far .sixtyfourbit_mode 464 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 465 .legacy_mode: 474 466 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 475 467 xor eax, eax … … 486 478 487 479 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 488 .longmode: 489 ; Convert return frame into a retf frame 64-bit -> 32-bit 490 xor eax, eax 491 xchg eax, [esp] 492 push cs 493 push 0 494 push eax ; original return address. 495 ; jmp far .thunk64 496 db 0xea 497 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 498 BITS 64 499 .thunk64: 480 ALIGNCODE(16) 481 BITS 64 482 .sixtyfourbit_mode: 500 483 and edx, 0ffffffffh 501 484 and ecx, 0ffffffffh … … 506 489 mov r9d, VERR_VMX_INVALID_VMCS_PTR 507 490 cmovc eax, r9d 508 retf ; return to caller 491 jmp far [.fpret wrt rip] 492 .fpret: ; 16:32 Pointer to .the_end. 493 dd .the_end, NAME(SUPR0AbsKernelCS) 509 494 BITS 32 510 495 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL … … 531 516 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 532 517 cmp byte [NAME(g_fVMXIs64bitHost)], 0 533 jne .longmode 518 jz .legacy_mode 519 db 0xea ; jmp far .sixtyfourbit_mode 520 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 521 .legacy_mode: 534 522 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 535 523 xor eax, eax … … 551 539 552 540 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 553 .longmode: 554 lea edx, [esp + 4] ; &HCPhysVMXOn. 555 ; Convert return frame into a retf frame 64-bit -> 32-bit 556 xor eax, eax 557 xchg eax, [esp] 558 push cs 559 push 0 560 push eax ; original return address. 561 ; jmp far .thunk64 562 db 0xea 563 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 564 BITS 64 565 .thunk64: 541 ALIGNCODE(16) 542 BITS 64 543 .sixtyfourbit_mode: 544 lea rdx, [rsp + 4] ; &HCPhysVMXOn. 566 545 and edx, 0ffffffffh 567 546 xor eax, eax … … 571 550 mov r9d, VERR_VMX_INVALID_VMCS_PTR 572 551 cmovc eax, r9d 573 retf ; return to caller 552 jmp far [.fpret wrt rip] 553 .fpret: ; 16:32 Pointer to .the_end. 554 dd .the_end, NAME(SUPR0AbsKernelCS) 574 555 BITS 32 575 556 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL … … 584 565 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 585 566 cmp byte [NAME(g_fVMXIs64bitHost)], 0 586 jne .longmode 567 jz .legacy_mode 568 db 0xea ; jmp far .sixtyfourbit_mode 569 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 570 .legacy_mode: 587 571 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 588 572 vmxoff 589 ret 590 591 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 592 .longmode: 593 ; Convert return frame into a retf frame 64-bit -> 32-bit 594 xor eax, eax 595 xchg eax, [esp] 596 push cs 597 push 0 598 push eax ; original return address. 599 ; jmp far .thunk64 600 db 0xea 601 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 602 BITS 64 603 .thunk64: 573 .the_end: 574 ret 575 576 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 577 ALIGNCODE(16) 578 BITS 64 579 .sixtyfourbit_mode: 604 580 vmxoff 605 retf ; return to caller 581 jmp far [.fpret wrt rip] 582 .fpret: ; 16:32 Pointer to .the_end. 583 dd .the_end, NAME(SUPR0AbsKernelCS) 606 584 BITS 32 607 585 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL … … 628 606 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 629 607 cmp byte [NAME(g_fVMXIs64bitHost)], 0 630 jne .longmode 608 jz .legacy_mode 609 db 0xea ; jmp far .sixtyfourbit_mode 610 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 611 .legacy_mode: 631 612 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 632 613 xor eax, eax … … 642 623 643 624 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 644 .longmode: 645 lea edx, [esp + 4] ; &HCPhysVMCS 646 ; Convert return frame into a retf frame 64-bit -> 32-bit 647 xor eax, eax 648 xchg eax, [esp] 649 push cs 650 push 0 651 push eax ; original return address. 652 ; jmp far .thunk64 653 db 0xea 654 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 655 BITS 64 656 .thunk64: 625 ALIGNCODE(16) 626 BITS 64 627 .sixtyfourbit_mode: 628 lea rdx, [rsp + 4] ; &HCPhysVMCS 657 629 and edx, 0ffffffffh 658 630 xor eax, eax … … 660 632 mov r9d, VERR_VMX_INVALID_VMCS_PTR 661 633 cmovc eax, r9d 662 retf ; return to caller 634 jmp far [.fpret wrt rip] 635 .fpret: ; 16:32 Pointer to .the_end. 636 dd .the_end, NAME(SUPR0AbsKernelCS) 663 637 BITS 32 664 638 %endif … … 685 659 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 686 660 cmp byte [NAME(g_fVMXIs64bitHost)], 0 687 jne .longmode 661 jz .legacy_mode 662 db 0xea ; jmp far .sixtyfourbit_mode 663 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 664 .legacy_mode: 688 665 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 689 666 xor eax, eax … … 699 676 700 677 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 701 .longmode: 702 lea edx, [esp + 4] ; &HCPhysVMCS 703 ; Convert return frame into a retf frame 64-bit -> 32-bit 704 xor eax, eax 705 xchg eax, [esp] 706 push cs 707 push 0 708 push eax ; original return address. 709 ; jmp far .thunk64 710 db 0xea 711 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 712 BITS 64 713 .thunk64: 678 ALIGNCODE(16) 679 BITS 64 680 .sixtyfourbit_mode: 681 lea rdx, [rsp + 4] ; &HCPhysVMCS 714 682 and edx, 0ffffffffh 715 683 xor eax, eax … … 717 685 mov r9d, VERR_VMX_INVALID_VMCS_PTR 718 686 cmovc eax, r9d 719 retf ; return to caller 687 jmp far [.fpret wrt rip] 688 .fpret: ; 16:32 Pointer to .the_end. 689 dd .the_end, NAME(SUPR0AbsKernelCS) 720 690 BITS 32 721 691 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL … … 744 714 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 745 715 cmp byte [NAME(g_fVMXIs64bitHost)], 0 746 jne .longmode 716 jz .legacy_mode 717 db 0xea ; jmp far .sixtyfourbit_mode 718 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 719 .legacy_mode: 747 720 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 748 721 vmptrst qword [esp+04h] 749 722 %endif 750 723 xor eax, eax 724 .the_end: 751 725 ret 752 726 753 727 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 754 .longmode: 755 lea edx, [esp + 4] ; &HCPhysVMCS 756 ; Convert return frame into a retf frame 64-bit -> 32-bit 757 xor eax, eax 758 xchg eax, [esp] 759 push cs 760 push 0 761 push eax ; original return address. 762 ; jmp far .thunk64 763 db 0xea 764 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 765 BITS 64 766 .thunk64: 728 ALIGNCODE(16) 729 BITS 64 730 .sixtyfourbit_mode: 731 lea rdx, [rsp + 4] ; &HCPhysVMCS 767 732 and edx, 0ffffffffh 768 733 vmptrst qword [rdx] 769 734 xor eax, eax 770 retf ; return to caller 735 jmp far [.fpret wrt rip] 736 .fpret: ; 16:32 Pointer to .the_end. 737 dd .the_end, NAME(SUPR0AbsKernelCS) 771 738 BITS 32 772 739 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL … … 796 763 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 797 764 cmp byte [NAME(g_fVMXIs64bitHost)], 0 798 jne .longmode 765 jz .legacy_mode 766 db 0xea ; jmp far .sixtyfourbit_mode 767 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 768 .legacy_mode: 799 769 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 800 770 mov eax, [esp + 4] … … 813 783 814 784 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 815 .longmode: 816 mov ecx, [esp + 4] ; enmFlush 817 mov edx, [esp + 8] ; pDescriptor 818 ; Convert return frame into a retf frame 64-bit -> 32-bit 819 xor eax, eax 820 xchg eax, [esp] 821 push cs 822 push 0 823 push eax ; original return address. 824 ; jmp far .thunk64 825 db 0xea 826 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 827 BITS 64 828 .thunk64: 829 and ecx, 0ffffffffh 830 and edx, 0ffffffffh 785 ALIGNCODE(16) 786 BITS 64 787 .sixtyfourbit_mode: 788 and esp, 0ffffffffh 789 mov ecx, [rsp + 4] ; enmFlush 790 mov edx, [rsp + 8] ; pDescriptor 831 791 xor eax, eax 832 792 ; invept rcx, qword [rdx] … … 836 796 mov r9d, VERR_VMX_INVALID_VMCS_PTR 837 797 cmovc eax, r9d 838 retf ; return to caller 798 jmp far [.fpret wrt rip] 799 .fpret: ; 16:32 Pointer to .the_end. 800 dd .the_end, NAME(SUPR0AbsKernelCS) 839 801 BITS 32 840 802 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL … … 863 825 %else 864 826 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 865 cmp byte [NAME(g_fVMXIs64bitHost)], 0 866 jne .longmode 827 cmp byte [NAME(g_fVMXIs64bitHost)], 0 828 jz .legacy_mode 829 db 0xea ; jmp far .sixtyfourbit_mode 830 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 831 .legacy_mode: 867 832 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL 868 833 mov eax, [esp + 4] … … 881 846 882 847 %ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL 883 .longmode: 884 mov ecx, [esp + 4] ; enmFlush 885 mov edx, [esp + 8] ; pDescriptor 886 ; Convert return frame into a retf frame 64-bit -> 32-bit 887 xor eax, eax 888 xchg eax, [esp] 889 push cs 890 push 0 891 push eax ; original return address. 892 ; jmp far .thunk64 893 db 0xea 894 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 895 BITS 64 896 .thunk64: 897 and ecx, 0ffffffffh 898 and edx, 0ffffffffh 848 ALIGNCODE(16) 849 BITS 64 850 .sixtyfourbit_mode: 851 and esp, 0ffffffffh 852 mov ecx, [rsp + 4] ; enmFlush 853 mov edx, [rsp + 8] ; pDescriptor 899 854 xor eax, eax 900 855 ; invvpid rcx, qword [rdx] … … 904 859 mov r9d, VERR_VMX_INVALID_VMCS_PTR 905 860 cmovc eax, r9d 906 retf ; return to caller 861 jmp far [.fpret wrt rip] 862 .fpret: ; 16:32 Pointer to .the_end. 863 dd .the_end, NAME(SUPR0AbsKernelCS) 907 864 BITS 32 908 865 %endif ; VBOX_WITH_HYBIRD_32BIT_KERNEL … … 979 936 ;DECLASM(void) hwaccmR0Get64bitGDTRandIDTR(PX86XDTR64 pGdtr, PX86XDTR64 pIdtr); 980 937 BEGINPROC hwaccmR0Get64bitGDTRandIDTR 981 .longmode: 982 mov ecx, [esp + 4] ; pGdtr 983 mov edx, [esp + 8] ; pIdtr 984 ; Convert return frame into a retf frame 64-bit -> 32-bit 985 xor eax, eax 986 xchg eax, [esp] 987 push cs 988 push 0 989 push eax ; original return address. 990 ; jmp far .thunk64 991 db 0xea 992 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 993 BITS 64 994 .thunk64: 995 and ecx, 0ffffffffh 996 and edx, 0ffffffffh 938 db 0xea ; jmp far .sixtyfourbit_mode 939 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 940 .the_end: 941 ret 942 943 ALIGNCODE(16) 944 BITS 64 945 .sixtyfourbit_mode: 946 and esp, 0ffffffffh 947 mov ecx, [rsp + 4] ; pGdtr 948 mov edx, [rsp + 8] ; pIdtr 997 949 sgdt [rcx] 998 950 sidt [rdx] 999 retf 951 jmp far [.fpret wrt rip] 952 .fpret: ; 16:32 Pointer to .the_end. 953 dd .the_end, NAME(SUPR0AbsKernelCS) 1000 954 BITS 32 1001 955 ENDPROC hwaccmR0Get64bitGDTRandIDTR … … 1008 962 ;DECLASM(uint64_t) hwaccmR0Get64bitCR3(void); 1009 963 BEGINPROC hwaccmR0Get64bitCR3 1010 .longmode: 1011 ; Convert return frame into a retf frame 64-bit -> 32-bit 1012 xor eax, eax 1013 xchg eax, [esp] 1014 push cs 1015 push 0 1016 push eax ; original return address. 1017 ; jmp far .thunk64 1018 db 0xea 1019 dd .thunk64, NAME(SUPR0Abs64bitKernelCS) 1020 BITS 64 1021 .thunk64: 964 db 0xea ; jmp far .sixtyfourbit_mode 965 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS) 966 .the_end: 967 ret 968 969 ALIGNCODE(16) 970 BITS 64 971 .sixtyfourbit_mode: 1022 972 mov rax, cr3 1023 973 mov rdx, rax 1024 974 shr rdx, 32 1025 retf 975 jmp far [.fpret wrt rip] 976 .fpret: ; 16:32 Pointer to .the_end. 977 dd .the_end, NAME(SUPR0AbsKernelCS) 1026 978 BITS 32 1027 979 ENDPROC hwaccmR0Get64bitCR3
Note:
See TracChangeset
for help on using the changeset viewer.