[Bug 46179] Multiple Windows 10 ARM{32,64} apps need ' kernel32.dll.GetCurrentThreadStackLimits' to get stack start address

wine-bugs at winehq.org wine-bugs at winehq.org
Tue Nov 27 14:54:58 CST 2018


https://bugs.winehq.org/show_bug.cgi?id=46179

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://aka.ms/chakracore/c
                   |                            |c_windows_all_1_11_3
            Summary|Multiple Windows 10 ARM64   |Multiple Windows 10
                   |apps need                   |ARM{32,64} apps need
                   |'kernel32.dll.GetCurrentThr |'kernel32.dll.GetCurrentThr
                   |eadStackLimits' to get      |eadStackLimits' to get
                   |stack start address         |stack start address
           Keywords|                            |download

--- Comment #2 from Anastasius Focht <focht at gmx.net> ---
Hello André,

thanks. I've found some apps for x86_64, arm32, arm64 architecture using this
API on Github.

Example: ChakraCore 

--- quote ---
ChakraCore is the core part of Chakra, the high-performance JavaScript engine
that powers Microsoft Edge and Windows applications written in HTML/CSS/JS.
ChakraCore supports Just-in-time (JIT) compilation of JavaScript for
x86/x64/ARM, garbage collection, and a wide range of the latest JavaScript
features. ChakraCore also supports the JavaScript Runtime (JSRT) APIs, which
allows you to easily embed ChakraCore in your applications.
--- quote ---

https://github.com/Microsoft/ChakraCore

https://github.com/Microsoft/ChakraCore/blob/master/lib/Runtime/Base/StackProber.cpp#L7

--- snip ---
...

void
StackProber::Initialize()
{
    // NumGuardPages is 2 on x86/x86-64
    // 1 MEM_RESERVE page at the bottom of the stack
    // 1 PAGE_GUARD | PAGE_READWRITE page that serves as the guard page
    const size_t guardPageSize = Js::Constants::NumGuardPages *
AutoSystemInfo::PageSize;
    const size_t stackOverflowBuffer =
Js::Constants::StackOverflowHandlingBufferPages * AutoSystemInfo::PageSize;

    size_t stackBottom = 0;      // This is the low address limit (here we
consider stack growing down).
    ULONG stackGuarantee = 0;

#if defined(_M_IX86) && defined(_MSC_VER)
    stackBottom = __readfsdword(0xE0C); // points to the DeAllocationStack on
the TEB - which turns to be the stack bottom.
#elif defined(_M_AMD64) && defined(_MSC_VER)
    stackBottom = __readgsqword(0x1478);
#elif defined(_M_ARM)
    ULONG lowLimit, highLimit;
    ::GetCurrentThreadStackLimits(&lowLimit, &highLimit);
    stackBottom = lowLimit;
#elif defined(_M_ARM64)
    ULONG64 lowLimit, highLimit;
    ::GetCurrentThreadStackLimits(&lowLimit, &highLimit);
    stackBottom =  lowLimit;
#elif !defined(_MSC_VER)
    ULONG_PTR lowLimit = 0;
    ULONG_PTR highLimit = 0;
    ::GetCurrentThreadStackLimits(&lowLimit, &highLimit);
    stackBottom = lowLimit;
#else
    stackBottom = NULL;
    Js::Throw::NotImplemented();
#endif

    Assert(stackBottom);

#ifdef _WIN32
    // Calling this API with stackGuarantee == 0 *gets* current stack
guarantee.
    SetThreadStackGuarantee(&stackGuarantee);
#endif

    stackLimit = stackBottom + guardPageSize + stackGuarantee +
stackOverflowBuffer;
}
--- snip ---

https://aka.ms/chakracore/cc_windows_all_1_11_3

--- snip ---
$ unzip -l cc_windows_1_11_3.zip 
Archive:  cc_windows_1_11_3.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  11-13-2018 15:56   arm_release/
   281216  11-13-2018 15:56   arm_release/ch.exe
  4657152  11-13-2018 15:56   arm_release/ch.pdb
  4599032  11-13-2018 15:56   arm_release/ChakraCore.dll
 56020992  11-13-2018 15:56   arm_release/ChakraCore.pdb
        0  11-13-2018 15:56   x64_release/
   350024  11-13-2018 15:56   x64_release/ch.exe
  4739072  11-13-2018 15:56   x64_release/ch.pdb
  6511152  11-13-2018 15:56   x64_release/ChakraCore.dll
 67653632  11-13-2018 15:56   x64_release/ChakraCore.pdb
        0  11-13-2018 15:56   x86_release/
   308344  11-13-2018 15:56   x86_release/ch.exe
  5050368  11-13-2018 15:56   x86_release/ch.pdb
  4863232  11-13-2018 15:56   x86_release/ChakraCore.dll
 69365760  11-13-2018 15:56   x86_release/ChakraCore.pdb
---------                     -------
224399976                     15 files
--- snip ---

--- snip ---
$ wget
https://raw.githubusercontent.com/Microsoft/ChakraCore/master/test/es6module/moduletest1.js

$ wget
https://raw.githubusercontent.com/Microsoft/ChakraCore/master/test/es6module/passmodule.js

$ file *
ChakraCore.dll: PE32 executable (DLL) (console) ARMv7 Thumb, for MS Windows
ChakraCore.pdb: MSVC program database ver 7.00, 4096*13677 bytes
ch.exe:         PE32 executable (console) ARMv7 Thumb, for MS Windows
ch.pdb:         MSVC program database ver 7.00, 4096*1137 bytes
moduletest1.js: ASCII text, with CRLF line terminators
passmodule.js:  ASCII text, with CRLF line terminators

$ WINEDEBUG=+seh,+loaddll,+relay wine ./ch.exe ./moduletest1.js >>log.txt 2>&1
...
0029:Call KERNEL32.GetCurrentThreadStackLimits(f5edf97c,f5edf980) ret=1003b285
0029:Ret  KERNEL32.GetCurrentThreadStackLimits() retval=f77f1000 ret=1003b285 
...
0029:Call KERNEL32.SetThreadStackGuarantee(f5edf978) ret=1003b295
0029:fixme:thread:SetThreadStackGuarantee (0xf5edf978): stub
0029:Ret  KERNEL32.SetThreadStackGuarantee() retval=00000001 ret=1003b295 
...
--- snip ---

$ du -sh cc_windows_1_11_3.zip 
51M    cc_windows_1_11_3.zip

$ sha1sum cc_windows_1_11_3.zip 
e388575db7385ad2b5d87a9f078c5db95c73d1f5  cc_windows_1_11_3.zip

$ wine --version
wine-3.21-58-gb1a0482b80

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.


More information about the wine-bugs mailing list