bitwiseworks / qtwebengine-os2

Port of Qt WebEngine module version 5 to OS/2
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

Port page_allocator API to OS/2 #5

Closed dmik closed 4 years ago

dmik commented 4 years ago

There is AllocPages & friends API (page_allocator.h) in base used for memory allocation (it's not the only one but anyway). Currently, we follow the POSIX code path that uses mmap. However, our mmap implementation is limited ATM (see https://github.com/bitwiseworks/libcx/issues/75, https://github.com/bitwiseworks/libcx/issues/76) and doesn't pass Chromium checks (mprotect expectedly fails, see #4).

In fact, this is a normal memory allocation which uses VirtualAlloc on Windows and mmap(MAP_ANONYMOUS) on Posix. It makes no sense to use mmap on OS/2 in this simple case due to inevitable overhead and current incompleteness of the implementation. We will use DosAllocMem directly as we do in several other places in Chromium already.

dmik commented 4 years ago

I've done this (not a big deal) and it runs much further now but then the Chromium code tries to free the block of memory not at its base address but with some offset. This expectedly fails as it's not possible on OS/2. The problem is that it's not possible on Windows either so it should fail there as well but apparently it doesn't... I need to dig deeper to see if the code calling base::FreePages contains some platform dependent code.

dmik commented 4 years ago

The last problem is fixed in the above commit.