Changeset 12000 in vbox
- Timestamp:
- Sep 2, 2008 5:20:08 PM (16 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/Makefile.kmk
r11878 r12000 216 216 VBoxDrv_DEFS += VBOX_WITH_IDT_PATCHING 217 217 endif 218 #VBoxDrv_DEFS += SUPDRV_WITH_UNWIND_HACK - post 2.0, need to wrap more APIs and entry functions. 218 219 VBoxDrv_SDKS = W2K3DDK WINPSDKINCS 219 220 VBoxDrv_INCS := $(PATH_SUB_CURRENT) -
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r10805 r12000 184 184 { "RTSemEventMultiReset", (void *)RTSemEventMultiReset }, 185 185 { "RTSemEventMultiWait", (void *)RTSemEventMultiWait }, 186 #ifdef SUPDRV_WITH_UNWIND_HACK 187 { "RTSemEventMultiWaitNoResume", (void *)supdrvNtWrapRTSemEventMultiWaitNoResume }, 188 #else 186 189 { "RTSemEventMultiWaitNoResume", (void *)RTSemEventMultiWaitNoResume }, 190 #endif 187 191 { "RTSemEventMultiDestroy", (void *)RTSemEventMultiDestroy }, 188 192 { "RTSpinlockCreate", (void *)RTSpinlockCreate }, … … 1116 1120 /* execute */ 1117 1121 if (RT_LIKELY(pDevExt->pfnVMMR0EntryEx)) 1122 #ifdef SUPDRV_WITH_UNWIND_HACK 1123 pReq->Hdr.rc = supdrvNtWrapVMMR0EntryEx((PFNRT)pDevExt->pfnVMMR0EntryEx, pReq->u.In.pVMR0, pReq->u.In.uOperation, NULL, pReq->u.In.u64Arg, pSession); 1124 #else 1118 1125 pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.uOperation, NULL, pReq->u.In.u64Arg, pSession); 1126 #endif 1119 1127 else 1120 1128 pReq->Hdr.rc = VERR_WRONG_ORDER; … … 1130 1138 /* execute */ 1131 1139 if (RT_LIKELY(pDevExt->pfnVMMR0EntryEx)) 1140 #ifdef SUPDRV_WITH_UNWIND_HACK 1141 pReq->Hdr.rc = supdrvNtWrapVMMR0EntryEx((PFNRT)pDevExt->pfnVMMR0EntryEx, pReq->u.In.pVMR0, pReq->u.In.uOperation, pVMMReq, pReq->u.In.u64Arg, pSession); 1142 #else 1132 1143 pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.uOperation, pVMMReq, pReq->u.In.u64Arg, pSession); 1144 #endif 1133 1145 else 1134 1146 pReq->Hdr.rc = VERR_WRONG_ORDER; -
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r10935 r12000 670 670 bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt); 671 671 672 #ifdef SUPDRV_WITH_UNWIND_HACK 673 DECLASM(int) supdrvNtWrapVMMR0EntryEx(PFNRT pfnVMMR0EntryEx, PVM pVM, unsigned uOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession); 674 DECLASM(int) supdrvNtWrapRTSemEventMultiWaitNoResume(RTSEMEVENTMULTI EventMultiSem, unsigned cMillies); 675 #endif 676 672 677 673 678 /******************************************************************************* -
trunk/src/VBox/HostDrivers/Support/win/SUPDrvA-win.asm
r8155 r12000 52 52 ENDPROC SUPR0Printf 53 53 54 55 %ifdef SUPDRV_WITH_UNWIND_HACK 56 %if 0 ; def RT_ARCH_AMD64 57 ;; 58 ; @cproto DECLASM(int) supdrvNtWrapVMMR0EntryEx(PFNRT pfnVMMR0EntryEx, PVM pVM, unsigned uOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession); 59 ; 60 ; @param pfnVMMR0EntryEx rcx 61 ; @param pVM rdx 62 ; @param uOperation r8 63 ; @param pReq r9 64 ; @param u64Arg [rsp + 28h] / [rbp + 30h] 65 ; @param pSession [rsp + 30h] / [rbp + 38h] 66 ; 67 BEGINPROC supdrvNtWrapVMMR0EntryEx 68 [proc_frame supdrvNtWrapVMMR0EntryEx] 69 push rbp 70 [pushreg rbp] 71 mov rbp, rsp 72 [setframe rbp,0] 73 sub rsp, 80h 74 [allocstack 0x80] 75 ;; @todo save more regs? 76 [endprolog] 77 78 ; 79 ; Create a stack marker with the rbp. The marker is 32 byte big. 80 ; This is 32-byte aligned and 32 byte in size. 81 ; 82 lea r10, [rbp - 30h] 83 and r10, ~1fh ; 32-byte align it. 84 mov dword [r10 ], 0x20080901 85 mov dword [r10 + 4], 0x20080902 86 mov qword [r10 + 8], rbp 87 mov dword [r10 +16], 0x20080903 88 mov dword [r10 +20], 0x20080904 89 mov qword [r10 +24], rbp 90 91 ; 92 ; Forward the call. 93 ; 94 mov rax, rcx 95 mov rcx, rdx 96 mov rdx, r8 97 mov r8, r9 98 mov r9, [rbp + 30h] 99 mov r11, [rbp + 38h] 100 mov [rsp + 20h], r11 101 call rax 102 103 ; 104 ; Trash the stack marker. 105 ; 106 lea r10, [rbp - 30h] 107 and r10, ~1fh ; 32-byte align it. 108 mov qword [r10 ], rax 109 mov qword [r10 + 8], rax 110 mov qword [r10 +16], rax 111 mov qword [r10 +24], rax 112 113 leave 114 ret 115 [endproc_frame supdrvNtWrapVMMR0EntryEx] 116 ENDPROC supdrvNtWrapVMMR0EntryEx 117 118 119 extern RTSemEventMultiWaitNoResume 120 121 ;; 122 ; @cproto DECLASM(int) supdrvNtWrapRTSemEventMultiWaitNoResume(RTSEMEVENTMULTI EventMultiSem, unsigned cMillies); 123 ; 124 ; @param EventMultiSem rcx 125 ; @param cMillies rdx 126 ; 127 BEGINPROC supdrvNtWrapRTSemEventMultiWaitNoResume 128 [proc_frame supdrvNtWrapRTSemEventMultiWaitNoResume] 129 push rbp 130 [pushreg rbp] 131 mov rbp, rsp 132 [setframe rbp,0] 133 sub rsp, 40h 134 [allocstack 0x40] 135 mov [rbp - 8h], rdi 136 [savereg rdi, 0x38] 137 ;; @todo save more? 138 ;mov [rbp - 10h], rsi 139 ;[savereg rsi, 0x30] 140 [endprolog] 141 142 ; 143 ; Find the stack marker with the rbp of the entry frame. 144 ; Search a maximum of 4096 bytes. 145 ; 146 mov rax, rbp 147 and rax, ~1fh ; 32-byte align it. 148 mov r10, 1000h / 20h 149 .again: 150 dec r10 151 jz .not_found 152 add rax, 20h 153 154 cmp dword [rax], 0x20080901 155 jne .again 156 cmp dword [rax + 4], 0x20080902 157 jne .again 158 cmp dword [rax + 16], 0x20080903 159 jne .again 160 cmp dword [rax + 20], 0x20080904 161 jne .again 162 mov r11, [rax + 8] 163 cmp r11, [rax + 24] 164 jne .again 165 166 ; found it, change rbp. 167 mov rdi, rbp 168 mov rbp, r11 169 170 ; 171 ; Forward the call. 172 ; 173 .resume: 174 call RTSemEventMultiWaitNoResume 175 176 ; 177 ; Restore rbp and any saved registers before returning. 178 ; 179 mov rbp, rdi 180 ;mov rsi, [rbp - 10h] 181 mov rdi, [rbp - 8h] 182 leave 183 ret 184 185 .not_found: 186 int3 187 mov rdi, rbp 188 jmp .resume 189 [endproc_frame supdrvNtWrapRTSemEventMultiWaitNoResume] 190 ENDPROC supdrvNtWrapRTSemEventMultiWaitNoResume 191 192 %endif ; RT_ARCH_AMD64 193 %endif ; SUPDRV_WITH_UNWIND_HACK 194
Note:
See TracChangeset
for help on using the changeset viewer.