Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/man/man4 bpf(4): make all instruction tables align



details:   https://anonhg.NetBSD.org/src/rev/07673798ae88
branches:  trunk
changeset: 373455:07673798ae88
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sat Feb 11 11:34:49 2023 +0000

description:
bpf(4): make all instruction tables align

Define string max-insn and use it in all tables for the width of the
first column (nroff has variables, shocking, I know).  Define only the
width of the first column, the last column gets all the remaining width.

diffstat:

 share/man/man4/bpf.4 |  23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diffs (92 lines):

diff -r 7ecdbc1f65c3 -r 07673798ae88 share/man/man4/bpf.4
--- a/share/man/man4/bpf.4      Sat Feb 11 11:02:31 2023 +0000
+++ b/share/man/man4/bpf.4      Sat Feb 11 11:34:49 2023 +0000
@@ -1,6 +1,6 @@
 .\" -*- nroff -*-
 .\"
-.\"    $NetBSD: bpf.4,v 1.68 2023/02/11 11:02:31 uwe Exp $
+.\"    $NetBSD: bpf.4,v 1.69 2023/02/11 11:34:49 uwe Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1992, 1993, 1994
 .\"    The Regents of the University of California.  All rights reserved.
@@ -601,7 +601,10 @@
 Arithmetic overflow when calculating a variable offset terminates
 the filter program and the packet is ignored.
 The semantics of all the recognized BPF_LD instructions follow.
-.Bl -column "BPF_LD_BPF_W_BPF_ABS" "A \[<-] P[k:4]" -offset indent
+.\" to make all instruction tables align nicely, use common max width
+.ds max-insn .Sy BPF_LDX+BPF_W+BPF_WWW
+.\"
+.Bl -column "\*[max-insn]" -offset indent
 .It Sy BPF_LD+BPF_W+BPF_ABS Ta A \[<-] P[k:4]
 .It Sy BPF_LD+BPF_H+BPF_ABS Ta A \[<-] P[k:2]
 .It Sy BPF_LD+BPF_B+BPF_ABS Ta A \[<-] P[k:1]
@@ -618,7 +621,7 @@
 the accumulator loads, but they include
 .Sy BPF_MSH ,
 a hack for efficiently loading the IP header length.
-.Bl -column "BPF_LDX_BPF_W_BPF_MEM" "X \[<-] k" -offset indent
+.Bl -column "\*[max-insn]" -offset indent
 .It Sy BPF_LDX+BPF_W+BPF_IMM Ta X \[<-] k
 .It Sy BPF_LDX+BPF_W+BPF_MEM Ta X \[<-] M[k]
 .It Sy BPF_LDX+BPF_W+BPF_LEN Ta X \[<-] len
@@ -628,12 +631,12 @@
 This instruction stores the accumulator into the scratch memory.
 We do not need an addressing mode since there is only one possibility
 for the destination.
-.Bl -column "BPF_ST" "M[k] \[<-] A" -offset indent
+.Bl -column "\*[max-insn]" -offset indent
 .It Sy BPF_ST Ta M[k] \[<-] A
 .El
 .It Sy BPF_STX
 This instruction stores the index register in the scratch memory store.
-.Bl -column "BPF_STX" "M[k] \[<-] X" -offset indent
+.Bl -column "\*[max-insn]" -offset indent
 .It Sy BPF_STX Ta M[k] \[<-] X
 .El
 .It Sy BPF_ALU
@@ -643,7 +646,7 @@
 .Sy ( BPF_K
 or
 .Sy BPF_X ) .
-.Bl -column "BPF_ALU_BPF_ADD_BPF_K" "A \[<-] A + k" -offset indent
+.Bl -column "\*[max-insn]" -offset indent
 .It Sy BPF_ALU+BPF_ADD+BPF_K Ta A \[<-] A + k
 .It Sy BPF_ALU+BPF_SUB+BPF_K Ta A \[<-] A - k
 .It Sy BPF_ALU+BPF_MUL+BPF_K Ta A \[<-] A * k
@@ -677,7 +680,7 @@
 .Va k
 field as the offset, allowing arbitrarily distant destinations.
 All conditionals use unsigned comparison conventions.
-.Bl -column "BPF_JMP+BPF_JSET+BPF_K" "pc += (A \*[Ge] k) ? jt : jf" -offset indent
+.Bl -column "\*[max-insn]" -offset indent
 .It Sy BPF_JMP+BPF_JA Ta pc += k
 .It Sy BPF_JMP+BPF_JGT+BPF_K Ta "pc += (A > k) ? jt : jf"
 .It Sy BPF_JMP+BPF_JGE+BPF_K Ta "pc += (A \*[Ge] k) ? jt : jf"
@@ -696,7 +699,7 @@
 .Sy ( BPF_K )
 or the accumulator
 .Sy ( BPF_A ) .
-.Bl -column "BPF_RET+BPF_A" "accept A bytes" -offset indent
+.Bl -column "\*[max-insn]" -offset indent
 .It Sy BPF_RET+BPF_A Ta accept A bytes
 .It Sy BPF_RET+BPF_K Ta accept k bytes
 .El
@@ -706,7 +709,7 @@
 be added.
 Currently, these are the register transfer instructions
 that copy the index register to the accumulator or vice versa.
-.Bl -column "BPF_MISC+BPF_TAX" "X \[<-] A" -offset indent
+.Bl -column "\*[max-insn]" -offset indent
 .It Sy BPF_MISC+BPF_TAX Ta X \[<-] A
 .It Sy BPF_MISC+BPF_TXA Ta A \[<-] X
 .El
@@ -714,7 +717,7 @@
 Also, two instructions to call a "coprocessor" if initialized by the kernel
 component.
 There is no coprocessor by default.
-.Bl -column "BPF_MISC+BPF_COPX" "A \[<-] funcs[X](...)" -offset indent
+.Bl -column "\*[max-insn]" -offset indent
 .It Sy BPF_MISC+BPF_COP Ta A \[<-] funcs[k](..)
 .It Sy BPF_MISC+BPF_COPX Ta A \[<-] funcs[X](..)
 .El



Home | Main Index | Thread Index | Old Index