diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-07-12 20:07:59 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-08-21 09:49:33 -0400 |
commit | 59690cbea6a7b7a89abf3b5fd7d9ed2db61c548c (patch) | |
tree | 468a84ca6c320507932d099b382fefff7cc4f9e0 /includes | |
parent | 1d3882a5b96de8a3634d6dd3d559769bc588dba0 (diff) | |
download | haskell-59690cbea6a7b7a89abf3b5fd7d9ed2db61c548c.tar.gz |
rts: Introduce and use ExecPage abstraction
Here we introduce a very thin abstraction for allocating, filling, and
freezing executable pages to replace allocateExec.
(cherry picked from commit 0e875c3f1d7373812ddae9962edfc9538465d2ed)
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Rts.h | 1 | ||||
-rw-r--r-- | includes/rts/ExecPage.h | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/includes/Rts.h b/includes/Rts.h index 0f96ba2eca..5e657e07ce 100644 --- a/includes/Rts.h +++ b/includes/Rts.h @@ -223,6 +223,7 @@ void _assertFail(const char *filename, unsigned int linenum) #include "rts/ForeignExports.h" /* Other RTS external APIs */ +#include "rts/ExecPage.h" #include "rts/Parallel.h" #include "rts/Signals.h" #include "rts/BlockSignals.h" diff --git a/includes/rts/ExecPage.h b/includes/rts/ExecPage.h new file mode 100644 index 0000000000..4261b71259 --- /dev/null +++ b/includes/rts/ExecPage.h @@ -0,0 +1,18 @@ +/* + * Utilities for managing dynamically-allocated executable pages. + */ + +#pragma once + +typedef struct { + char contents; +} ExecPage; + +/* Allocate a writable page. */ +ExecPage *allocateExecPage(void); + +/* Make a page previously allocated by allocateExecPage. */ +void freezeExecPage(ExecPage *page); + +/* Free a page previously allocated by allocateExecPage. */ +void freeExecPage(ExecPage *page); |