summary refs log tree commit diff stats
path: root/include/qemu/queue.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2017-11-02 15:19:14 +0100
committerRichard Henderson <richard.henderson@linaro.org>2017-12-29 12:43:39 -0800
commit15fa08f8451babc88d733bd411d4c94976f9d0f8 (patch)
tree2db297c71e5e7a9f9ae5cff3d37bb98d2b724898 /include/qemu/queue.h
parentf764718d0cb30af9f1f8e1d6a33622cc05ca4155 (diff)
downloadfocaccia-qemu-15fa08f8451babc88d733bd411d4c94976f9d0f8.tar.gz
focaccia-qemu-15fa08f8451babc88d733bd411d4c94976f9d0f8.zip
tcg: Dynamically allocate TCGOps
With no fixed array allocation, we can't overflow a buffer.
This will be important as optimizations related to host vectors
may expand the number of ops used.

Use QTAILQ to link the ops together.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/qemu/queue.h')
-rw-r--r--include/qemu/queue.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index 35292c3155..aa270d2b38 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -425,6 +425,11 @@ struct {                                                                \
                 (var);                                                  \
                 (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
 
+#define QTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev_var) \
+        for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+             (var) && ((prev_var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)), 1); \
+             (var) = (prev_var))
+
 /*
  * Tail queue access methods.
  */