Commit 0005e55a authored by Russell King's avatar Russell King

ARM: net: bpf: correct stack layout documentation

The stack layout documentation incorrectly suggests that the BPF JIT
scratch space starts immediately below BPF_FP. This is not correct,
so let's fix the documentation to reflect reality.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent 70ec3a6c
...@@ -28,24 +28,43 @@ ...@@ -28,24 +28,43 @@
int bpf_jit_enable __read_mostly; int bpf_jit_enable __read_mostly;
/* /*
* eBPF prog stack layout * eBPF prog stack layout:
* *
* high * high
* original ARM_SP => +-----+ eBPF prologue * original ARM_SP => +-----+
* |FP/LR| * | | callee saved registers
* current ARM_FP => +-----+ * +-----+ <= (BPF_FP + SCRATCH_SIZE)
* | ... | callee saved registers
* eBPF fp register => +-----+ <= (BPF_FP)
* | ... | eBPF JIT scratch space * | ... | eBPF JIT scratch space
* | | eBPF prog stack * eBPF fp register => +-----+
* (BPF_FP) | ... | eBPF prog stack
* +-----+ * +-----+
* |RSVD | JIT scratchpad * |RSVD | JIT scratchpad
* current ARM_SP => +-----+ <= (BPF_FP - STACK_SIZE) * current ARM_SP => +-----+ <= (BPF_FP - STACK_SIZE + SCRATCH_SIZE)
* | | * | |
* | ... | Function call stack * | ... | Function call stack
* | | * | |
* +-----+ * +-----+
* low * low
*
* The callee saved registers depends on whether frame pointers are enabled.
* With frame pointers (to be compliant with the ABI):
*
* high
* original ARM_SP => +------------------+ \
* | pc | |
* current ARM_FP => +------------------+ } callee saved registers
* |r4-r8,r10,fp,ip,lr| |
* +------------------+ /
* low
*
* Without frame pointers:
*
* high
* original ARM_SP => +------------------+
* | lr | (optional)
* | r4-r8,r10 | callee saved registers
* +------------------+
* low
*/ */
#define STACK_OFFSET(k) (k) #define STACK_OFFSET(k) (k)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment