wip: extend shared library support, window demo

This commit is contained in:
2026-04-05 21:38:05 +02:00
parent 01c242d4de
commit 6f0707bc80
14 changed files with 268 additions and 53 deletions
+2
View File
@@ -417,6 +417,8 @@ namespace Montauk {
return Sys_UnloadLib(frame->arg1);
case SYS_DLSYM:
return (int64_t)Sys_DLSym(frame->arg1, frame->arg2);
case SYS_GETLIBBASE:
return (int64_t)Sys_GetLibBase(frame->arg1);
default:
return -1;
}
+1
View File
@@ -210,6 +210,7 @@ namespace Montauk {
static constexpr uint64_t SYS_LOAD_LIB = 114;
static constexpr uint64_t SYS_UNLOAD_LIB = 115;
static constexpr uint64_t SYS_DLSYM = 116;
static constexpr uint64_t SYS_GETLIBBASE = 117;
static constexpr uint32_t IPC_SIGNAL_READABLE = 1u << 0;
static constexpr uint32_t IPC_SIGNAL_WRITABLE = 1u << 1;
+3 -3
View File
@@ -270,11 +270,11 @@ namespace Sched {
if (copyStart < copyEnd) {
// Source: file data at (copyStart - targetSegStart) offset from p_offset
uint64_t srcOffset = phdr->p_offset + (copyStart - targetSegStart);
// Dest: page at (copyStart - pageStart) offset
uint64_t dstOffset = copyStart - pageStart;
// Dest: page at (copyStart - targetSegStart) offset, then adjusted for this page
uint64_t pageDataOffset = copyStart - targetSegStart;
uint64_t copySize = copyEnd - copyStart;
uint8_t* dst = (uint8_t*)Memory::HHDM(physAddr) + dstOffset;
uint8_t* dst = (uint8_t*)Memory::HHDM(physAddr) + pageDataOffset;
uint8_t* src = fileData + srcOffset;
memcpy(dst, src, copySize);
}