Lines Matching refs:r

438 static void bpf_dump_curr(struct bpf_regs *r, struct sock_filter *f)  in bpf_dump_curr()  argument
442 rl_printf("pc: [%u]\n", r->Pc); in bpf_dump_curr()
446 bpf_disasm(*f, r->Pc); in bpf_dump_curr()
450 bpf_disasm(*(f + f->jt + 1), r->Pc + f->jt + 1); in bpf_dump_curr()
452 bpf_disasm(*(f + f->jf + 1), r->Pc + f->jf + 1); in bpf_dump_curr()
455 rl_printf("A: [%#08x][%u]\n", r->A, r->A); in bpf_dump_curr()
456 rl_printf("X: [%#08x][%u]\n", r->X, r->X); in bpf_dump_curr()
457 if (r->Rs) in bpf_dump_curr()
458 rl_printf("ret: [%#08x][%u]!\n", r->R, r->R); in bpf_dump_curr()
461 if (r->M[i]) { in bpf_dump_curr()
463 rl_printf("M[%d]: [%#08x][%u]\n", i, r->M[i], r->M[i]); in bpf_dump_curr()
605 uint32_t r; in extract_u32() local
607 memcpy(&r, &pkt[off], sizeof(r)); in extract_u32()
609 return ntohl(r); in extract_u32()
614 uint16_t r; in extract_u16() local
616 memcpy(&r, &pkt[off], sizeof(r)); in extract_u16()
618 return ntohs(r); in extract_u16()
626 static void set_return(struct bpf_regs *r) in set_return() argument
628 r->R = 0; in set_return()
629 r->Rs = true; in set_return()
632 static void bpf_single_step(struct bpf_regs *r, struct sock_filter *f, in bpf_single_step() argument
641 r->R = K; in bpf_single_step()
642 r->Rs = true; in bpf_single_step()
645 r->R = r->A; in bpf_single_step()
646 r->Rs = true; in bpf_single_step()
649 r->R = r->X; in bpf_single_step()
650 r->Rs = true; in bpf_single_step()
653 r->X = r->A; in bpf_single_step()
656 r->A = r->X; in bpf_single_step()
659 r->M[K] = r->A; in bpf_single_step()
662 r->M[K] = r->X; in bpf_single_step()
667 r->A = extract_u32(pkt, K); in bpf_single_step()
669 set_return(r); in bpf_single_step()
674 r->A = extract_u16(pkt, K); in bpf_single_step()
676 set_return(r); in bpf_single_step()
681 r->A = extract_u8(pkt, K); in bpf_single_step()
683 set_return(r); in bpf_single_step()
686 d = pkt_caplen - (r->X + K); in bpf_single_step()
688 r->A = extract_u32(pkt, r->X + K); in bpf_single_step()
691 d = pkt_caplen - (r->X + K); in bpf_single_step()
693 r->A = extract_u16(pkt, r->X + K); in bpf_single_step()
695 set_return(r); in bpf_single_step()
698 d = pkt_caplen - (r->X + K); in bpf_single_step()
700 r->A = extract_u8(pkt, r->X + K); in bpf_single_step()
702 set_return(r); in bpf_single_step()
707 r->X = extract_u8(pkt, K); in bpf_single_step()
708 r->X = (r->X & 0xf) << 2; in bpf_single_step()
710 set_return(r); in bpf_single_step()
713 r->A = pkt_len; in bpf_single_step()
716 r->A = pkt_len; in bpf_single_step()
719 r->A = K; in bpf_single_step()
722 r->X = K; in bpf_single_step()
725 r->A = r->M[K]; in bpf_single_step()
728 r->X = r->M[K]; in bpf_single_step()
731 r->Pc += K; in bpf_single_step()
734 r->Pc += r->A > r->X ? f->jt : f->jf; in bpf_single_step()
737 r->Pc += r->A > K ? f->jt : f->jf; in bpf_single_step()
740 r->Pc += r->A >= r->X ? f->jt : f->jf; in bpf_single_step()
743 r->Pc += r->A >= K ? f->jt : f->jf; in bpf_single_step()
746 r->Pc += r->A == r->X ? f->jt : f->jf; in bpf_single_step()
749 r->Pc += r->A == K ? f->jt : f->jf; in bpf_single_step()
752 r->Pc += r->A & r->X ? f->jt : f->jf; in bpf_single_step()
755 r->Pc += r->A & K ? f->jt : f->jf; in bpf_single_step()
758 r->A = -r->A; in bpf_single_step()
761 r->A <<= r->X; in bpf_single_step()
764 r->A <<= K; in bpf_single_step()
767 r->A >>= r->X; in bpf_single_step()
770 r->A >>= K; in bpf_single_step()
773 r->A += r->X; in bpf_single_step()
776 r->A += K; in bpf_single_step()
779 r->A -= r->X; in bpf_single_step()
782 r->A -= K; in bpf_single_step()
785 r->A *= r->X; in bpf_single_step()
788 r->A *= K; in bpf_single_step()
792 if (r->X == 0) { in bpf_single_step()
793 set_return(r); in bpf_single_step()
800 set_return(r); in bpf_single_step()
806 r->A /= r->X; in bpf_single_step()
809 r->A /= K; in bpf_single_step()
812 r->A %= r->X; in bpf_single_step()
815 r->A %= K; in bpf_single_step()
820 r->A &= r->X; in bpf_single_step()
823 r->A &= K; in bpf_single_step()
826 r->A |= r->X; in bpf_single_step()
829 r->A |= K; in bpf_single_step()
832 r->A ^= r->X; in bpf_single_step()
835 r->A ^= K; in bpf_single_step()
854 static bool bpf_handle_breakpoint(struct bpf_regs *r, struct sock_filter *f, in bpf_handle_breakpoint() argument
859 bpf_dump_curr(r, &f[r->Pc]); in bpf_handle_breakpoint()