armel-eabi-linux.shlib: improve integration with system calls.
This commit is contained in:
parent
ba634118d7
commit
9f6cb5de4c
@ -32,8 +32,8 @@
|
||||
|
||||
|
||||
#define STUB_ARM_LINUX_SHLIB_INIT_SIZE 15402
|
||||
#define STUB_ARM_LINUX_SHLIB_INIT_ADLER32 0xfcd8e9e0
|
||||
#define STUB_ARM_LINUX_SHLIB_INIT_CRC32 0xf3aa50c6
|
||||
#define STUB_ARM_LINUX_SHLIB_INIT_ADLER32 0xb330e98e
|
||||
#define STUB_ARM_LINUX_SHLIB_INIT_CRC32 0x1edfa530
|
||||
|
||||
unsigned char stub_arm_linux_shlib_init[15402] = {
|
||||
/* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 97, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@ -334,8 +334,8 @@ unsigned char stub_arm_linux_shlib_init[15402] = {
|
||||
/* 0x1270 */ 160, 17, 33, 17,176,225, 0, 0, 80, 19, 14,240,160, 1, 1, 16,
|
||||
/* 0x1280 */ 65,226, 1, 33,144,231, 15, 52, 2,226, 11, 4, 83,227, 43, 0,
|
||||
/* 0x1290 */ 0, 26,255, 52, 2,226, 1, 32, 66,224,255, 36,194,227, 3, 32,
|
||||
/* 0x12a0 */ 130,225, 1, 33,128,231, 0, 0, 81,227, 33, 0, 0, 26, 14,240,
|
||||
/* 0x12b0 */ 160,225, 4,224, 45,229, 5, 48,209,229, 4, 48, 45,229, 6, 48,
|
||||
/* 0x12a0 */ 130,225, 1, 33,128,231, 0, 0, 81,227, 33, 0, 0, 26, 30,255,
|
||||
/* 0x12b0 */ 47,225, 4,224, 45,229, 5, 48,209,229, 4, 48, 45,229, 6, 48,
|
||||
/* 0x12c0 */ 209,229, 4, 48, 45,229, 4, 64, 45,229, 4, 0, 45,229,154, 0,
|
||||
/* 0x12d0 */ 0,235, 4, 80,160,225,154, 0, 0,235, 4, 64, 45,229, 4, 32,
|
||||
/* 0x12e0 */ 45,229, 40, 48, 75,226, 4, 48, 45,229, 4, 0, 45,229, 4, 80,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -39,25 +39,34 @@
|
||||
__NR_SYSCALL_BASE = 0
|
||||
.macro do_sys N
|
||||
mov ip,#\N
|
||||
swi 0x80 // returns Carry iff error
|
||||
swi 0x80 // sets Carry iff error
|
||||
orrcs r0,r0,#(1<<31) // force negative on error; FIXME: needed?
|
||||
ret
|
||||
.endm
|
||||
.macro do_sys7t N
|
||||
do_sys \N
|
||||
.endm
|
||||
|
||||
#elif defined(ARMEL_EABI4) /*}{*/
|
||||
|
||||
__NR_SYSCALL_BASE = 0
|
||||
.macro do_sys N
|
||||
mov r12,r7 // save r7 in ip
|
||||
.macro do_sys7t N
|
||||
mov r7,#\N // syscall number
|
||||
swi 0
|
||||
.endm
|
||||
.macro do_sys N
|
||||
mov r12,r7 // save r7 in ip
|
||||
do_sys7t \N
|
||||
mov r7,r12 // restore r7 from ip
|
||||
.endm
|
||||
.macro do_sys2 N
|
||||
mov r12,r7 // save r7 in ip
|
||||
.macro do_sys7t2 N
|
||||
mov r7, #(\N) & 0xff // syscall number
|
||||
orr r7,r7,#(\N) &~0xff // high bits
|
||||
swi 0
|
||||
.endm
|
||||
.macro do_sys2 N
|
||||
mov r12,r7 // save r7 in ip
|
||||
do_sys7t2 \N
|
||||
mov r7,r12 // restore r7 from ip
|
||||
.endm
|
||||
|
||||
@ -67,16 +76,22 @@ __NR_SYSCALL_BASE = 0x900000
|
||||
.macro do_sys N
|
||||
swi \N
|
||||
.endm
|
||||
.macro do_sys7t N
|
||||
do_sys \N
|
||||
.endm
|
||||
.macro do_sys2 N
|
||||
swi \N
|
||||
.endm
|
||||
.macro do_sys7t2 N
|
||||
do_sys2 \N
|
||||
.endm
|
||||
|
||||
#else /*}{*/
|
||||
.macro do_sys N
|
||||
error ARM_OLDABI, ARMEL_EABI4, ARMEL_DARWIN ?
|
||||
error \N // ARM_OLDABI, ARMEL_EABI4, ARMEL_DARWIN ?
|
||||
.endm
|
||||
.macro do_sys2 N
|
||||
error ARM_OLDABI, ARMEL_EABI4, ARMEL_DARWIN ?
|
||||
error \N // ARM_OLDABI, ARMEL_EABI4, ARMEL_DARWIN ?
|
||||
.endm
|
||||
#endif /*}*/
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
.section \name
|
||||
.endm
|
||||
|
||||
/* The order of #if-#elif matters: ARMEL_EABI4 takes precedence over ARM_OLDABI */
|
||||
#if defined(ARMEL_DARWIN) /*{*/
|
||||
__NR_SYSCALL_BASE = 0
|
||||
.macro do_sys N
|
||||
@ -42,6 +43,9 @@ __NR_SYSCALL_BASE = 0
|
||||
orrcs r0,r0,#(1<<31) // force negative on error; FIXME: needed?
|
||||
ret
|
||||
.endm
|
||||
.macro do_sys7t N
|
||||
do_sys \N
|
||||
.endm
|
||||
|
||||
.macro do_dcache_flush // In: r0=addr; r1=len
|
||||
mov r3,#1 // _sys_dcache_flush
|
||||
@ -57,17 +61,23 @@ __NR_SYSCALL_BASE = 0
|
||||
#elif defined(ARMEL_EABI4) /*}{*/
|
||||
|
||||
__NR_SYSCALL_BASE = 0
|
||||
.macro do_sys N
|
||||
mov r12,r7 // save r7 in ip
|
||||
.macro do_sys7t N
|
||||
mov r7,#\N // syscall number
|
||||
swi 0
|
||||
.endm
|
||||
.macro do_sys N
|
||||
mov r12,r7 // save r7 in ip
|
||||
do_sys7t \N
|
||||
mov r7,r12 // restore r7 from ip
|
||||
.endm
|
||||
.macro do_sys2 N
|
||||
mov r12,r7 // save r7 in ip
|
||||
.macro do_sys7t2 N
|
||||
mov r7, #(\N) & 0xff // syscall number
|
||||
orr r7,r7,#(\N) &~0xff // high bits
|
||||
swi 0
|
||||
.endm
|
||||
.macro do_sys2 N
|
||||
mov r12,r7 // save r7 in ip
|
||||
do_sys7t2 \N
|
||||
mov r7,r12 // restore r7 from ip
|
||||
.endm
|
||||
|
||||
@ -77,9 +87,15 @@ __NR_SYSCALL_BASE = 0x900000
|
||||
.macro do_sys N
|
||||
swi \N
|
||||
.endm
|
||||
.macro do_sys7t N
|
||||
do_sys \N
|
||||
.endm
|
||||
.macro do_sys2 N
|
||||
swi \N
|
||||
.endm
|
||||
.macro do_sys7t2 N
|
||||
do_sys2 \N
|
||||
.endm
|
||||
|
||||
#else /*}{*/
|
||||
.macro do_sys N
|
||||
|
||||
@ -236,7 +236,7 @@ top_unf:
|
||||
tst_unf:
|
||||
cmp len,#0
|
||||
bne top_unf
|
||||
mov pc,lr
|
||||
ret
|
||||
|
||||
#undef ptr
|
||||
#undef len
|
||||
@ -282,7 +282,7 @@ supervise:
|
||||
ldr arg2,[fp,#p_mprot+4] // dstlen
|
||||
ldr arg1,[fp,#p_mprot ] // dst
|
||||
mov r6,arg1 // required result
|
||||
do_sys __NR_mmap64; cmp r0,r6; beq 0f; bkpt; 0:
|
||||
do_sys7t __NR_mmap64; cmp r0,r6; beq 0f; bkpt; 0:
|
||||
|
||||
// Restore fragment of page below dst
|
||||
ldr ecx,[fp,#o_wfrag]
|
||||
@ -304,11 +304,11 @@ supervise:
|
||||
ldr arg2,[sp,#1*4] // len
|
||||
mov arg3,#0
|
||||
add arg2,arg2,arg1 // hi(dst)
|
||||
do_sys2 __ARM_NR_cacheflush
|
||||
do_sys7t2 __ARM_NR_cacheflush
|
||||
|
||||
ldmia sp!,{arg1,arg2}
|
||||
mov arg3,#PROT_READ|PROT_EXEC
|
||||
do_sys __NR_mprotect
|
||||
do_sys7t __NR_mprotect
|
||||
|
||||
//p_unmap
|
||||
//ldmia sp!,{arg1,arg2, pc}
|
||||
@ -338,7 +338,7 @@ o_super= -18*4
|
||||
mov arg3,#PROT_READ|PROT_WRITE|PROT_EXEC
|
||||
str arg2,[fp,#p_unmap+1*4] // length to unmap
|
||||
mov arg1,#0 // any addr
|
||||
do_sys __NR_mmap64; cmn r0,#4096; bcc 0f; bkpt; 0:
|
||||
do_sys7t __NR_mmap64; cmn r0,#4096; bcc 0f; bkpt; 0:
|
||||
str r0,[fp,#p_unmap+0*4] // address to unmap
|
||||
|
||||
ldr esi,[fp,#p_mprot]
|
||||
@ -374,7 +374,7 @@ o_super= -18*4
|
||||
mov arg2,edi // hi(dst) of copied code
|
||||
mov arg1,edx // lo(dst) of copied code
|
||||
mov arg3,#0
|
||||
do_sys2 __ARM_NR_cacheflush
|
||||
do_sys7t2 __ARM_NR_cacheflush
|
||||
|
||||
pop pc // goto copied supervisor
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ Idx Name Size VMA LMA File off Algn Flags
|
||||
8 LZMA_DEC10 00000478 00000000 00000000 00000d84 2**0 CONTENTS, RELOC, READONLY
|
||||
9 LZMA_DEC30 00000000 00000000 00000000 000011fc 2**0 CONTENTS, READONLY
|
||||
10 ELFMAINY 0000003e 00000000 00000000 000011fc 2**0 CONTENTS, READONLY
|
||||
11 ELFMAINZ 000002e8 00000000 00000000 0000123a 2**0 CONTENTS, RELOC, READONLY
|
||||
11 ELFMAINZ 000002c0 00000000 00000000 0000123a 2**0 CONTENTS, RELOC, READONLY
|
||||
SYMBOL TABLE:
|
||||
00000000 l d NRV2E 00000000 NRV2E
|
||||
00000000 l d NRV2D 00000000 NRV2D
|
||||
@ -254,14 +254,14 @@ OFFSET TYPE VALUE
|
||||
0000011c R_ARM_PC24 ELFMAINZ
|
||||
00000124 R_ARM_PC24 ELFMAINZ
|
||||
00000128 R_ARM_PC24 ELFMAINZ
|
||||
00000158 R_ARM_PC24 ELFMAINZ
|
||||
00000168 R_ARM_PC24 ELFMAINZ
|
||||
00000180 R_ARM_PC24 ELFMAINZ
|
||||
000001e8 R_ARM_PC24 ELFMAINZ
|
||||
000001f8 R_ARM_PC24 ELFMAINZ
|
||||
00000228 R_ARM_PC24 ELFMAINZ
|
||||
0000023c R_ARM_PC24 ELFMAINZ
|
||||
00000264 R_ARM_PC24 ELFMAINZ
|
||||
00000274 R_ARM_PC24 ELFMAINZ
|
||||
00000280 R_ARM_PC24 ELFMAINZ
|
||||
0000028c R_ARM_PC24 ELFMAINZ
|
||||
00000150 R_ARM_PC24 ELFMAINZ
|
||||
00000160 R_ARM_PC24 ELFMAINZ
|
||||
00000178 R_ARM_PC24 ELFMAINZ
|
||||
000001d0 R_ARM_PC24 ELFMAINZ
|
||||
000001e0 R_ARM_PC24 ELFMAINZ
|
||||
00000208 R_ARM_PC24 ELFMAINZ
|
||||
0000021c R_ARM_PC24 ELFMAINZ
|
||||
00000244 R_ARM_PC24 ELFMAINZ
|
||||
00000254 R_ARM_PC24 ELFMAINZ
|
||||
00000260 R_ARM_PC24 ELFMAINZ
|
||||
0000026c R_ARM_PC24 ELFMAINZ
|
||||
|
||||
Loading…
Reference in New Issue
Block a user