Blue v7 Bytecode View
aarch64/Linux/cmd/true2/x86_64/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 `aarch64` and our target is `x86_64`.
The words that are executed at `asmtime` are brought in from the `aarch64` 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
`x86_64/Linux/cmd/true2/bye.bo`, which writes the machine code to issue the
minimal exit system call. `bye` will disassemble to:
mov al, 0x3C
syscall
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/aarch64/Linux/cmd/true2/blue.bo
- x86_64/Linux/cmd/true2/bye.bo
- lib/blue/dup.bo
- lib/blue/dcb.bo
- x86_64/Linux/lib/elf/hdr.bo
- cmd/true2/bye.bo
- lib/elf/fin.bo
obj/aarch64/Linux/cmd/true2/blue.bo
; D65F03C0 D65F03C0 >ds F80085C0 ; ds>2 F85F8DC1 ds> F85F8DC0 ;
$ AA0C03E0 >ds ; $^ AA0D03E0 >ds ; $^! AA0C03ED ;
- ds>2 CB010000 >ds ; ! ds>2 F9000020 ;
x86_64/Linux/cmd/true2/bye.bo
bye 050F3CB0 ;
lib/blue/dup.bo
dup ds> >ds >ds ;
lib/blue/dcb.bo
$^!
x86_64/Linux/lib/elf/hdr.bo
03010102464C457F 0000000000000000
00000001003E0002 entry 0000000000400078
0000000000000040 0000000000000000
0038004000000000 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