add ppc64 and ppc64le
Some checks failed
Hydra bin0-bin.aarch64-linux Hydra build #1197 of bootstrap:bootstrap:bin0-bin.aarch64-linux
Hydra bin0.aarch64-linux Hydra build #1198 of bootstrap:bootstrap:bin0.aarch64-linux
Hydra bin0-bin.powerpc-linux Hydra build #1199 of bootstrap:bootstrap:bin0-bin.powerpc-linux
Hydra bin0-bin.armv7l-linux Hydra build #1202 of bootstrap:bootstrap:bin0-bin.armv7l-linux
Hydra bin0.armv7l-linux Hydra build #1200 of bootstrap:bootstrap:bin0.armv7l-linux
Hydra bin0-bin.powerpc64le-linux Hydra build #1206 of bootstrap:bootstrap:bin0-bin.powerpc64le-linux
Hydra bin0.powerpc64le-linux Hydra build #1201 of bootstrap:bootstrap:bin0.powerpc64le-linux
Hydra bin0.powerpc-linux Hydra build #1204 of bootstrap:bootstrap:bin0.powerpc-linux
Hydra bin0-bin.powerpc64-linux Hydra build #1205 of bootstrap:bootstrap:bin0-bin.powerpc64-linux
Hydra bin0.powerpc64-linux Hydra build #1203 of bootstrap:bootstrap:bin0.powerpc64-linux

This commit is contained in:
Charlotte 🦝 Delenk 2022-02-28 10:02:57 +01:00
parent 9b690ead91
commit 6b94a1ceda
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
23 changed files with 361 additions and 2 deletions

View file

@ -1,5 +1,5 @@
01000110 01001100 01000101 01111111 # ELF Magic
00000000 00000001 00000001 00000010 # 32 bit little endian elf
00000000 00000001 00000001 00000010 # 64 bit little endian elf
00000000000000000000000000000000
00000000000000000000000000000000 # padding
0000000010110111 0000000000000010 # ARM64 ELF

View file

