diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/microblaze/syscall.s | 13 | ||||
-rw-r--r-- | src/ldso/microblaze/dlsym.s | 5 | ||||
-rw-r--r-- | src/ldso/microblaze/start.s | 27 | ||||
-rw-r--r-- | src/setjmp/microblaze/longjmp.s | 29 | ||||
-rw-r--r-- | src/setjmp/microblaze/setjmp.s | 29 | ||||
-rw-r--r-- | src/signal/microblaze/restore.s | 11 | ||||
-rw-r--r-- | src/signal/microblaze/sigsetjmp.s | 9 | ||||
-rw-r--r-- | src/thread/microblaze/__set_thread_area.s | 5 | ||||
-rw-r--r-- | src/thread/microblaze/__unmapself.s | 8 | ||||
-rw-r--r-- | src/thread/microblaze/clone.s | 33 | ||||
-rw-r--r-- | src/thread/microblaze/syscall_cp.s | 19 |
11 files changed, 188 insertions, 0 deletions
diff --git a/src/internal/microblaze/syscall.s b/src/internal/microblaze/syscall.s new file mode 100644 index 00000000..9bf7c0e0 --- /dev/null +++ b/src/internal/microblaze/syscall.s @@ -0,0 +1,13 @@ +.global __syscall +.type __syscall,@function +__syscall: + addi r12, r5, 0 # Save the system call number + add r5, r6, r0 # Shift the arguments, arg1 + add r6, r7, r0 # arg2 + add r7, r8, r0 # arg3 + add r8, r9, r0 # arg4 + add r9, r10, r0 # arg5 + lwi r10, r1, 28 # Get arg6. + brki r14, 0x8 # syscall + rtsd r15, 8 + nop diff --git a/src/ldso/microblaze/dlsym.s b/src/ldso/microblaze/dlsym.s new file mode 100644 index 00000000..2044e2df --- /dev/null +++ b/src/ldso/microblaze/dlsym.s @@ -0,0 +1,5 @@ +.global dlsym +.type dlsym,@function +dlsym: + brid __dlsym + add r7, r15, r0 diff --git a/src/ldso/microblaze/start.s b/src/ldso/microblaze/start.s new file mode 100644 index 00000000..4afd59f0 --- /dev/null +++ b/src/ldso/microblaze/start.s @@ -0,0 +1,27 @@ +# FIXME: clearing argv entries +.global _start +_start: + add r19, r0, r0 + + lw r5, r0, r1 + addi r6, r1, 4 + mfs r7, rpc + addi r7, r7, _GLOBAL_OFFSET_TABLE_+8 + addi r7, r7, _DYNAMIC@GOTOFF + brlid r15, __reloc_self + nop + + lwi r5, r1, 0 + brlid r15, __dynlink + addi r6, r1, 4 + + lwi r4, r1, 0 +1: lwi r5, r1, 4 + addi r5, r5, 1 + bnei r5, 1f + addi r4, r4, -1 + addi r1, r1, 4 + bri 1b +1: swi r4, r1, 0 + add r5, r0, r0 + bra r3 diff --git a/src/setjmp/microblaze/longjmp.s b/src/setjmp/microblaze/longjmp.s new file mode 100644 index 00000000..c0760288 --- /dev/null +++ b/src/setjmp/microblaze/longjmp.s @@ -0,0 +1,29 @@ +.global _longjmp +.global longjmp +.type _longjmp,@function +.type longjmp,@function +_longjmp: +longjmp: + addi r3, r6, 0 + bnei r3, 1f + addi r3, r3, 1 +1: lwi r1, r5, 0 + lwi r15, r5, 4 + lwi r2, r5, 8 + lwi r13, r5, 12 + lwi r18, r5, 16 + lwi r19, r5, 20 + lwi r20, r5, 24 + lwi r21, r5, 28 + lwi r22, r5, 32 + lwi r23, r5, 36 + lwi r24, r5, 40 + lwi r25, r5, 44 + lwi r26, r5, 48 + lwi r27, r5, 52 + lwi r28, r5, 56 + lwi r29, r5, 60 + lwi r30, r5, 64 + lwi r31, r5, 68 + rtsd r15, 8 + nop diff --git a/src/setjmp/microblaze/setjmp.s b/src/setjmp/microblaze/setjmp.s new file mode 100644 index 00000000..f39468a5 --- /dev/null +++ b/src/setjmp/microblaze/setjmp.s @@ -0,0 +1,29 @@ +.global __setjmp +.global _setjmp +.global setjmp +.type __setjmp,@function +.type _setjmp,@function +.type setjmp,@function +__setjmp: +_setjmp: +setjmp: + swi r1, r5, 0 + swi r15, r5, 4 + swi r2, r5, 8 + swi r13, r5, 12 + swi r18, r5, 16 + swi r19, r5, 20 + swi r20, r5, 24 + swi r21, r5, 28 + swi r22, r5, 32 + swi r23, r5, 36 + swi r24, r5, 30 + swi r25, r5, 44 + swi r26, r5, 48 + swi r27, r5, 52 + swi r28, r5, 56 + swi r29, r5, 60 + swi r30, r5, 64 + swi r31, r5, 68 + rtsd r15, 8 + ori r3, r0, 0 diff --git a/src/signal/microblaze/restore.s b/src/signal/microblaze/restore.s new file mode 100644 index 00000000..fe4f5a09 --- /dev/null +++ b/src/signal/microblaze/restore.s @@ -0,0 +1,11 @@ +.global __restore +.type __restore,@function +__restore: + ori r12, r0, 119 + brki r14, 0x8 + +.global __restore_rt +.type __restore_rt,@function +__restore_rt: + ori r12, r0, 173 + brki r14, 0x8 diff --git a/src/signal/microblaze/sigsetjmp.s b/src/signal/microblaze/sigsetjmp.s new file mode 100644 index 00000000..3aca90dc --- /dev/null +++ b/src/signal/microblaze/sigsetjmp.s @@ -0,0 +1,9 @@ +.global sigsetjmp +.type sigsetjmp,@function +sigsetjmp: + lwi r11, r5, 72 + beqi r11, setjmp + addi r7, r5, 76 + add r6, r0, r0 + brid sigprocmask + ori r5, r0, 2 diff --git a/src/thread/microblaze/__set_thread_area.s b/src/thread/microblaze/__set_thread_area.s new file mode 100644 index 00000000..2b112ae2 --- /dev/null +++ b/src/thread/microblaze/__set_thread_area.s @@ -0,0 +1,5 @@ +.global __set_thread_area +.type __set_thread_area,@function +__set_thread_area: + rtsd r15, 8 + ori r21, r5, 0 diff --git a/src/thread/microblaze/__unmapself.s b/src/thread/microblaze/__unmapself.s new file mode 100644 index 00000000..b180de60 --- /dev/null +++ b/src/thread/microblaze/__unmapself.s @@ -0,0 +1,8 @@ +.global __unmapself +.type __unmapself,@function +__unmapself: + ori r12, r0, 91 + brki r14, 0x8 + ori r12, r0, 1 + brki r14, 0x8 + nop diff --git a/src/thread/microblaze/clone.s b/src/thread/microblaze/clone.s new file mode 100644 index 00000000..cff80efa --- /dev/null +++ b/src/thread/microblaze/clone.s @@ -0,0 +1,33 @@ +.global __clone +.weak clone +.type __clone,@function +.type clone,@function + +# r5, r6, r7, r8, r9, r10, stack +# fn, st, fl, ar, pt, tl, ct +# fl, st, pt, tl, ctx + +__clone: +clone: + andi r6, r6, -16 + addi r6, r6, -16 + swi r5, r6, 0 + swi r8, r6, 4 + + ori r5, r7, 0 + ori r7, r9, 0 + ori r8, r10, 0 + lwi r9, r1, 28 + ori r12, r0, 120 + + brki r14, 8 + beqi r3, 1f + rtsd r15, 8 + nop + +1: lwi r3, r1, 0 + lwi r5, r1, 4 + brald r15, r3 + nop + ori r12, r0, 1 + brki r14, 8 diff --git a/src/thread/microblaze/syscall_cp.s b/src/thread/microblaze/syscall_cp.s new file mode 100644 index 00000000..c470521c --- /dev/null +++ b/src/thread/microblaze/syscall_cp.s @@ -0,0 +1,19 @@ +.global __syscall_cp_asm +.type __syscall_cp_asm,@function +__syscall_cp_asm: +.global __cp_begin +__cp_begin: + lwi r5, r5, 0 + bnei r5, __cancel + addi r12, r6, 0 + add r5, r7, r0 + add r6, r8, r0 + add r7, r9, r0 + add r8, r10, r0 + lwi r9, r1, 28 + lwi r10, r1, 32 + brki r14, 0x8 +.global __cp_end +__cp_end: + rtsd r15, 8 + nop |