David S. Miller | 2809a2087 | 2012-04-15 20:06:27 -0700 | [diff] [blame] | 1 | #ifndef _BPF_JIT_H |
| 2 | #define _BPF_JIT_H |
| 3 | |
| 4 | /* Conventions: |
| 5 | * %g1 : temporary |
| 6 | * %g2 : Secondary temporary used by SKB data helper stubs. |
| 7 | * %o0 : pointer to skb (first argument given to JIT function) |
| 8 | * %o1 : BPF A accumulator |
| 9 | * %o2 : BPF X accumulator |
| 10 | * %o3 : Holds saved %o7 so we can call helper functions without needing |
| 11 | * to allocate a register window. |
| 12 | * %o4 : skb->data |
| 13 | * %o5 : skb->len - skb->data_len |
| 14 | */ |
| 15 | |
| 16 | #ifndef __ASSEMBLER__ |
| 17 | #define G0 0x00 |
| 18 | #define G1 0x01 |
| 19 | #define G3 0x03 |
| 20 | #define G6 0x06 |
| 21 | #define O0 0x08 |
| 22 | #define O1 0x09 |
| 23 | #define O2 0x0a |
| 24 | #define O3 0x0b |
| 25 | #define O4 0x0c |
| 26 | #define O5 0x0d |
| 27 | #define SP 0x0e |
| 28 | #define O7 0x0f |
| 29 | #define FP 0x1e |
| 30 | |
| 31 | #define r_SKB O0 |
| 32 | #define r_A O1 |
| 33 | #define r_X O2 |
| 34 | #define r_saved_O7 O3 |
| 35 | #define r_HEADLEN O4 |
| 36 | #define r_SKB_DATA O5 |
| 37 | #define r_TMP G1 |
| 38 | #define r_TMP2 G2 |
| 39 | #define r_OFF G3 |
| 40 | #else |
| 41 | #define r_SKB %o0 |
| 42 | #define r_A %o1 |
| 43 | #define r_X %o2 |
| 44 | #define r_saved_O7 %o3 |
| 45 | #define r_HEADLEN %o4 |
| 46 | #define r_SKB_DATA %o5 |
| 47 | #define r_TMP %g1 |
| 48 | #define r_TMP2 %g2 |
| 49 | #define r_OFF %g3 |
| 50 | #endif |
| 51 | |
| 52 | #endif /* _BPF_JIT_H */ |