-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce temporary string space for string manipulation functions
String functions that have a string as return value need to store that string in a temporary location so it can be used in following code. We need at most 4 temporary strings to support nesting string functions in an expression. Functions must request a temporary string slot and have it associated with their return value using a statement like: dt_cg_tstring_alloc(pcb, dnp); The address of the string location should be obtained using: BPF_LOAD(BPF_DW, dnp->dn_reg, BPF_REG_FP, DT_STK_DCTX) BPF_LOAD(BPF_DW, dnp->dn_reg, dnp->dn_reg, DCTX_MEM) BPF_ALU64_IMM(BPF_ADD, dnp->dn_reg, dnp->dn_tstring->dn_value) Functions that may be receiving a temporary string as argument (which is any function or action that accept string arguments) must free the temporary string once it is no longer needed. This should be done using code like: if (dnp->dn_tstring) dt_cg_tstring_free(pcb, dnp); In order to support the use of temporary strings for arbitrary use (not associated with a specific node), the following two functions are provided as well: offset = dt_cg_tstring_xalloc(pcb); dt_cg_tstring_xfree(pcb, offset); Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
- Loading branch information
Showing
5 changed files
with
153 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters