mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 20:48:31 +00:00
9c5153270f
Considering that features are converted to global properties and global properties are automatically applied to every new instance of created CPU (at object_new() time), there is no point in parsing cpu_model string every time a CPU created. So move parsing outside CPU creation loop and do it only once. Parsing also should be done before any CPU is created so that features would affect the first CPU a well. Backports commit 6aff24c6a61c6fec31e555c7748ba6085b7b2c06 from qemu
64 lines
2.3 KiB
C
64 lines
2.3 KiB
C
/*
|
|
* QEMU PC System Emulator
|
|
*
|
|
* Copyright (c) 2003-2004 Fabrice Bellard
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
* THE SOFTWARE.
|
|
*/
|
|
/* Modified for Unicorn Engine by Nguyen Anh Quynh, 2015 */
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "cpu.h"
|
|
#include "qapi/error.h"
|
|
#include "hw/i386/pc.h"
|
|
#include "hw/boards.h"
|
|
#include "exec/address-spaces.h"
|
|
#include "uc_priv.h"
|
|
|
|
|
|
/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
|
|
* host addresses aligned at 1Gbyte boundaries. This way we can use 1GByte
|
|
* pages in the host.
|
|
*/
|
|
#define GIGABYTE_ALIGN true
|
|
|
|
/* PC hardware initialisation */
|
|
static int pc_init1(struct uc_struct *uc, MachineState *machine)
|
|
{
|
|
PCMachineState *pcms = PC_MACHINE(uc, machine);
|
|
return pc_cpus_init(uc, pcms);
|
|
}
|
|
|
|
static void pc_compat_2_2(struct uc_struct *uc, MachineState *machine)
|
|
{
|
|
}
|
|
|
|
// Unicorn: Modified for use with unicorn (no need for an option function)
|
|
#define DEFINE_I440FX_MACHINE(suffix, name, compatfn) \
|
|
static int pc_init_##suffix(struct uc_struct *uc, MachineState *machine) \
|
|
{ \
|
|
void (*compat)(struct uc_struct *uc, MachineState *m) = (compatfn); \
|
|
if (compat) { \
|
|
compat(uc, machine); \
|
|
} \
|
|
return pc_init1(uc, machine); \
|
|
} \
|
|
DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix)
|
|
|
|
DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2);
|