aboutsummaryrefslogtreecommitdiff
path: root/kernel/memory/frame.sats
blob: 0d29298d8658927ff1f39449496b2d665dde154c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#define PAGE_SIZE 4096

staload "kernel/bootinfo/multiboot.sats"

typedef frame_t = @{
  num = size_t
}

typedef frame_allocator_t = @{
  next_free_frame = frame_t,
  current_area = memory_area_t,
  kernel_start = frame_t,
  kernel_end = frame_t,
  multiboot_start = frame_t,
  multiboot_end = frame_t
}

vtypedef allocptr  = [l : agz] (frame_allocator_t@l , frame_allocator_t@l -<lin,prf> void | ptr l)

fn containing_address {l : addr} (address : ptr l) : frame_t
fn allocate_frame {l : agz}{k : agz} (pf : !frame_allocator_t @ l >> frame_allocator_t @ l, bf : !boot_info_t @ k | p : ptr l, b : ptr k) : frame_t
fn deallocate_frame (p : !allocptr) : void
fn frame_allocator_init() : allocptr