[Bug 42255] Xenia emulator needs ntdll.dll.RtlAddGrowableFunctionTable implementation

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Nov 2 03:13:03 CDT 2018


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

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |focht at gmx.net
     Ever confirmed|0                           |1
           Keywords|                            |source

--- Comment #10 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

confirming and behalf of OP.

I found the corresponding source on Github:

https://github.com/xenia-project/xenia/blob/master/src/xenia/cpu/backend/x64/x64_code_cache_win.cc

--- snip ---
bool Win32X64CodeCache::Initialize() {
  if (!X64CodeCache::Initialize()) {
    return false;
  }

  // Compute total number of unwind entries we should allocate.
  // We don't support reallocing right now, so this should be high.
  unwind_table_.resize(kMaximumFunctionCount);

#ifdef USE_GROWABLE_FUNCTION_TABLE
  // Create table and register with the system. It's empty now, but we'll grow
  // it as functions are added.
  if (RtlAddGrowableFunctionTable(
          &unwind_table_handle_, unwind_table_.data(), unwind_table_count_,
          DWORD(unwind_table_.size()),
          reinterpret_cast<ULONG_PTR>(generated_code_base_),
          reinterpret_cast<ULONG_PTR>(generated_code_base_ +
                                      kGeneratedCodeSize))) {
    XELOGE("Unable to create unwind function table");
    return false;
  }
#else
  // Install a callback that the debugger will use to lookup unwind info on
  // demand.
  if (!RtlInstallFunctionTableCallback(
          reinterpret_cast<DWORD64>(generated_code_base_) | 0x3,
          reinterpret_cast<DWORD64>(generated_code_base_), kGeneratedCodeSize,
          [](uintptr_t control_pc, void* context) {
            auto code_cache = reinterpret_cast<X64CodeCache*>(context);
            return reinterpret_cast<PRUNTIME_FUNCTION>(
                code_cache->LookupUnwindEntry(control_pc));
          },
          this, nullptr)) {
    XELOGE("Unable to install function table callback");
    return false;
  }
#endif  // USE_GROWABLE_FUNCTION_TABLE

  return true;
}
--- snip ---

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