* updated firefox (133.0.3 -> 134.0.2)
[t2sde.git] / package / emulators / qemu / restore-ppc64abi32.patch
blobbdc2f405e22d6c80ea1ce36f874a7c5fe924266b
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/qemu/restore-ppc64abi32.patch
3 # Copyright (C) 2024 The T2 SDE Project
4 #
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7 #
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 --- /dev/null
15 +++ a/configs/targets/ppc64abi32-linux-user.mak
16 @@ -0,0 +1,8 @@
17 +TARGET_ARCH=ppc64
18 +TARGET_ABI32=y
19 +TARGET_BASE_ARCH=ppc
20 +TARGET_ABI_DIR=ppc
21 +TARGET_SYSTBL_ABI=common,nospu,32
22 +TARGET_SYSTBL=syscall.tbl
23 +TARGET_BIG_ENDIAN=y
24 +TARGET_XML_FILES= gdb-xml/power64-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml gdb-xml/power-vsx.xml
25 --- b/linux-user/elfload.c
26 +++ a/linux-user/elfload.c
27 @@ -718,7 +718,7 @@
28 #define ELF_MACHINE PPC_ELF_MACHINE
29 #define ELF_START_MMAP 0x80000000
31 +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
32 -#if defined(TARGET_PPC64)
34 #define elf_check_arch(x) ( (x) == EM_PPC64 )
36 @@ -870,7 +870,7 @@
37 static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop)
39 _regs->gpr[1] = infop->start_stack;
40 +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
41 -#if defined(TARGET_PPC64)
42 if (get_ppc64_abi(infop) < 2) {
43 uint64_t val;
44 get_user_u64(val, infop->entry + 8);
45 --- b/linux-user/ppc/signal.c
46 +++ a/linux-user/ppc/signal.c
47 @@ -490,8 +490,10 @@
48 int i, err = 0;
49 #if defined(TARGET_PPC64)
50 struct target_sigcontext *sc = 0;
51 +#if !defined(TARGET_ABI32)
52 struct image_info *image = get_task_state(thread_cpu)->info;
53 #endif
54 +#endif
56 rt_sf_addr = get_sigframe(ka, env, sizeof(*rt_sf));
57 if (!lock_user_struct(VERIFY_WRITE, rt_sf, rt_sf_addr, 1))
58 @@ -528,7 +530,7 @@
59 env->gpr[5] = (target_ulong) h2g(&rt_sf->uc);
60 env->gpr[6] = (target_ulong) h2g(rt_sf);
62 +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
63 -#if defined(TARGET_PPC64)
64 if (get_ppc64_abi(image) < 2) {
65 /* ELFv1 PPC64 function pointers are pointers to OPD entries. */
66 struct target_func_ptr *handler =
67 @@ -560,7 +562,7 @@
71 +#if !defined(TARGET_PPC64) || defined(TARGET_ABI32)
72 -#if !defined(TARGET_PPC64)
73 long do_sigreturn(CPUPPCState *env)
75 struct target_sigcontext *sc = NULL;
76 @@ -573,9 +575,12 @@
77 if (!lock_user_struct(VERIFY_READ, sc, sc_addr, 1))
78 goto sigsegv;
80 +#if defined(TARGET_PPC64)
81 + set.sig[0] = sc->oldmask + ((uint64_t)(sc->_unused[3]) << 32);
82 +#else
83 __get_user(set.sig[0], &sc->oldmask);
84 __get_user(set.sig[1], &sc->_unused[3]);
85 +#endif
87 target_to_host_sigset_internal(&blocked, &set);
88 set_sigmask(&blocked);
90 --- a/linux-user/ppc/target_syscall.h.vanilla
91 +++ b/linux-user/ppc/target_syscall.h
92 @@ -36,7 +36,7 @@
93 abi_ulong link;
94 abi_ulong xer;
95 abi_ulong ccr;
96 -#if defined(TARGET_PPC64)
97 +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
98 abi_ulong softe;
99 #else
100 abi_ulong mq; /* 601 only (not used at present) */
101 @@ -58,7 +58,7 @@
102 * flags masks
105 -#if defined(TARGET_PPC64)
106 +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
107 #if TARGET_BIG_ENDIAN
108 #define UNAME_MACHINE "ppc64"
109 #else
110 --- a/linux-user/syscall_defs.h
111 +++ b/linux-user/syscall_defs.h
112 @@ -1445,7 +1445,7 @@
113 struct target_stat {
114 abi_ulong st_dev;
115 abi_ulong st_ino;
116 -#if defined(TARGET_PPC64)
117 +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
118 abi_ulong st_nlink;
119 abi_uint st_mode;
120 #else
121 @@ -1466,12 +1466,12 @@
122 abi_ulong target_st_ctime_nsec;
123 abi_ulong __unused4;
124 abi_ulong __unused5;
125 -#if defined(TARGET_PPC64)
126 +#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
127 abi_ulong __unused6;
128 #endif
131 -#if !defined(TARGET_PPC64)
132 +#if !defined(TARGET_PPC64) || defined(TARGET_ABI32)
133 #define TARGET_HAS_STRUCT_STAT64
134 struct QEMU_PACKED target_stat64 {
135 abi_ullong st_dev;
137 --- qemu-8.2.2/linux-user/ppc/signal.c.vanilla 2024-03-21 16:29:38.321042834 +0100
138 +++ qemu-8.2.2/linux-user/ppc/signal.c 2024-03-21 16:33:39.347030693 +0100
139 @@ -66,6 +66,7 @@
140 #endif
143 +#if !defined(TARGET_ABI32)
144 QEMU_BUILD_BUG_ON(offsetof(struct target_mcontext, mc_fregs)
145 != offsetof_mcontext_fregs);
146 #if defined(TARGET_PPC64)
147 @@ -75,6 +76,7 @@
148 QEMU_BUILD_BUG_ON(offsetof(struct target_mcontext, mc_vregs)
149 != offsetof_mcontext_vregs);
150 #endif
151 +#endif
153 /* See arch/powerpc/include/asm/sigcontext.h. */
154 struct target_sigcontext {
155 @@ -192,9 +194,11 @@
156 char abigap[288];
157 } __attribute__((aligned(16)));
159 +#if !defined(TARGET_ABI32)
160 QEMU_BUILD_BUG_ON(offsetof(struct target_rt_sigframe,
161 uc.tuc_sigcontext.mcontext)
162 != offsetof_rt_sigframe_mcontext);
163 +#endif
165 #else
167 --- a/linux-user/ppc/meson.build.vanilla 2024-03-21 17:05:39.796933958 +0100
168 +++ b/linux-user/ppc/meson.build 2024-03-21 17:05:21.739934868 +0100
169 @@ -14,4 +14,4 @@
170 extra_args: ['-r', '__kernel_sigtramp_rt64'])
171 vdso_64le_inc = gen_vdso.process('vdso-64le.so',
172 extra_args: ['-r', '__kernel_sigtramp_rt64'])
173 -linux_user_ss.add(when: 'TARGET_PPC64', if_true: [vdso_64_inc, vdso_64le_inc])
174 +linux_user_ss.add(when: 'TARGET_PPC64', if_true: [vdso_32_inc, vdso_64_inc, vdso_64le_inc])
175 --- qemu-8.2.2/linux-user/elfload.c.vanilla 2024-03-21 16:39:22.546013406 +0100
176 +++ qemu-8.2.2/linux-user/elfload.c 2024-03-21 16:40:30.175009999 +0100
177 @@ -1194,7 +1194,7 @@
178 #define USE_ELF_CORE_DUMP
179 #define ELF_EXEC_PAGESIZE 4096
181 -#ifndef TARGET_PPC64
182 +#if !defined(TARGET_PPC64) || defined(TARGET_ABI32)
183 # define VDSO_HEADER "vdso-32.c.inc"
184 #elif TARGET_BIG_ENDIAN
185 # define VDSO_HEADER "vdso-64.c.inc"