VirtualBox

Changeset 96568 in vbox


Ignore:
Timestamp:
Sep 1, 2022 8:26:32 PM (2 years ago)
Author:
vboxsync
Message:

IPRT/nocrt: Fixed alloca_probe/chkstk issue where it would partly trash the saved register values. bugref:10261

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/compiler/vcc/stack-vcc.asm

    r96560 r96568  
    124124;
    125125; @param    xAX     Frame size.
    126 ; @uses     AMD64: Nothing (because we don't quite now the convention).
    127 ;           x86:   ESP = ESP - EAX; nothing else
     126; @uses     AMD64:  Probably nothing. EAX is certainly not supposed to change.
     127;           x86:    ESP = ESP - EAX; EFLAGS, nothing else
    128128;
    129129ALIGNCODE(64)
     
    141141
    142142        ;
    143         ; Adjust eax so we can use xBP for stack addressing.
    144         ;
    145         sub     xAX, xCB*2
    146         jle     .touch_loop_done
     143        ; Adjust eax so we're relative to [xBP - xCB*2].
     144        ;
     145        sub     xAX, xCB * 4
     146        jle     .touch_loop_done            ; jump if rax < xCB*4, very unlikely
    147147
    148148        ;
     
    150150        ; the touch loop if (int)xAX > 0.
    151151        ;
    152         mov     ebx, PAGE_SIZE - 1
    153         and     ebx, ebp
     152        lea     ebx, [ebp - xCB * 2]
     153        and     ebx, PAGE_SIZE - 1
    154154        sub     xAX, xBX
    155         jnl     .touch_loop
     155        jnl     .touch_loop                 ; jump if pages to touch.
    156156
    157157.touch_loop_done:
     
    167167        sub     esp, eax
    168168        add     esp, 4
    169         jmp    dword [esp + eax - 4]
     169        jmp     dword [esp + eax - 4]
    170170%endif
    171171
     
    175175.touch_loop:
    176176        sub     xBX, PAGE_SIZE
    177         mov     [xBP + xBX], bl
     177%if 1
     178        mov     [xBP + xBX - xCB * 2], bl
     179%else
     180        or      byte [xBP + xBX - xCB * 2], 0   ; non-destructive variant...
     181%endif
    178182        sub     xAX, PAGE_SIZE
    179183        jnl     .touch_loop
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