linux-user pull for 2.2
Two minor fixes and new a feature, addition of QEMU_RAND_SEED for testing needs. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUAVFdr07RIkN7ePJvAAQgUiQ//ekySzynXpAls/SNvKDXSEUj2q0DiUrYo EYijS/Cy0D4uwJQ2M1psS08BYRFsyJbf9ethHxquBA0NbRgzsDeN5nUTT2Qm7/RR cLXjZL/u5snsZSAjuMKX5uAKq5syy9YaDHhUKKpFKvmI0MO5cNDq2Bv58q1ce6Ff Bbo255Lp2cJMybdt8vUX9XeZ/Lp6DsVaaYK+YnWWbGRDtjlpxOZHPiG3cw4NNb68 3GHF/eYmCXrXo08yRTCTT+byah2yvckJVHX/lONL9CwZO7QSrrwGt34C1sgWM+ar bZM36hQYOqTmpHJD6giW9Zip2eHf09IR5rWCLq89EngQPeS/T/G60wdvmbTALVr9 AYYVqcIL8K9d7tv3lI7cgLxgBNdkc8TDKFmyMDjqNcSvC+5TtASqMKuYJQrGHJY/ MESfBKfbyIk8j9SySTbxBtmxlV7/VXtaCmzMHv8qvLIKqcB2gehomclM6coBLB74 rrjeoTqykwW7C0YiZMoUDr5feyI55F0YcbSd99pzQC2TmizAXVmmMLhlHW3Jp1Au q0TIRM1g9F2AqgrN0LXqFMlv2SNmMX5mjluMec6N/1fxeUG+V6YyiSrwdZZGGvb7 6f3j6GuVKbhxn69cTVZg9BM0e14eNH7iBfNJIrusSpe3ADzpeyC46Ipb16rNFgw4 /1z2DIWaGtM= =WmYo -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20141101' into staging linux-user pull for 2.2 Two minor fixes and new a feature, addition of QEMU_RAND_SEED for testing needs. # gpg: Signature made Mon 03 Nov 2014 11:49:39 GMT using RSA key ID DE3C9BC0 # gpg: Good signature from "Riku Voipio <riku.voipio@iki.fi>" # gpg: aka "Riku Voipio <riku.voipio@linaro.org>" * remotes/riku/tags/pull-linux-user-20141101: elf: take phdr offset into account when calculating the program load address linux-user: Fix fault address truncation AArch64 linux-user: Let user specify random seed Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
47e8acb45f
@ -1539,7 +1539,6 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
|
||||
* Generate 16 random bytes for userspace PRNG seeding (not
|
||||
* cryptically secure but it's not the aim of QEMU).
|
||||
*/
|
||||
srand((unsigned int) time(NULL));
|
||||
for (i = 0; i < 16; i++) {
|
||||
k_rand_bytes[i] = rand();
|
||||
}
|
||||
@ -1821,7 +1820,7 @@ static void load_elf_image(const char *image_name, int image_fd,
|
||||
loaddr = -1, hiaddr = 0;
|
||||
for (i = 0; i < ehdr->e_phnum; ++i) {
|
||||
if (phdr[i].p_type == PT_LOAD) {
|
||||
abi_ulong a = phdr[i].p_vaddr;
|
||||
abi_ulong a = phdr[i].p_vaddr - phdr[i].p_offset;
|
||||
if (a < loaddr) {
|
||||
loaddr = a;
|
||||
}
|
||||
|
@ -1006,7 +1006,6 @@ void cpu_loop(CPUARMState *env)
|
||||
CPUState *cs = CPU(arm_env_get_cpu(env));
|
||||
int trapnr, sig;
|
||||
target_siginfo_t info;
|
||||
uint32_t addr;
|
||||
|
||||
for (;;) {
|
||||
cpu_exec_start(cs);
|
||||
@ -1042,12 +1041,11 @@ void cpu_loop(CPUARMState *env)
|
||||
/* fall through for segv */
|
||||
case EXCP_PREFETCH_ABORT:
|
||||
case EXCP_DATA_ABORT:
|
||||
addr = env->exception.vaddress;
|
||||
info.si_signo = SIGSEGV;
|
||||
info.si_errno = 0;
|
||||
/* XXX: check env->error_code */
|
||||
info.si_code = TARGET_SEGV_MAPERR;
|
||||
info._sifields._sigfault._addr = addr;
|
||||
info._sifields._sigfault._addr = env->exception.vaddress;
|
||||
queue_signal(env, info.si_signo, &info);
|
||||
break;
|
||||
case EXCP_DEBUG:
|
||||
@ -3546,6 +3544,17 @@ static void handle_arg_pagesize(const char *arg)
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_arg_randseed(const char *arg)
|
||||
{
|
||||
unsigned long long seed;
|
||||
|
||||
if (parse_uint_full(arg, &seed, 0) != 0 || seed > UINT_MAX) {
|
||||
fprintf(stderr, "Invalid seed number: %s\n", arg);
|
||||
exit(1);
|
||||
}
|
||||
srand(seed);
|
||||
}
|
||||
|
||||
static void handle_arg_gdb(const char *arg)
|
||||
{
|
||||
gdbstub_port = atoi(arg);
|
||||
@ -3674,6 +3683,8 @@ static const struct qemu_argument arg_table[] = {
|
||||
"", "run in singlestep mode"},
|
||||
{"strace", "QEMU_STRACE", false, handle_arg_strace,
|
||||
"", "log system calls"},
|
||||
{"seed", "QEMU_RAND_SEED", true, handle_arg_randseed,
|
||||
"", "Seed for pseudo-random number generator"},
|
||||
{"version", "QEMU_VERSION", false, handle_arg_version,
|
||||
"", "display version information and exit"},
|
||||
{NULL, NULL, false, NULL, NULL, NULL}
|
||||
@ -3856,6 +3867,8 @@ int main(int argc, char **argv, char **envp)
|
||||
cpudef_setup(); /* parse cpu definitions in target config file (TBD) */
|
||||
#endif
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
optind = parse_args(argc, argv);
|
||||
|
||||
/* Zero out regs */
|
||||
@ -3926,6 +3939,10 @@ int main(int argc, char **argv, char **envp)
|
||||
do_strace = 1;
|
||||
}
|
||||
|
||||
if (getenv("QEMU_RAND_SEED")) {
|
||||
handle_arg_randseed(getenv("QEMU_RAND_SEED"));
|
||||
}
|
||||
|
||||
target_environ = envlist_to_environ(envlist, NULL);
|
||||
envlist_free(envlist);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user