Blue v7 Bytecode View
x86_64/Linux/cmd/true2/aarch64/true2.bl
This version of `/bin/true` shows a very basic example of how cross assembling
can be done by mixing green numbers that run on the host with those that run
on the target. In this case our host is `x86_64` and our target is `aarch64`.
The words that are executed at `asmtime` are brought in from the `x86_64` lib.
At runtime we need the implementation of `bye` as well as the elf headers for
the target.
Near the bottom, `cmd/true2/bye.bo` calls `bye` as a blue word which causes
it to be executed at `asmtime`. This word is a macro, defined prior in
`aarch64/Linux/cmd/true2/bye.bo`, which writes the machine code to issue the
minimal exit system call. `bye` will disassemble to:
mov w8, 0x5D
svc 0
The `fin.bo` from the elf lib takes the size from the start of the output to
the end, and writes that into the `elfbsz` and `elfmsz` fields. In this case
the magenta word pushes the `asmtime` address of the word, which allows it to
be set like a variable.
Blocks:
- obj/x86_64/Linux/cmd/true2/blue.bo
- aarch64/Linux/cmd/true2/bye.bo
- lib/blue/dup.bo
- lib/blue/dcb.bo
- aarch64/Linux/lib/elf/hdr.bo
- cmd/true2/bye.bo
- lib/elf/fin.bo
obj/x86_64/Linux/cmd/true2/blue.bo
; C3 C3 >ds 49 0089 08C08349 ; ds>2 08E88349 49 088B ds> 08E88349 49 008B ;
$ 48 F889 >ds ; $^ 4C E089 >ds ; $^! 49 FC89 ;
- ds>2 48 C829 >ds ; ! ds>2 48 0189 ;
aarch64/Linux/cmd/true2/bye.bo
bye D400000152800BA8 ;
lib/blue/dup.bo
dup ds> >ds >ds ;
lib/blue/dcb.bo
$^!
aarch64/Linux/lib/elf/hdr.bo
00010102464C457F 0000000000000000
0000000100B70002 entry 0000000000400078
0000000000000040 0000000000000000
0038004005000000 0000000000400001
0000000700000001 0000000000000000
0000000000400000 0000000000400000
elfbsz 0000000000000000 elfmsz 0000000000000000
0000000000001000
cmd/true2/bye.bo
bye
lib/elf/fin.bo
$ $^ - dup elfbsz ! elfmsz !
Blue v7 repo