1 /*- 2 * Test 0076: Check boundary conditions (BPF_LDX+BPF_MEM) 3 */ 4 5 /* BPF program */ 6 static struct bpf_insn pc[] = { 7 BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de), 8 BPF_STMT(BPF_LDX+BPF_MEM, 0x8fffffff), 9 BPF_STMT(BPF_MISC+BPF_TXA, 0), 10 BPF_STMT(BPF_RET+BPF_A, 0), 11 }; 12 13 /* Packet */ 14 static u_char pkt[] = { 15 0x00, 16 }; 17 18 /* Packet length seen on wire */ 19 static u_int wirelen = sizeof(pkt); 20 21 /* Packet length passed on buffer */ 22 static u_int buflen = sizeof(pkt); 23 24 /* Invalid instruction */ 25 static int invalid = 1; 26 27 /* Expected return value */ 28 static u_int expect = 0xdeadc0de; 29 30 /* Expected signal */ 31 #ifdef __amd64__ 32 static int expect_signal = SIGBUS; 33 #else 34 static int expect_signal = SIGSEGV; 35 #endif 36