aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-06-16 18:26:21 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-06-16 18:26:21 +0100
commitaf44da87e926ff64260b95f4350d338c4fc113ca (patch)
tree303a18d80e73641bb6e23218ac7b7df0666bcc6b /linux-user
parentf27701510cdce9f76cdad0aaf9fb0bbcb23d299a (diff)
parent9dbae97723e964692364fb43012c6fa5448a661f (diff)
Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging
Patch queue for ppc - 2014-06-16 This pull request brings a lot of fun things. Among others we have - e500: u-boot firmware support - sPAPR: magic page enablement - sPAPR: add "compat" CPU option to support older guests - sPAPR: refactorings in preparation for VFIO - POWER8 live migration - mac99: expose bus frequency - little endian core dump, gdb and disas support - new ppc64le-linux-user target - DFP emulation - bug fixes # gpg: Signature made Mon 16 Jun 2014 12:28:32 BST using RSA key ID 03FEDC60 # gpg: Can't check signature: public key not found * remotes/agraf/tags/signed-ppc-for-upstream: (156 commits) spapr_pci: Advertise MSI quota PPC: KVM: Make pv hcall endian agnostic powerpc: use float64 for frsqrte spapr: Add kvm-type property spapr: Create SPAPRMachine struct linux-user: Tell guest about big host page sizes spapr_hcall: Add address-translation-mode-on-interrupt resource in H_SET_MODE spapr_hcall: Split h_set_mode() target-ppc: Enable DABRX SPR and limit it to <=POWER7 target-ppc: Enable PPR and VRSAVE SPRs migration target-ppc: Add POWER8's Event Based Branch (EBB) control SPRs KVM: target-ppc: Enable TM state migration target-ppc: Add POWER8's TM SPRs target-ppc: Add POWER8's MMCR2/MMCRS SPRs target-ppc: Enable FSCR facility check for TAR target-ppc: Add POWER8's FSCR SPR target-ppc: Add POWER8's TIR SPR target-ppc: Refactor class init for POWER7/8 target-ppc: Switch POWER7/8 classes to use correct PMU SPRs target-ppc: Make use of gen_spr_power5p_lpar() for POWER7/8 ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/elfload.c26
-rw-r--r--linux-user/main.c10
-rw-r--r--linux-user/ppc/syscall.h4
3 files changed, 32 insertions, 8 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 68b9793649..c123244ecd 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -784,12 +784,18 @@ static uint32_t get_elf_hwcap(void)
NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
} while (0)
+static inline uint32_t get_ppc64_abi(struct image_info *infop);
+
static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop)
{
_regs->gpr[1] = infop->start_stack;
#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
- _regs->gpr[2] = ldq_raw(infop->entry + 8) + infop->load_bias;
- infop->entry = ldq_raw(infop->entry) + infop->load_bias;
+ if (get_ppc64_abi(infop) < 2) {
+ _regs->gpr[2] = ldq_raw(infop->entry + 8) + infop->load_bias;
+ infop->entry = ldq_raw(infop->entry) + infop->load_bias;
+ } else {
+ _regs->gpr[12] = infop->entry; /* r12 set to global entry address */
+ }
#endif
_regs->nip = infop->entry;
}
@@ -1159,6 +1165,13 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
#include "elf.h"
+#ifdef TARGET_PPC
+static inline uint32_t get_ppc64_abi(struct image_info *infop)
+{
+ return infop->elf_flags & EF_PPC64_ABI;
+}
+#endif
+
struct exec
{
unsigned int a_info; /* Use macros N_MAGIC, etc for access */
@@ -1412,10 +1425,11 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong last_bss, int prot)
perror("cannot mmap brk");
exit(-1);
}
+ }
- /* Since we didn't use target_mmap, make sure to record
- the validity of the pages with qemu. */
- page_set_flags(elf_bss & TARGET_PAGE_MASK, last_bss, prot|PAGE_VALID);
+ /* Ensure that the bss page(s) are valid */
+ if ((page_get_flags(last_bss-1) & prot) != prot) {
+ page_set_flags(elf_bss & TARGET_PAGE_MASK, last_bss, prot | PAGE_VALID);
}
if (host_start < host_map_start) {
@@ -1538,7 +1552,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff));
NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr)));
NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum));
- NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE));
+ NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(MAX(TARGET_PAGE_SIZE, getpagesize())));
NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_info ? interp_info->load_addr : 0));
NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0);
NEW_AUX_ENT(AT_ENTRY, info->entry);
diff --git a/linux-user/main.c b/linux-user/main.c
index 3e21024056..a87c6f7ed4 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -1484,7 +1484,7 @@ static int do_store_exclusive(CPUPPCState *env)
{
target_ulong addr;
target_ulong page_addr;
- target_ulong val, val2 __attribute__((unused));
+ target_ulong val, val2 __attribute__((unused)) = 0;
int flags;
int segv = 0;
@@ -1497,7 +1497,7 @@ static int do_store_exclusive(CPUPPCState *env)
segv = 1;
} else {
int reg = env->reserve_info & 0x1f;
- int size = (env->reserve_info >> 5) & 0xf;
+ int size = env->reserve_info >> 5;
int stored = 0;
if (addr == env->reserve_addr) {
@@ -1527,6 +1527,12 @@ static int do_store_exclusive(CPUPPCState *env)
case 8: segv = put_user_u64(val, addr); break;
case 16: {
if (val2 == env->reserve_val2) {
+ if (msr_le) {
+ val2 = val;
+ val = env->gpr[reg+1];
+ } else {
+ val2 = env->gpr[reg+1];
+ }
segv = put_user_u64(val, addr);
if (!segv) {
segv = put_user_u64(val2, addr + 8);
diff --git a/linux-user/ppc/syscall.h b/linux-user/ppc/syscall.h
index 6514c637a5..db92bbee17 100644
--- a/linux-user/ppc/syscall.h
+++ b/linux-user/ppc/syscall.h
@@ -58,8 +58,12 @@ struct target_revectored_struct {
*/
#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
+#ifdef TARGET_WORDS_BIGENDIAN
#define UNAME_MACHINE "ppc64"
#else
+#define UNAME_MACHINE "ppc64le"
+#endif
+#else
#define UNAME_MACHINE "ppc"
#endif
#define UNAME_MINIMUM_RELEASE "2.6.32"