aboutsummaryrefslogtreecommitdiff
path: root/kernel/main.dats
blob: b35387fb4307bed6638520dca67dbcb4bb382c93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "./prelude/kernel_prelude.hats"

#define ATS_DYNLOADFLAG 0

staload "kernel/interrupts/idt.sats"
staload "lib/SATS/writer.sats"

staload UN = "prelude/SATS/unsafe.sats"

%{^
  void breakpoint(){ 
    __asm__("int3");
  }
%}

extern castfn char_arr2string {n:nat} (arr : &(@[char][n])) : string n

extern fun breakpoint() :void  = "mac#"

extern fun main(p : ptr) : void = "ext#"
implement  main(p) = let
  prval size = $UN.ptr0_get<strptr>(ptr_add<uint8>(p,
    8 + 
    16 + 
    16 + 
    4 + 4
    (* 16 +  *)
    (* 8 +  *)
    (* 32 +  *)
    (* 16 + 24 + 24 + 24 + 24 + 24 + 48 + // memory map *)
    (* 792 + // elf *)
    (* 4 + 4 + 4 *)
    ))
in

  clear_screen();
  println!("Start");
  (* println!(size); *)

  // Initialize interrupt table
  idt_init();

  // Throws breakpoint exception
  breakpoint();

  println!("End");

end