import
This commit is contained in:
2
qemu/hw/arm/Makefile.objs
Normal file
2
qemu/hw/arm/Makefile.objs
Normal file
@@ -0,0 +1,2 @@
|
||||
obj-y += tosa.o
|
||||
obj-y += virt.o
|
||||
35
qemu/hw/arm/tosa.c
Normal file
35
qemu/hw/arm/tosa.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/* vim:set shiftwidth=4 ts=4 et: */
|
||||
/*
|
||||
* PXA255 Sharp Zaurus SL-6000 PDA platform
|
||||
*
|
||||
* Copyright (c) 2008 Dmitry Baryshkov
|
||||
*
|
||||
* Code based on spitz platform by Andrzej Zaborowski <balrog@zabor.org>
|
||||
* This code is licensed under the GNU GPL v2.
|
||||
*
|
||||
* Contributions after 2012-01-13 are licensed under the terms of the
|
||||
* GNU GPL, version 2 or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "hw/hw.h"
|
||||
#include "hw/arm/arm.h"
|
||||
#include "hw/boards.h"
|
||||
#include "exec/address-spaces.h"
|
||||
|
||||
|
||||
static void tosa_init(struct uc_struct *uc, MachineState *machine)
|
||||
{
|
||||
cpu_arm_init(uc, "pxa255");
|
||||
}
|
||||
|
||||
void tosa_machine_init(struct uc_struct *uc)
|
||||
{
|
||||
static QEMUMachine tosapda_machine = {
|
||||
.name = "tosa",
|
||||
.init = tosa_init,
|
||||
.is_default = 1,
|
||||
.arch = UC_ARCH_ARM,
|
||||
};
|
||||
|
||||
qemu_register_machine(uc, &tosapda_machine, TYPE_MACHINE, NULL);
|
||||
}
|
||||
72
qemu/hw/arm/virt.c
Normal file
72
qemu/hw/arm/virt.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* ARM mach-virt emulation
|
||||
*
|
||||
* Copyright (c) 2013 Linaro Limited
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2 or later, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Emulate a virtual board which works by passing Linux all the information
|
||||
* it needs about what devices are present via the device tree.
|
||||
* There are some restrictions about what we can do here:
|
||||
* + we can only present devices whose Linux drivers will work based
|
||||
* purely on the device tree with no platform data at all
|
||||
* + we want to present a very stripped-down minimalist platform,
|
||||
* both because this reduces the security attack surface from the guest
|
||||
* and also because it reduces our exposure to being broken when
|
||||
* the kernel updates its device tree bindings and requires further
|
||||
* information in a device binding that we aren't providing.
|
||||
* This is essentially the same approach kvmtool uses.
|
||||
*/
|
||||
|
||||
/* Unicorn Emulator Engine */
|
||||
/* By Nguyen Anh Quynh, 2015 */
|
||||
|
||||
#include "hw/arm/arm.h"
|
||||
#include "hw/boards.h"
|
||||
#include "exec/address-spaces.h"
|
||||
|
||||
|
||||
static void machvirt_init(struct uc_struct *uc, MachineState *machine)
|
||||
{
|
||||
const char *cpu_model = machine->cpu_model;
|
||||
int n;
|
||||
|
||||
if (!cpu_model) {
|
||||
cpu_model = "cortex-a57"; // ARM64
|
||||
}
|
||||
|
||||
for (n = 0; n < smp_cpus; n++) {
|
||||
Object *cpuobj;
|
||||
ObjectClass *oc = cpu_class_by_name(uc, TYPE_ARM_CPU, cpu_model);
|
||||
|
||||
if (!oc) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cpuobj = object_new(uc, object_class_get_name(oc));
|
||||
object_property_set_bool(uc, cpuobj, true, "realized", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void machvirt_machine_init(struct uc_struct *uc)
|
||||
{
|
||||
static QEMUMachine machvirt_a15_machine = {
|
||||
.name = "virt",
|
||||
.init = machvirt_init,
|
||||
.is_default = 1,
|
||||
.arch = UC_ARCH_ARM64,
|
||||
};
|
||||
|
||||
qemu_register_machine(uc, &machvirt_a15_machine, TYPE_MACHINE, NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user