Commit 4f0fdb46 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

compiler: add ASSIGN_TYPED and ASSIGN_MEMBER

Looks like it's the most appropriate place for those hooks.
Didn't know about those helpers - maybe I should have used
them in my code more widely instead of casts.
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent e1d7ff8f
......@@ -54,9 +54,6 @@ typedef struct {
typedef struct user_pt_regs user_regs_struct_t;
#define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0)
#define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
#define REG_RES(regs) ((u64)(regs).regs[0])
#define REG_IP(regs) ((u64)(regs).pc)
#define REG_SYSCALL_NR(regs) ((u64)(regs).regs[8])
......
......@@ -89,9 +89,6 @@ struct user_vfp_exc {
unsigned long fpinst2;
};
#define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0)
#define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
#define REG_RES(regs) ((regs).ARM_r0)
#define REG_IP(regs) ((regs).ARM_pc)
#define REG_SYSCALL_NR(regs) ((regs).ARM_r7)
......
......@@ -72,9 +72,6 @@ typedef UserPpc64RegsEntry UserRegsEntry;
#define CORE_ENTRY__MARCH CORE_ENTRY__MARCH__PPC64
#define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0)
#define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
#define REG_RES(regs) ((u64)(regs).gpr[3])
#define REG_IP(regs) ((u64)(regs).nip)
#define REG_SYSCALL_NR(regs) ((u64)(regs).gpr[0])
......
......@@ -105,9 +105,6 @@ typedef struct {
u32 padding[24];
} user_fpregs_struct_t;
#define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0)
#define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
#ifdef CONFIG_X86_64
# define TASK_SIZE ((1UL << 47) - PAGE_SIZE)
#else
......
......@@ -10,6 +10,9 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
#define ASSIGN_TYPED(a, b) do { (a) = (typeof(a))(b); } while (0)
#define ASSIGN_MEMBER(a, b, m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0)
#define __stringify_1(x...) #x
#define __stringify(x...) __stringify_1(x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment