linux-user pull request 20210708
Code and style cleanup Add ppid in self/stat ELF_HWCAP for RISC-V -----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmDmzmMSHGxhdXJlbnRA dml2aWVyLmV1AAoJEPMMOL0/L748qXoQAIwHGBAh02KDxXqJg/BHNVnH0b0gcD3H HVqAvZTI86NrijRVK8UItekanqvO0AxXSWs0kVQe4gF8vlyViZRlsyhteyHs4Cpf +VsRqxMv8h05mUI+8Odxfsrwo/XlpKcPoe4NV1qgdn4LnWY+3g9j9/Rbvg1MtSwt QHA4oUfpoFoXwK/k81YJlDPzY86lisfW30tyZLbpq3keSfelzZ6r8zUgxj8hOfOw E6U7/UrPa77r1gi/Gx4QdRKPn+9jfVxPjLVObkomC4mkWK3ieR2XAXStEni8veSp 88OcImLjiZ2DeD5vUqF0J261tYh+/lobcfBw0xjyzF+nkAvHJmt9YcD2nFCj6BzF OfcSG1ebWvpvJBGVopNP7VcxaL7bJTEr+FxlpJP9YsnVvCEnJUZiZjcjmIs6I2Tj jCOppjyetFu82b0RDs7IxwwVCypeZpNkcEJQpLeSXWgFQrqsJ0M6HVGyO68hTZUX ris3K6/CXbmZD/9XgZs+8hqmOfIDZBL6xejFZgCU+GTK+RE9Y2/Uq0kxy38cc7N7 3epskyv5IPBTxEXoaaCNvLEI2qx+RFsPJ+9Ei5/ZbjDE3/7lgW/FAC2JAAmer1eQ KuY/GhNgYDGM+Kluk41GNsKnEyFMXHhWc52cjKl0i+9Ni7r95qzTifd7QkUNX12M b0LiF6emY5gV =wCA4 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.1-pull-request' into staging linux-user pull request 20210708 Code and style cleanup Add ppid in self/stat ELF_HWCAP for RISC-V # gpg: Signature made Thu 08 Jul 2021 11:07:31 BST # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-6.1-pull-request: linux-user/syscall: Remove hardcoded tabs (code style) linux-user/alpha: Remove hardcoded tabs (code style) linux-user/mips: Handle TARGET_EWOULDBLOCK as TARGET_EAGAIN linux-user/hppa: Handle TARGET_EWOULDBLOCK as TARGET_EAGAIN linux-user/alpha: Handle TARGET_EWOULDBLOCK as TARGET_EAGAIN linux-user: Fix style problems in linuxload.c linux-user: fill ppid field in /proc/self/stat linux-user/elfload: Implement ELF_HWCAP for RISC-V Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
9db3065c62
@ -44,6 +44,8 @@ struct target_pt_regs {
|
||||
#define UNAME_MACHINE "alpha"
|
||||
#define UNAME_MINIMUM_RELEASE "2.6.32"
|
||||
|
||||
#undef TARGET_EWOULDBLOCK
|
||||
#define TARGET_EWOULDBLOCK TARGET_EAGAIN /* Operation would block */
|
||||
#undef TARGET_EDEADLK
|
||||
#define TARGET_EDEADLK 11
|
||||
#undef TARGET_EAGAIN
|
||||
@ -110,7 +112,7 @@ struct target_pt_regs {
|
||||
#define TARGET_EHOSTUNREACH 65
|
||||
#undef TARGET_ENOTEMPTY
|
||||
#define TARGET_ENOTEMPTY 66
|
||||
// Unused 67
|
||||
/* Unused 67 */
|
||||
#undef TARGET_EUSERS
|
||||
#define TARGET_EUSERS 68
|
||||
#undef TARGET_EDQUOT
|
||||
@ -119,12 +121,12 @@ struct target_pt_regs {
|
||||
#define TARGET_ESTALE 70
|
||||
#undef TARGET_EREMOTE
|
||||
#define TARGET_EREMOTE 71
|
||||
// Unused 72-76
|
||||
/* Unused 72-76 */
|
||||
#undef TARGET_ENOLCK
|
||||
#define TARGET_ENOLCK 77
|
||||
#undef TARGET_ENOSYS
|
||||
#define TARGET_ENOSYS 78
|
||||
// Unused 79
|
||||
/* Unused 79 */
|
||||
#undef TARGET_ENOMSG
|
||||
#define TARGET_ENOMSG 80
|
||||
#undef TARGET_EIDRM
|
||||
@ -171,7 +173,7 @@ struct target_pt_regs {
|
||||
#define TARGET_EBADRQC 101
|
||||
#undef TARGET_EBADSLT
|
||||
#define TARGET_EBADSLT 102
|
||||
// Unused 103
|
||||
/* Unused 103 */
|
||||
#undef TARGET_EBFONT
|
||||
#define TARGET_EBFONT 104
|
||||
#undef TARGET_ENONET
|
||||
@ -198,9 +200,7 @@ struct target_pt_regs {
|
||||
#define TARGET_EREMCHG 115
|
||||
#undef TARGET_EILSEQ
|
||||
#define TARGET_EILSEQ 116
|
||||
|
||||
// Same as default 117-121
|
||||
|
||||
/* Same as default 117-121 */
|
||||
#undef TARGET_ELIBACC
|
||||
#define TARGET_ELIBACC 122
|
||||
#undef TARGET_ELIBBAD
|
||||
|
@ -1434,6 +1434,19 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
|
||||
#define ELF_CLASS ELFCLASS64
|
||||
#endif
|
||||
|
||||
#define ELF_HWCAP get_elf_hwcap()
|
||||
|
||||
static uint32_t get_elf_hwcap(void)
|
||||
{
|
||||
#define MISA_BIT(EXT) (1 << (EXT - 'A'))
|
||||
RISCVCPU *cpu = RISCV_CPU(thread_cpu);
|
||||
uint32_t mask = MISA_BIT('I') | MISA_BIT('M') | MISA_BIT('A')
|
||||
| MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C');
|
||||
|
||||
return cpu->env.misa & mask;
|
||||
#undef MISA_BIT
|
||||
}
|
||||
|
||||
static inline void init_thread(struct target_pt_regs *regs,
|
||||
struct image_info *infop)
|
||||
{
|
||||
|
@ -27,6 +27,8 @@ struct target_pt_regs {
|
||||
#define TARGET_MCL_FUTURE 2
|
||||
#define TARGET_MCL_ONFAULT 4
|
||||
|
||||
#undef TARGET_EWOULDBLOCK
|
||||
#define TARGET_EWOULDBLOCK TARGET_EAGAIN /* Operation would block */
|
||||
#undef TARGET_ENOMSG
|
||||
#define TARGET_ENOMSG 35
|
||||
#undef TARGET_EIDRM
|
||||
|
@ -1,20 +1,19 @@
|
||||
/* Code for loading Linux executables. Mostly linux kernel code. */
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
||||
#include "qemu.h"
|
||||
|
||||
#define NGROUPS 32
|
||||
|
||||
/* ??? This should really be somewhere else. */
|
||||
abi_long memcpy_to_target(abi_ulong dest, const void *src,
|
||||
unsigned long len)
|
||||
abi_long memcpy_to_target(abi_ulong dest, const void *src, unsigned long len)
|
||||
{
|
||||
void *host_ptr;
|
||||
|
||||
host_ptr = lock_user(VERIFY_WRITE, dest, len, 0);
|
||||
if (!host_ptr)
|
||||
if (!host_ptr) {
|
||||
return -TARGET_EFAULT;
|
||||
}
|
||||
memcpy(host_ptr, src, len);
|
||||
unlock_user(host_ptr, dest, 1);
|
||||
return 0;
|
||||
@ -27,8 +26,7 @@ static int count(char ** vec)
|
||||
for (i = 0; *vec; i++) {
|
||||
vec++;
|
||||
}
|
||||
|
||||
return(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
static int prepare_binprm(struct linux_binprm *bprm)
|
||||
@ -38,15 +36,15 @@ static int prepare_binprm(struct linux_binprm *bprm)
|
||||
int retval;
|
||||
|
||||
if (fstat(bprm->fd, &st) < 0) {
|
||||
return(-errno);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
mode = st.st_mode;
|
||||
if (!S_ISREG(mode)) { /* Must be regular file */
|
||||
return(-EACCES);
|
||||
return -EACCES;
|
||||
}
|
||||
if (!(mode & 0111)) { /* Must have at least one execute bit set */
|
||||
return(-EACCES);
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
bprm->e_uid = geteuid();
|
||||
@ -163,5 +161,5 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
||||
return retval;
|
||||
}
|
||||
|
||||
return(retval);
|
||||
return retval;
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ struct target_pt_regs {
|
||||
};
|
||||
|
||||
/* Target errno definitions taken from asm-mips/errno.h */
|
||||
#undef TARGET_EWOULDBLOCK
|
||||
#define TARGET_EWOULDBLOCK TARGET_EAGAIN /* Operation would block */
|
||||
#undef TARGET_ENOMSG
|
||||
#define TARGET_ENOMSG 35 /* Identifier removed */
|
||||
#undef TARGET_EIDRM
|
||||
|
@ -18,6 +18,8 @@ struct target_pt_regs {
|
||||
};
|
||||
|
||||
/* Target errno definitions taken from asm-mips/errno.h */
|
||||
#undef TARGET_EWOULDBLOCK
|
||||
#define TARGET_EWOULDBLOCK TARGET_EAGAIN /* Operation would block */
|
||||
#undef TARGET_ENOMSG
|
||||
#define TARGET_ENOMSG 35 /* Identifier removed */
|
||||
#undef TARGET_EIDRM
|
||||
|
@ -7956,6 +7956,9 @@ static int open_self_stat(void *cpu_env, int fd)
|
||||
gchar *bin = g_strrstr(ts->bprm->argv[0], "/");
|
||||
bin = bin ? bin + 1 : ts->bprm->argv[0];
|
||||
g_string_printf(buf, "(%.15s) ", bin);
|
||||
} else if (i == 3) {
|
||||
/* ppid */
|
||||
g_string_printf(buf, FMT_pid " ", getppid());
|
||||
} else if (i == 27) {
|
||||
/* stack bottom */
|
||||
g_string_printf(buf, TARGET_ABI_FMT_ld " ", ts->info->start_stack);
|
||||
|
Loading…
x
Reference in New Issue
Block a user