PowerPC64 stub: fix register assignments
modified: stub/powerpc64-linux.elf-fold.h modified: stub/powerpc64le-linux.elf-fold.h modified: stub/src/powerpc64-linux.elf-entry.S modified: stub/src/powerpc64-linux.elf-fold.S
This commit is contained in:
parent
22717c15af
commit
b94a150685
18
src/stub/powerpc64-linux.elf-fold.h
generated
18
src/stub/powerpc64-linux.elf-fold.h
generated
@ -33,8 +33,8 @@
|
||||
/* clang-format off */
|
||||
|
||||
#define STUB_POWERPC64_LINUX_ELF_FOLD_SIZE 19923
|
||||
#define STUB_POWERPC64_LINUX_ELF_FOLD_ADLER32 0x5002a220
|
||||
#define STUB_POWERPC64_LINUX_ELF_FOLD_CRC32 0xf49f6007
|
||||
#define STUB_POWERPC64_LINUX_ELF_FOLD_ADLER32 0x3953a31b
|
||||
#define STUB_POWERPC64_LINUX_ELF_FOLD_CRC32 0xfdccfc89
|
||||
|
||||
unsigned char stub_powerpc64_linux_elf_fold[19923] = {
|
||||
/* 0x0000 */ 127, 69, 76, 70, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@ -58,17 +58,17 @@ unsigned char stub_powerpc64_linux_elf_fold[19923] = {
|
||||
/* 0x0120 */ 59, 90,255,248,232, 4, 0, 9,127,164,208, 64,248, 3, 0, 9,
|
||||
/* 0x0130 */ 65,156,255,244, 59, 67, 0, 16,248, 3, 0, 9,232, 4, 0, 8,
|
||||
/* 0x0140 */ 43,160, 0, 0,248, 3, 0, 8,232, 4, 0, 17,248, 3, 0, 17,
|
||||
/* 0x0150 */ 64,158,255,236, 58,163, 0, 8, 65,146, 0,180,126,154,168, 80,
|
||||
/* 0x0160 */ 128, 22,255,252, 58,100, 0, 8,148, 3, 0, 8, 58, 67, 0, 4,
|
||||
/* 0x0150 */ 64,158,255,236, 58,163, 0, 8, 65,146, 0,180,126,122,168, 80,
|
||||
/* 0x0160 */ 128, 22,255,252, 58, 68, 0, 8,148, 3, 0, 8, 59,195, 0, 4,
|
||||
/* 0x0170 */ 56,128, 0, 0,126,195,179,120, 72, 0, 0, 1,124,123, 27,120,
|
||||
/* 0x0180 */ 56,160, 15,255,126, 68,147,120,126,195,179,120, 72, 0, 0, 1,
|
||||
/* 0x0190 */ 56,178,255,252, 44, 35, 0, 0, 65,129, 0, 12, 56,182,255,252,
|
||||
/* 0x0180 */ 56,160, 15,255,127,196,243,120,126,195,179,120, 72, 0, 0, 1,
|
||||
/* 0x0190 */ 56,190,255,252, 44, 35, 0, 0, 65,129, 0, 12, 56,182,255,252,
|
||||
/* 0x01a0 */ 56, 96, 0, 12, 56, 99, 0, 4,124,133, 26, 20,124,105, 3,166,
|
||||
/* 0x01b0 */ 126, 99,155,120, 56,160, 0, 0,156,163,255,255,140, 4,255,255,
|
||||
/* 0x01b0 */ 126, 67,147,120, 56,160, 0, 0,156,163,255,255,140, 4,255,255,
|
||||
/* 0x01c0 */ 156, 3,255,255, 66, 0,255,248,248,122,255,240,120, 99, 7, 36,
|
||||
/* 0x01d0 */ 124, 32, 34,120,124, 0, 26,120,120, 0, 7, 32,124, 96, 24, 80,
|
||||
/* 0x01e0 */ 126,164,171,120, 56, 0, 0, 0,248, 3,255,249,248, 3,255,249,
|
||||
/* 0x01f0 */ 124,117, 27,120,127, 84, 24, 80,232, 4,255,249,127,164, 8, 64,
|
||||
/* 0x01f0 */ 124,117, 27,120,127, 83, 24, 80,232, 4,255,249,127,164, 8, 64,
|
||||
/* 0x0200 */ 248, 3,255,249, 65,253,255,244,124, 97, 27,120, 57, 33, 1,136,
|
||||
/* 0x0210 */ 251, 41, 0, 0,248, 33,247,113,127, 3,195,120,126,228,187,120,
|
||||
/* 0x0220 */ 56,161, 0,144,127, 70,211,120, 56,225, 10, 24,251, 39, 0, 0,
|
||||
@ -78,7 +78,7 @@ unsigned char stub_powerpc64_linux_elf_fold[19923] = {
|
||||
/* 0x0260 */ 124, 99, 2, 20,248,117, 0, 0,124,127, 27,120,127, 35,203,120,
|
||||
/* 0x0270 */ 72, 0, 0, 1,232,153, 0,160,127, 35,203,120, 72, 0, 0, 1,
|
||||
/* 0x0280 */ 65,146, 0, 48, 57, 0, 0, 0,127,103,219,120, 44, 7, 0, 0,
|
||||
/* 0x0290 */ 65,128, 0, 32, 56,192, 0, 2, 56,160, 0, 1,124,158, 0,208,
|
||||
/* 0x0290 */ 65,128, 0, 32, 56,192, 0, 2, 56,160, 0, 1,124,148, 0,208,
|
||||
/* 0x02a0 */ 56, 96, 0, 0, 72, 0, 0, 1,127, 99,219,120, 72, 0, 0, 1,
|
||||
/* 0x02b0 */ 232, 21,255,248,124, 9, 3,166,251,225, 1,128,127,163,235,120,
|
||||
/* 0x02c0 */ 127,132,227,120, 56, 0, 0, 91,127,232, 3,166,232,161, 0,176,
|
||||
|
||||
18
src/stub/powerpc64le-linux.elf-fold.h
generated
18
src/stub/powerpc64le-linux.elf-fold.h
generated
@ -33,8 +33,8 @@
|
||||
/* clang-format off */
|
||||
|
||||
#define STUB_POWERPC64LE_LINUX_ELF_FOLD_SIZE 19965
|
||||
#define STUB_POWERPC64LE_LINUX_ELF_FOLD_ADLER32 0x639baa77
|
||||
#define STUB_POWERPC64LE_LINUX_ELF_FOLD_CRC32 0x6d8a77b5
|
||||
#define STUB_POWERPC64LE_LINUX_ELF_FOLD_ADLER32 0x73ebab72
|
||||
#define STUB_POWERPC64LE_LINUX_ELF_FOLD_CRC32 0xfe29ebf8
|
||||
|
||||
unsigned char stub_powerpc64le_linux_elf_fold[19965] = {
|
||||
/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@ -58,24 +58,24 @@ unsigned char stub_powerpc64le_linux_elf_fold[19965] = {
|
||||
/* 0x0120 */ 248,255, 90, 59, 9, 0, 4,232, 64,208,164,127, 9, 0, 3,248,
|
||||
/* 0x0130 */ 244,255,156, 65, 16, 0, 67, 59, 9, 0, 3,248, 8, 0, 4,232,
|
||||
/* 0x0140 */ 0, 0,160, 43, 8, 0, 3,248, 17, 0, 4,232, 17, 0, 3,248,
|
||||
/* 0x0150 */ 236,255,158, 64, 8, 0,163, 58,180, 0,146, 65, 80,168,154,126,
|
||||
/* 0x0160 */ 252,255, 22,128, 8, 0,100, 58, 8, 0, 3,148, 4, 0, 67, 58,
|
||||
/* 0x0150 */ 236,255,158, 64, 8, 0,163, 58,180, 0,146, 65, 80,168,122,126,
|
||||
/* 0x0160 */ 252,255, 22,128, 8, 0, 68, 58, 8, 0, 3,148, 4, 0,195, 59,
|
||||
/* 0x0170 */ 0, 0,128, 56,120,179,195,126, 1, 0, 0, 72,120, 27,123,124,
|
||||
/* 0x0180 */ 255, 15,160, 56,120,147, 68,126,120,179,195,126, 1, 0, 0, 72,
|
||||
/* 0x0190 */ 252,255,178, 56, 0, 0, 35, 44, 12, 0,129, 65,252,255,182, 56,
|
||||
/* 0x0180 */ 255, 15,160, 56,120,243,196,127,120,179,195,126, 1, 0, 0, 72,
|
||||
/* 0x0190 */ 252,255,190, 56, 0, 0, 35, 44, 12, 0,129, 65,252,255,182, 56,
|
||||
/* 0x01a0 */ 12, 0, 96, 56, 4, 0, 99, 56, 20, 26,133,124,166, 3,105,124,
|
||||
/* 0x01b0 */ 120,155, 99,126, 0, 0,160, 56,255,255,163,156,255,255, 4,140,
|
||||
/* 0x01b0 */ 120,147, 67,126, 0, 0,160, 56,255,255,163,156,255,255, 4,140,
|
||||
/* 0x01c0 */ 255,255, 3,156,248,255, 0, 66,240,255,122,248, 36, 7, 99,120,
|
||||
/* 0x01d0 */ 120, 34, 32,124,120, 26, 0,124, 32, 7, 0,120, 80, 24, 96,124,
|
||||
/* 0x01e0 */ 120,171,164,126, 0, 0, 0, 56,249,255, 3,248,249,255, 3,248,
|
||||
/* 0x01f0 */ 120, 27,117,124, 80, 24, 84,127,249,255, 4,232, 64, 8,164,127,
|
||||
/* 0x01f0 */ 120, 27,117,124, 80, 24, 83,127,249,255, 4,232, 64, 8,164,127,
|
||||
/* 0x0200 */ 249,255, 3,248,244,255,253, 65,120, 27, 97,124,136, 1, 33, 57,
|
||||
/* 0x0210 */ 0, 0, 41,251,113,247, 33,248,120,195, 3,127,120,187,228,126,
|
||||
/* 0x0220 */ 144, 0,161, 56,120,211, 70,127, 24, 10,225, 56, 0, 0, 39,251,
|
||||
/* 0x0230 */ 1, 0, 0, 72,144, 8, 33, 56,120, 27,127,124,120,203, 35,127,
|
||||
/* 0x0240 */ 1, 0, 0, 72,160, 0,153,232,120,203, 35,127, 1, 0, 0, 72,
|
||||
/* 0x0250 */ 48, 0,146, 65, 0, 0, 0, 57,120,219,103,127, 0, 0, 7, 44,
|
||||
/* 0x0260 */ 32, 0,128, 65, 2, 0,192, 56, 1, 0,160, 56,208, 0,158,124,
|
||||
/* 0x0260 */ 32, 0,128, 65, 2, 0,192, 56, 1, 0,160, 56,208, 0,148,124,
|
||||
/* 0x0270 */ 0, 0, 96, 56, 1, 0, 0, 72,120,219, 99,127, 1, 0, 0, 72,
|
||||
/* 0x0280 */ 248,255, 21,232,166, 3, 9,124,128, 1,225,251,120,235,163,127,
|
||||
/* 0x0290 */ 120,227,132,127, 91, 0, 0, 56,166, 3,232,127,176, 0,161,232,
|
||||
|
||||
@ -159,7 +159,7 @@ r_ADRX= 24
|
||||
r_LENX= 23
|
||||
r_FLD= 22
|
||||
r_szuf= 21
|
||||
r_PMASK= 20
|
||||
r_PMASK= 20
|
||||
r_obinf= 19
|
||||
|
||||
/* Decompress the rest of this loader, and jump to it. */
|
||||
@ -215,6 +215,7 @@ SYS_mmap= __NR_mmap
|
||||
mr r_ADRU,a0
|
||||
|
||||
mr a0,r_fd
|
||||
// r_fd dead
|
||||
SYS_close= __NR_close
|
||||
li r0,SYS_close; sc; bns+ 0f; teq r0,r0; 0:
|
||||
|
||||
|
||||
@ -93,21 +93,22 @@ OVERHEAD= 2048
|
||||
|
||||
// In:
|
||||
r_exp= 31 // f_exp == &decompress
|
||||
r_PMASK= 30 // page_mask
|
||||
r_buf= 30 // Local
|
||||
r_ADRU= 29 // &base to unmap
|
||||
r_LENU= 28 // length to unmap
|
||||
r_fd= 27 // open fd of /proc/self/exe
|
||||
r_fd= 27 // for fd of /proc/self/exe
|
||||
r_auxv= 26
|
||||
r_elfa= 25 // original &Elf64_Ehdr of stub
|
||||
r_ADRX= 24 // compressed input
|
||||
r_LENX= 23 // total size
|
||||
r_FLD= 22
|
||||
r_FLD= 22 // &O_BINFO; overlaps r_pse
|
||||
r_PMASK= 20 // page_mask
|
||||
// Local:
|
||||
r_pse= 22 // &"/proc/self/exe"
|
||||
r_pse= 22 // &"/proc/self/exe"; overlaps r_FLD
|
||||
av_hi= 21
|
||||
av_len= 20
|
||||
cblk= 19
|
||||
r_buf= 18
|
||||
// r_PMASK= 20
|
||||
av_len= 19
|
||||
cblk= 18
|
||||
|
||||
page_mask: .quad ~0<<16 // default
|
||||
.quad 0 // something else?
|
||||
@ -145,6 +146,7 @@ fold_begin:
|
||||
//// teq r0,r0 // debugging
|
||||
mtctr r0 // # words before argc FIXME: fragile
|
||||
lwz r0,0(r_FLD) // O_BINFO | is_ptinterp | unmap_all_pages
|
||||
// r_FLD dead
|
||||
slwi r0,r0,3*4
|
||||
mtcrf 0x8,r0 // cr4.eq = unmap_all_pages
|
||||
call L90
|
||||
@ -193,14 +195,17 @@ no_buf:
|
||||
movr a1,r_buf // buffer
|
||||
movr a0,r_pse // "/proc/self/exe"
|
||||
call readlink; la a2,-L_PFX(r_buf) // a0= len; a2= buffer
|
||||
// r_buf dead
|
||||
cmpdi a0,0; bgt 0f // success
|
||||
la a2,L90a - L_pse(r_pse) // " =/proc/self/exe"
|
||||
// r_pse dead
|
||||
li a0,L90 - (NBPW+ L90a) // round_up(NBPW, strlen("/proc/self/exe"))
|
||||
0:
|
||||
addi a0,a0,L_PFX // len += strlen(" =");
|
||||
add a1,a2,a0 // beyond end of path
|
||||
mtctr a0
|
||||
movr a0,cblk // old &strings
|
||||
// cblk dead
|
||||
li a2,0
|
||||
stbu a2,-1(a0) // NUL terminate
|
||||
0: // slide path up
|
||||
|
||||
Loading…
Reference in New Issue
Block a user