mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
tests/tcg: unify ppc64 and ppc64le Makefiles
Make tests/tcg/ppc64le include tests/tcg/ppc64 instead of duplicating the rules. Because the ppc64le vpath includes tests/tcg/ppc64 but not vice versa, the tests have to be moved from tests/tcg/ppc64le/ to tests/tcg/ppc64. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220929114231.583801-23-alex.bennee@linaro.org>
This commit is contained in:
parent
6ffe81370a
commit
37b0dba45c
9 changed files with 1 additions and 26 deletions
42
tests/tcg/ppc64/signal_save_restore_xer.c
Normal file
42
tests/tcg/ppc64/signal_save_restore_xer.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <signal.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#define XER_SO (1 << 31)
|
||||
#define XER_OV (1 << 30)
|
||||
#define XER_CA (1 << 29)
|
||||
#define XER_OV32 (1 << 19)
|
||||
#define XER_CA32 (1 << 18)
|
||||
|
||||
uint64_t saved;
|
||||
|
||||
void sigtrap_handler(int sig, siginfo_t *si, void *ucontext)
|
||||
{
|
||||
ucontext_t *uc = ucontext;
|
||||
uc->uc_mcontext.regs->nip += 4;
|
||||
saved = uc->uc_mcontext.regs->xer;
|
||||
uc->uc_mcontext.regs->xer |= XER_OV | XER_OV32;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
uint64_t initial = XER_CA | XER_CA32, restored;
|
||||
struct sigaction sa = {
|
||||
.sa_sigaction = sigtrap_handler,
|
||||
.sa_flags = SA_SIGINFO
|
||||
};
|
||||
|
||||
sigaction(SIGTRAP, &sa, NULL);
|
||||
|
||||
asm("mtspr 1, %1\n\t"
|
||||
"trap\n\t"
|
||||
"mfspr %0, 1\n\t"
|
||||
: "=r" (restored)
|
||||
: "r" (initial));
|
||||
|
||||
assert(saved == initial);
|
||||
assert(restored == (XER_OV | XER_OV32 | XER_CA | XER_CA32));
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue