ziskos 1.1.0-alpha

Guest runtime and entrypoint for programs targeting the ZisK zkVM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::kernel_heap::*;
use core::alloc::{GlobalAlloc, Layout};
use talc::{ErrOnOom, Talc, Talck};

#[global_allocator]
static HEAP: Talck<talc::locking::AssumeUnlockable, ErrOnOom> = Talc::new(ErrOnOom).lock();

pub fn init() {
    unsafe {
        let heap_start = &_heap_bottom as *const u8 as usize;
        let heap_size = &_heap_size as *const u8 as usize;
        let heap_span = talc::Span::from_base_size(heap_start as *mut u8, heap_size);
        HEAP.lock().claim(heap_span).unwrap();
    }
}