VirtualBox

Changeset 743 in vbox


Ignore:
Timestamp:
Feb 7, 2007 10:37:06 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18395
Message:

Changed call patch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PATM/PATMA.asm

    r739 r743  
    3838%include "PATMA.mac"
    3939
     40%ifdef DEBUG
     41; Noisy, but useful for debugging certain problems
     42;;;%define PATM_LOG_PATCHINSTR
     43%endif
    4044
    4145BEGINCODE
     
    275279    mov     dword [ss:PATM_INTERRUPTFLAG], 0
    276280    pushf
    277 %ifdef PATM_LOG_IF_CHANGES
     281%ifdef PATM_LOG_PATCHINSTR
    278282    push    eax
    279283    push    ecx
     
    304308    DD      0
    305309    DD      PATMCliEnd - PATMCliStart
    306 %ifdef PATM_LOG_IF_CHANGES
     310%ifdef PATM_LOG_PATCHINSTR
    307311    DD      4
    308312%else
     
    311315    DD      PATM_INTERRUPTFLAG
    312316    DD      0
    313 %ifdef PATM_LOG_IF_CHANGES
     317%ifdef PATM_LOG_PATCHINSTR
    314318    DD      PATM_PENDINGACTION
    315319    DD      0
     
    327331    mov     dword [ss:PATM_INHIBITIRQADDR], PATM_NEXTINSTRADDR
    328332    pushf
    329 %ifdef PATM_LOG_IF_CHANGES
     333%ifdef PATM_LOG_PATCHINSTR
    330334    push    eax
    331335    push    ecx
     
    350354    DD      0
    351355    DD      PATMStiEnd - PATMStiStart
    352 %ifdef PATM_LOG_IF_CHANGES
     356%ifdef PATM_LOG_PATCHINSTR
    353357    DD      6
    354358%else
     
    361365    DD      PATM_NEXTINSTRADDR
    362366    DD      0
    363 %ifdef PATM_LOG_IF_CHANGES
     367%ifdef PATM_LOG_PATCHINSTR
    364368    DD      PATM_PENDINGACTION
    365369    DD      0
     
    594598PATMPopf32Start:
    595599    mov     dword [ss:PATM_INTERRUPTFLAG], 0
    596 %ifdef PATM_LOG_IF_CHANGES
     600%ifdef PATM_LOG_PATCHINSTR
    597601    push    eax
    598602    push    ecx
     
    654658    DD      0
    655659    DD      PATMPopf32End - PATMPopf32Start
    656 %ifdef PATM_LOG_IF_CHANGES
     660%ifdef PATM_LOG_PATCHINSTR
    657661    DD      13
    658662%else
     
    661665    DD      PATM_INTERRUPTFLAG
    662666    DD      0
    663 %ifdef PATM_LOG_IF_CHANGES
     667%ifdef PATM_LOG_PATCHINSTR
    664668    DD      PATM_PENDINGACTION
    665669    DD      0
     
    693697PATMPopf32_NoExitStart:
    694698    mov     dword [ss:PATM_INTERRUPTFLAG], 0
    695 %ifdef PATM_LOG_IF_CHANGES
     699%ifdef PATM_LOG_PATCHINSTR
    696700    push    eax
    697701    push    ecx
     
    748752    DD      0
    749753    DD      PATMPopf32_NoExitEnd - PATMPopf32_NoExitStart
    750 %ifdef PATM_LOG_IF_CHANGES
     754%ifdef PATM_LOG_PATCHINSTR
    751755    DD      14
    752756%else
     
    755759    DD      PATM_INTERRUPTFLAG
    756760    DD      0
    757 %ifdef PATM_LOG_IF_CHANGES
     761%ifdef PATM_LOG_PATCHINSTR
    758762    DD      PATM_PENDINGACTION
    759763    DD      0
     
    917921    mov     dword [ss:PATM_INTERRUPTFLAG], 0
    918922    pushfd
    919 %ifdef PATM_LOG_IF_CHANGES
     923%ifdef PATM_LOG_PATCHINSTR
    920924    push    eax
    921925    push    ecx
     
    948952    DD      0
    949953    DD      PATMPushf32End - PATMPushf32Start
    950 %ifdef PATM_LOG_IF_CHANGES
     954%ifdef PATM_LOG_PATCHINSTR
    951955    DD      4
    952956%else
     
    955959    DD      PATM_INTERRUPTFLAG
    956960    DD      0
    957 %ifdef PATM_LOG_IF_CHANGES
     961%ifdef PATM_LOG_PATCHINSTR
    958962    DD      PATM_PENDINGACTION
    959963    DD      0
     
    10661070    pushfd
    10671071
    1068 %ifdef PATM_LOG_IF_CHANGES
     1072%ifdef PATM_LOG_PATCHINSTR
    10691073    push    eax
    10701074    push    ecx
     
    12131217    DD      0
    12141218    DD      PATMIretEnd- PATMIretStart
    1215 %ifdef PATM_LOG_IF_CHANGES
     1219%ifdef PATM_LOG_PATCHINSTR
    12161220    DD      22
    12171221%else
     
    12201224    DD      PATM_INTERRUPTFLAG
    12211225    DD      0
    1222 %ifdef PATM_LOG_IF_CHANGES
     1226%ifdef PATM_LOG_PATCHINSTR
    12231227    DD      PATM_PENDINGACTION
    12241228    DD      0
     
    16011605    push    ecx
    16021606
     1607    mov     eax, dword [esp+16+4]                   ; guest return address
     1608    mov     dword [ss:PATM_CALL_RETURN_ADDR], eax                               ; temporary storage
     1609
    16031610    mov     edx, dword [esp+16+20]  ; pushed target address
    16041611
     
    16671674    mov     dword [ss:edi], eax
    16681675
    1669     push    ecx                                 ; temporarily store the target address on the stack
    1670     add     esp, 4
     1676    mov     dword [ss:PATM_CALL_PATCH_TARGET_ADDR], ecx       ; temporarily store the target address
    16711677    pop     ecx
    16721678    pop     edi
     
    16751681    add     esp, 24                             ; parameters + return address pushed by caller (changes the flags, but that shouldn't matter)
    16761682
    1677 %ifdef PATM_LOG_IF_CHANGES
     1683%ifdef PATM_LOG_PATCHINSTR
    16781684    push    eax
    1679     push    ebx
    16801685    push    ecx
    1681     push    edx
    1682     mov     ebx, dword [esp - 20 - 16]               ; original guest return address
    1683     mov     edx, dword [esp - 40 + 4 - 16]           ; duplicated patch function
    16841686    lock    or dword [ss:PATM_PENDINGACTION], PATM_ACTION_LOG_CALL
    16851687    mov     eax, PATM_ACTION_LOG_CALL
    16861688    mov     ecx, PATM_ACTION_MAGIC
    16871689    db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
    1688     pop     edx
    16891690    pop     ecx
    1690     pop     ebx
    16911691    pop     eax
    16921692%endif
    16931693
    1694     push    dword [esp - 20]                    ; push original guest return address
     1694    push    dword [ss:PATM_CALL_RETURN_ADDR]   ; push original guest return address
    16951695
    16961696    ; the called function will set PATM_INTERRUPTFLAG (!!)
    1697     jmp     dword [esp-40]                      ; call duplicated patch function
     1697    jmp     dword [ss:PATM_CALL_PATCH_TARGET_ADDR]
    16981698
    16991699PATMLookupAndCallEnd:
     
    17081708    DD      0
    17091709    DD      PATMLookupAndCallEnd - PATMLookupAndCallStart
    1710 %ifdef PATM_LOG_IF_CHANGES
    1711     DD      6
     1710%ifdef PATM_LOG_PATCHINSTR
     1711    DD      10
    17121712%else
    1713     DD      5
    1714 %endif
     1713    DD      9
     1714%endif
     1715    DD      PATM_CALL_RETURN_ADDR
     1716    DD      0
    17151717    DD      PATM_PENDINGACTION
    17161718    DD      0
     
    17231725    DD      PATM_STACKBASE_GUEST
    17241726    DD      0
    1725 %ifdef PATM_LOG_IF_CHANGES
     1727    DD      PATM_CALL_PATCH_TARGET_ADDR
     1728    DD      0
     1729%ifdef PATM_LOG_PATCHINSTR
    17261730    DD      PATM_PENDINGACTION
    17271731    DD      0
    17281732%endif
     1733    DD      PATM_CALL_RETURN_ADDR
     1734    DD      0
     1735    DD      PATM_CALL_PATCH_TARGET_ADDR
     1736    DD      0
    17291737    DD      0ffffffffh
    17301738
     
    21212129    add     eax, PATM_PATCHBASE
    21222130
    2123 %ifdef PATM_LOG_IF_CHANGES
     2131%ifdef PATM_LOG_PATCHINSTR
    21242132    push    eax
    21252133    push    ecx
     
    21802188    add     eax, PATM_PATCHBASE
    21812189
    2182 %ifdef PATM_LOG_IF_CHANGES
     2190%ifdef PATM_LOG_PATCHINSTR
    21832191    push    eax
    21842192    push    ecx
     
    22162224    DD      0
    22172225    DD      PATMRetFunction_End - PATMRetFunction_Start
    2218 %ifdef PATM_LOG_IF_CHANGES
     2226%ifdef PATM_LOG_PATCHINSTR
    22192227    DD      9
    22202228%else
     
    22312239    DD      PATM_PATCHBASE
    22322240    DD      0
    2233 %ifdef PATM_LOG_IF_CHANGES
     2241%ifdef PATM_LOG_PATCHINSTR
    22342242    DD      PATM_PENDINGACTION
    22352243    DD      0
     
    22392247    DD      PATM_PATCHBASE
    22402248    DD      0
    2241 %ifdef PATM_LOG_IF_CHANGES
     2249%ifdef PATM_LOG_PATCHINSTR
    22422250    DD      PATM_PENDINGACTION
    22432251    DD      0
     
    22662274    mov     dword [ss:PATM_STACKPTR], PATM_STACK_SIZE
    22672275
    2268 %ifdef PATM_LOG_IF_CHANGES
     2276%ifdef PATM_LOG_PATCHINSTR
    22692277    push    eax
    22702278    push    ecx
     
    22922300    DD      0
    22932301    DD      PATMCheckIF_End - PATMCheckIF_Start
    2294 %ifdef PATM_LOG_IF_CHANGES
     2302%ifdef PATM_LOG_PATCHINSTR
    22952303    DD      6
    22962304%else
     
    23052313    DD      PATM_STACKPTR
    23062314    DD      0
    2307 %ifdef PATM_LOG_IF_CHANGES
     2315%ifdef PATM_LOG_PATCHINSTR
    23082316    DD      PATM_PENDINGACTION
    23092317    DD      0
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette