Merge tag 'upstream-3.18-rc1-v2' of git://git.infradead.org/linux-ubifs
[linux-2.6-microblaze.git] / lib / test_bpf.c
index 9a67456..23e070b 100644 (file)
@@ -1735,6 +1735,27 @@ static struct bpf_test tests[] = {
                { },
                { { 1, 0 } },
        },
+       {
+               "load 64-bit immediate",
+               .u.insns_int = {
+                       BPF_LD_IMM64(R1, 0x567800001234LL),
+                       BPF_MOV64_REG(R2, R1),
+                       BPF_MOV64_REG(R3, R2),
+                       BPF_ALU64_IMM(BPF_RSH, R2, 32),
+                       BPF_ALU64_IMM(BPF_LSH, R3, 32),
+                       BPF_ALU64_IMM(BPF_RSH, R3, 32),
+                       BPF_ALU64_IMM(BPF_MOV, R0, 0),
+                       BPF_JMP_IMM(BPF_JEQ, R2, 0x5678, 1),
+                       BPF_EXIT_INSN(),
+                       BPF_JMP_IMM(BPF_JEQ, R3, 0x1234, 1),
+                       BPF_EXIT_INSN(),
+                       BPF_ALU64_IMM(BPF_MOV, R0, 1),
+                       BPF_EXIT_INSN(),
+               },
+               INTERNAL,
+               { },
+               { { 0, 1 } }
+       },
 };
 
 static struct net_device dev;
@@ -1873,7 +1894,7 @@ static int __run_one(const struct bpf_prog *fp, const void *data,
                     int runs, u64 *duration)
 {
        u64 start, finish;
-       int ret, i;
+       int ret = 0, i;
 
        start = ktime_to_us(ktime_get());