VirtualBox

Changeset 106658 in vbox for trunk/src


Ignore:
Timestamp:
Oct 24, 2024 12:43:36 PM (6 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
165505
Message:

Add/3d/VBoxICD: Better code and explain why lazy loading fails on amd64. jiraref:VBP-1253

Location:
trunk/src/VBox/Additions/3D/win/VBoxICD
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/3D/win/VBoxICD/VBoxICD.c

    r106452 r106658  
    121121 * and loading it in a lazy way fails for unknown reason on 64 bit Windows.
    122122 *
     123 * Update 2024-10-24 / bird: It fails on AMD64 because you trash the parameter registers
     124 *                           when making the call. duh.
     125 *
    123126 * So just call VBoxLoadICD from DLL_PROCESS_ATTACH.
    124127 */
  • trunk/src/VBox/Additions/3D/win/VBoxICD/icd_forwarders.py

    r106061 r106658  
    5757        sys.exit()
    5858
     59    asm_file.write('; AUTOGENERATED - DO NOT EDIT!\n')
    5960    asm_file.write('%include "iprt/asmdefs.mac"\n')
    6061    asm_file.write('\n')
    6162    asm_file.write(';;;; Enable ICD_LAZY_LOAD to lazy load the ICD DLL (does not work on Win64)\n')
    6263    asm_file.write('; %define ICD_LAZY_LOAD 1\n')
    63     asm_file.write('\n')
    64     asm_file.write('%ifdef RT_ARCH_AMD64\n')
    65     asm_file.write('%define PTR_SIZE_PREFIX qword\n')
    66     asm_file.write('%else ; X86\n')
    67     asm_file.write('%define PTR_SIZE_PREFIX dword\n')
    68     asm_file.write('%endif\n')
    6964    asm_file.write('\n')
    7065    asm_file.write('%ifdef ICD_LAZY_LOAD\n')
     
    8176        asm_file.write(';    int3\n')
    8277        asm_file.write('%ifdef ICD_LAZY_LOAD\n')
    83         asm_file.write('    mov   xAX, PTR_SIZE_PREFIX NAME(g_hmodICD)\n')
    84         asm_file.write('    mov   xAX, [xAX]\n')
    85         asm_file.write('    or    xAX, xAX\n')
    86         asm_file.write('    jnz   l_icd_loaded_%s\n' % fn)
     78        asm_file.write('    mov   xAX, [NAME(g_hmodICD) xWrtRIP]\n')
     79        asm_file.write('    test  xAX, xAX\n')
     80        asm_file.write('    jnz   .already_loaded\n')
    8781        asm_file.write('    call  NAME(VBoxLoadICD)\n')
    88         asm_file.write('l_icd_loaded_%s:\n' % fn)
     82        asm_file.write('.already_loaded:\n')
    8983        asm_file.write('%endif\n')
    90         asm_file.write('    mov   xAX, PTR_SIZE_PREFIX NAME(pfn_%s)\n' % fn)
    91         asm_file.write('    mov   xAX, [xAX]\n')
    92         asm_file.write('    or    xAX, xAX\n')
    93         asm_file.write('    jnz   l_jmp_to_%s\n' % fn)
     84        asm_file.write('    mov   xAX, [NAME(pfn_%s) xWrtRIP]\n' % fn)
     85        asm_file.write('    test  xAX, xAX\n')
     86        asm_file.write('    jz    .return\n')
     87        asm_file.write('    jmp   xAX\n')
     88        asm_file.write('.return:\n')
    9489        asm_file.write('%ifdef RT_ARCH_AMD64\n')
    9590        asm_file.write('    ret\n')
    9691        asm_file.write('%else ; X86\n')
    97         asm_file.write('    ret %s\n' % cbRet)
     92        asm_file.write('    ret   %s\n' % cbRet)
    9893        asm_file.write('%endif\n')
    99         asm_file.write('l_jmp_to_%s:\n' % fn)
    100         asm_file.write('    jmp   xAX\n')
    10194        asm_file.write('ENDPROC %s\n' % fn)
    10295
Note: See TracChangeset for help on using the changeset viewer.

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