@ -2,6 +2,8 @@ system: { self, nixpkgs, ... } @ args: with self.lib.${system}; with nixpkgs.lib
"armv7l-linux"
"aarch64-linux"
"powerpc-linux"
"powerpc64-linux"
"powerpc64le-linux"
] then
rec {
bin0-bin = baseDerivation {

View file

@ -0,0 +1,15 @@
# Bin0 for powerpc64-linux
- 32 bit words
- big endian
This is compatible with:
- powerpc
## Syscalls of interest
- `exit` - 1
- `read` - 3
- `write` - 4
- `openat` - 286

BIN
bin0/powerpc64-linux/bin0 Executable file

Binary file not shown.

View file

@ -0,0 +1,62 @@
.section .text
.global _start
_start:
ld 3, 0(1) // get argc
cmpdi 3, 3 // check if argc is 3
blt exit // exit otherwise
li 3, -100 // AT_FDCWD
ld 4, 16(1) // first argument
li 5, 0 // O_RDONLY
li 6, 0 // no mode
li 0, 286 // openat
sc
bso exit // exit otherwise
mr 12, 3 // save file descriptor
li 3, -100 // AT_FDCWD
ld 4, 24(1) // second argument
li 5, 577 // O_TRUNC | O_CREAT | O_WRONLY
li 6, 493 // rwxr-xr-x
li 0, 286 // openat
sc
bso exit // exit otherwise
mr 13, 3 // save file descriptor
.Lloop_init:
li 14, 0 // accumulator
li 15, 32 // Counter
.Lread_loop:
mr 3, 12 // source fd
mr 4, 1 // destination buffer
li 5, 1 // size
li 0, 3 // read
sc
bso exit // exit otherwise
cmpdi 3, 0 // check if eof
beq exit
lbz 3, 0(1) // get byte
andi. 4, 3, 0xFE // clear bottom bit
cmpwi 4, 0x30 // check if byte is a number
bne .Lread_loop // loop if not
andi. 3, 3, 1 // get the bottom bit
rlwinm 14, 14, 1, 0, 30 // shift accumulator
or 14, 14, 3 // add bottom bit to accumulator
addi 15, 15, -1 // decrement counter
cmpwi 15, 0 // check if counter is 0
bne .Lread_loop // loop if not
stw 14, 0(1) // store accumulator
mr 3, 13 // dest fd
mr 4, 1 // source buffer
li 5, 4 // size
li 0, 4 // write
sc
bso exit // exit otherwise
b .Lloop_init // loop
exit:
li 0, 1 // exit
sc

View file

@ -0,0 +1,94 @@
01111111 01000101 01001100 01000110 # ELF Magic
00000010 00000010 00000001 00000000 # 64 bit big endian elf
00000000000000000000000000000000
00000000000000000000000000000000 # padding
0000000000000010 0000000000010101 # PPC ELF
00000000000000000000000000000001 # original version elf
00000000000000000000000000000000
00010000000000000000000001111000 # Program Entry position
00000000000000000000000000000000
00000000000000000000000001000000 # Program header table position
00000000000000000000000000000000
00000000000000000000000000000000 # Section Header table position
00000000000000000000000000000000 # Flags
0000000001000000 0000000000111000 # Header Size, Size of an entry in the program header table
0000000000000001 0000000001000000 # One program header, section header size
0000000000000000 0000000000000000 # no section headers, no section name section
00000000000000000000000000000001 # PT_LOAD
00000000000000000000000000000111 # rwx
00000000000000000000000000000000
00000000000000000000000000000000 # Load from ZERO
00000000000000000000000000000000
00010000000000000000000000000000 # Load at l6MB
00000000000000000000000000000000
00010000000000000000000000000000 # Who cares about physical address
00000000000000000000000000000000
00000000000000000000000100111100 # size
00000000000000000000000000000000
00000000000000000000000100111100 # memory size
00000000000000000000000000000000
00000000000000000000000000000100 # align 4 bytes
#.section .text
#.global _start
#
#_start:
111010 00011 00001 0000000000000000 # ld 3, O(l) // get argc
001011 000 0 1 00011 0000000000000011 # cmpdi 3, 3 // check if argc is 3
010000 01100 00000 00000000101101 0 0 # blt exit // exit otherwise
#
001110 00011 00000 1111111110011100 # li 3, -lOO // AT_FDCWD
111010 00100 00001 0000000000010000 # ld 4, 16(l) // first argument
001110 00101 00000 0000000000000000 # li 5, O // O_RDONLY
001110 00110 00000 0000000000000000 # li 6, O // no mode
001110 00000 00000 0000000100011110 # li O, 286 // openat
010001 00000 00000 0000 0000000 000 1 0 # sc
010000 01100 00011 00000000100110 0 0 # bso exit // exit otherwise
011111 00011 01100 00011 0110111100 0 # mr l2, 3 // save file descriptor
#
001110 00011 00000 1111111110011100 # li 3, -lOO // AT_FDCWD
111010 00100 00001 0000000000011000 # ld 4, 24(l) // second argument
001110 00101 00000 0000001001000001 # li 5, 577 // O_TRUNC | O_CREAT | O_WRONLY
001110 00110 00000 0000000111101101 # li 6, 493 // rwxr-xr-x
001110 00000 00000 0000000100011110 # li O, 286 // openat
010001 00000 00000 0000 0000000 000 1 0 # sc
010000 01100 00011 00000000011110 0 0 # bso exit // exit otherwise
011111 00011 01101 00011 0110111100 0 # mr l3, 3 // save file descriptor
#
#.Lloop_init:
001110 01110 00000 0000000000000000 # li l4, O // accumulator
001110 01111 00000 0000000000100000 # li l5, 32 // Counter
#.Lread_loop:
011111 01100 00011 01100 0110111100 0 # mr 3, l2 // source fd
011111 00001 00100 00001 0110111100 0 # mr 4, l // destination buffer
001110 00101 00000 0000000000000001 # li 5, l // size
001110 00000 00000 0000000000000011 # li O, 3 // read
010001 00000 00000 0000 0000000 000 1 0 # sc
010000 01100 00011 00000000010101 0 0 # bso exit // exit otherwise
001011 000 0 1 00011 0000000000000000 # cmpdi 3, O // check if eof
010000 01100 00010 00000000010011 0 0 # beq exit
#
100010 00011 00001 0000000000000000 # lbz 3, O(l) // get byte
011100 00011 00100 0000000011111110 # andi. 4, 3, OxFE // clear bottom bit
001011 000 0 0 00100 0000000000110000 # cmpwi 4, Ox3O // check if byte is a number
010000 00100 00010 11111111110101 0 0 # bne .Lread_loop // loop if not
#
011100 00011 00011 0000000000000001 # andi. 3, 3, l // get the bottom bit
010101 01110 01110 00001 00000 11110 0 # rlwinm l4, l4, l, O, 3O // shift accumulator
011111 01110 01110 00011 0110111100 0 # or l4, l4, 3 // add bottom bit to accumulator
001110 01111 01111 1111111111111111 # addi l5, l5, -l // decrement counter
001011 000 0 0 01111 0000000000000000 # cmpwi l5, O // check if counter is O
010000 00100 00010 11111111101111 0 0 # bne .Lread_loop // loop if not
#
100100 01110 00001 0000000000000000 # stw l4, O(l) // store accumulator
011111 01101 00011 01101 0110111100 0 # mr 3, l3 // dest fd
011111 00001 00100 00001 0110111100 0 # mr 4, l // source buffer
001110 00101 00000 0000000000000100 # li 5, 4 // size
001110 00000 00000 0000000000000100 # li O, 4 // write
010001 00000 00000 0000 0000000 000 1 0 # sc
010000 01100 00011 00000000000010 0 0 # bso exit // exit otherwise
010010 11111111111111111110010100 # b .Lloop_init // loop
#exit:
001110 00000 00000 0000000000000001 # li O, l // exit
010001 00000 00000 0000 0000000 000 1 0 # sc

View file

@ -0,0 +1,20 @@
# Bin0 for powerpc64le-linux
- 32 bit words
- little endian
This is compatible with:
- armv7l
- aarch64
- riscv32
- riscv64
- i686
- x86_64
## Syscalls of interest
- `exit` - 1
- `read` - 3
- `write` - 4
- `openat` - 286

BIN
bin0/powerpc64le-linux/bin0 Executable file

Binary file not shown.

View file

@ -0,0 +1,62 @@
.section .text
.global _start
_start:
ld 3, 0(1) // get argc
cmpdi 3, 3 // check if argc is 3
blt exit // exit otherwise
li 3, -100 // AT_FDCWD
ld 4, 16(1) // first argument
li 5, 0 // O_RDONLY
li 6, 0 // no mode
li 0, 286 // openat
sc
bso exit // exit otherwise
mr 12, 3 // save file descriptor
li 3, -100 // AT_FDCWD
ld 4, 24(1) // second argument
li 5, 577 // O_TRUNC | O_CREAT | O_WRONLY
li 6, 493 // rwxr-xr-x
li 0, 286 // openat
sc
bso exit // exit otherwise
mr 13, 3 // save file descriptor
.Lloop_init:
li 14, 0 // accumulator
li 15, 32 // Counter
.Lread_loop:
mr 3, 12 // source fd
mr 4, 1 // destination buffer
li 5, 1 // size
li 0, 3 // read
sc
bso exit // exit otherwise
cmpdi 3, 0 // check if eof
beq exit
lbz 3, 0(1) // get byte
andi. 4, 3, 0xFE // clear bottom bit
cmpwi 4, 0x30 // check if byte is a number
bne .Lread_loop // loop if not
andi. 3, 3, 1 // get the bottom bit
rlwinm 14, 14, 1, 0, 30 // shift accumulator
or 14, 14, 3 // add bottom bit to accumulator
addi 15, 15, -1 // decrement counter
cmpwi 15, 0 // check if counter is 0
bne .Lread_loop // loop if not
stw 14, 0(1) // store accumulator
mr 3, 13 // dest fd
mr 4, 1 // source buffer
li 5, 4 // size
li 0, 4 // write
sc
bso exit // exit otherwise
b .Lloop_init // loop
exit:
li 0, 1 // exit
sc

View file

@ -0,0 +1,94 @@
01000110 01001100 01000101 01111111 # ELF Magic
00000000 00000001 00000001 00000010 # 64 bit little endian elf
00000000000000000000000000000000
00000000000000000000000000000000 # padding
0000000000010101 0000000000000010 # PPC ELF
00000000000000000000000000000001 # original version elf
00010000000000000000000001111000
00000000000000000000000000000000 # Program Entry position
00000000000000000000000001000000
00000000000000000000000000000000 # Program header table position
00000000000000000000000000000000
00000000000000000000000000000000 # Section Header table position
00000000000000000000000000000000 # Flags
0000000000111000 0000000001000000 # Header Size, Size of an entry in the program header table
0000000001000000 0000000000000001 # One program header, section header size
0000000000000000 0000000000000000 # no section headers, no section name section
00000000000000000000000000000001 # PT_LOAD
00000000000000000000000000000111 # rwx
00000000000000000000000000000000
00000000000000000000000000000000 # Load from ZERO
00010000000000000000000000000000
00000000000000000000000000000000 # Load at l6MB
00010000000000000000000000000000
00000000000000000000000000000000 # Who cares about physical address
00000000000000000000000100111100
00000000000000000000000000000000 # size
00000000000000000000000100111100
00000000000000000000000000000000 # memory size
00000000000000000000000000000100
00000000000000000000000000000000 # align 4 bytes
#.section .text
#.global _start
#
#_start:
111010 00011 00001 0000000000000000 # ld 3, O(l) // get argc
001011 000 0 1 00011 0000000000000011 # cmpdi 3, 3 // check if argc is 3
010000 01100 00000 00000000101101 0 0 # blt exit // exit otherwise
#
001110 00011 00000 1111111110011100 # li 3, -lOO // AT_FDCWD
111010 00100 00001 0000000000010000 # ld 4, 16(l) // first argument
001110 00101 00000 0000000000000000 # li 5, O // O_RDONLY
001110 00110 00000 0000000000000000 # li 6, O // no mode
001110 00000 00000 0000000100011110 # li O, 286 // openat
010001 00000 00000 0000 0000000 000 1 0 # sc
010000 01100 00011 00000000100110 0 0 # bso exit // exit otherwise
011111 00011 01100 00011 0110111100 0 # mr l2, 3 // save file descriptor
#
001110 00011 00000 1111111110011100 # li 3, -lOO // AT_FDCWD
111010 00100 00001 0000000000011000 # ld 4, 24(l) // second argument
001110 00101 00000 0000001001000001 # li 5, 577 // O_TRUNC | O_CREAT | O_WRONLY
001110 00110 00000 0000000111101101 # li 6, 493 // rwxr-xr-x
001110 00000 00000 0000000100011110 # li O, 286 // openat
010001 00000 00000 0000 0000000 000 1 0 # sc
010000 01100 00011 00000000011110 0 0 # bso exit // exit otherwise
011111 00011 01101 00011 0110111100 0 # mr l3, 3 // save file descriptor
#
#.Lloop_init:
001110 01110 00000 0000000000000000 # li l4, O // accumulator
001110 01111 00000 0000000000100000 # li l5, 32 // Counter
#.Lread_loop:
011111 01100 00011 01100 0110111100 0 # mr 3, l2 // source fd
011111 00001 00100 00001 0110111100 0 # mr 4, l // destination buffer
001110 00101 00000 0000000000000001 # li 5, l // size
001110 00000 00000 0000000000000011 # li O, 3 // read
010001 00000 00000 0000 0000000 000 1 0 # sc
010000 01100 00011 00000000010101 0 0 # bso exit // exit otherwise
001011 000 0 1 00011 0000000000000000 # cmpdi 3, O // check if eof
010000 01100 00010 00000000010011 0 0 # beq exit
#
100010 00011 00001 0000000000000000 # lbz 3, O(l) // get byte
011100 00011 00100 0000000011111110 # andi. 4, 3, OxFE // clear bottom bit
001011 000 0 0 00100 0000000000110000 # cmpwi 4, Ox3O // check if byte is a number
010000 00100 00010 11111111110101 0 0 # bne .Lread_loop // loop if not
#
011100 00011 00011 0000000000000001 # andi. 3, 3, l // get the bottom bit
010101 01110 01110 00001 00000 11110 0 # rlwinm l4, l4, l, O, 3O // shift accumulator
011111 01110 01110 00011 0110111100 0 # or l4, l4, 3 // add bottom bit to accumulator
001110 01111 01111 1111111111111111 # addi l5, l5, -l // decrement counter
001011 000 0 0 01111 0000000000000000 # cmpwi l5, O // check if counter is O
010000 00100 00010 11111111101111 0 0 # bne .Lread_loop // loop if not
#
100100 01110 00001 0000000000000000 # stw l4, O(l) // store accumulator
011111 01101 00011 01101 0110111100 0 # mr 3, l3 // dest fd
011111 00001 00100 00001 0110111100 0 # mr 4, l // source buffer
001110 00101 00000 0000000000000100 # li 5, 4 // size
001110 00000 00000 0000000000000100 # li O, 4 // write
010001 00000 00000 0000 0000000 000 1 0 # sc
010000 01100 00011 00000000000010 0 0 # bso exit // exit otherwise
010010 11111111111111111110010100 # b .Lloop_init // loop
#exit:
001110 00000 00000 0000000000000001 # li O, l // exit
010001 00000 00000 0000 0000000 000 1 0 # sc

View file

@ -3,7 +3,7 @@ system: { nixpkgs, ... } @ args: rec {
allPrebuilds = builtins.path {
path = ../prebuilt;
sha256 = "sha256-KCcpkzakViGAgcR8CECNuXghl1B3HREoTPfDLg2o9Ys=";
sha256 = "sha256-TEPsjuw7VzZSmBJNR0XxNnD3jVBh6aXll+3N3ZQpO3g=";
};
prebuilts = "${allPrebuilds}/${system}";

BIN
prebuilt/powerpc64-linux/busybox Executable file

Binary file not shown.

1
prebuilt/powerpc64-linux/cp Symbolic link
View file

@ -0,0 +1 @@
busybox

View file

@ -0,0 +1 @@
busybox

View file

@ -0,0 +1 @@
busybox

View file

@ -0,0 +1 @@
busybox

1
prebuilt/powerpc64-linux/mv Symbolic link
View file

@ -0,0 +1 @@
busybox

Binary file not shown.

View file

@ -0,0 +1 @@
busybox

View file

@ -0,0 +1 @@
busybox

View file

@ -0,0 +1 @@
busybox

View file

@ -0,0 +1 @@
busybox

View file

@ -0,0 +1 @@
busybox