Skip to content

Commit

Permalink
Fix source format non-compliances.
Browse files Browse the repository at this point in the history
  • Loading branch information
AssadHashmi committed Mar 26, 2024
1 parent 026b04e commit 2de41c7
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 78 deletions.
17 changes: 9 additions & 8 deletions core/ir/opnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,21 +346,22 @@ extern reg_id_t dr_reg_stolen;
#endif

#ifdef AARCH64
#if !defined(DR_HOST_NOT_TARGET) && !defined(STANDALONE_DECODER) && !defined(BUILD_TESTS)
# define OPSZ_SVE_VL_BYTES opnd_size_from_bytes(proc_get_vector_length_bytes())
# define OPSZ_SVE_PL_BYTES opnd_size_from_bytes(proc_get_vector_length_bytes() / 8)
#else
# if !defined(DR_HOST_NOT_TARGET) && !defined(STANDALONE_DECODER) && \
!defined(BUILD_TESTS)
# define OPSZ_SVE_VL_BYTES opnd_size_from_bytes(proc_get_vector_length_bytes())
# define OPSZ_SVE_PL_BYTES opnd_size_from_bytes(proc_get_vector_length_bytes() / 8)
# else
/* SVE vector length for off-line decoder set using -vl option with drdisas,
* e.g.
* $ drdisas -vl 256 e58057a1 85865e6b
* e58057a1 str %z1 -> +0x05(%x29)[32byte]
* 85865e6b ldr +0x37(%x19)[32byte] -> %z11
* $
*/
# define OPSZ_SVE_VL_BYTES opnd_size_from_bytes(dr_get_sve_vector_length() / 8)
# define OPSZ_SVE_PL_BYTES opnd_size_from_bytes((dr_get_sve_vector_length() / 8) / 8)
#endif
# define OPSZ_SVE_VL_BYTES opnd_size_from_bytes(dr_get_sve_vector_length() / 8)
# define OPSZ_SVE_PL_BYTES \
opnd_size_from_bytes((dr_get_sve_vector_length() / 8) / 8)
# endif
#endif /*AARCH64*/


#endif /* _OPND_H_ */
111 changes: 49 additions & 62 deletions core/unix/include/sigcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ struct extra_context {
__u32 __reserved[3]; /* 12 bytes */
};

# define ESR_MAGIC 0x45535201
# define ESR_MAGIC 0x45535201

