summary refs log tree commit diff
path: root/evoke.e
blob: 86e79c80702dc24e95d94f975bba8ca2eaa49ded (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
~ cat labels.e elf.e execution.e transform.e evoke.e \
~     | ./quine > evoke && chmod 755 evoke && ./evoke

1024 read-to-buffer
~   Any word that ends with a normal semicolon will require this, so its
~ definition has to be near the start.
: exit
  [ here @
    :rsi pack-popcontrol
    here ! ] ;asm

: lit
  [ here @
    lods64
    :rax push-reg64
    here ! ] ;asm

: sys-exit
  [ here @
    60 :rax mov-reg64-imm64
    :rdi pop-reg64
    syscall
    hlt
    here ! ] ;asm

: happy-path 42 sys-exit ;

~  : lods64 ;
~  : :rax ;
~  : push-reg64 ;
~  : mov-reg64-imm64 ;
~  : :rdi ;
~  : pop-reg64 ;
~  : syscall ;
~  : hlt ;
~  : here ;
~  : @ ;
~  : ! ;
~  : [ ;
~  : ] ;

pyrzqxgl
s" source-to-precompile" variable

~ (output memory start, current output point
~  -- output memory start, current output point)

~ (output memory start, current output point
~  -- output memory start, current output point)
~
~ Everything directly called by all-contents has this same interface.
~
: all-contents
  0x08000000 L!' origin
  elf-file-header
  elf-program-header
  cold-start
  warm-start
  output-docol
  source-to-precompile transform
  0 L!' final-word-name
  current-offset L!' total-size
  0 L!' :
  0 L!' ;
  0 L!' ;asm
  ;

' all-contents entry-to-execution-token label-loop
swap sys-write bye