summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/longjmp.S
diff options
context:
space:
mode:
authorCarl Smith <carl.smith@alliedtelesis.co.nz>2018-07-26 15:45:28 +1200
committerDave Barach <openvpp@barachs.net>2018-07-27 12:04:37 +0000
commit28d4271d1a9103099e6711fc58f9a479c8722e60 (patch)
tree40839c9981cbcf4e14585c118955d28993c407f9 /src/vppinfra/longjmp.S
parentfc5dda3d0a96fd9722cdac055dfa4865823d5ebd (diff)
mips64: Add timer and longjump support
Also correct types.h for mips64 which could never be hit as _mips was part of the previous ifdef. Change-Id: Id0435c8fc960c5d25c43129b9d9f1606e39ba8e3 Signed-off-by: Carl Smith <carl.smith@alliedtelesis.co.nz>
Diffstat (limited to 'src/vppinfra/longjmp.S')
-rw-r--r--src/vppinfra/longjmp.S74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/vppinfra/longjmp.S b/src/vppinfra/longjmp.S
index d4dd4c7d916..6468dba45bf 100644
--- a/src/vppinfra/longjmp.S
+++ b/src/vppinfra/longjmp.S
@@ -580,6 +580,80 @@ clib_longjmp:
clib_calljmp:
1: B .S1 1b
+#elif defined(_mips) && __mips == 64
+
+ .global clib_setjmp
+ .align 8
+ .type clib_setjmp, %function
+clib_setjmp:
+ sd $ra, 0($a0)
+ sd $sp, 8($a0)
+ sd $gp, 16($a0)
+ sd $16, 24($a0)
+ sd $17, 32($a0)
+ sd $18, 40($a0)
+ sd $19, 48($a0)
+ sd $20, 56($a0)
+ sd $21, 64($a0)
+ sd $22, 72($a0)
+ sd $23, 80($a0)
+ sd $30, 88($a0)
+ move $v0, $a1
+ jr $ra
+ nop
+
+ .global clib_longjmp
+ .align 8
+ .type clib_longjmp, @function
+clib_longjmp:
+ move $v0, $a1
+ bne $v0, $0, 1f
+ nop
+ daddu $v0, $v0, 1
+1:
+ ld $ra, 0($a0)
+ ld $sp, 8($a0)
+ ld $gp, 16($a0)
+ ld $16, 24($a0)
+ ld $17, 32($a0)
+ ld $18, 40($a0)
+ ld $19, 48($a0)
+ ld $20, 56($a0)
+ ld $21, 64($a0)
+ ld $22, 72($a0)
+ ld $23, 80($a0)
+ ld $30, 88($a0)
+ jr $ra
+ nop
+
+ .global clib_calljmp
+ .align 8
+ .type clib_calljmp, %function
+clib_calljmp:
+ /* Force 16 byte alignment of the new stack */
+ li $t1, -16
+ and $t0, $a2, $t1
+ /* Save old ra/gp/sp on new stack */
+ daddiu $t0, $t0, (-24)
+ sd $ra, 0($t0)
+ sd $gp, 8($t0)
+ sd $sp, 16($t0)
+ /* Switch stacks */
+ move $sp, $t0
+ /* Away we go */
+ move $t9, $a0
+ move $a0, $a1
+ jalr $t9
+ nop
+ /* Switch back to old ra/gp/sp */
+ move $t0, $sp
+ ld $ra, 0($t0)
+ ld $gp, 8($t0)
+ ld $sp, 16($t0)
+ /* Return to caller */
+ jr $ra
+ nop
+
#elif defined (__aarch64__)
/*
Copyright (c) 2011, 2012 ARM Ltd