Module Name:    src
Committed By:   uwe
Date:           Sat Feb 11 11:34:49 UTC 2023

Modified Files:
        src/share/man/man4: bpf.4

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/share/man/man4/bpf.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/bpf.4
diff -u src/share/man/man4/bpf.4:1.68 src/share/man/man4/bpf.4:1.69
--- src/share/man/man4/bpf.4:1.68	Sat Feb 11 11:02:31 2023
+++ src/share/man/man4/bpf.4	Sat Feb 11 11:34:49 2023
@@ -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 @@ or byte
 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 @@ Note that the addressing modes are more 
 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 @@ a hack for efficiently loading the IP he
 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 @@ For binary operations, a source mode is 
 .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 @@ opcode uses the 32 bit
 .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 @@ The return value is either a constant
 .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 @@ fit into the above classes, and for any 
 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 @@ that copy the index register to the accu
 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

Reply via email to