VirtualBox

Changeset 20548 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Jun 14, 2009 12:52:53 AM (15 years ago)
Author:
vboxsync
Message:

VMMR0JmpA-x86.asm: Fixed stack usage calc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/VMMR0JmpA-x86.asm

    r20545 r20548  
    9797    mov     [esi + 10h], dword 0f00dbeefh ; Marker 3.
    9898    mov     edx, [esp + 10h]            ; pvArg2
    99     mov     [esi + 04h], edx
    10099    mov     ecx, [esp + 0ch]            ; pvArg1
    101     mov     [esi      ], ecx
    102100    mov     eax, [esp + 08h]            ; pfn
    103     mov     esp, esi                    ; Switch stack!
     101%if 1                                   ; Use this to eat of some extra stack - handy for finding paths using lots of stack.
     102 %define FRAME_OFFSET 0
     103%else
     104 %define FRAME_OFFSET 1024
     105%endif
     106    mov     [esi - FRAME_OFFSET + 04h], edx
     107    mov     [esi - FRAME_OFFSET      ], ecx
     108    lea     esp, [esi - FRAME_OFFSET]   ; Switch stack!
    104109    call    eax
    105110    and     dword [esi + 1ch], byte 0   ; reset marker.
     
    115120    cld
    116121    repe scasd
     122    shl     ecx, 2                      ; *4
     123    cmp     ecx, VMM_STACK_SIZE - 64    ; Less than 64 bytes left -> overflow as well.
    117124    mov     eax, esi                    ; restore eax in case of overflow (esi remains used)
    118     mov     edi, VMM_STACK_SIZE
    119     shl     ecx, 2                      ; *4
    120     sub     edi, ecx
    121     cmp     edi, VMM_STACK_SIZE - 64    ; Less than 64 bytes left -> overflow as well.
    122125    jae     .stack_overflow_almost
    123126
    124127    ; Update stack usage statistics.
    125     cmp     edi, [ebx + VMMR0JMPBUF.cbUsedMax] ; New max usage?
     128    cmp     ecx, [ebx + VMMR0JMPBUF.cbUsedMax] ; New max usage?
    126129    jle     .no_used_max
    127     mov     [ebx + VMMR0JMPBUF.cbUsedMax], edi
     130    mov     [ebx + VMMR0JMPBUF.cbUsedMax], ecx
    128131.no_used_max:
    129132    ; To simplify the average stuff, just historize before we hit div errors.
     
    132135    jz      .no_historize
    133136    mov     dword [ebx + VMMR0JMPBUF.cUsedTotal], 2
    134     mov     ecx, [ebx + VMMR0JMPBUF.cbUsedAvg]
    135     mov     [ebx + VMMR0JMPBUF.cbUsedTotal], ecx
     137    mov     edi, [ebx + VMMR0JMPBUF.cbUsedAvg]
     138    mov     [ebx + VMMR0JMPBUF.cbUsedTotal], edi
    136139    mov     dword [ebx + VMMR0JMPBUF.cbUsedTotal + 4], 0
    137140.no_historize:
    138     add     [ebx + VMMR0JMPBUF.cbUsedTotal], edi
     141    add     [ebx + VMMR0JMPBUF.cbUsedTotal], ecx
    139142    adc     dword [ebx + VMMR0JMPBUF.cbUsedTotal + 4], 0
    140143    mov     eax, [ebx + VMMR0JMPBUF.cbUsedTotal]
    141144    mov     edx, [ebx + VMMR0JMPBUF.cbUsedTotal + 4]
    142     mov     ecx, [ebx + VMMR0JMPBUF.cUsedTotal]
    143     div     ecx
     145    mov     edi, [ebx + VMMR0JMPBUF.cUsedTotal]
     146    div     edi
    144147    mov     [ebx + VMMR0JMPBUF.cbUsedAvg], eax
    145148
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