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,197 +44,197 @@ struct target_pt_regs {
|
|||||||
#define UNAME_MACHINE "alpha"
|
#define UNAME_MACHINE "alpha"
|
||||||
#define UNAME_MINIMUM_RELEASE "2.6.32"
|
#define UNAME_MINIMUM_RELEASE "2.6.32"
|
||||||
|
|
||||||
|
#undef TARGET_EWOULDBLOCK
|
||||||
|
#define TARGET_EWOULDBLOCK TARGET_EAGAIN /* Operation would block */
|
||||||
#undef TARGET_EDEADLK
|
#undef TARGET_EDEADLK
|
||||||
#define TARGET_EDEADLK 11
|
#define TARGET_EDEADLK 11
|
||||||
#undef TARGET_EAGAIN
|
#undef TARGET_EAGAIN
|
||||||
#define TARGET_EAGAIN 35
|
#define TARGET_EAGAIN 35
|
||||||
#undef TARGET_EINPROGRESS
|
#undef TARGET_EINPROGRESS
|
||||||
#define TARGET_EINPROGRESS 36
|
#define TARGET_EINPROGRESS 36
|
||||||
#undef TARGET_EALREADY
|
#undef TARGET_EALREADY
|
||||||
#define TARGET_EALREADY 37
|
#define TARGET_EALREADY 37
|
||||||
#undef TARGET_ENOTSOCK
|
#undef TARGET_ENOTSOCK
|
||||||
#define TARGET_ENOTSOCK 38
|
#define TARGET_ENOTSOCK 38
|
||||||
#undef TARGET_EDESTADDRREQ
|
#undef TARGET_EDESTADDRREQ
|
||||||
#define TARGET_EDESTADDRREQ 39
|
#define TARGET_EDESTADDRREQ 39
|
||||||
#undef TARGET_EMSGSIZE
|
#undef TARGET_EMSGSIZE
|
||||||
#define TARGET_EMSGSIZE 40
|
#define TARGET_EMSGSIZE 40
|
||||||
#undef TARGET_EPROTOTYPE
|
#undef TARGET_EPROTOTYPE
|
||||||
#define TARGET_EPROTOTYPE 41
|
#define TARGET_EPROTOTYPE 41
|
||||||
#undef TARGET_ENOPROTOOPT
|
#undef TARGET_ENOPROTOOPT
|
||||||
#define TARGET_ENOPROTOOPT 42
|
#define TARGET_ENOPROTOOPT 42
|
||||||
#undef TARGET_EPROTONOSUPPORT
|
#undef TARGET_EPROTONOSUPPORT
|
||||||
#define TARGET_EPROTONOSUPPORT 43
|
#define TARGET_EPROTONOSUPPORT 43
|
||||||
#undef TARGET_ESOCKTNOSUPPORT
|
#undef TARGET_ESOCKTNOSUPPORT
|
||||||
#define TARGET_ESOCKTNOSUPPORT 44
|
#define TARGET_ESOCKTNOSUPPORT 44
|
||||||
#undef TARGET_EOPNOTSUPP
|
#undef TARGET_EOPNOTSUPP
|
||||||
#define TARGET_EOPNOTSUPP 45
|
#define TARGET_EOPNOTSUPP 45
|
||||||
#undef TARGET_EPFNOSUPPORT
|
#undef TARGET_EPFNOSUPPORT
|
||||||
#define TARGET_EPFNOSUPPORT 46
|
#define TARGET_EPFNOSUPPORT 46
|
||||||
#undef TARGET_EAFNOSUPPORT
|
#undef TARGET_EAFNOSUPPORT
|
||||||
#define TARGET_EAFNOSUPPORT 47
|
#define TARGET_EAFNOSUPPORT 47
|
||||||
#undef TARGET_EADDRINUSE
|
#undef TARGET_EADDRINUSE
|
||||||
#define TARGET_EADDRINUSE 48
|
#define TARGET_EADDRINUSE 48
|
||||||
#undef TARGET_EADDRNOTAVAIL
|
#undef TARGET_EADDRNOTAVAIL
|
||||||
#define TARGET_EADDRNOTAVAIL 49
|
#define TARGET_EADDRNOTAVAIL 49
|
||||||
#undef TARGET_ENETDOWN
|
#undef TARGET_ENETDOWN
|
||||||
#define TARGET_ENETDOWN 50
|
#define TARGET_ENETDOWN 50
|
||||||
#undef TARGET_ENETUNREACH
|
#undef TARGET_ENETUNREACH
|
||||||
#define TARGET_ENETUNREACH 51
|
#define TARGET_ENETUNREACH 51
|
||||||
#undef TARGET_ENETRESET
|
#undef TARGET_ENETRESET
|
||||||
#define TARGET_ENETRESET 52
|
#define TARGET_ENETRESET 52
|
||||||
#undef TARGET_ECONNABORTED
|
#undef TARGET_ECONNABORTED
|
||||||
#define TARGET_ECONNABORTED 53
|
#define TARGET_ECONNABORTED 53
|
||||||
#undef TARGET_ECONNRESET
|
#undef TARGET_ECONNRESET
|
||||||
#define TARGET_ECONNRESET 54
|
#define TARGET_ECONNRESET 54
|
||||||
#undef TARGET_ENOBUFS
|
#undef TARGET_ENOBUFS
|
||||||
#define TARGET_ENOBUFS 55
|
#define TARGET_ENOBUFS 55
|
||||||
#undef TARGET_EISCONN
|
#undef TARGET_EISCONN
|
||||||
#define TARGET_EISCONN 56
|
#define TARGET_EISCONN 56
|
||||||
#undef TARGET_ENOTCONN
|
#undef TARGET_ENOTCONN
|
||||||
#define TARGET_ENOTCONN 57
|
#define TARGET_ENOTCONN 57
|
||||||
#undef TARGET_ESHUTDOWN
|
#undef TARGET_ESHUTDOWN
|
||||||
#define TARGET_ESHUTDOWN 58
|
#define TARGET_ESHUTDOWN 58
|
||||||
#undef TARGET_ETOOMANYREFS
|
#undef TARGET_ETOOMANYREFS
|
||||||
#define TARGET_ETOOMANYREFS 59
|
#define TARGET_ETOOMANYREFS 59
|
||||||
#undef TARGET_ETIMEDOUT
|
#undef TARGET_ETIMEDOUT
|
||||||
#define TARGET_ETIMEDOUT 60
|
#define TARGET_ETIMEDOUT 60
|
||||||
#undef TARGET_ECONNREFUSED
|
#undef TARGET_ECONNREFUSED
|
||||||
#define TARGET_ECONNREFUSED 61
|
#define TARGET_ECONNREFUSED 61
|
||||||
#undef TARGET_ELOOP
|
#undef TARGET_ELOOP
|
||||||
#define TARGET_ELOOP 62
|
#define TARGET_ELOOP 62
|
||||||
#undef TARGET_ENAMETOOLONG
|
#undef TARGET_ENAMETOOLONG
|
||||||
#define TARGET_ENAMETOOLONG 63
|
#define TARGET_ENAMETOOLONG 63
|
||||||
#undef TARGET_EHOSTDOWN
|
#undef TARGET_EHOSTDOWN
|
||||||
#define TARGET_EHOSTDOWN 64
|
#define TARGET_EHOSTDOWN 64
|
||||||
#undef TARGET_EHOSTUNREACH
|
#undef TARGET_EHOSTUNREACH
|
||||||
#define TARGET_EHOSTUNREACH 65
|
#define TARGET_EHOSTUNREACH 65
|
||||||
#undef TARGET_ENOTEMPTY
|
#undef TARGET_ENOTEMPTY
|
||||||
#define TARGET_ENOTEMPTY 66
|
#define TARGET_ENOTEMPTY 66
|
||||||
// Unused 67
|
/* Unused 67 */
|
||||||
#undef TARGET_EUSERS
|
#undef TARGET_EUSERS
|
||||||
#define TARGET_EUSERS 68
|
#define TARGET_EUSERS 68
|
||||||
#undef TARGET_EDQUOT
|
#undef TARGET_EDQUOT
|
||||||
#define TARGET_EDQUOT 69
|
#define TARGET_EDQUOT 69
|
||||||
#undef TARGET_ESTALE
|
#undef TARGET_ESTALE
|
||||||
#define TARGET_ESTALE 70
|
#define TARGET_ESTALE 70
|
||||||
#undef TARGET_EREMOTE
|
#undef TARGET_EREMOTE
|
||||||
#define TARGET_EREMOTE 71
|
#define TARGET_EREMOTE 71
|
||||||
// Unused 72-76
|
/* Unused 72-76 */
|
||||||
#undef TARGET_ENOLCK
|
#undef TARGET_ENOLCK
|
||||||
#define TARGET_ENOLCK 77
|
#define TARGET_ENOLCK 77
|
||||||
#undef TARGET_ENOSYS
|
#undef TARGET_ENOSYS
|
||||||
#define TARGET_ENOSYS 78
|
#define TARGET_ENOSYS 78
|
||||||
// Unused 79
|
/* Unused 79 */
|
||||||
#undef TARGET_ENOMSG
|
#undef TARGET_ENOMSG
|
||||||
#define TARGET_ENOMSG 80
|
#define TARGET_ENOMSG 80
|
||||||
#undef TARGET_EIDRM
|
#undef TARGET_EIDRM
|
||||||
#define TARGET_EIDRM 81
|
#define TARGET_EIDRM 81
|
||||||
#undef TARGET_ENOSR
|
#undef TARGET_ENOSR
|
||||||
#define TARGET_ENOSR 82
|
#define TARGET_ENOSR 82
|
||||||
#undef TARGET_ETIME
|
#undef TARGET_ETIME
|
||||||
#define TARGET_ETIME 83
|
#define TARGET_ETIME 83
|
||||||
#undef TARGET_EBADMSG
|
#undef TARGET_EBADMSG
|
||||||
#define TARGET_EBADMSG 84
|
#define TARGET_EBADMSG 84
|
||||||
#undef TARGET_EPROTO
|
#undef TARGET_EPROTO
|
||||||
#define TARGET_EPROTO 85
|
#define TARGET_EPROTO 85
|
||||||
#undef TARGET_ENODATA
|
#undef TARGET_ENODATA
|
||||||
#define TARGET_ENODATA 86
|
#define TARGET_ENODATA 86
|
||||||
#undef TARGET_ENOSTR
|
#undef TARGET_ENOSTR
|
||||||
#define TARGET_ENOSTR 87
|
#define TARGET_ENOSTR 87
|
||||||
#undef TARGET_ECHRNG
|
#undef TARGET_ECHRNG
|
||||||
#define TARGET_ECHRNG 88
|
#define TARGET_ECHRNG 88
|
||||||
#undef TARGET_EL2NSYNC
|
#undef TARGET_EL2NSYNC
|
||||||
#define TARGET_EL2NSYNC 89
|
#define TARGET_EL2NSYNC 89
|
||||||
#undef TARGET_EL3HLT
|
#undef TARGET_EL3HLT
|
||||||
#define TARGET_EL3HLT 90
|
#define TARGET_EL3HLT 90
|
||||||
#undef TARGET_EL3RST
|
#undef TARGET_EL3RST
|
||||||
#define TARGET_EL3RST 91
|
#define TARGET_EL3RST 91
|
||||||
#undef TARGET_ENOPKG
|
#undef TARGET_ENOPKG
|
||||||
#define TARGET_ENOPKG 92
|
#define TARGET_ENOPKG 92
|
||||||
#undef TARGET_ELNRNG
|
#undef TARGET_ELNRNG
|
||||||
#define TARGET_ELNRNG 93
|
#define TARGET_ELNRNG 93
|
||||||
#undef TARGET_EUNATCH
|
#undef TARGET_EUNATCH
|
||||||
#define TARGET_EUNATCH 94
|
#define TARGET_EUNATCH 94
|
||||||
#undef TARGET_ENOCSI
|
#undef TARGET_ENOCSI
|
||||||
#define TARGET_ENOCSI 95
|
#define TARGET_ENOCSI 95
|
||||||
#undef TARGET_EL2HLT
|
#undef TARGET_EL2HLT
|
||||||
#define TARGET_EL2HLT 96
|
#define TARGET_EL2HLT 96
|
||||||
#undef TARGET_EBADE
|
#undef TARGET_EBADE
|
||||||
#define TARGET_EBADE 97
|
#define TARGET_EBADE 97
|
||||||
#undef TARGET_EBADR
|
#undef TARGET_EBADR
|
||||||
#define TARGET_EBADR 98
|
#define TARGET_EBADR 98
|
||||||
#undef TARGET_EXFULL
|
#undef TARGET_EXFULL
|
||||||
#define TARGET_EXFULL 99
|
#define TARGET_EXFULL 99
|
||||||
#undef TARGET_ENOANO
|
#undef TARGET_ENOANO
|
||||||
#define TARGET_ENOANO 100
|
#define TARGET_ENOANO 100
|
||||||
#undef TARGET_EBADRQC
|
#undef TARGET_EBADRQC
|
||||||
#define TARGET_EBADRQC 101
|
#define TARGET_EBADRQC 101
|
||||||
#undef TARGET_EBADSLT
|
#undef TARGET_EBADSLT
|
||||||
#define TARGET_EBADSLT 102
|
#define TARGET_EBADSLT 102
|
||||||
// Unused 103
|
/* Unused 103 */
|
||||||
#undef TARGET_EBFONT
|
#undef TARGET_EBFONT
|
||||||
#define TARGET_EBFONT 104
|
#define TARGET_EBFONT 104
|
||||||
#undef TARGET_ENONET
|
#undef TARGET_ENONET
|
||||||
#define TARGET_ENONET 105
|
#define TARGET_ENONET 105
|
||||||
#undef TARGET_ENOLINK
|
#undef TARGET_ENOLINK
|
||||||
#define TARGET_ENOLINK 106
|
#define TARGET_ENOLINK 106
|
||||||
#undef TARGET_EADV
|
#undef TARGET_EADV
|
||||||
#define TARGET_EADV 107
|
#define TARGET_EADV 107
|
||||||
#undef TARGET_ESRMNT
|
#undef TARGET_ESRMNT
|
||||||
#define TARGET_ESRMNT 108
|
#define TARGET_ESRMNT 108
|
||||||
#undef TARGET_ECOMM
|
#undef TARGET_ECOMM
|
||||||
#define TARGET_ECOMM 109
|
#define TARGET_ECOMM 109
|
||||||
#undef TARGET_EMULTIHOP
|
#undef TARGET_EMULTIHOP
|
||||||
#define TARGET_EMULTIHOP 110
|
#define TARGET_EMULTIHOP 110
|
||||||
#undef TARGET_EDOTDOT
|
#undef TARGET_EDOTDOT
|
||||||
#define TARGET_EDOTDOT 111
|
#define TARGET_EDOTDOT 111
|
||||||
#undef TARGET_EOVERFLOW
|
#undef TARGET_EOVERFLOW
|
||||||
#define TARGET_EOVERFLOW 112
|
#define TARGET_EOVERFLOW 112
|
||||||
#undef TARGET_ENOTUNIQ
|
#undef TARGET_ENOTUNIQ
|
||||||
#define TARGET_ENOTUNIQ 113
|
#define TARGET_ENOTUNIQ 113
|
||||||
#undef TARGET_EBADFD
|
#undef TARGET_EBADFD
|
||||||
#define TARGET_EBADFD 114
|
#define TARGET_EBADFD 114
|
||||||
#undef TARGET_EREMCHG
|
#undef TARGET_EREMCHG
|
||||||
#define TARGET_EREMCHG 115
|
#define TARGET_EREMCHG 115
|
||||||
#undef TARGET_EILSEQ
|
#undef TARGET_EILSEQ
|
||||||
#define TARGET_EILSEQ 116
|
#define TARGET_EILSEQ 116
|
||||||
|
/* Same as default 117-121 */
|
||||||
// Same as default 117-121
|
|
||||||
|
|
||||||
#undef TARGET_ELIBACC
|
#undef TARGET_ELIBACC
|
||||||
#define TARGET_ELIBACC 122
|
#define TARGET_ELIBACC 122
|
||||||
#undef TARGET_ELIBBAD
|
#undef TARGET_ELIBBAD
|
||||||
#define TARGET_ELIBBAD 123
|
#define TARGET_ELIBBAD 123
|
||||||
#undef TARGET_ELIBSCN
|
#undef TARGET_ELIBSCN
|
||||||
#define TARGET_ELIBSCN 124
|
#define TARGET_ELIBSCN 124
|
||||||
#undef TARGET_ELIBMAX
|
#undef TARGET_ELIBMAX
|
||||||
#define TARGET_ELIBMAX 125
|
#define TARGET_ELIBMAX 125
|
||||||
#undef TARGET_ELIBEXEC
|
#undef TARGET_ELIBEXEC
|
||||||
#define TARGET_ELIBEXEC 126
|
#define TARGET_ELIBEXEC 126
|
||||||
#undef TARGET_ERESTART
|
#undef TARGET_ERESTART
|
||||||
#define TARGET_ERESTART 127
|
#define TARGET_ERESTART 127
|
||||||
#undef TARGET_ESTRPIPE
|
#undef TARGET_ESTRPIPE
|
||||||
#define TARGET_ESTRPIPE 128
|
#define TARGET_ESTRPIPE 128
|
||||||
#undef TARGET_ENOMEDIUM
|
#undef TARGET_ENOMEDIUM
|
||||||
#define TARGET_ENOMEDIUM 129
|
#define TARGET_ENOMEDIUM 129
|
||||||
#undef TARGET_EMEDIUMTYPE
|
#undef TARGET_EMEDIUMTYPE
|
||||||
#define TARGET_EMEDIUMTYPE 130
|
#define TARGET_EMEDIUMTYPE 130
|
||||||
#undef TARGET_ECANCELED
|
#undef TARGET_ECANCELED
|
||||||
#define TARGET_ECANCELED 131
|
#define TARGET_ECANCELED 131
|
||||||
#undef TARGET_ENOKEY
|
#undef TARGET_ENOKEY
|
||||||
#define TARGET_ENOKEY 132
|
#define TARGET_ENOKEY 132
|
||||||
#undef TARGET_EKEYEXPIRED
|
#undef TARGET_EKEYEXPIRED
|
||||||
#define TARGET_EKEYEXPIRED 133
|
#define TARGET_EKEYEXPIRED 133
|
||||||
#undef TARGET_EKEYREVOKED
|
#undef TARGET_EKEYREVOKED
|
||||||
#define TARGET_EKEYREVOKED 134
|
#define TARGET_EKEYREVOKED 134
|
||||||
#undef TARGET_EKEYREJECTED
|
#undef TARGET_EKEYREJECTED
|
||||||
#define TARGET_EKEYREJECTED 135
|
#define TARGET_EKEYREJECTED 135
|
||||||
#undef TARGET_EOWNERDEAD
|
#undef TARGET_EOWNERDEAD
|
||||||
#define TARGET_EOWNERDEAD 136
|
#define TARGET_EOWNERDEAD 136
|
||||||
#undef TARGET_ENOTRECOVERABLE
|
#undef TARGET_ENOTRECOVERABLE
|
||||||
#define TARGET_ENOTRECOVERABLE 137
|
#define TARGET_ENOTRECOVERABLE 137
|
||||||
#undef TARGET_ERFKILL
|
#undef TARGET_ERFKILL
|
||||||
#define TARGET_ERFKILL 138
|
#define TARGET_ERFKILL 138
|
||||||
#undef TARGET_EHWPOISON
|
#undef TARGET_EHWPOISON
|
||||||
#define TARGET_EHWPOISON 139
|
#define TARGET_EHWPOISON 139
|
||||||
|
|
||||||
|
@ -1434,6 +1434,19 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
|
|||||||
#define ELF_CLASS ELFCLASS64
|
#define ELF_CLASS ELFCLASS64
|
||||||
#endif
|
#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,
|
static inline void init_thread(struct target_pt_regs *regs,
|
||||||
struct image_info *infop)
|
struct image_info *infop)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,8 @@ struct target_pt_regs {
|
|||||||
#define TARGET_MCL_FUTURE 2
|
#define TARGET_MCL_FUTURE 2
|
||||||
#define TARGET_MCL_ONFAULT 4
|
#define TARGET_MCL_ONFAULT 4
|
||||||
|
|
||||||
|
#undef TARGET_EWOULDBLOCK
|
||||||
|
#define TARGET_EWOULDBLOCK TARGET_EAGAIN /* Operation would block */
|
||||||
#undef TARGET_ENOMSG
|
#undef TARGET_ENOMSG
|
||||||
#define TARGET_ENOMSG 35
|
#define TARGET_ENOMSG 35
|
||||||
#undef TARGET_EIDRM
|
#undef TARGET_EIDRM
|
||||||
|
@ -1,59 +1,57 @@
|
|||||||
/* Code for loading Linux executables. Mostly linux kernel code. */
|
/* Code for loading Linux executables. Mostly linux kernel code. */
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
|
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
|
|
||||||
#define NGROUPS 32
|
#define NGROUPS 32
|
||||||
|
|
||||||
/* ??? This should really be somewhere else. */
|
/* ??? This should really be somewhere else. */
|
||||||
abi_long memcpy_to_target(abi_ulong dest, const void *src,
|
abi_long memcpy_to_target(abi_ulong dest, const void *src, unsigned long len)
|
||||||
unsigned long len)
|
|
||||||
{
|
{
|
||||||
void *host_ptr;
|
void *host_ptr;
|
||||||
|
|
||||||
host_ptr = lock_user(VERIFY_WRITE, dest, len, 0);
|
host_ptr = lock_user(VERIFY_WRITE, dest, len, 0);
|
||||||
if (!host_ptr)
|
if (!host_ptr) {
|
||||||
return -TARGET_EFAULT;
|
return -TARGET_EFAULT;
|
||||||
|
}
|
||||||
memcpy(host_ptr, src, len);
|
memcpy(host_ptr, src, len);
|
||||||
unlock_user(host_ptr, dest, 1);
|
unlock_user(host_ptr, dest, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int count(char ** vec)
|
static int count(char **vec)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; *vec; i++) {
|
for (i = 0; *vec; i++) {
|
||||||
vec++;
|
vec++;
|
||||||
}
|
}
|
||||||
|
return i;
|
||||||
return(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int prepare_binprm(struct linux_binprm *bprm)
|
static int prepare_binprm(struct linux_binprm *bprm)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int mode;
|
int mode;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if(fstat(bprm->fd, &st) < 0) {
|
if (fstat(bprm->fd, &st) < 0) {
|
||||||
return(-errno);
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
mode = st.st_mode;
|
mode = st.st_mode;
|
||||||
if(!S_ISREG(mode)) { /* Must be regular file */
|
if (!S_ISREG(mode)) { /* Must be regular file */
|
||||||
return(-EACCES);
|
return -EACCES;
|
||||||
}
|
}
|
||||||
if(!(mode & 0111)) { /* Must have at least one execute bit set */
|
if (!(mode & 0111)) { /* Must have at least one execute bit set */
|
||||||
return(-EACCES);
|
return -EACCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
bprm->e_uid = geteuid();
|
bprm->e_uid = geteuid();
|
||||||
bprm->e_gid = getegid();
|
bprm->e_gid = getegid();
|
||||||
|
|
||||||
/* Set-uid? */
|
/* Set-uid? */
|
||||||
if(mode & S_ISUID) {
|
if (mode & S_ISUID) {
|
||||||
bprm->e_uid = st.st_uid;
|
bprm->e_uid = st.st_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,8 +123,8 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
||||||
struct target_pt_regs * regs, struct image_info *infop,
|
struct target_pt_regs *regs, struct image_info *infop,
|
||||||
struct linux_binprm *bprm)
|
struct linux_binprm *bprm)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
@ -139,7 +137,7 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
|||||||
|
|
||||||
retval = prepare_binprm(bprm);
|
retval = prepare_binprm(bprm);
|
||||||
|
|
||||||
if(retval>=0) {
|
if (retval >= 0) {
|
||||||
if (bprm->buf[0] == 0x7f
|
if (bprm->buf[0] == 0x7f
|
||||||
&& bprm->buf[1] == 'E'
|
&& bprm->buf[1] == 'E'
|
||||||
&& bprm->buf[2] == 'L'
|
&& bprm->buf[2] == 'L'
|
||||||
@ -157,11 +155,11 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(retval>=0) {
|
if (retval >= 0) {
|
||||||
/* success. Initialize important registers */
|
/* success. Initialize important registers */
|
||||||
do_init_thread(regs, infop);
|
do_init_thread(regs, infop);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(retval);
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ struct target_pt_regs {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Target errno definitions taken from asm-mips/errno.h */
|
/* Target errno definitions taken from asm-mips/errno.h */
|
||||||
|
#undef TARGET_EWOULDBLOCK
|
||||||
|
#define TARGET_EWOULDBLOCK TARGET_EAGAIN /* Operation would block */
|
||||||
#undef TARGET_ENOMSG
|
#undef TARGET_ENOMSG
|
||||||
#define TARGET_ENOMSG 35 /* Identifier removed */
|
#define TARGET_ENOMSG 35 /* Identifier removed */
|
||||||
#undef TARGET_EIDRM
|
#undef TARGET_EIDRM
|
||||||
|
@ -18,6 +18,8 @@ struct target_pt_regs {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Target errno definitions taken from asm-mips/errno.h */
|
/* Target errno definitions taken from asm-mips/errno.h */
|
||||||
|
#undef TARGET_EWOULDBLOCK
|
||||||
|
#define TARGET_EWOULDBLOCK TARGET_EAGAIN /* Operation would block */
|
||||||
#undef TARGET_ENOMSG
|
#undef TARGET_ENOMSG
|
||||||
#define TARGET_ENOMSG 35 /* Identifier removed */
|
#define TARGET_ENOMSG 35 /* Identifier removed */
|
||||||
#undef TARGET_EIDRM
|
#undef TARGET_EIDRM
|
||||||
|
@ -519,112 +519,112 @@ static uint16_t target_to_host_errno_table[ERRNO_TABLE_SIZE] = {
|
|||||||
* minus the errnos that are not actually generic to all archs.
|
* minus the errnos that are not actually generic to all archs.
|
||||||
*/
|
*/
|
||||||
static uint16_t host_to_target_errno_table[ERRNO_TABLE_SIZE] = {
|
static uint16_t host_to_target_errno_table[ERRNO_TABLE_SIZE] = {
|
||||||
[EAGAIN] = TARGET_EAGAIN,
|
[EAGAIN] = TARGET_EAGAIN,
|
||||||
[EIDRM] = TARGET_EIDRM,
|
[EIDRM] = TARGET_EIDRM,
|
||||||
[ECHRNG] = TARGET_ECHRNG,
|
[ECHRNG] = TARGET_ECHRNG,
|
||||||
[EL2NSYNC] = TARGET_EL2NSYNC,
|
[EL2NSYNC] = TARGET_EL2NSYNC,
|
||||||
[EL3HLT] = TARGET_EL3HLT,
|
[EL3HLT] = TARGET_EL3HLT,
|
||||||
[EL3RST] = TARGET_EL3RST,
|
[EL3RST] = TARGET_EL3RST,
|
||||||
[ELNRNG] = TARGET_ELNRNG,
|
[ELNRNG] = TARGET_ELNRNG,
|
||||||
[EUNATCH] = TARGET_EUNATCH,
|
[EUNATCH] = TARGET_EUNATCH,
|
||||||
[ENOCSI] = TARGET_ENOCSI,
|
[ENOCSI] = TARGET_ENOCSI,
|
||||||
[EL2HLT] = TARGET_EL2HLT,
|
[EL2HLT] = TARGET_EL2HLT,
|
||||||
[EDEADLK] = TARGET_EDEADLK,
|
[EDEADLK] = TARGET_EDEADLK,
|
||||||
[ENOLCK] = TARGET_ENOLCK,
|
[ENOLCK] = TARGET_ENOLCK,
|
||||||
[EBADE] = TARGET_EBADE,
|
[EBADE] = TARGET_EBADE,
|
||||||
[EBADR] = TARGET_EBADR,
|
[EBADR] = TARGET_EBADR,
|
||||||
[EXFULL] = TARGET_EXFULL,
|
[EXFULL] = TARGET_EXFULL,
|
||||||
[ENOANO] = TARGET_ENOANO,
|
[ENOANO] = TARGET_ENOANO,
|
||||||
[EBADRQC] = TARGET_EBADRQC,
|
[EBADRQC] = TARGET_EBADRQC,
|
||||||
[EBADSLT] = TARGET_EBADSLT,
|
[EBADSLT] = TARGET_EBADSLT,
|
||||||
[EBFONT] = TARGET_EBFONT,
|
[EBFONT] = TARGET_EBFONT,
|
||||||
[ENOSTR] = TARGET_ENOSTR,
|
[ENOSTR] = TARGET_ENOSTR,
|
||||||
[ENODATA] = TARGET_ENODATA,
|
[ENODATA] = TARGET_ENODATA,
|
||||||
[ETIME] = TARGET_ETIME,
|
[ETIME] = TARGET_ETIME,
|
||||||
[ENOSR] = TARGET_ENOSR,
|
[ENOSR] = TARGET_ENOSR,
|
||||||
[ENONET] = TARGET_ENONET,
|
[ENONET] = TARGET_ENONET,
|
||||||
[ENOPKG] = TARGET_ENOPKG,
|
[ENOPKG] = TARGET_ENOPKG,
|
||||||
[EREMOTE] = TARGET_EREMOTE,
|
[EREMOTE] = TARGET_EREMOTE,
|
||||||
[ENOLINK] = TARGET_ENOLINK,
|
[ENOLINK] = TARGET_ENOLINK,
|
||||||
[EADV] = TARGET_EADV,
|
[EADV] = TARGET_EADV,
|
||||||
[ESRMNT] = TARGET_ESRMNT,
|
[ESRMNT] = TARGET_ESRMNT,
|
||||||
[ECOMM] = TARGET_ECOMM,
|
[ECOMM] = TARGET_ECOMM,
|
||||||
[EPROTO] = TARGET_EPROTO,
|
[EPROTO] = TARGET_EPROTO,
|
||||||
[EDOTDOT] = TARGET_EDOTDOT,
|
[EDOTDOT] = TARGET_EDOTDOT,
|
||||||
[EMULTIHOP] = TARGET_EMULTIHOP,
|
[EMULTIHOP] = TARGET_EMULTIHOP,
|
||||||
[EBADMSG] = TARGET_EBADMSG,
|
[EBADMSG] = TARGET_EBADMSG,
|
||||||
[ENAMETOOLONG] = TARGET_ENAMETOOLONG,
|
[ENAMETOOLONG] = TARGET_ENAMETOOLONG,
|
||||||
[EOVERFLOW] = TARGET_EOVERFLOW,
|
[EOVERFLOW] = TARGET_EOVERFLOW,
|
||||||
[ENOTUNIQ] = TARGET_ENOTUNIQ,
|
[ENOTUNIQ] = TARGET_ENOTUNIQ,
|
||||||
[EBADFD] = TARGET_EBADFD,
|
[EBADFD] = TARGET_EBADFD,
|
||||||
[EREMCHG] = TARGET_EREMCHG,
|
[EREMCHG] = TARGET_EREMCHG,
|
||||||
[ELIBACC] = TARGET_ELIBACC,
|
[ELIBACC] = TARGET_ELIBACC,
|
||||||
[ELIBBAD] = TARGET_ELIBBAD,
|
[ELIBBAD] = TARGET_ELIBBAD,
|
||||||
[ELIBSCN] = TARGET_ELIBSCN,
|
[ELIBSCN] = TARGET_ELIBSCN,
|
||||||
[ELIBMAX] = TARGET_ELIBMAX,
|
[ELIBMAX] = TARGET_ELIBMAX,
|
||||||
[ELIBEXEC] = TARGET_ELIBEXEC,
|
[ELIBEXEC] = TARGET_ELIBEXEC,
|
||||||
[EILSEQ] = TARGET_EILSEQ,
|
[EILSEQ] = TARGET_EILSEQ,
|
||||||
[ENOSYS] = TARGET_ENOSYS,
|
[ENOSYS] = TARGET_ENOSYS,
|
||||||
[ELOOP] = TARGET_ELOOP,
|
[ELOOP] = TARGET_ELOOP,
|
||||||
[ERESTART] = TARGET_ERESTART,
|
[ERESTART] = TARGET_ERESTART,
|
||||||
[ESTRPIPE] = TARGET_ESTRPIPE,
|
[ESTRPIPE] = TARGET_ESTRPIPE,
|
||||||
[ENOTEMPTY] = TARGET_ENOTEMPTY,
|
[ENOTEMPTY] = TARGET_ENOTEMPTY,
|
||||||
[EUSERS] = TARGET_EUSERS,
|
[EUSERS] = TARGET_EUSERS,
|
||||||
[ENOTSOCK] = TARGET_ENOTSOCK,
|
[ENOTSOCK] = TARGET_ENOTSOCK,
|
||||||
[EDESTADDRREQ] = TARGET_EDESTADDRREQ,
|
[EDESTADDRREQ] = TARGET_EDESTADDRREQ,
|
||||||
[EMSGSIZE] = TARGET_EMSGSIZE,
|
[EMSGSIZE] = TARGET_EMSGSIZE,
|
||||||
[EPROTOTYPE] = TARGET_EPROTOTYPE,
|
[EPROTOTYPE] = TARGET_EPROTOTYPE,
|
||||||
[ENOPROTOOPT] = TARGET_ENOPROTOOPT,
|
[ENOPROTOOPT] = TARGET_ENOPROTOOPT,
|
||||||
[EPROTONOSUPPORT] = TARGET_EPROTONOSUPPORT,
|
[EPROTONOSUPPORT] = TARGET_EPROTONOSUPPORT,
|
||||||
[ESOCKTNOSUPPORT] = TARGET_ESOCKTNOSUPPORT,
|
[ESOCKTNOSUPPORT] = TARGET_ESOCKTNOSUPPORT,
|
||||||
[EOPNOTSUPP] = TARGET_EOPNOTSUPP,
|
[EOPNOTSUPP] = TARGET_EOPNOTSUPP,
|
||||||
[EPFNOSUPPORT] = TARGET_EPFNOSUPPORT,
|
[EPFNOSUPPORT] = TARGET_EPFNOSUPPORT,
|
||||||
[EAFNOSUPPORT] = TARGET_EAFNOSUPPORT,
|
[EAFNOSUPPORT] = TARGET_EAFNOSUPPORT,
|
||||||
[EADDRINUSE] = TARGET_EADDRINUSE,
|
[EADDRINUSE] = TARGET_EADDRINUSE,
|
||||||
[EADDRNOTAVAIL] = TARGET_EADDRNOTAVAIL,
|
[EADDRNOTAVAIL] = TARGET_EADDRNOTAVAIL,
|
||||||
[ENETDOWN] = TARGET_ENETDOWN,
|
[ENETDOWN] = TARGET_ENETDOWN,
|
||||||
[ENETUNREACH] = TARGET_ENETUNREACH,
|
[ENETUNREACH] = TARGET_ENETUNREACH,
|
||||||
[ENETRESET] = TARGET_ENETRESET,
|
[ENETRESET] = TARGET_ENETRESET,
|
||||||
[ECONNABORTED] = TARGET_ECONNABORTED,
|
[ECONNABORTED] = TARGET_ECONNABORTED,
|
||||||
[ECONNRESET] = TARGET_ECONNRESET,
|
[ECONNRESET] = TARGET_ECONNRESET,
|
||||||
[ENOBUFS] = TARGET_ENOBUFS,
|
[ENOBUFS] = TARGET_ENOBUFS,
|
||||||
[EISCONN] = TARGET_EISCONN,
|
[EISCONN] = TARGET_EISCONN,
|
||||||
[ENOTCONN] = TARGET_ENOTCONN,
|
[ENOTCONN] = TARGET_ENOTCONN,
|
||||||
[EUCLEAN] = TARGET_EUCLEAN,
|
[EUCLEAN] = TARGET_EUCLEAN,
|
||||||
[ENOTNAM] = TARGET_ENOTNAM,
|
[ENOTNAM] = TARGET_ENOTNAM,
|
||||||
[ENAVAIL] = TARGET_ENAVAIL,
|
[ENAVAIL] = TARGET_ENAVAIL,
|
||||||
[EISNAM] = TARGET_EISNAM,
|
[EISNAM] = TARGET_EISNAM,
|
||||||
[EREMOTEIO] = TARGET_EREMOTEIO,
|
[EREMOTEIO] = TARGET_EREMOTEIO,
|
||||||
[EDQUOT] = TARGET_EDQUOT,
|
[EDQUOT] = TARGET_EDQUOT,
|
||||||
[ESHUTDOWN] = TARGET_ESHUTDOWN,
|
[ESHUTDOWN] = TARGET_ESHUTDOWN,
|
||||||
[ETOOMANYREFS] = TARGET_ETOOMANYREFS,
|
[ETOOMANYREFS] = TARGET_ETOOMANYREFS,
|
||||||
[ETIMEDOUT] = TARGET_ETIMEDOUT,
|
[ETIMEDOUT] = TARGET_ETIMEDOUT,
|
||||||
[ECONNREFUSED] = TARGET_ECONNREFUSED,
|
[ECONNREFUSED] = TARGET_ECONNREFUSED,
|
||||||
[EHOSTDOWN] = TARGET_EHOSTDOWN,
|
[EHOSTDOWN] = TARGET_EHOSTDOWN,
|
||||||
[EHOSTUNREACH] = TARGET_EHOSTUNREACH,
|
[EHOSTUNREACH] = TARGET_EHOSTUNREACH,
|
||||||
[EALREADY] = TARGET_EALREADY,
|
[EALREADY] = TARGET_EALREADY,
|
||||||
[EINPROGRESS] = TARGET_EINPROGRESS,
|
[EINPROGRESS] = TARGET_EINPROGRESS,
|
||||||
[ESTALE] = TARGET_ESTALE,
|
[ESTALE] = TARGET_ESTALE,
|
||||||
[ECANCELED] = TARGET_ECANCELED,
|
[ECANCELED] = TARGET_ECANCELED,
|
||||||
[ENOMEDIUM] = TARGET_ENOMEDIUM,
|
[ENOMEDIUM] = TARGET_ENOMEDIUM,
|
||||||
[EMEDIUMTYPE] = TARGET_EMEDIUMTYPE,
|
[EMEDIUMTYPE] = TARGET_EMEDIUMTYPE,
|
||||||
#ifdef ENOKEY
|
#ifdef ENOKEY
|
||||||
[ENOKEY] = TARGET_ENOKEY,
|
[ENOKEY] = TARGET_ENOKEY,
|
||||||
#endif
|
#endif
|
||||||
#ifdef EKEYEXPIRED
|
#ifdef EKEYEXPIRED
|
||||||
[EKEYEXPIRED] = TARGET_EKEYEXPIRED,
|
[EKEYEXPIRED] = TARGET_EKEYEXPIRED,
|
||||||
#endif
|
#endif
|
||||||
#ifdef EKEYREVOKED
|
#ifdef EKEYREVOKED
|
||||||
[EKEYREVOKED] = TARGET_EKEYREVOKED,
|
[EKEYREVOKED] = TARGET_EKEYREVOKED,
|
||||||
#endif
|
#endif
|
||||||
#ifdef EKEYREJECTED
|
#ifdef EKEYREJECTED
|
||||||
[EKEYREJECTED] = TARGET_EKEYREJECTED,
|
[EKEYREJECTED] = TARGET_EKEYREJECTED,
|
||||||
#endif
|
#endif
|
||||||
#ifdef EOWNERDEAD
|
#ifdef EOWNERDEAD
|
||||||
[EOWNERDEAD] = TARGET_EOWNERDEAD,
|
[EOWNERDEAD] = TARGET_EOWNERDEAD,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENOTRECOVERABLE
|
#ifdef ENOTRECOVERABLE
|
||||||
[ENOTRECOVERABLE] = TARGET_ENOTRECOVERABLE,
|
[ENOTRECOVERABLE] = TARGET_ENOTRECOVERABLE,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENOMSG
|
#ifdef ENOMSG
|
||||||
[ENOMSG] = TARGET_ENOMSG,
|
[ENOMSG] = TARGET_ENOMSG,
|
||||||
@ -7956,6 +7956,9 @@ static int open_self_stat(void *cpu_env, int fd)
|
|||||||
gchar *bin = g_strrstr(ts->bprm->argv[0], "/");
|
gchar *bin = g_strrstr(ts->bprm->argv[0], "/");
|
||||||
bin = bin ? bin + 1 : ts->bprm->argv[0];
|
bin = bin ? bin + 1 : ts->bprm->argv[0];
|
||||||
g_string_printf(buf, "(%.15s) ", bin);
|
g_string_printf(buf, "(%.15s) ", bin);
|
||||||
|
} else if (i == 3) {
|
||||||
|
/* ppid */
|
||||||
|
g_string_printf(buf, FMT_pid " ", getppid());
|
||||||
} else if (i == 27) {
|
} else if (i == 27) {
|
||||||
/* stack bottom */
|
/* stack bottom */
|
||||||
g_string_printf(buf, TARGET_ABI_FMT_ld " ", ts->info->start_stack);
|
g_string_printf(buf, TARGET_ABI_FMT_ld " ", ts->info->start_stack);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user