ISA: "code pointer"/"address" clarity
I have a slide about the following question at the end of the ISA presentation
at IETF later today, so putting it on the list in case there are any comments before
the meeting.
The jump instruction section defines CALL with src_reg = 0 as "call helper function by address", with
Quoted 1 line
Historically, each helper function was identified by an address encoded in
the
Quoted 1 line
imm field. The available helper functions may differ for each program
type,
Quoted 1 line
but address values are unique across all program types.
First, this text is slightly confusing since imm is only 32-bits whereas the document
never states the size of a memory pointers in the BPF VM. One interpretation is
that ALL pointers are 32-bits, and another interpretation is that the pointer size
is up to the runtime, but one can only use the CALL instruction with larger pointers
if the upper bits are zero so that all non-zero bits fit in imm. It would be helpful to
clarify either way.
The 64-bit immediate instructions section then says:
Quoted 2 lines
src_regpseudocode imm type dst type0x4dst =code_addr(imm)integer code pointer
The use of "code pointer" rather than "code address" in the table above to some readers may beg the question of whether a "code pointer" and an "address" as used with the CALL instruction are the same or different.
It then goes on to say:
Quoted 1 line
code_addr(imm)gets the address of the instruction at a specified relative
offset
Quoted 1 line
in number of (64-bit) instructions
Which uses "address of the instruction", and that sounds synonymous with "code pointer" so the reader wonders why the same term isn't used.
Is there a better way to clarify in the text what the intent is, either by using the
same term in the table ("code address"?) or by distinguishing the definitions
if they are different concepts?
I know in Linux the "address" of a helper function is internally implemented as an index, but that could just be an implementation detail not worth mentioning in the standard.
Although detailed discussion may be in a different document (e.g., the "[PS] cross-platform helper functions" document mentioned in the charter, or an ABI document) I'm wondering if there's some trivial wording Improvement that should be made in the ISA draft.
Dave