mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
tcg: Add in_code_gen_buffer
Create a function to determine if a pointer is within the buffer. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
8b5c2b6260
commit
4846cd37df
2 changed files with 19 additions and 18 deletions
|
@ -680,6 +680,17 @@ extern __thread TCGContext *tcg_ctx;
|
|||
extern void *tcg_code_gen_epilogue;
|
||||
extern TCGv_env cpu_env;
|
||||
|
||||
static inline bool in_code_gen_buffer(const void *p)
|
||||
{
|
||||
const TCGContext *s = &tcg_init_ctx;
|
||||
/*
|
||||
* Much like it is valid to have a pointer to the byte past the
|
||||
* end of an array (so long as you don't dereference it), allow
|
||||
* a pointer to the byte past the end of the code gen buffer.
|
||||
*/
|
||||
return (size_t)(p - s->code_gen_buffer) <= s->code_gen_buffer_size;
|
||||
}
|
||||
|
||||
static inline size_t temp_idx(TCGTemp *ts)
|
||||
{
|
||||
ptrdiff_t n = ts - tcg_ctx->temps;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue