Skip to content

Commit e47ce02

Browse files
Component: zkvm_zisk_sim: reserve fixed RAM cell for inline bump pointer
Reserve the top 8 bytes of the heap region as a fixed-address cell holding the downward bump pointer, shared by the C allocator and JIT-emitted inline allocation. Lower the heap top by 16 so the cell never overlaps the heap. zisk_sim reuses the zisk pal.o, so it needs the same g_zk_bump_ptr symbol; mirrors modules/zkvm_zisk/script.ld. Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
1 parent 4a73a09 commit e47ce02

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/bflat/modules/zkvm_zisk_sim/script.ld

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ SECTIONS
7373
{
7474
_kernel_heap_bottom = .;
7575
. = . + (150 * 1024 * 1024);
76-
_kernel_heap_top = .;
76+
/* zkVM per-site inline allocator: reserve the top 8 bytes of the heap region as a
77+
* FIXED-address cell holding the downward bump pointer, shared by the C allocator
78+
* (pal/module.c, which references g_zk_bump_ptr) and JIT-emitted inline allocation.
79+
* Heap top is lowered by 16 so the cell never overlaps the heap. zisk_sim reuses the
80+
* zisk pal.o, so it needs the same symbol; mirrors modules/zkvm_zisk/script.ld. */
81+
_kernel_heap_top = . - 16;
82+
PROVIDE(g_zk_bump_ptr = . - 8);
7783
} :data
7884

7985
PROVIDE(_kernel_heap_size = _kernel_heap_top - _kernel_heap_bottom);

0 commit comments

Comments
 (0)