From d7efb0a32c17775071bb8f13ac0962353fe22ab8 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 25 May 2013 13:31:27 +0100 Subject: [PATCH] Implement .csa. --HG-- branch : dtrg-videocore rename : mach/vc4/libem/dummy.s => mach/vc4/libem/csa.s --- mach/vc4/libem/csa.s | 33 +++++++++++++++++++++++++++++++++ mach/vc4/libem/dummy.s | 14 -------------- mach/vc4/libem/videocore.h | 2 ++ 3 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 mach/vc4/libem/csa.s delete mode 100644 mach/vc4/libem/dummy.s diff --git a/mach/vc4/libem/csa.s b/mach/vc4/libem/csa.s new file mode 100644 index 000000000..1628199a0 --- /dev/null +++ b/mach/vc4/libem/csa.s @@ -0,0 +1,33 @@ +# +/* + * VideoCore IV support library for the ACK + * © 2013 David Given + * This file is redistributable under the terms of the 3-clause BSD license. + * See the file 'Copying' in the root of the distribution for the full text. + */ + +#include "videocore.h" + +.define .csa +.sect .data +.csa: + ! on entry: + ! r0 = un-fixed-up descriptor + ! r1 = value + add r0, gp + + ld r2, 4 (r0) ! check lower bound + cmp r1, r2 + mov.lo r1, r2 ! r1 = min(r1, r2) + + sub r1, r2 ! adjust value to be 0-based + + ld r2, 8 (r0) ! check upper bound + cmp r1, r2 + mov.hi r1, r2 ! r1 = max(r1, r2) + + add r1, #3 + ld r1, (r0, r1) ! load destination address + add r1, gp + b r1 ! ...and go + diff --git a/mach/vc4/libem/dummy.s b/mach/vc4/libem/dummy.s deleted file mode 100644 index fdbcc4c38..000000000 --- a/mach/vc4/libem/dummy.s +++ /dev/null @@ -1,14 +0,0 @@ -# -/* - * VideoCore IV support library for the ACK - * © 2013 David Given - * This file is redistributable under the terms of the 3-clause BSD license. - * See the file 'Copying' in the root of the distribution for the full text. - */ - -#include "videocore.h" - -.define __dummy -.sect .data -__dummy: - diff --git a/mach/vc4/libem/videocore.h b/mach/vc4/libem/videocore.h index 3e27a7e7b..8ccb981ee 100644 --- a/mach/vc4/libem/videocore.h +++ b/mach/vc4/libem/videocore.h @@ -13,3 +13,5 @@ .sect .data .sect .bss +#define gp r15 +