summaryrefslogtreecommitdiffstats
path: root/asm-tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:51 +0000
commit6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e (patch)
tree32451fa3cdd9321fb2591fada9891b2cb70a9cd1 /asm-tests
parentInitial commit. (diff)
downloadgrub2-6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e.tar.xz
grub2-6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e.zip
Adding upstream version 2.06.upstream/2.06upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'asm-tests')
-rw-r--r--asm-tests/arm.S20
-rw-r--r--asm-tests/i386-pc.S18
-rw-r--r--asm-tests/i386.S4
-rw-r--r--asm-tests/mips.S11
-rw-r--r--asm-tests/powerpc.S8
-rw-r--r--asm-tests/sparc64.S9
6 files changed, 70 insertions, 0 deletions
diff --git a/asm-tests/arm.S b/asm-tests/arm.S
new file mode 100644
index 0000000..97c2546
--- /dev/null
+++ b/asm-tests/arm.S
@@ -0,0 +1,20 @@
+/* on arm clang doesn't support .arch directive */
+
+ .text
+ .syntax unified
+
+#if !defined (__thumb2__)
+ .arch armv7a
+ .arm
+#else
+ .arch armv7
+ .thumb
+#endif
+ mcr p15, 0, r11, c7, c14, 2
+
+ /* clang restricts access to dsb/isb despite .arch */
+ dsb
+ isb
+
+
+
diff --git a/asm-tests/i386-pc.S b/asm-tests/i386-pc.S
new file mode 100644
index 0000000..d037744
--- /dev/null
+++ b/asm-tests/i386-pc.S
@@ -0,0 +1,18 @@
+/* on x86 old clang doesn't support .code16
+ newer clang supports it but creates 6-byte jumps instead of 3-byte ones
+ which makes us go over boot sector size.
+ Starting with 3.9 clang emits 3-byte jumps but still creates 8-bytes movl
+ instead of 5-bytes, so code overflows into data. */
+
+ .code16
+ jmp far
+ .org 4
+ jmp nearer
+ .org 6
+ movl nearer, %ebx
+ .org 11
+ .space 100
+nearer:
+ .space 200
+far:
+ .byte 0
diff --git a/asm-tests/i386.S b/asm-tests/i386.S
new file mode 100644
index 0000000..30adc4f
--- /dev/null
+++ b/asm-tests/i386.S
@@ -0,0 +1,4 @@
+/* on x86 old clang doesn't support .code16 */
+
+ .code16
+ movb %al, %bl
diff --git a/asm-tests/mips.S b/asm-tests/mips.S
new file mode 100644
index 0000000..1312d47
--- /dev/null
+++ b/asm-tests/mips.S
@@ -0,0 +1,11 @@
+/* on mips clang doesn't support privilegied instructions, doubleword store/load
+ and crashes with hand-written assembly
+ */
+
+ .set mips3
+ sync
+ ld $t2, 0($t1)
+
+a:
+ addiu $t1, $s0, (b - a)
+b: nop
diff --git a/asm-tests/powerpc.S b/asm-tests/powerpc.S
new file mode 100644
index 0000000..396a6cc
--- /dev/null
+++ b/asm-tests/powerpc.S
@@ -0,0 +1,8 @@
+/* clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly
+ used by gcrypt */
+/* Cache invalidation loop is a fair test. */
+ li 5, 0
+1: icbi 5, 3
+ addi 5, 5, 32
+ cmpw 5, 4
+ blt 1b
diff --git a/asm-tests/sparc64.S b/asm-tests/sparc64.S
new file mode 100644
index 0000000..03c5fe0
--- /dev/null
+++ b/asm-tests/sparc64.S
@@ -0,0 +1,9 @@
+ .text
+1:
+ /* A small list of examples of what clang doesn't support. */
+ clr %o0
+ lduw [%o4 + 4], %o4
+ and %o6, ~0xff, %o6
+ stw %o5, [%o3]
+ bne,pt %icc, 1b
+ nop