Fix: alignment problems on targets not supporting unaligned access.
authorFredrik Markström <fredrik.markstrom@gmail.com>
Fri, 16 May 2014 01:10:07 +0000 (09:10 +0800)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 28 May 2014 13:38:49 +0000 (09:38 -0400)
Accessing floats, doubles and 64 bit int at unaligned addresses is not
supported on all configurations of arm processors and if it is it's
emulated and slow. This patch replaces direct assignments with memcpy.

Signed-off-by: Fredrik Markström <fredrik.markstrom@gmail.com>
Signed-off-by: Roy Li <rongqing.li@windriver.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c

index 762d60464cc257e97c642bc7eb38c307e914937b..8c6dc96ff236520de23ea0efa7ee7b37f1c20784 100644 (file)
@@ -222,7 +222,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node)
                if (!insn)
                        return -ENOMEM;
                insn->op = FILTER_OP_LOAD_S64;
-               *(int64_t *) insn->data = node->u.load.u.num;
+               memcpy(insn->data, &node->u.load.u.num, sizeof(int64_t));
                ret = bytecode_push(&ctx->bytecode, insn, 1, insn_len);
                free(insn);
                return ret;
@@ -237,7 +237,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node)
                if (!insn)
                        return -ENOMEM;
                insn->op = FILTER_OP_LOAD_DOUBLE;
-               *(double *) insn->data = node->u.load.u.flt;
+               memcpy(insn->data, &node->u.load.u.flt, sizeof(double));
                ret = bytecode_push(&ctx->bytecode, insn, 1, insn_len);
                free(insn);
                return ret;
This page took 0.02594 seconds and 4 git commands to generate.