std/heap.slm

Contents

class heapentry SIZE: 17b

A entry on the heap.

prop heapentry.addr SIZE: 8b POS: 0b

The address of the entry, this is to help with copying.

prop heapentry.flags SIZE: 1b POS: 8b

Some flags for the entry, the last bit is 0 if the entry is free.

prop heapentry.size SIZE: 8b POS: 9b

The requested size of the entry, the entry may be bigger though.

prop heapentry.data SIZE: 0b POS: 17b

The data for the entry, atleast size bytes.

proc heapentry.isentry START: 1 RET: 1

ptr[entry] => int[valid]

Returns bool.true if the address is of a valid entry.

proc heapentry.setfree START: 1 RET: 0

ptr[entry] => _

Sets the free flag of an entry.

proc heapentry.create START: 1 RET: 0

ptr[entry] => _

Makes an entry valid.

class heap SIZE: 0b

Manages the heap.

const heap.BRK VALUE: 12

Just a break syscall, will be reloacated to OS.

const heap.PAGE_SIZE VALUE: 64000

The size of a page on the heap.

const heap.STEP_SIZE VALUE: 64

The minimum size of a heap entry.

var heap.startaddr SIZE: 8b

The start of the heap.

var heap.endaddr SIZE: 8b

The end of the heap.

var heap.allocstart SIZE: 8b

Where to start allocating on the heap.

var heap.isinit SIZE: 1b

Is bool.true if the heap is init.

proc heap.newpage START: 0 RET: 0

proc heap.init START: 0 RET: 0

proc heap.empty START: 0 RET: 1

proc heap.alloc START: 1 RET: 1

proc heap.zalloc START: 1 RET: 1

proc heap.realloc START: 2 RET: 1

proc heap.free START: 1 RET: 0