test0076.h revision 256281
1168515Sgshapiro/*-
2168515Sgshapiro * Test 0076:	Check boundary conditions (BPF_LDX+BPF_MEM)
3168515Sgshapiro *
4168515Sgshapiro * $FreeBSD: stable/10/tools/regression/bpf/bpf_filter/tests/test0076.h 199604 2009-11-20 18:53:38Z jkim $
5168515Sgshapiro */
6168515Sgshapiro
7168515Sgshapiro/* BPF program */
8168515Sgshapirostruct bpf_insn pc[] = {
9168515Sgshapiro	BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de),
10168515Sgshapiro	BPF_STMT(BPF_LDX+BPF_MEM, 0x8fffffff),
11168515Sgshapiro	BPF_STMT(BPF_MISC+BPF_TXA, 0),
12168515Sgshapiro	BPF_STMT(BPF_RET+BPF_A, 0),
13168515Sgshapiro};
14168515Sgshapiro
15168515Sgshapiro/* Packet */
16168515Sgshapirou_char	pkt[] = {
17168515Sgshapiro	0x00,
18168515Sgshapiro};
19
20/* Packet length seen on wire */
21u_int	wirelen =	sizeof(pkt);
22
23/* Packet length passed on buffer */
24u_int	buflen =	sizeof(pkt);
25
26/* Invalid instruction */
27int	invalid =	1;
28
29/* Expected return value */
30u_int	expect =	0xdeadc0de;
31
32/* Expected signal */
33#ifdef __amd64__
34int	expect_signal =	SIGBUS;
35#else
36int	expect_signal =	SIGSEGV;
37#endif
38