Cxbx-reloaded: Reservation of memory ranges

Created on 27 Feb 2017  路  4Comments  路  Source: Cxbx-Reloaded/Cxbx-Reloaded

Research if there's a method by which memory ranges can be reserved. Perhaps by linking in sections at absolute addresses. This would allow us to reserve an address range for the kernel, contiguous memory, memory mapped hardware devices / mmio, etc.

Surely, VirtualAllocEx can be used, but that's unreliable. I wonder if we could (ab)use the PE loader for this.
(unreliable in a sense that the preferred address might not be claimable)

One lead is here :
http://stackoverflow.com/questions/33400783/how-can-i-declare-a-variable-at-an-absolute-address-with-gcc

enhancement help wanted high-priority kernel needs-developer-discussion

All 4 comments

Just a thought on a hacky solution:

We already reserve the lower 64MB/128MB region by setting the EXE base address to the start of that region and then making sure the EXE contains data of that size in that region.

Couldn't we potentially do the same to allocate other regions? The kernel address space could be reserved by linking with a DLL that has a base address of the kernel, etc.

That would need a DLL for each section we wish to allocate, but I don't think there would be that many regions to cover.

Actually that's a great idea!

In issue #202 the Cxbx DLL is removed, and only the Cxbx executable remains.
Adding DLL's to reserve certain address ranges could be a logical next step.

PR #254 arranged for the reservation of contiguous memory at 0x80000000+64MB.
PR #264, #283 and #301 arranged allocating contiguous memory in this address range.

With those two features, this issue can be closed (we can always re-visit this subject later).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PatrickvL picture PatrickvL  路  3Comments

jackchentwkh picture jackchentwkh  路  3Comments

Margen67 picture Margen67  路  3Comments

PatrickvL picture PatrickvL  路  3Comments

AzurikRiseOfPerathia picture AzurikRiseOfPerathia  路  4Comments