void-packages/srcpkgs/criu/patches/ppc64-musl.patch
2019-12-17 21:10:54 +01:00

148 lines
4.5 KiB
Diff

Get rid of some header conflicts and glibc specific things.
--- compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h
+++ compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h
@@ -1,6 +1,8 @@
#ifndef UAPI_COMPEL_ASM_TYPES_H__
#define UAPI_COMPEL_ASM_TYPES_H__
+#include <asm/types.h>
+#include <asm/elf.h>
#include <stdbool.h>
#include <signal.h>
#include <stdint.h>
@@ -55,8 +57,8 @@ typedef struct {
#define MSR_TM_ACTIVE(x) ((((x) & MSR_TM) && ((x)&(MSR_TMA|MSR_TMS))) != 0)
typedef struct {
- uint64_t fpregs[NFPREG];
- __vector128 vrregs[NVRREG];
+ uint64_t fpregs[ELF_NFPREG];
+ __vector128 vrregs[ELF_NVRREG];
uint64_t vsxregs[NVSXREG];
int flags;
@@ -66,8 +68,8 @@ typedef struct {
uint64_t tfhar, texasr, tfiar;
} tm_spr_regs;
user_regs_struct_t regs;
- uint64_t fpregs[NFPREG];
- __vector128 vrregs[NVRREG];
+ uint64_t fpregs[ELF_NFPREG];
+ __vector128 vrregs[ELF_NVRREG];
uint64_t vsxregs[NVSXREG];
} tm;
} user_fpregs_struct_t;
--- compel/arch/ppc64/src/lib/infect.c
+++ compel/arch/ppc64/src/lib/infect.c
@@ -1,7 +1,6 @@
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/uio.h>
-#include <sys/user.h>
#include <sys/mman.h>
#include <stdint.h>
#include <errno.h>
@@ -57,15 +56,15 @@ static void put_fpu_regs(mcontext_t *mc, uint64_t *fpregs)
{
uint64_t *mcfp = (uint64_t *)mc->fp_regs;
- memcpy(mcfp, fpregs, sizeof(*fpregs) * NFPREG);
+ memcpy(mcfp, fpregs, sizeof(*fpregs) * ELF_NFPREG);
}
static void put_altivec_regs(mcontext_t *mc, __vector128 *vrregs)
{
vrregset_t *v_regs = (vrregset_t *)(((unsigned long)mc->vmx_reserve + 15) & ~0xful);
- memcpy(&v_regs->vrregs[0][0], vrregs, sizeof(uint64_t) * 2 * (NVRREG - 1));
- v_regs->vrsave = *((uint32_t *)&vrregs[NVRREG - 1]);
+ memcpy(&v_regs->vrregs[0][0], vrregs, sizeof(uint64_t) * 2 * (ELF_NVRREG - 1));
+ v_regs->vrsave = *((uint32_t *)&vrregs[ELF_NVRREG - 1]);
mc->v_regs = v_regs;
}
--- criu/arch/ppc64/crtools.c
+++ criu/arch/ppc64/crtools.c
@@ -1,7 +1,6 @@
#include <string.h>
#include <unistd.h>
#include <elf.h>
-#include <sys/user.h>
#include <asm/unistd.h>
#include <sys/uio.h>
@@ -33,7 +32,7 @@ static UserPpc64FpstateEntry *copy_fp_regs(uint64_t *fpregs)
return NULL;
user_ppc64_fpstate_entry__init(fpe);
- fpe->n_fpregs = NFPREG;
+ fpe->n_fpregs = ELF_NFPREG;
fpe->fpregs = xmalloc(fpe->n_fpregs * sizeof(fpe->fpregs[0]));
if (!fpe->fpregs) {
xfree(fpe);
@@ -41,7 +40,7 @@ static UserPpc64FpstateEntry *copy_fp_regs(uint64_t *fpregs)
}
/* FPSRC is the last (33th) register in the set */
- for (i = 0; i < NFPREG; i++)
+ for (i = 0; i < ELF_NFPREG; i++)
fpe->fpregs[i] = fpregs[i];
return fpe;
@@ -69,7 +68,7 @@ static UserPpc64VrstateEntry *copy_altivec_regs(__vector128 *vrregs)
user_ppc64_vrstate_entry__init(vse);
/* protocol buffer store only 64bit entries and we need 128bit */
- vse->n_vrregs = (NVRREG-1) * 2;
+ vse->n_vrregs = (ELF_NVRREG-1) * 2;
vse->vrregs = xmalloc(vse->n_vrregs * sizeof(vse->vrregs[0]));
if (!vse->vrregs) {
xfree(vse);
@@ -77,13 +76,13 @@ static UserPpc64VrstateEntry *copy_altivec_regs(__vector128 *vrregs)
}
/* Vectors are 2*64bits entries */
- for (i = 0; i < (NVRREG-1); i++) {
+ for (i = 0; i < (ELF_NVRREG-1); i++) {
p64 = (uint64_t*) &vrregs[i];
vse->vrregs[i*2] = p64[0];
vse->vrregs[i*2 + 1] = p64[1];
}
- p32 = (uint32_t*) &vrregs[NVRREG-1];
+ p32 = (uint32_t*) &vrregs[ELF_NVRREG-1];
vse->vrsave = *p32;
return vse;
@@ -95,7 +94,7 @@ static int put_altivec_regs(mcontext_t *mc, UserPpc64VrstateEntry *vse)
pr_debug("Restoring Altivec registers\n");
- if (vse->n_vrregs != (NVRREG-1)*2) {
+ if (vse->n_vrregs != (ELF_NVRREG-1)*2) {
pr_err("Corrupted Altivec dump data\n");
return -1;
}
@@ -104,7 +103,7 @@ static int put_altivec_regs(mcontext_t *mc, UserPpc64VrstateEntry *vse)
* this is not a big deal to do that in all cases.
*/
memcpy(&v_regs->vrregs[0][0], vse->vrregs,
- sizeof(uint64_t) * 2 * (NVRREG-1));
+ sizeof(uint64_t) * 2 * (ELF_NVRREG-1));
/* vscr has been restored with the previous memcpy which copied 32
* 128bits registers + a 128bits field containing the vscr value in
* the low part.
--- include/common/arch/ppc64/asm/cmpxchg.h
+++ include/common/arch/ppc64/asm/cmpxchg.h
@@ -1,6 +1,10 @@
#ifndef __CR_CMPXCHG_H__
#define __CR_CMPXCHG_H__
+#ifndef __always_inline
+#define __always_inline __inline __attribute__ ((__always_inline__))
+#endif
+
/*
* Copied from kernel header file arch/powerpc/include/asm/cmpxchg.h
*/