struct esr_context {
struct _aarch64_ctx head;
Expand All @@ -434,88 +434,75 @@ struct esr_context {
# endif

/* SVE helper macros. */
#define __SVE_VQ_BYTES 16 /* number of bytes per quadword */
# define __SVE_VQ_BYTES 16 /* number of bytes per quadword */

#define __SVE_VQ_MIN 1
#define __SVE_VQ_MAX 512
# define __SVE_VQ_MIN 1
# define __SVE_VQ_MAX 512

#define __SVE_VL_MIN (__SVE_VQ_MIN * __SVE_VQ_BYTES)
#define __SVE_VL_MAX (__SVE_VQ_MAX * __SVE_VQ_BYTES)
# define __SVE_VL_MIN (__SVE_VQ_MIN * __SVE_VQ_BYTES)
# define __SVE_VL_MAX (__SVE_VQ_MAX * __SVE_VQ_BYTES)

#define __SVE_NUM_ZREGS 32
#define __SVE_NUM_PREGS 16
# define __SVE_NUM_ZREGS 32
# define __SVE_NUM_PREGS 16

#define __sve_vl_valid(vl) \
((vl) % __SVE_VQ_BYTES == 0 && \
(vl) >= __SVE_VL_MIN && \
(vl) <= __SVE_VL_MAX)
# define __sve_vl_valid(vl) \
((vl) % __SVE_VQ_BYTES == 0 && (vl) >= __SVE_VL_MIN && (vl) <= __SVE_VL_MAX)

#define __sve_vq_from_vl(vl) ((vl) / __SVE_VQ_BYTES)
#define __sve_vl_from_vq(vq) ((vq) * __SVE_VQ_BYTES)
# define __sve_vq_from_vl(vl) ((vl) / __SVE_VQ_BYTES)
# define __sve_vl_from_vq(vq) ((vq)*__SVE_VQ_BYTES)

#define __SVE_ZREG_SIZE(vq) ((__u32)(vq) * __SVE_VQ_BYTES)
#define __SVE_PREG_SIZE(vq) ((__u32)(vq) * (__SVE_VQ_BYTES / 8))
#define __SVE_FFR_SIZE(vq) __SVE_PREG_SIZE(vq)
# define __SVE_ZREG_SIZE(vq) ((__u32)(vq)*__SVE_VQ_BYTES)
# define __SVE_PREG_SIZE(vq) ((__u32)(vq) * (__SVE_VQ_BYTES / 8))
# define __SVE_FFR_SIZE(vq) __SVE_PREG_SIZE(vq)

#define __SVE_ZREGS_OFFSET 0
#define __SVE_ZREG_OFFSET(vq, n) \
(__SVE_ZREGS_OFFSET + __SVE_ZREG_SIZE(vq) * (n))
#define __SVE_ZREGS_SIZE(vq) \
(__SVE_ZREG_OFFSET(vq, __SVE_NUM_ZREGS) - __SVE_ZREGS_OFFSET)
# define __SVE_ZREGS_OFFSET 0
# define __SVE_ZREG_OFFSET(vq, n) (__SVE_ZREGS_OFFSET + __SVE_ZREG_SIZE(vq) * (n))
# define __SVE_ZREGS_SIZE(vq) \
(__SVE_ZREG_OFFSET(vq, __SVE_NUM_ZREGS) - __SVE_ZREGS_OFFSET)

#define __SVE_PREGS_OFFSET(vq) \
(__SVE_ZREGS_OFFSET + __SVE_ZREGS_SIZE(vq))
#define __SVE_PREG_OFFSET(vq, n) \
(__SVE_PREGS_OFFSET(vq) + __SVE_PREG_SIZE(vq) * (n))
#define __SVE_PREGS_SIZE(vq) \
(__SVE_PREG_OFFSET(vq, __SVE_NUM_PREGS) - __SVE_PREGS_OFFSET(vq))
# define __SVE_PREGS_OFFSET(vq) (__SVE_ZREGS_OFFSET + __SVE_ZREGS_SIZE(vq))
# define __SVE_PREG_OFFSET(vq, n) (__SVE_PREGS_OFFSET(vq) + __SVE_PREG_SIZE(vq) * (n))
# define __SVE_PREGS_SIZE(vq) \
(__SVE_PREG_OFFSET(vq, __SVE_NUM_PREGS) - __SVE_PREGS_OFFSET(vq))

#define __SVE_FFR_OFFSET(vq) \
(__SVE_PREGS_OFFSET(vq) + __SVE_PREGS_SIZE(vq))
# define __SVE_FFR_OFFSET(vq) (__SVE_PREGS_OFFSET(vq) + __SVE_PREGS_SIZE(vq))

#define SVE_VQ_BYTES __SVE_VQ_BYTES /* bytes per quadword */
# define SVE_VQ_BYTES __SVE_VQ_BYTES /* bytes per quadword */

#define SVE_VQ_MIN __SVE_VQ_MIN
#define SVE_VQ_MAX __SVE_VQ_MAX
# define SVE_VQ_MIN __SVE_VQ_MIN
# define SVE_VQ_MAX __SVE_VQ_MAX

#define SVE_VL_MIN __SVE_VL_MIN
#define SVE_VL_MAX __SVE_VL_MAX
# define SVE_VL_MIN __SVE_VL_MIN
# define SVE_VL_MAX __SVE_VL_MAX

#define SVE_NUM_ZREGS __SVE_NUM_ZREGS
#define SVE_NUM_PREGS __SVE_NUM_PREGS
# define SVE_NUM_ZREGS __SVE_NUM_ZREGS
# define SVE_NUM_PREGS __SVE_NUM_PREGS

#define sve_vl_valid(vl) __sve_vl_valid(vl)
#define sve_vq_from_vl(vl) __sve_vq_from_vl(vl)
#define sve_vl_from_vq(vq) __sve_vl_from_vq(vq)
# define sve_vl_valid(vl) __sve_vl_valid(vl)
# define sve_vq_from_vl(vl) __sve_vq_from_vl(vl)
# define sve_vl_from_vq(vq) __sve_vl_from_vq(vq)

#define SVE_SIG_ZREG_SIZE(vq) __SVE_ZREG_SIZE(vq)
#define SVE_SIG_PREG_SIZE(vq) __SVE_PREG_SIZE(vq)
#define SVE_SIG_FFR_SIZE(vq) __SVE_FFR_SIZE(vq)
# define SVE_SIG_ZREG_SIZE(vq) __SVE_ZREG_SIZE(vq)
# define SVE_SIG_PREG_SIZE(vq) __SVE_PREG_SIZE(vq)
# define SVE_SIG_FFR_SIZE(vq) __SVE_FFR_SIZE(vq)

#define SVE_SIG_REGS_OFFSET \
((sizeof(struct sve_context) + (__SVE_VQ_BYTES - 1)) \
/ __SVE_VQ_BYTES * __SVE_VQ_BYTES)
# define SVE_SIG_REGS_OFFSET \
((sizeof(struct sve_context) + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * \
__SVE_VQ_BYTES)

#define SVE_SIG_ZREGS_OFFSET \
(SVE_SIG_REGS_OFFSET + __SVE_ZREGS_OFFSET)
#define SVE_SIG_ZREG_OFFSET(vq, n) \
(SVE_SIG_REGS_OFFSET + __SVE_ZREG_OFFSET(vq, n))
#define SVE_SIG_ZREGS_SIZE(vq) __SVE_ZREGS_SIZE(vq)
# define SVE_SIG_ZREGS_OFFSET (SVE_SIG_REGS_OFFSET + __SVE_ZREGS_OFFSET)
# define SVE_SIG_ZREG_OFFSET(vq, n) (SVE_SIG_REGS_OFFSET + __SVE_ZREG_OFFSET(vq, n))
# define SVE_SIG_ZREGS_SIZE(vq) __SVE_ZREGS_SIZE(vq)

#define SVE_SIG_PREGS_OFFSET(vq) \
(SVE_SIG_REGS_OFFSET + __SVE_PREGS_OFFSET(vq))
#define SVE_SIG_PREG_OFFSET(vq, n) \
(SVE_SIG_REGS_OFFSET + __SVE_PREG_OFFSET(vq, n))
#define SVE_SIG_PREGS_SIZE(vq) __SVE_PREGS_SIZE(vq)
# define SVE_SIG_PREGS_OFFSET(vq) (SVE_SIG_REGS_OFFSET + __SVE_PREGS_OFFSET(vq))
# define SVE_SIG_PREG_OFFSET(vq, n) (SVE_SIG_REGS_OFFSET + __SVE_PREG_OFFSET(vq, n))
# define SVE_SIG_PREGS_SIZE(vq) __SVE_PREGS_SIZE(vq)

#define SVE_SIG_FFR_OFFSET(vq) \
(SVE_SIG_REGS_OFFSET + __SVE_FFR_OFFSET(vq))
# define SVE_SIG_FFR_OFFSET(vq) (SVE_SIG_REGS_OFFSET + __SVE_FFR_OFFSET(vq))

#define SVE_SIG_REGS_SIZE(vq) \
(__SVE_FFR_OFFSET(vq) + __SVE_FFR_SIZE(vq))
# define SVE_SIG_REGS_SIZE(vq) (__SVE_FFR_OFFSET(vq) + __SVE_FFR_SIZE(vq))

#define SVE_SIG_CONTEXT_SIZE(vq) \
(SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
# define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))

#endif /* AARCH64 */

Expand Down
12 changes: 7 additions & 5 deletions core/unix/signal_linux_aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ typedef union {
void
dump_sigcontext(dcontext_t *dcontext, sigcontext_t *sc)
{
#ifdef DR_HOST_NOT_TARGET
# ifdef DR_HOST_NOT_TARGET
ASSERT_NOT_REACHED();
#endif
# endif
LOG(THREAD, LOG_ASYNCH, 1, "\tSignal context:\n");
int i;
for (i = 0; i <= DR_REG_X30 - DR_REG_X0; i++)
Expand Down Expand Up @@ -125,7 +125,8 @@ dump_sigcontext(dcontext_t *dcontext, sigcontext_t *sc)
for (i = 0; i < MCXT_NUM_SIMD_SVE_SLOTS; i++) {
LOG(THREAD, LOG_ASYNCH, 2, "\tz%-2d 0x", i);
for (boff = ((vq * 2) - 1); boff >= 0; boff--) {
vdw = *((uint64 *)((((byte *)sve) + (SVE_SIG_ZREG_OFFSET(vq, i)) + (boff * 8))));
vdw = *((uint64 *)((((byte *)sve) + (SVE_SIG_ZREG_OFFSET(vq, i)) +
(boff * 8))));
LOG(THREAD, LOG_ASYNCH, 2, "%016lx ", vdw);
}
LOG(THREAD, LOG_ASYNCH, 2, "\n");
Expand All @@ -141,8 +142,9 @@ dump_sigcontext(dcontext_t *dcontext, sigcontext_t *sc)
break;
}
default:
SYSLOG_INTERNAL_WARNING("%s %d Unknown section found in signal context with magic number 0x%x",
__func__, __LINE__, next_head->magic);
SYSLOG_INTERNAL_WARNING("%s %d Unknown section found in signal context "
"with magic number 0x%x",
__func__, __LINE__, next_head->magic);
break;
}
offset += next_head->size;
Expand Down
6 changes: 3 additions & 3 deletions suite/tests/tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,7 @@ dump_ucontext(ucontext_t *ucxt, bool is_sve, int vl_bytes)
assert(head->magic == FPSIMD_MAGIC);
assert(head->size == sizeof(struct fpsimd_context));

struct fpsimd_context *fpsimd =
(struct fpsimd_context *)(ucxt->uc_mcontext.RESERVED);
struct fpsimd_context *fpsimd = (struct fpsimd_context *)(ucxt->uc_mcontext.RESERVED);
print("\nfpsr 0x%x\n", fpsimd->fpsr);
print("fpcr 0x%x\n", fpsimd->fpcr);
reinterpret128_2x64_t vreg;
Expand Down Expand Up @@ -542,7 +541,8 @@ dump_ucontext(ucontext_t *ucxt, bool is_sve, int vl_bytes)
for (i = 0; i < MCXT_NUM_SIMD_SVE_SLOTS; i++) {
print("z%-2d 0x", i);
for (boff = ((vq * 2) - 1); boff >= 0; boff--) {
vdw = *((uint64 *)((((byte *)sve) + (SVE_SIG_ZREG_OFFSET(vq, i)) + (boff * 8))));
vdw = *((uint64 *)((((byte *)sve) + (SVE_SIG_ZREG_OFFSET(vq, i)) +
(boff * 8))));
print("%016lx ", vdw);
}
print("\n");
Expand Down

0 comments on commit 2de41c7

Please sign in to comment.