dmarschal
Member
Hello,
I'm coding a multi-threaded game and I found some weird things.
Tested on Gig and RB Pandoras (latest fw), both in silver case if that matters.
First, conditional SWI does not work. Please see the attached code. It's just an example to demonstrate the issue with SWIPL.
sys_exit =1
sys_write=4
console =1
sys_open =5
o_wr =1
sys_close=6
@ macro definitions
.macro invoke iint
mov r7,#\iint
swi 0
.endm
.macro exit rretval
mov r0,#\rretval
invoke sys_exit
.endm
.macro print sstr
b 3f
1: .ascii "\sstr"
2: .align
3:
mov r0,#console
adr r1,1b
mov r2,#(2b-1b)
invoke sys_write
.endm
.data
dsp_dev: .asciz "/dev/dsp"
.align
.text
.globl _start
_start:
ldr r0,dsp_dev_ofs
mov r1,#o_wr
invoke sys_open
sub r12,r0,#0
bpl 11f
print "can't open dsp dev\n"
exit 0
dsp_dev_ofs: .word dsp_dev
11:
print "all ok\n"
subs r0,r12,#0
mov r7,#sys_close
swipl 0 @ <<<<<<<< SWIPL
exit 0
.bss
.end
Copy-paste and save as swipl.s.
To assemble & link:
as swipl.s
ld a.out -o swipl
"strace ./swipl" gives this error:
syscall: unknown syscall trap 0x5f000000
What's wrong with it? ARM ARM clearly states that SWI can run conditionally.
Second, .text section is read-only. Was it changed to "ro" in 3.x kernel? Why?
Third. There are also issues with sys_nanosleep, sys_gettimeofday and termios & child process but it needs more debugging.
What's your thoughts?
I'm coding a multi-threaded game and I found some weird things.
Tested on Gig and RB Pandoras (latest fw), both in silver case if that matters.
First, conditional SWI does not work. Please see the attached code. It's just an example to demonstrate the issue with SWIPL.
sys_exit =1
sys_write=4
console =1
sys_open =5
o_wr =1
sys_close=6
@ macro definitions
.macro invoke iint
mov r7,#\iint
swi 0
.endm
.macro exit rretval
mov r0,#\rretval
invoke sys_exit
.endm
.macro print sstr
b 3f
1: .ascii "\sstr"
2: .align
3:
mov r0,#console
adr r1,1b
mov r2,#(2b-1b)
invoke sys_write
.endm
.data
dsp_dev: .asciz "/dev/dsp"
.align
.text
.globl _start
_start:
ldr r0,dsp_dev_ofs
mov r1,#o_wr
invoke sys_open
sub r12,r0,#0
bpl 11f
print "can't open dsp dev\n"
exit 0
dsp_dev_ofs: .word dsp_dev
11:
print "all ok\n"
subs r0,r12,#0
mov r7,#sys_close
swipl 0 @ <<<<<<<< SWIPL
exit 0
.bss
.end
Copy-paste and save as swipl.s.
To assemble & link:
as swipl.s
ld a.out -o swipl
"strace ./swipl" gives this error:
syscall: unknown syscall trap 0x5f000000
What's wrong with it? ARM ARM clearly states that SWI can run conditionally.
Second, .text section is read-only. Was it changed to "ro" in 3.x kernel? Why?
Third. There are also issues with sys_nanosleep, sys_gettimeofday and termios & child process but it needs more debugging.
What's your thoughts?
Last edited by a moderator: