mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-29 13:01:52 -06:00
linux-user: introduce functions to detect CPU type
Add a function to return ELF e_flags and use it to select the CPU model. Signed-off-by: YunQiang Su <syq@debian.org> [lv: split the patch and some cleanup in get_elf_eflags()] Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180220173307.25125-3-laurent@vivier.eu>
This commit is contained in:
parent
542ca43498
commit
768fe76e92
3 changed files with 46 additions and 10 deletions
|
@ -4344,8 +4344,17 @@ int main(int argc, char **argv, char **envp)
|
|||
|
||||
init_qemu_uname_release();
|
||||
|
||||
execfd = qemu_getauxval(AT_EXECFD);
|
||||
if (execfd == 0) {
|
||||
execfd = open(filename, O_RDONLY);
|
||||
if (execfd < 0) {
|
||||
printf("Error while loading %s: %s\n", filename, strerror(errno));
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu_model == NULL) {
|
||||
cpu_model = cpu_get_model(0);
|
||||
cpu_model = cpu_get_model(get_elf_eflags(execfd));
|
||||
}
|
||||
tcg_exec_init(0);
|
||||
/* NOTE: we need to init the CPU at this stage to get
|
||||
|
@ -4438,15 +4447,6 @@ int main(int argc, char **argv, char **envp)
|
|||
cpu->opaque = ts;
|
||||
task_settid(ts);
|
||||
|
||||
execfd = qemu_getauxval(AT_EXECFD);
|
||||
if (execfd == 0) {
|
||||
execfd = open(filename, O_RDONLY);
|
||||
if (execfd < 0) {
|
||||
printf("Error while loading %s: %s\n", filename, strerror(errno));
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
ret = loader_exec(execfd, filename, target_argv, target_environ, regs,
|
||||
info, &bprm);
|
||||
if (ret != 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue