mirror of https://gitee.com/openkylin/qemu.git
* cpu-exec fixes (Emilio, Laurent)
* TCG bugfix in queue.h (Paolo) * high address load for linuxboot (Zhijian) * PVH support (Liam, Stefano) * misc i386 changes (Paolo, Robert, Doug) * configure tweak for openpty (Thomas) * elf2dmp port to Windows (Viktor) * initial improvements to Makefile infrastructure (Yang + GSoC 2013) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAABAgAGBQJcWckyAAoJEL/70l94x66DCU0H/03tjXBR5iVGjBIroSCq7tti 6+BWvVbDEHQMS9i3BQc6rNgc4ZAyfJ4iO9wQkpx43PltPIG9e6ZiJaCB4F3jmN5f 3i2LKBXJGFmGNwz8cAq2qpSIBrx7iPeCzbO/BylpwsILfNycb5K35oS7Qr7ezUcj xLM5VfW+3TF0SqI0utNHNAlO/xeBOKh+N1Iettqn+L5MAgI9rmnfDkaD3Pmkbw1H Iw8yzEypU4Qsqy4zUyb+dppkwSLELOZ24uJVtYnV+HeTwejXD66FMhvFssw0P7kF VBK8L6SttYfe9ltUAsXmlLSsnYThCiV0AMclHy8U3mvA47KbBPxTR7u47UDAZSE= =2trt -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging * cpu-exec fixes (Emilio, Laurent) * TCG bugfix in queue.h (Paolo) * high address load for linuxboot (Zhijian) * PVH support (Liam, Stefano) * misc i386 changes (Paolo, Robert, Doug) * configure tweak for openpty (Thomas) * elf2dmp port to Windows (Viktor) * initial improvements to Makefile infrastructure (Yang + GSoC 2013) # gpg: Signature made Tue 05 Feb 2019 17:34:42 GMT # gpg: using RSA key BFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (76 commits) queue: fix QTAILQ_FOREACH_REVERSE_SAFE scsi-generic: Convert from DPRINTF() macro to trace events scsi-disk: Convert from DPRINTF() macro to trace events pc: Use hotplug_handler_(plug|unplug|unplug_request) i386: hvf: Fix smp boot hangs hw/vfio/Makefile.objs: Create new CONFIG_* variables for VFIO core and PCI hw/i2c/Makefile.objs: Create new CONFIG_* variables for EEPROM and ACPI controller hw/tricore/Makefile.objs: Create CONFIG_* for tricore hw/openrisc/Makefile.objs: Create CONFIG_* for openrisc hw/moxie/Makefile.objs: Conditionally build moxie hw/hppa/Makefile.objs: Create CONFIG_* for hppa hw/cris/Makefile.objs: Create CONFIG_* for cris hw/alpha/Makefile.objs: Create CONFIG_* for alpha hw/sparc64/Makefile.objs: Create CONFIG_* for sparc64 hw/riscv/Makefile.objs: Create CONFIG_* for riscv boards hw/nios2/Makefile.objs: Conditionally build nios2 hw/xtensa/Makefile.objs: Build xtensa_sim and xtensa_fpga conditionally hw/lm32/Makefile.objs: Conditionally build lm32 and milkmyst hw/sparc/Makefile.objs: CONFIG_* for sun4m and leon3 created hw/s390/Makefile.objs: Create new CONFIG_* variables for s390x boards and devices ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> # Conflicts: # qemu-deprecated.texi
This commit is contained in:
commit
3e29da9fd8
|
@ -103,6 +103,10 @@
|
|||
/pc-bios/optionrom/linuxboot_dma.bin
|
||||
/pc-bios/optionrom/linuxboot_dma.raw
|
||||
/pc-bios/optionrom/linuxboot_dma.img
|
||||
/pc-bios/optionrom/pvh.asm
|
||||
/pc-bios/optionrom/pvh.bin
|
||||
/pc-bios/optionrom/pvh.raw
|
||||
/pc-bios/optionrom/pvh.img
|
||||
/pc-bios/optionrom/multiboot.asm
|
||||
/pc-bios/optionrom/multiboot.bin
|
||||
/pc-bios/optionrom/multiboot.raw
|
||||
|
|
6
Makefile
6
Makefile
|
@ -570,8 +570,8 @@ ifneq ($(EXESUF),)
|
|||
qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
|
||||
endif
|
||||
|
||||
elf2dmp: LIBS = $(CURL_LIBS)
|
||||
elf2dmp: $(elf2dmp-obj-y)
|
||||
elf2dmp$(EXESUF): LIBS += $(CURL_LIBS)
|
||||
elf2dmp$(EXESUF): $(elf2dmp-obj-y)
|
||||
$(call LINK, $^)
|
||||
|
||||
ifdef CONFIG_IVSHMEM
|
||||
|
@ -673,7 +673,7 @@ efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
|
|||
efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
|
||||
efi-e1000e.rom efi-vmxnet3.rom \
|
||||
bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
|
||||
multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
|
||||
multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
|
||||
s390-ccw.img s390-netboot.img \
|
||||
spapr-rtas.bin slof.bin skiboot.lid \
|
||||
palcode-clipper \
|
||||
|
|
|
@ -266,6 +266,9 @@ void cpu_exec_step_atomic(CPUState *cpu)
|
|||
#ifndef CONFIG_SOFTMMU
|
||||
tcg_debug_assert(!have_mmap_lock());
|
||||
#endif
|
||||
if (qemu_mutex_iothread_locked()) {
|
||||
qemu_mutex_unlock_iothread();
|
||||
}
|
||||
assert_no_pages_locked();
|
||||
}
|
||||
|
||||
|
@ -702,6 +705,7 @@ int cpu_exec(CPUState *cpu)
|
|||
if (qemu_mutex_iothread_locked()) {
|
||||
qemu_mutex_unlock_iothread();
|
||||
}
|
||||
assert_no_pages_locked();
|
||||
}
|
||||
|
||||
/* if an exception is pending, we execute it here */
|
||||
|
|
|
@ -4612,9 +4612,17 @@ elif compile_prog "" "$pthread_lib -lrt" ; then
|
|||
libs_qga="$libs_qga -lrt"
|
||||
fi
|
||||
|
||||
if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
|
||||
"$haiku" != "yes" ; then
|
||||
# Check whether we need to link libutil for openpty()
|
||||
cat > $TMPC << EOF
|
||||
extern int openpty(int *am, int *as, char *name, void *termp, void *winp);
|
||||
int main(void) { return openpty(0, 0, 0, 0, 0); }
|
||||
EOF
|
||||
|
||||
if ! compile_prog "" "" ; then
|
||||
if compile_prog "" "-lutil" ; then
|
||||
libs_softmmu="-lutil $libs_softmmu"
|
||||
libs_tools="-lutil $libs_tools"
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
|
@ -5782,8 +5790,8 @@ if test "$want_tools" = "yes" ; then
|
|||
if [ "$ivshmem" = "yes" ]; then
|
||||
tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
|
||||
fi
|
||||
if [ "$posix" = "yes" ] && [ "$curl" = "yes" ]; then
|
||||
tools="elf2dmp $tools"
|
||||
if [ "$curl" = "yes" ]; then
|
||||
tools="elf2dmp\$(EXESUF) $tools"
|
||||
fi
|
||||
fi
|
||||
if test "$softmmu" = yes ; then
|
||||
|
@ -7129,14 +7137,14 @@ TARGET_ABI_DIR=""
|
|||
case "$target_name" in
|
||||
i386)
|
||||
mttcg="yes"
|
||||
gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml"
|
||||
gdb_xml_files="i386-32bit.xml"
|
||||
target_compiler=$cross_cc_i386
|
||||
target_compiler_cflags=$cross_cc_ccflags_i386
|
||||
;;
|
||||
x86_64)
|
||||
TARGET_BASE_ARCH=i386
|
||||
mttcg="yes"
|
||||
gdb_xml_files="i386-64bit.xml i386-64bit-core.xml i386-64bit-sse.xml"
|
||||
gdb_xml_files="i386-64bit.xml"
|
||||
target_compiler=$cross_cc_x86_64
|
||||
;;
|
||||
alpha)
|
||||
|
|
|
@ -25,11 +25,15 @@ typedef struct DBGKD_GET_VERSION64 {
|
|||
uint64_t DebuggerDataList;
|
||||
} DBGKD_GET_VERSION64;
|
||||
|
||||
#ifndef _WIN32
|
||||
typedef struct LIST_ENTRY64 {
|
||||
struct LIST_ENTRY64 *Flink;
|
||||
struct LIST_ENTRY64 *Blink;
|
||||
} LIST_ENTRY64;
|
||||
#endif
|
||||
|
||||
typedef struct DBGKD_DEBUG_DATA_HEADER64 {
|
||||
struct LIST_ENTRY64 {
|
||||
struct LIST_ENTRY64 *Flink;
|
||||
struct LIST_ENTRY64 *Blink;
|
||||
} List;
|
||||
LIST_ENTRY64 List;
|
||||
uint32_t OwnerTag;
|
||||
uint32_t Size;
|
||||
} DBGKD_DEBUG_DATA_HEADER64;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "err.h"
|
||||
#include "addrspace.h"
|
||||
|
@ -41,7 +43,8 @@ static const uint64_t SharedUserData = 0xfffff78000000000;
|
|||
#define KUSD_OFFSET_PRODUCT_TYPE 0x264
|
||||
|
||||
#define SYM_RESOLVE(base, r, s) ((s = pdb_resolve(base, r, #s)),\
|
||||
s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
|
||||
s ? printf(#s" = 0x%016"PRIx64"\n", s) :\
|
||||
eprintf("Failed to resolve "#s"\n"), s)
|
||||
|
||||
static uint64_t rol(uint64_t x, uint64_t y)
|
||||
{
|
||||
|
@ -98,8 +101,8 @@ static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
printf("[KiWaitNever] = 0x%016lx\n", kwn);
|
||||
printf("[KiWaitAlways] = 0x%016lx\n", kwa);
|
||||
printf("[KiWaitNever] = 0x%016"PRIx64"\n", kwn);
|
||||
printf("[KiWaitAlways] = 0x%016"PRIx64"\n", kwa);
|
||||
|
||||
/*
|
||||
* If KDBG header can be decoded, KDBG size is available
|
||||
|
@ -202,7 +205,7 @@ static int fix_dtb(struct va_space *vs, QEMU_Elf *qe)
|
|||
|
||||
if (is_system(s)) {
|
||||
va_space_set_dtb(vs, s->cr[3]);
|
||||
printf("DTB 0x%016lx has been found from CPU #%zu"
|
||||
printf("DTB 0x%016"PRIx64" has been found from CPU #%zu"
|
||||
" as system task CR3\n", vs->dtb, i);
|
||||
return !(va_space_resolve(vs, SharedUserData));
|
||||
}
|
||||
|
@ -222,7 +225,7 @@ static int fix_dtb(struct va_space *vs, QEMU_Elf *qe)
|
|||
}
|
||||
|
||||
va_space_set_dtb(vs, *cr3);
|
||||
printf("DirectoryTableBase = 0x%016lx has been found from CPU #0"
|
||||
printf("DirectoryTableBase = 0x%016"PRIx64" has been found from CPU #0"
|
||||
" as interrupt handling CR3\n", vs->dtb);
|
||||
return !(va_space_resolve(vs, SharedUserData));
|
||||
}
|
||||
|
@ -393,8 +396,8 @@ static int pe_get_pdb_symstore_hash(uint64_t base, void *start_addr,
|
|||
return 1;
|
||||
}
|
||||
|
||||
printf("Debug Directory RVA = 0x%016x\n",
|
||||
data_dir[IMAGE_FILE_DEBUG_DIRECTORY].VirtualAddress);
|
||||
printf("Debug Directory RVA = 0x%08"PRIx32"\n",
|
||||
(uint32_t)data_dir[IMAGE_FILE_DEBUG_DIRECTORY].VirtualAddress);
|
||||
|
||||
if (va_space_rw(vs,
|
||||
base + data_dir[IMAGE_FILE_DEBUG_DIRECTORY].VirtualAddress,
|
||||
|
@ -488,7 +491,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
state = qemu_elf.state[0];
|
||||
printf("CPU #0 CR3 is 0x%016lx\n", state->cr[3]);
|
||||
printf("CPU #0 CR3 is 0x%016"PRIx64"\n", state->cr[3]);
|
||||
|
||||
va_space_create(&vs, &ps, state->cr[3]);
|
||||
if (fix_dtb(&vs, &qemu_elf)) {
|
||||
|
@ -497,7 +500,7 @@ int main(int argc, char *argv[])
|
|||
goto out_elf;
|
||||
}
|
||||
|
||||
printf("CPU #0 IDT is at 0x%016lx\n", state->idt.base);
|
||||
printf("CPU #0 IDT is at 0x%016"PRIx64"\n", state->idt.base);
|
||||
|
||||
if (va_space_rw(&vs, state->idt.base,
|
||||
&first_idt_desc, sizeof(first_idt_desc), 0)) {
|
||||
|
@ -505,10 +508,10 @@ int main(int argc, char *argv[])
|
|||
err = 1;
|
||||
goto out_ps;
|
||||
}
|
||||
printf("CPU #0 IDT[0] -> 0x%016lx\n", idt_desc_addr(first_idt_desc));
|
||||
printf("CPU #0 IDT[0] -> 0x%016"PRIx64"\n", idt_desc_addr(first_idt_desc));
|
||||
|
||||
KernBase = idt_desc_addr(first_idt_desc) & ~(PAGE_SIZE - 1);
|
||||
printf("Searching kernel downwards from 0x%16lx...\n", KernBase);
|
||||
printf("Searching kernel downwards from 0x%016"PRIx64"...\n", KernBase);
|
||||
|
||||
for (; KernBase >= 0xfffff78000000000; KernBase -= PAGE_SIZE) {
|
||||
nt_start_addr = va_space_resolve(&vs, KernBase);
|
||||
|
@ -521,7 +524,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
printf("KernBase = 0x%16lx, signature is \'%.2s\'\n", KernBase,
|
||||
printf("KernBase = 0x%016"PRIx64", signature is \'%.2s\'\n", KernBase,
|
||||
(char *)nt_start_addr);
|
||||
|
||||
if (pe_get_pdb_symstore_hash(KernBase, nt_start_addr, pdb_hash, &vs)) {
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "pdb.h"
|
||||
#include "err.h"
|
||||
|
@ -66,7 +68,7 @@ uint64_t pdb_find_public_v3_symbol(struct pdb_reader *r, const char *name)
|
|||
uint32_t sect_rva = segment->dword[1];
|
||||
uint64_t rva = sect_rva + sym->public_v3.offset;
|
||||
|
||||
printf("%s: 0x%016x(%d:\'%.8s\') + 0x%08x = 0x%09lx\n", name,
|
||||
printf("%s: 0x%016x(%d:\'%.8s\') + 0x%08x = 0x%09"PRIx64"\n", name,
|
||||
sect_rva, sym->public_v3.segment,
|
||||
((char *)segment - 8), sym->public_v3.offset, rva);
|
||||
return rva;
|
||||
|
@ -277,28 +279,18 @@ static void pdb_reader_exit(struct pdb_reader *r)
|
|||
|
||||
int pdb_init_from_file(const char *name, struct pdb_reader *reader)
|
||||
{
|
||||
GError *gerr = NULL;
|
||||
int err = 0;
|
||||
int fd;
|
||||
void *map;
|
||||
struct stat st;
|
||||
|
||||
fd = open(name, O_RDONLY, 0);
|
||||
if (fd == -1) {
|
||||
eprintf("Failed to open PDB file \'%s\'\n", name);
|
||||
reader->gmf = g_mapped_file_new(name, TRUE, &gerr);
|
||||
if (gerr) {
|
||||
eprintf("Failed to map PDB file \'%s\'\n", name);
|
||||
return 1;
|
||||
}
|
||||
reader->fd = fd;
|
||||
|
||||
fstat(fd, &st);
|
||||
reader->file_size = st.st_size;
|
||||
|
||||
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (map == MAP_FAILED) {
|
||||
eprintf("Failed to map PDB file\n");
|
||||
err = 1;
|
||||
goto out_fd;
|
||||
}
|
||||
|
||||
reader->file_size = g_mapped_file_get_length(reader->gmf);
|
||||
map = g_mapped_file_get_contents(reader->gmf);
|
||||
if (pdb_reader_init(reader, map)) {
|
||||
err = 1;
|
||||
goto out_unmap;
|
||||
|
@ -307,16 +299,13 @@ int pdb_init_from_file(const char *name, struct pdb_reader *reader)
|
|||
return 0;
|
||||
|
||||
out_unmap:
|
||||
munmap(map, st.st_size);
|
||||
out_fd:
|
||||
close(fd);
|
||||
g_mapped_file_unref(reader->gmf);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void pdb_exit(struct pdb_reader *reader)
|
||||
{
|
||||
munmap(reader->ds.header, reader->file_size);
|
||||
close(reader->fd);
|
||||
g_mapped_file_unref(reader->gmf);
|
||||
pdb_reader_exit(reader);
|
||||
}
|
||||
|
|
|
@ -9,12 +9,14 @@
|
|||
#define PDB_H
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
typedef struct GUID {
|
||||
unsigned int Data1;
|
||||
unsigned short Data2;
|
||||
unsigned short Data3;
|
||||
unsigned char Data4[8];
|
||||
} GUID;
|
||||
#endif
|
||||
|
||||
struct PDB_FILE {
|
||||
uint32_t size;
|
||||
|
@ -216,7 +218,7 @@ typedef struct pdb_seg {
|
|||
#define IMAGE_FILE_MACHINE_AMD64 0x8664
|
||||
|
||||
struct pdb_reader {
|
||||
int fd;
|
||||
GMappedFile *gmf;
|
||||
size_t file_size;
|
||||
struct {
|
||||
PDB_DS_HEADER *header;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#define PE_H
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
typedef struct IMAGE_DOS_HEADER {
|
||||
uint16_t e_magic; /* 0x00: MZ Header signature */
|
||||
uint16_t e_cblp; /* 0x02: Bytes on last page of file */
|
||||
|
@ -87,8 +88,6 @@ typedef struct IMAGE_NT_HEADERS64 {
|
|||
IMAGE_OPTIONAL_HEADER64 OptionalHeader;
|
||||
} __attribute__ ((packed)) IMAGE_NT_HEADERS64;
|
||||
|
||||
#define IMAGE_FILE_DEBUG_DIRECTORY 6
|
||||
|
||||
typedef struct IMAGE_DEBUG_DIRECTORY {
|
||||
uint32_t Characteristics;
|
||||
uint32_t TimeDateStamp;
|
||||
|
@ -101,6 +100,9 @@ typedef struct IMAGE_DEBUG_DIRECTORY {
|
|||
} __attribute__ ((packed)) IMAGE_DEBUG_DIRECTORY;
|
||||
|
||||
#define IMAGE_DEBUG_TYPE_CODEVIEW 2
|
||||
#endif
|
||||
|
||||
#define IMAGE_FILE_DEBUG_DIRECTORY 6
|
||||
|
||||
typedef struct guid_t {
|
||||
uint32_t a;
|
||||
|
|
|
@ -120,25 +120,17 @@ static void exit_states(QEMU_Elf *qe)
|
|||
|
||||
int QEMU_Elf_init(QEMU_Elf *qe, const char *filename)
|
||||
{
|
||||
GError *gerr = NULL;
|
||||
int err = 0;
|
||||
struct stat st;
|
||||
|
||||
qe->fd = open(filename, O_RDONLY, 0);
|
||||
if (qe->fd == -1) {
|
||||
eprintf("Failed to open ELF dump file \'%s\'\n", filename);
|
||||
qe->gmf = g_mapped_file_new(filename, TRUE, &gerr);
|
||||
if (gerr) {
|
||||
eprintf("Failed to map ELF dump file \'%s\'\n", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fstat(qe->fd, &st);
|
||||
qe->size = st.st_size;
|
||||
|
||||
qe->map = mmap(NULL, qe->size, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE, qe->fd, 0);
|
||||
if (qe->map == MAP_FAILED) {
|
||||
eprintf("Failed to map ELF file\n");
|
||||
err = 1;
|
||||
goto out_fd;
|
||||
}
|
||||
qe->map = g_mapped_file_get_contents(qe->gmf);
|
||||
qe->size = g_mapped_file_get_length(qe->gmf);
|
||||
|
||||
if (init_states(qe)) {
|
||||
eprintf("Failed to extract QEMU CPU states\n");
|
||||
|
@ -149,9 +141,7 @@ int QEMU_Elf_init(QEMU_Elf *qe, const char *filename)
|
|||
return 0;
|
||||
|
||||
out_unmap:
|
||||
munmap(qe->map, qe->size);
|
||||
out_fd:
|
||||
close(qe->fd);
|
||||
g_mapped_file_unref(qe->gmf);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -159,6 +149,5 @@ out_fd:
|
|||
void QEMU_Elf_exit(QEMU_Elf *qe)
|
||||
{
|
||||
exit_states(qe);
|
||||
munmap(qe->map, qe->size);
|
||||
close(qe->fd);
|
||||
g_mapped_file_unref(qe->gmf);
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef QEMU_ELF_H
|
||||
#define QEMU_ELF_H
|
||||
#ifndef ELF2DMP_ELF_H
|
||||
#define ELF2DMP_ELF_H
|
||||
|
||||
#include <elf.h>
|
||||
#include "elf.h"
|
||||
|
||||
typedef struct QEMUCPUSegment {
|
||||
uint32_t selector;
|
||||
|
@ -33,7 +33,7 @@ typedef struct QEMUCPUState {
|
|||
int is_system(QEMUCPUState *s);
|
||||
|
||||
typedef struct QEMU_Elf {
|
||||
int fd;
|
||||
GMappedFile *gmf;
|
||||
size_t size;
|
||||
void *map;
|
||||
QEMUCPUState **state;
|
||||
|
@ -47,4 +47,4 @@ void QEMU_Elf_exit(QEMU_Elf *qe);
|
|||
Elf64_Phdr *elf64_getphdr(void *map);
|
||||
Elf64_Half elf_getphdrnum(void *map);
|
||||
|
||||
#endif /* QEMU_ELF_H */
|
||||
#endif /* ELF2DMP_ELF_H */
|
||||
|
|
2
cpus.c
2
cpus.c
|
@ -1778,7 +1778,7 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
|
|||
}
|
||||
cpu->thread_kicked = true;
|
||||
err = pthread_kill(cpu->thread->thread, SIG_IPI);
|
||||
if (err) {
|
||||
if (err && err != ESRCH) {
|
||||
fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));
|
||||
exit(1);
|
||||
}
|
||||
|
|
414
crypto/aes.c
414
crypto/aes.c
|
@ -1059,109 +1059,109 @@ const uint32_t AES_Td4[256] = {
|
|||
0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU,
|
||||
};
|
||||
static const u32 rcon[] = {
|
||||
0x01000000, 0x02000000, 0x04000000, 0x08000000,
|
||||
0x10000000, 0x20000000, 0x40000000, 0x80000000,
|
||||
0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
|
||||
0x01000000, 0x02000000, 0x04000000, 0x08000000,
|
||||
0x10000000, 0x20000000, 0x40000000, 0x80000000,
|
||||
0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
|
||||
};
|
||||
|
||||
/**
|
||||
* Expand the cipher key into the encryption key schedule.
|
||||
*/
|
||||
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key) {
|
||||
AES_KEY *key) {
|
||||
|
||||
u32 *rk;
|
||||
int i = 0;
|
||||
u32 temp;
|
||||
u32 *rk;
|
||||
int i = 0;
|
||||
u32 temp;
|
||||
|
||||
if (!userKey || !key)
|
||||
return -1;
|
||||
if (bits != 128 && bits != 192 && bits != 256)
|
||||
return -2;
|
||||
if (!userKey || !key)
|
||||
return -1;
|
||||
if (bits != 128 && bits != 192 && bits != 256)
|
||||
return -2;
|
||||
|
||||
rk = key->rd_key;
|
||||
rk = key->rd_key;
|
||||
|
||||
if (bits==128)
|
||||
key->rounds = 10;
|
||||
else if (bits==192)
|
||||
key->rounds = 12;
|
||||
else
|
||||
key->rounds = 14;
|
||||
if (bits==128)
|
||||
key->rounds = 10;
|
||||
else if (bits==192)
|
||||
key->rounds = 12;
|
||||
else
|
||||
key->rounds = 14;
|
||||
|
||||
rk[0] = GETU32(userKey );
|
||||
rk[1] = GETU32(userKey + 4);
|
||||
rk[2] = GETU32(userKey + 8);
|
||||
rk[3] = GETU32(userKey + 12);
|
||||
if (bits == 128) {
|
||||
while (1) {
|
||||
temp = rk[3];
|
||||
rk[4] = rk[0] ^
|
||||
rk[0] = GETU32(userKey );
|
||||
rk[1] = GETU32(userKey + 4);
|
||||
rk[2] = GETU32(userKey + 8);
|
||||
rk[3] = GETU32(userKey + 12);
|
||||
if (bits == 128) {
|
||||
while (1) {
|
||||
temp = rk[3];
|
||||
rk[4] = rk[0] ^
|
||||
(AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^
|
||||
(AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Te4[(temp >> 24) ] & 0x000000ff) ^
|
||||
rcon[i];
|
||||
rk[5] = rk[1] ^ rk[4];
|
||||
rk[6] = rk[2] ^ rk[5];
|
||||
rk[7] = rk[3] ^ rk[6];
|
||||
if (++i == 10) {
|
||||
return 0;
|
||||
}
|
||||
rk += 4;
|
||||
}
|
||||
}
|
||||
rk[4] = GETU32(userKey + 16);
|
||||
rk[5] = GETU32(userKey + 20);
|
||||
if (bits == 192) {
|
||||
while (1) {
|
||||
temp = rk[ 5];
|
||||
rk[ 6] = rk[ 0] ^
|
||||
rcon[i];
|
||||
rk[5] = rk[1] ^ rk[4];
|
||||
rk[6] = rk[2] ^ rk[5];
|
||||
rk[7] = rk[3] ^ rk[6];
|
||||
if (++i == 10) {
|
||||
return 0;
|
||||
}
|
||||
rk += 4;
|
||||
}
|
||||
}
|
||||
rk[4] = GETU32(userKey + 16);
|
||||
rk[5] = GETU32(userKey + 20);
|
||||
if (bits == 192) {
|
||||
while (1) {
|
||||
temp = rk[ 5];
|
||||
rk[ 6] = rk[ 0] ^
|
||||
(AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^
|
||||
(AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Te4[(temp >> 24) ] & 0x000000ff) ^
|
||||
rcon[i];
|
||||
rk[ 7] = rk[ 1] ^ rk[ 6];
|
||||
rk[ 8] = rk[ 2] ^ rk[ 7];
|
||||
rk[ 9] = rk[ 3] ^ rk[ 8];
|
||||
if (++i == 8) {
|
||||
return 0;
|
||||
}
|
||||
rk[10] = rk[ 4] ^ rk[ 9];
|
||||
rk[11] = rk[ 5] ^ rk[10];
|
||||
rk += 6;
|
||||
}
|
||||
}
|
||||
rk[6] = GETU32(userKey + 24);
|
||||
rk[7] = GETU32(userKey + 28);
|
||||
if (bits == 256) {
|
||||
while (1) {
|
||||
temp = rk[ 7];
|
||||
rk[ 8] = rk[ 0] ^
|
||||
rcon[i];
|
||||
rk[ 7] = rk[ 1] ^ rk[ 6];
|
||||
rk[ 8] = rk[ 2] ^ rk[ 7];
|
||||
rk[ 9] = rk[ 3] ^ rk[ 8];
|
||||
if (++i == 8) {
|
||||
return 0;
|
||||
}
|
||||
rk[10] = rk[ 4] ^ rk[ 9];
|
||||
rk[11] = rk[ 5] ^ rk[10];
|
||||
rk += 6;
|
||||
}
|
||||
}
|
||||
rk[6] = GETU32(userKey + 24);
|
||||
rk[7] = GETU32(userKey + 28);
|
||||
if (bits == 256) {
|
||||
while (1) {
|
||||
temp = rk[ 7];
|
||||
rk[ 8] = rk[ 0] ^
|
||||
(AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^
|
||||
(AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Te4[(temp >> 24) ] & 0x000000ff) ^
|
||||
rcon[i];
|
||||
rk[ 9] = rk[ 1] ^ rk[ 8];
|
||||
rk[10] = rk[ 2] ^ rk[ 9];
|
||||
rk[11] = rk[ 3] ^ rk[10];
|
||||
if (++i == 7) {
|
||||
return 0;
|
||||
}
|
||||
temp = rk[11];
|
||||
rk[12] = rk[ 4] ^
|
||||
rcon[i];
|
||||
rk[ 9] = rk[ 1] ^ rk[ 8];
|
||||
rk[10] = rk[ 2] ^ rk[ 9];
|
||||
rk[11] = rk[ 3] ^ rk[10];
|
||||
if (++i == 7) {
|
||||
return 0;
|
||||
}
|
||||
temp = rk[11];
|
||||
rk[12] = rk[ 4] ^
|
||||
(AES_Te4[(temp >> 24) ] & 0xff000000) ^
|
||||
(AES_Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Te4[(temp ) & 0xff] & 0x000000ff);
|
||||
rk[13] = rk[ 5] ^ rk[12];
|
||||
rk[14] = rk[ 6] ^ rk[13];
|
||||
rk[15] = rk[ 7] ^ rk[14];
|
||||
rk[13] = rk[ 5] ^ rk[12];
|
||||
rk[14] = rk[ 6] ^ rk[13];
|
||||
rk[15] = rk[ 7] ^ rk[14];
|
||||
|
||||
rk += 8;
|
||||
}
|
||||
}
|
||||
rk += 8;
|
||||
}
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
|
@ -1169,51 +1169,51 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
|||
* Expand the cipher key into the decryption key schedule.
|
||||
*/
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key) {
|
||||
AES_KEY *key) {
|
||||
|
||||
u32 *rk;
|
||||
int i, j, status;
|
||||
u32 temp;
|
||||
int i, j, status;
|
||||
u32 temp;
|
||||
|
||||
/* first, start with an encryption schedule */
|
||||
status = AES_set_encrypt_key(userKey, bits, key);
|
||||
if (status < 0)
|
||||
return status;
|
||||
/* first, start with an encryption schedule */
|
||||
status = AES_set_encrypt_key(userKey, bits, key);
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
rk = key->rd_key;
|
||||
rk = key->rd_key;
|
||||
|
||||
/* invert the order of the round keys: */
|
||||
for (i = 0, j = 4*(key->rounds); i < j; i += 4, j -= 4) {
|
||||
temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp;
|
||||
temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
|
||||
temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
|
||||
temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
|
||||
}
|
||||
/* apply the inverse MixColumn transform to all round keys but the first and the last: */
|
||||
for (i = 1; i < (key->rounds); i++) {
|
||||
rk += 4;
|
||||
rk[0] =
|
||||
/* invert the order of the round keys: */
|
||||
for (i = 0, j = 4*(key->rounds); i < j; i += 4, j -= 4) {
|
||||
temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp;
|
||||
temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
|
||||
temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
|
||||
temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
|
||||
}
|
||||
/* apply the inverse MixColumn transform to all round keys but the first and the last: */
|
||||
for (i = 1; i < (key->rounds); i++) {
|
||||
rk += 4;
|
||||
rk[0] =
|
||||
AES_Td0[AES_Te4[(rk[0] >> 24) ] & 0xff] ^
|
||||
AES_Td1[AES_Te4[(rk[0] >> 16) & 0xff] & 0xff] ^
|
||||
AES_Td2[AES_Te4[(rk[0] >> 8) & 0xff] & 0xff] ^
|
||||
AES_Td3[AES_Te4[(rk[0] ) & 0xff] & 0xff];
|
||||
rk[1] =
|
||||
rk[1] =
|
||||
AES_Td0[AES_Te4[(rk[1] >> 24) ] & 0xff] ^
|
||||
AES_Td1[AES_Te4[(rk[1] >> 16) & 0xff] & 0xff] ^
|
||||
AES_Td2[AES_Te4[(rk[1] >> 8) & 0xff] & 0xff] ^
|
||||
AES_Td3[AES_Te4[(rk[1] ) & 0xff] & 0xff];
|
||||
rk[2] =
|
||||
rk[2] =
|
||||
AES_Td0[AES_Te4[(rk[2] >> 24) ] & 0xff] ^
|
||||
AES_Td1[AES_Te4[(rk[2] >> 16) & 0xff] & 0xff] ^
|
||||
AES_Td2[AES_Te4[(rk[2] >> 8) & 0xff] & 0xff] ^
|
||||
AES_Td3[AES_Te4[(rk[2] ) & 0xff] & 0xff];
|
||||
rk[3] =
|
||||
rk[3] =
|
||||
AES_Td0[AES_Te4[(rk[3] >> 24) ] & 0xff] ^
|
||||
AES_Td1[AES_Te4[(rk[3] >> 16) & 0xff] & 0xff] ^
|
||||
AES_Td2[AES_Te4[(rk[3] >> 8) & 0xff] & 0xff] ^
|
||||
AES_Td3[AES_Te4[(rk[3] ) & 0xff] & 0xff];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef AES_ASM
|
||||
|
@ -1222,67 +1222,67 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
|||
* in and out can overlap
|
||||
*/
|
||||
void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key) {
|
||||
const AES_KEY *key) {
|
||||
|
||||
const u32 *rk;
|
||||
u32 s0, s1, s2, s3, t0, t1, t2, t3;
|
||||
const u32 *rk;
|
||||
u32 s0, s1, s2, s3, t0, t1, t2, t3;
|
||||
#ifndef FULL_UNROLL
|
||||
int r;
|
||||
int r;
|
||||
#endif /* ?FULL_UNROLL */
|
||||
|
||||
assert(in && out && key);
|
||||
rk = key->rd_key;
|
||||
assert(in && out && key);
|
||||
rk = key->rd_key;
|
||||
|
||||
/*
|
||||
* map byte array block to cipher state
|
||||
* and add initial round key:
|
||||
*/
|
||||
s0 = GETU32(in ) ^ rk[0];
|
||||
s1 = GETU32(in + 4) ^ rk[1];
|
||||
s2 = GETU32(in + 8) ^ rk[2];
|
||||
s3 = GETU32(in + 12) ^ rk[3];
|
||||
/*
|
||||
* map byte array block to cipher state
|
||||
* and add initial round key:
|
||||
*/
|
||||
s0 = GETU32(in ) ^ rk[0];
|
||||
s1 = GETU32(in + 4) ^ rk[1];
|
||||
s2 = GETU32(in + 8) ^ rk[2];
|
||||
s3 = GETU32(in + 12) ^ rk[3];
|
||||
#ifdef FULL_UNROLL
|
||||
/* round 1: */
|
||||
/* round 1: */
|
||||
t0 = AES_Te0[s0 >> 24] ^ AES_Te1[(s1 >> 16) & 0xff] ^ AES_Te2[(s2 >> 8) & 0xff] ^ AES_Te3[s3 & 0xff] ^ rk[ 4];
|
||||
t1 = AES_Te0[s1 >> 24] ^ AES_Te1[(s2 >> 16) & 0xff] ^ AES_Te2[(s3 >> 8) & 0xff] ^ AES_Te3[s0 & 0xff] ^ rk[ 5];
|
||||
t2 = AES_Te0[s2 >> 24] ^ AES_Te1[(s3 >> 16) & 0xff] ^ AES_Te2[(s0 >> 8) & 0xff] ^ AES_Te3[s1 & 0xff] ^ rk[ 6];
|
||||
t3 = AES_Te0[s3 >> 24] ^ AES_Te1[(s0 >> 16) & 0xff] ^ AES_Te2[(s1 >> 8) & 0xff] ^ AES_Te3[s2 & 0xff] ^ rk[ 7];
|
||||
/* round 2: */
|
||||
/* round 2: */
|
||||
s0 = AES_Te0[t0 >> 24] ^ AES_Te1[(t1 >> 16) & 0xff] ^ AES_Te2[(t2 >> 8) & 0xff] ^ AES_Te3[t3 & 0xff] ^ rk[ 8];
|
||||
s1 = AES_Te0[t1 >> 24] ^ AES_Te1[(t2 >> 16) & 0xff] ^ AES_Te2[(t3 >> 8) & 0xff] ^ AES_Te3[t0 & 0xff] ^ rk[ 9];
|
||||
s2 = AES_Te0[t2 >> 24] ^ AES_Te1[(t3 >> 16) & 0xff] ^ AES_Te2[(t0 >> 8) & 0xff] ^ AES_Te3[t1 & 0xff] ^ rk[10];
|
||||
s3 = AES_Te0[t3 >> 24] ^ AES_Te1[(t0 >> 16) & 0xff] ^ AES_Te2[(t1 >> 8) & 0xff] ^ AES_Te3[t2 & 0xff] ^ rk[11];
|
||||
/* round 3: */
|
||||
/* round 3: */
|
||||
t0 = AES_Te0[s0 >> 24] ^ AES_Te1[(s1 >> 16) & 0xff] ^ AES_Te2[(s2 >> 8) & 0xff] ^ AES_Te3[s3 & 0xff] ^ rk[12];
|
||||
t1 = AES_Te0[s1 >> 24] ^ AES_Te1[(s2 >> 16) & 0xff] ^ AES_Te2[(s3 >> 8) & 0xff] ^ AES_Te3[s0 & 0xff] ^ rk[13];
|
||||
t2 = AES_Te0[s2 >> 24] ^ AES_Te1[(s3 >> 16) & 0xff] ^ AES_Te2[(s0 >> 8) & 0xff] ^ AES_Te3[s1 & 0xff] ^ rk[14];
|
||||
t3 = AES_Te0[s3 >> 24] ^ AES_Te1[(s0 >> 16) & 0xff] ^ AES_Te2[(s1 >> 8) & 0xff] ^ AES_Te3[s2 & 0xff] ^ rk[15];
|
||||
/* round 4: */
|
||||
/* round 4: */
|
||||
s0 = AES_Te0[t0 >> 24] ^ AES_Te1[(t1 >> 16) & 0xff] ^ AES_Te2[(t2 >> 8) & 0xff] ^ AES_Te3[t3 & 0xff] ^ rk[16];
|
||||
s1 = AES_Te0[t1 >> 24] ^ AES_Te1[(t2 >> 16) & 0xff] ^ AES_Te2[(t3 >> 8) & 0xff] ^ AES_Te3[t0 & 0xff] ^ rk[17];
|
||||
s2 = AES_Te0[t2 >> 24] ^ AES_Te1[(t3 >> 16) & 0xff] ^ AES_Te2[(t0 >> 8) & 0xff] ^ AES_Te3[t1 & 0xff] ^ rk[18];
|
||||
s3 = AES_Te0[t3 >> 24] ^ AES_Te1[(t0 >> 16) & 0xff] ^ AES_Te2[(t1 >> 8) & 0xff] ^ AES_Te3[t2 & 0xff] ^ rk[19];
|
||||
/* round 5: */
|
||||
/* round 5: */
|
||||
t0 = AES_Te0[s0 >> 24] ^ AES_Te1[(s1 >> 16) & 0xff] ^ AES_Te2[(s2 >> 8) & 0xff] ^ AES_Te3[s3 & 0xff] ^ rk[20];
|
||||
t1 = AES_Te0[s1 >> 24] ^ AES_Te1[(s2 >> 16) & 0xff] ^ AES_Te2[(s3 >> 8) & 0xff] ^ AES_Te3[s0 & 0xff] ^ rk[21];
|
||||
t2 = AES_Te0[s2 >> 24] ^ AES_Te1[(s3 >> 16) & 0xff] ^ AES_Te2[(s0 >> 8) & 0xff] ^ AES_Te3[s1 & 0xff] ^ rk[22];
|
||||
t3 = AES_Te0[s3 >> 24] ^ AES_Te1[(s0 >> 16) & 0xff] ^ AES_Te2[(s1 >> 8) & 0xff] ^ AES_Te3[s2 & 0xff] ^ rk[23];
|
||||
/* round 6: */
|
||||
/* round 6: */
|
||||
s0 = AES_Te0[t0 >> 24] ^ AES_Te1[(t1 >> 16) & 0xff] ^ AES_Te2[(t2 >> 8) & 0xff] ^ AES_Te3[t3 & 0xff] ^ rk[24];
|
||||
s1 = AES_Te0[t1 >> 24] ^ AES_Te1[(t2 >> 16) & 0xff] ^ AES_Te2[(t3 >> 8) & 0xff] ^ AES_Te3[t0 & 0xff] ^ rk[25];
|
||||
s2 = AES_Te0[t2 >> 24] ^ AES_Te1[(t3 >> 16) & 0xff] ^ AES_Te2[(t0 >> 8) & 0xff] ^ AES_Te3[t1 & 0xff] ^ rk[26];
|
||||
s3 = AES_Te0[t3 >> 24] ^ AES_Te1[(t0 >> 16) & 0xff] ^ AES_Te2[(t1 >> 8) & 0xff] ^ AES_Te3[t2 & 0xff] ^ rk[27];
|
||||
/* round 7: */
|
||||
/* round 7: */
|
||||
t0 = AES_Te0[s0 >> 24] ^ AES_Te1[(s1 >> 16) & 0xff] ^ AES_Te2[(s2 >> 8) & 0xff] ^ AES_Te3[s3 & 0xff] ^ rk[28];
|
||||
t1 = AES_Te0[s1 >> 24] ^ AES_Te1[(s2 >> 16) & 0xff] ^ AES_Te2[(s3 >> 8) & 0xff] ^ AES_Te3[s0 & 0xff] ^ rk[29];
|
||||
t2 = AES_Te0[s2 >> 24] ^ AES_Te1[(s3 >> 16) & 0xff] ^ AES_Te2[(s0 >> 8) & 0xff] ^ AES_Te3[s1 & 0xff] ^ rk[30];
|
||||
t3 = AES_Te0[s3 >> 24] ^ AES_Te1[(s0 >> 16) & 0xff] ^ AES_Te2[(s1 >> 8) & 0xff] ^ AES_Te3[s2 & 0xff] ^ rk[31];
|
||||
/* round 8: */
|
||||
/* round 8: */
|
||||
s0 = AES_Te0[t0 >> 24] ^ AES_Te1[(t1 >> 16) & 0xff] ^ AES_Te2[(t2 >> 8) & 0xff] ^ AES_Te3[t3 & 0xff] ^ rk[32];
|
||||
s1 = AES_Te0[t1 >> 24] ^ AES_Te1[(t2 >> 16) & 0xff] ^ AES_Te2[(t3 >> 8) & 0xff] ^ AES_Te3[t0 & 0xff] ^ rk[33];
|
||||
s2 = AES_Te0[t2 >> 24] ^ AES_Te1[(t3 >> 16) & 0xff] ^ AES_Te2[(t0 >> 8) & 0xff] ^ AES_Te3[t1 & 0xff] ^ rk[34];
|
||||
s3 = AES_Te0[t3 >> 24] ^ AES_Te1[(t0 >> 16) & 0xff] ^ AES_Te2[(t1 >> 8) & 0xff] ^ AES_Te3[t2 & 0xff] ^ rk[35];
|
||||
/* round 9: */
|
||||
/* round 9: */
|
||||
t0 = AES_Te0[s0 >> 24] ^ AES_Te1[(s1 >> 16) & 0xff] ^ AES_Te2[(s2 >> 8) & 0xff] ^ AES_Te3[s3 & 0xff] ^ rk[36];
|
||||
t1 = AES_Te0[s1 >> 24] ^ AES_Te1[(s2 >> 16) & 0xff] ^ AES_Te2[(s3 >> 8) & 0xff] ^ AES_Te3[s0 & 0xff] ^ rk[37];
|
||||
t2 = AES_Te0[s2 >> 24] ^ AES_Te1[(s3 >> 16) & 0xff] ^ AES_Te2[(s0 >> 8) & 0xff] ^ AES_Te3[s1 & 0xff] ^ rk[38];
|
||||
|
@ -1375,37 +1375,37 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
|
|||
}
|
||||
#endif /* ?FULL_UNROLL */
|
||||
/*
|
||||
* apply last round and
|
||||
* map cipher state to byte array block:
|
||||
*/
|
||||
s0 =
|
||||
* apply last round and
|
||||
* map cipher state to byte array block:
|
||||
*/
|
||||
s0 =
|
||||
(AES_Te4[(t0 >> 24) ] & 0xff000000) ^
|
||||
(AES_Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Te4[(t2 >> 8) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Te4[(t3 ) & 0xff] & 0x000000ff) ^
|
||||
rk[0];
|
||||
PUTU32(out , s0);
|
||||
s1 =
|
||||
rk[0];
|
||||
PUTU32(out , s0);
|
||||
s1 =
|
||||
(AES_Te4[(t1 >> 24) ] & 0xff000000) ^
|
||||
(AES_Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Te4[(t3 >> 8) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Te4[(t0 ) & 0xff] & 0x000000ff) ^
|
||||
rk[1];
|
||||
PUTU32(out + 4, s1);
|
||||
s2 =
|
||||
rk[1];
|
||||
PUTU32(out + 4, s1);
|
||||
s2 =
|
||||
(AES_Te4[(t2 >> 24) ] & 0xff000000) ^
|
||||
(AES_Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Te4[(t0 >> 8) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Te4[(t1 ) & 0xff] & 0x000000ff) ^
|
||||
rk[2];
|
||||
PUTU32(out + 8, s2);
|
||||
s3 =
|
||||
rk[2];
|
||||
PUTU32(out + 8, s2);
|
||||
s3 =
|
||||
(AES_Te4[(t3 >> 24) ] & 0xff000000) ^
|
||||
(AES_Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Te4[(t1 >> 8) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Te4[(t2 ) & 0xff] & 0x000000ff) ^
|
||||
rk[3];
|
||||
PUTU32(out + 12, s3);
|
||||
rk[3];
|
||||
PUTU32(out + 12, s3);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1413,21 +1413,21 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
|
|||
* in and out can overlap
|
||||
*/
|
||||
void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key) {
|
||||
const AES_KEY *key) {
|
||||
|
||||
const u32 *rk;
|
||||
u32 s0, s1, s2, s3, t0, t1, t2, t3;
|
||||
const u32 *rk;
|
||||
u32 s0, s1, s2, s3, t0, t1, t2, t3;
|
||||
#ifndef FULL_UNROLL
|
||||
int r;
|
||||
int r;
|
||||
#endif /* ?FULL_UNROLL */
|
||||
|
||||
assert(in && out && key);
|
||||
rk = key->rd_key;
|
||||
assert(in && out && key);
|
||||
rk = key->rd_key;
|
||||
|
||||
/*
|
||||
* map byte array block to cipher state
|
||||
* and add initial round key:
|
||||
*/
|
||||
/*
|
||||
* map byte array block to cipher state
|
||||
* and add initial round key:
|
||||
*/
|
||||
s0 = GETU32(in ) ^ rk[0];
|
||||
s1 = GETU32(in + 4) ^ rk[1];
|
||||
s2 = GETU32(in + 8) ^ rk[2];
|
||||
|
@ -1502,7 +1502,7 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
|
|||
t3 = AES_Td0[s3 >> 24] ^ AES_Td1[(s2 >> 16) & 0xff] ^ AES_Td2[(s1 >> 8) & 0xff] ^ AES_Td3[s0 & 0xff] ^ rk[55];
|
||||
}
|
||||
}
|
||||
rk += key->rounds << 2;
|
||||
rk += key->rounds << 2;
|
||||
#else /* !FULL_UNROLL */
|
||||
/*
|
||||
* Nr - 1 full rounds:
|
||||
|
@ -1566,88 +1566,88 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
|
|||
}
|
||||
#endif /* ?FULL_UNROLL */
|
||||
/*
|
||||
* apply last round and
|
||||
* map cipher state to byte array block:
|
||||
*/
|
||||
s0 =
|
||||
* apply last round and
|
||||
* map cipher state to byte array block:
|
||||
*/
|
||||
s0 =
|
||||
(AES_Td4[(t0 >> 24) ] & 0xff000000) ^
|
||||
(AES_Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Td4[(t1 ) & 0xff] & 0x000000ff) ^
|
||||
rk[0];
|
||||
PUTU32(out , s0);
|
||||
s1 =
|
||||
rk[0];
|
||||
PUTU32(out , s0);
|
||||
s1 =
|
||||
(AES_Td4[(t1 >> 24) ] & 0xff000000) ^
|
||||
(AES_Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Td4[(t2 ) & 0xff] & 0x000000ff) ^
|
||||
rk[1];
|
||||
PUTU32(out + 4, s1);
|
||||
s2 =
|
||||
rk[1];
|
||||
PUTU32(out + 4, s1);
|
||||
s2 =
|
||||
(AES_Td4[(t2 >> 24) ] & 0xff000000) ^
|
||||
(AES_Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Td4[(t3 ) & 0xff] & 0x000000ff) ^
|
||||
rk[2];
|
||||
PUTU32(out + 8, s2);
|
||||
s3 =
|
||||
rk[2];
|
||||
PUTU32(out + 8, s2);
|
||||
s3 =
|
||||
(AES_Td4[(t3 >> 24) ] & 0xff000000) ^
|
||||
(AES_Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
|
||||
(AES_Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^
|
||||
(AES_Td4[(t0 ) & 0xff] & 0x000000ff) ^
|
||||
rk[3];
|
||||
PUTU32(out + 12, s3);
|
||||
rk[3];
|
||||
PUTU32(out + 12, s3);
|
||||
}
|
||||
|
||||
#endif /* AES_ASM */
|
||||
|
||||
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc)
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc)
|
||||
{
|
||||
|
||||
unsigned long n;
|
||||
unsigned long len = length;
|
||||
unsigned char tmp[AES_BLOCK_SIZE];
|
||||
unsigned long n;
|
||||
unsigned long len = length;
|
||||
unsigned char tmp[AES_BLOCK_SIZE];
|
||||
|
||||
assert(in && out && key && ivec);
|
||||
assert(in && out && key && ivec);
|
||||
|
||||
if (enc) {
|
||||
while (len >= AES_BLOCK_SIZE) {
|
||||
for(n=0; n < AES_BLOCK_SIZE; ++n)
|
||||
tmp[n] = in[n] ^ ivec[n];
|
||||
AES_encrypt(tmp, out, key);
|
||||
memcpy(ivec, out, AES_BLOCK_SIZE);
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
if (len) {
|
||||
for(n=0; n < len; ++n)
|
||||
tmp[n] = in[n] ^ ivec[n];
|
||||
for(n=len; n < AES_BLOCK_SIZE; ++n)
|
||||
tmp[n] = ivec[n];
|
||||
AES_encrypt(tmp, tmp, key);
|
||||
memcpy(out, tmp, AES_BLOCK_SIZE);
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
} else {
|
||||
while (len >= AES_BLOCK_SIZE) {
|
||||
memcpy(tmp, in, AES_BLOCK_SIZE);
|
||||
AES_decrypt(in, out, key);
|
||||
for(n=0; n < AES_BLOCK_SIZE; ++n)
|
||||
out[n] ^= ivec[n];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
if (len) {
|
||||
memcpy(tmp, in, AES_BLOCK_SIZE);
|
||||
AES_decrypt(tmp, tmp, key);
|
||||
for(n=0; n < len; ++n)
|
||||
out[n] = tmp[n] ^ ivec[n];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
if (enc) {
|
||||
while (len >= AES_BLOCK_SIZE) {
|
||||
for(n=0; n < AES_BLOCK_SIZE; ++n)
|
||||
tmp[n] = in[n] ^ ivec[n];
|
||||
AES_encrypt(tmp, out, key);
|
||||
memcpy(ivec, out, AES_BLOCK_SIZE);
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
if (len) {
|
||||
for(n=0; n < len; ++n)
|
||||
tmp[n] = in[n] ^ ivec[n];
|
||||
for(n=len; n < AES_BLOCK_SIZE; ++n)
|
||||
tmp[n] = ivec[n];
|
||||
AES_encrypt(tmp, tmp, key);
|
||||
memcpy(out, tmp, AES_BLOCK_SIZE);
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
} else {
|
||||
while (len >= AES_BLOCK_SIZE) {
|
||||
memcpy(tmp, in, AES_BLOCK_SIZE);
|
||||
AES_decrypt(in, out, key);
|
||||
for(n=0; n < AES_BLOCK_SIZE; ++n)
|
||||
out[n] ^= ivec[n];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
if (len) {
|
||||
memcpy(tmp, in, AES_BLOCK_SIZE);
|
||||
AES_decrypt(tmp, tmp, key);
|
||||
for(n=0; n < len; ++n)
|
||||
out[n] = tmp[n] ^ ivec[n];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
584
crypto/desrfb.c
584
crypto/desrfb.c
|
@ -37,353 +37,353 @@ static void cookey(unsigned long *);
|
|||
static unsigned long KnL[32] = { 0L };
|
||||
|
||||
static const unsigned short bytebit[8] = {
|
||||
01, 02, 04, 010, 020, 040, 0100, 0200 };
|
||||
01, 02, 04, 010, 020, 040, 0100, 0200 };
|
||||
|
||||
static const unsigned long bigbyte[24] = {
|
||||
0x800000L, 0x400000L, 0x200000L, 0x100000L,
|
||||
0x80000L, 0x40000L, 0x20000L, 0x10000L,
|
||||
0x8000L, 0x4000L, 0x2000L, 0x1000L,
|
||||
0x800L, 0x400L, 0x200L, 0x100L,
|
||||
0x80L, 0x40L, 0x20L, 0x10L,
|
||||
0x8L, 0x4L, 0x2L, 0x1L };
|
||||
0x800000L, 0x400000L, 0x200000L, 0x100000L,
|
||||
0x80000L, 0x40000L, 0x20000L, 0x10000L,
|
||||
0x8000L, 0x4000L, 0x2000L, 0x1000L,
|
||||
0x800L, 0x400L, 0x200L, 0x100L,
|
||||
0x80L, 0x40L, 0x20L, 0x10L,
|
||||
0x8L, 0x4L, 0x2L, 0x1L };
|
||||
|
||||
/* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
|
||||
|
||||
static const unsigned char pc1[56] = {
|
||||
56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,
|
||||
9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,
|
||||
62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,
|
||||
13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 };
|
||||
56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,
|
||||
9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,
|
||||
62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,
|
||||
13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 };
|
||||
|
||||
static const unsigned char totrot[16] = {
|
||||
1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
|
||||
1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
|
||||
|
||||
static const unsigned char pc2[48] = {
|
||||
13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
|
||||
22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,
|
||||
40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
|
||||
43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
|
||||
13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
|
||||
22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,
|
||||
40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
|
||||
43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
|
||||
|
||||
/* Thanks to James Gillogly & Phil Karn! */
|
||||
void deskey(unsigned char *key, int edf)
|
||||
{
|
||||
register int i, j, l, m, n;
|
||||
unsigned char pc1m[56], pcr[56];
|
||||
unsigned long kn[32];
|
||||
register int i, j, l, m, n;
|
||||
unsigned char pc1m[56], pcr[56];
|
||||
unsigned long kn[32];
|
||||
|
||||
for ( j = 0; j < 56; j++ ) {
|
||||
l = pc1[j];
|
||||
m = l & 07;
|
||||
pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
|
||||
}
|
||||
for( i = 0; i < 16; i++ ) {
|
||||
if( edf == DE1 ) m = (15 - i) << 1;
|
||||
else m = i << 1;
|
||||
n = m + 1;
|
||||
kn[m] = kn[n] = 0L;
|
||||
for( j = 0; j < 28; j++ ) {
|
||||
l = j + totrot[i];
|
||||
if( l < 28 ) pcr[j] = pc1m[l];
|
||||
else pcr[j] = pc1m[l - 28];
|
||||
}
|
||||
for( j = 28; j < 56; j++ ) {
|
||||
l = j + totrot[i];
|
||||
if( l < 56 ) pcr[j] = pc1m[l];
|
||||
else pcr[j] = pc1m[l - 28];
|
||||
}
|
||||
for( j = 0; j < 24; j++ ) {
|
||||
if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
|
||||
if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
|
||||
}
|
||||
}
|
||||
cookey(kn);
|
||||
return;
|
||||
}
|
||||
for ( j = 0; j < 56; j++ ) {
|
||||
l = pc1[j];
|
||||
m = l & 07;
|
||||
pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
|
||||
}
|
||||
for( i = 0; i < 16; i++ ) {
|
||||
if( edf == DE1 ) m = (15 - i) << 1;
|
||||
else m = i << 1;
|
||||
n = m + 1;
|
||||
kn[m] = kn[n] = 0L;
|
||||
for( j = 0; j < 28; j++ ) {
|
||||
l = j + totrot[i];
|
||||
if( l < 28 ) pcr[j] = pc1m[l];
|
||||
else pcr[j] = pc1m[l - 28];
|
||||
}
|
||||
for( j = 28; j < 56; j++ ) {
|
||||
l = j + totrot[i];
|
||||
if( l < 56 ) pcr[j] = pc1m[l];
|
||||
else pcr[j] = pc1m[l - 28];
|
||||
}
|
||||
for( j = 0; j < 24; j++ ) {
|
||||
if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
|
||||
if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
|
||||
}
|
||||
}
|
||||
cookey(kn);
|
||||
return;
|
||||
}
|
||||
|
||||
static void cookey(register unsigned long *raw1)
|
||||
{
|
||||
register unsigned long *cook, *raw0;
|
||||
unsigned long dough[32];
|
||||
register int i;
|
||||
register unsigned long *cook, *raw0;
|
||||
unsigned long dough[32];
|
||||
register int i;
|
||||
|
||||
cook = dough;
|
||||
for( i = 0; i < 16; i++, raw1++ ) {
|
||||
raw0 = raw1++;
|
||||
*cook = (*raw0 & 0x00fc0000L) << 6;
|
||||
*cook |= (*raw0 & 0x00000fc0L) << 10;
|
||||
*cook |= (*raw1 & 0x00fc0000L) >> 10;
|
||||
*cook++ |= (*raw1 & 0x00000fc0L) >> 6;
|
||||
*cook = (*raw0 & 0x0003f000L) << 12;
|
||||
*cook |= (*raw0 & 0x0000003fL) << 16;
|
||||
*cook |= (*raw1 & 0x0003f000L) >> 4;
|
||||
*cook++ |= (*raw1 & 0x0000003fL);
|
||||
}
|
||||
usekey(dough);
|
||||
return;
|
||||
}
|
||||
cook = dough;
|
||||
for( i = 0; i < 16; i++, raw1++ ) {
|
||||
raw0 = raw1++;
|
||||
*cook = (*raw0 & 0x00fc0000L) << 6;
|
||||
*cook |= (*raw0 & 0x00000fc0L) << 10;
|
||||
*cook |= (*raw1 & 0x00fc0000L) >> 10;
|
||||
*cook++ |= (*raw1 & 0x00000fc0L) >> 6;
|
||||
*cook = (*raw0 & 0x0003f000L) << 12;
|
||||
*cook |= (*raw0 & 0x0000003fL) << 16;
|
||||
*cook |= (*raw1 & 0x0003f000L) >> 4;
|
||||
*cook++ |= (*raw1 & 0x0000003fL);
|
||||
}
|
||||
usekey(dough);
|
||||
return;
|
||||
}
|
||||
|
||||
void usekey(register unsigned long *from)
|
||||
{
|
||||
register unsigned long *to, *endp;
|
||||
register unsigned long *to, *endp;
|
||||
|
||||
to = KnL, endp = &KnL[32];
|
||||
while( to < endp ) *to++ = *from++;
|
||||
return;
|
||||
}
|
||||
to = KnL, endp = &KnL[32];
|
||||
while( to < endp ) *to++ = *from++;
|
||||
return;
|
||||
}
|
||||
|
||||
void des(unsigned char *inblock, unsigned char *outblock)
|
||||
{
|
||||
unsigned long work[2];
|
||||
unsigned long work[2];
|
||||
|
||||
scrunch(inblock, work);
|
||||
desfunc(work, KnL);
|
||||
unscrun(work, outblock);
|
||||
return;
|
||||
}
|
||||
scrunch(inblock, work);
|
||||
desfunc(work, KnL);
|
||||
unscrun(work, outblock);
|
||||
return;
|
||||
}
|
||||
|
||||
static void scrunch(register unsigned char *outof, register unsigned long *into)
|
||||
{
|
||||
*into = (*outof++ & 0xffL) << 24;
|
||||
*into |= (*outof++ & 0xffL) << 16;
|
||||
*into |= (*outof++ & 0xffL) << 8;
|
||||
*into++ |= (*outof++ & 0xffL);
|
||||
*into = (*outof++ & 0xffL) << 24;
|
||||
*into |= (*outof++ & 0xffL) << 16;
|
||||
*into |= (*outof++ & 0xffL) << 8;
|
||||
*into |= (*outof & 0xffL);
|
||||
return;
|
||||
}
|
||||
*into = (*outof++ & 0xffL) << 24;
|
||||
*into |= (*outof++ & 0xffL) << 16;
|
||||
*into |= (*outof++ & 0xffL) << 8;
|
||||
*into++ |= (*outof++ & 0xffL);
|
||||
*into = (*outof++ & 0xffL) << 24;
|
||||
*into |= (*outof++ & 0xffL) << 16;
|
||||
*into |= (*outof++ & 0xffL) << 8;
|
||||
*into |= (*outof & 0xffL);
|
||||
return;
|
||||
}
|
||||
|
||||
static void unscrun(register unsigned long *outof, register unsigned char *into)
|
||||
{
|
||||
*into++ = (unsigned char)((*outof >> 24) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 16) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 8) & 0xffL);
|
||||
*into++ = (unsigned char)(*outof++ & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 24) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 16) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 8) & 0xffL);
|
||||
*into = (unsigned char)(*outof & 0xffL);
|
||||
return;
|
||||
}
|
||||
*into++ = (unsigned char)((*outof >> 24) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 16) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 8) & 0xffL);
|
||||
*into++ = (unsigned char)(*outof++ & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 24) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 16) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 8) & 0xffL);
|
||||
*into = (unsigned char)(*outof & 0xffL);
|
||||
return;
|
||||
}
|
||||
|
||||
static const unsigned long SP1[64] = {
|
||||
0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
|
||||
0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
|
||||
0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
|
||||
0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
|
||||
0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
|
||||
0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
|
||||
0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
|
||||
0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
|
||||
0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
|
||||
0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
|
||||
0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
|
||||
0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
|
||||
0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
|
||||
0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
|
||||
0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
|
||||
0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
|
||||
0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
|
||||
0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
|
||||
0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
|
||||
0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
|
||||
0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
|
||||
0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
|
||||
0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
|
||||
0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
|
||||
0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
|
||||
0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
|
||||
0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
|
||||
0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
|
||||
0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
|
||||
0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
|
||||
0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
|
||||
0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
|
||||
|
||||
static const unsigned long SP2[64] = {
|
||||
0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
|
||||
0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
|
||||
0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
|
||||
0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
|
||||
0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
|
||||
0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
|
||||
0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
|
||||
0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
|
||||
0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
|
||||
0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
|
||||
0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
|
||||
0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
|
||||
0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
|
||||
0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
|
||||
0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
|
||||
0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
|
||||
0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
|
||||
0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
|
||||
0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
|
||||
0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
|
||||
0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
|
||||
0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
|
||||
0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
|
||||
0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
|
||||
0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
|
||||
0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
|
||||
0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
|
||||
0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
|
||||
0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
|
||||
0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
|
||||
0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
|
||||
0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
|
||||
|
||||
static const unsigned long SP3[64] = {
|
||||
0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
|
||||
0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
|
||||
0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
|
||||
0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
|
||||
0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
|
||||
0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
|
||||
0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
|
||||
0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
|
||||
0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
|
||||
0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
|
||||
0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
|
||||
0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
|
||||
0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
|
||||
0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
|
||||
0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
|
||||
0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
|
||||
0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
|
||||
0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
|
||||
0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
|
||||
0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
|
||||
0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
|
||||
0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
|
||||
0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
|
||||
0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
|
||||
0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
|
||||
0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
|
||||
0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
|
||||
0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
|
||||
0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
|
||||
0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
|
||||
0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
|
||||
0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
|
||||
|
||||
static const unsigned long SP4[64] = {
|
||||
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
|
||||
0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
|
||||
0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
|
||||
0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
|
||||
0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
|
||||
0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
|
||||
0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
|
||||
0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
|
||||
0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
|
||||
0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
|
||||
0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
|
||||
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
|
||||
0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
|
||||
0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
|
||||
0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
|
||||
0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
|
||||
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
|
||||
0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
|
||||
0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
|
||||
0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
|
||||
0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
|
||||
0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
|
||||
0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
|
||||
0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
|
||||
0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
|
||||
0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
|
||||
0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
|
||||
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
|
||||
0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
|
||||
0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
|
||||
0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
|
||||
0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
|
||||
|
||||
static const unsigned long SP5[64] = {
|
||||
0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
|
||||
0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
|
||||
0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
|
||||
0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
|
||||
0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
|
||||
0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
|
||||
0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
|
||||
0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
|
||||
0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
|
||||
0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
|
||||
0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
|
||||
0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
|
||||
0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
|
||||
0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
|
||||
0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
|
||||
0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
|
||||
0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
|
||||
0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
|
||||
0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
|
||||
0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
|
||||
0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
|
||||
0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
|
||||
0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
|
||||
0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
|
||||
0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
|
||||
0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
|
||||
0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
|
||||
0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
|
||||
0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
|
||||
0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
|
||||
0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
|
||||
0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
|
||||
|
||||
static const unsigned long SP6[64] = {
|
||||
0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
|
||||
0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
|
||||
0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
|
||||
0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
|
||||
0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
|
||||
0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
|
||||
0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
|
||||
0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
|
||||
0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
|
||||
0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
|
||||
0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
|
||||
0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
|
||||
0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
|
||||
0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
|
||||
0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
|
||||
0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
|
||||
0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
|
||||
0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
|
||||
0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
|
||||
0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
|
||||
0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
|
||||
0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
|
||||
0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
|
||||
0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
|
||||
0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
|
||||
0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
|
||||
0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
|
||||
0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
|
||||
0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
|
||||
0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
|
||||
0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
|
||||
0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
|
||||
|
||||
static const unsigned long SP7[64] = {
|
||||
0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
|
||||
0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
|
||||
0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
|
||||
0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
|
||||
0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
|
||||
0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
|
||||
0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
|
||||
0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
|
||||
0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
|
||||
0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
|
||||
0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
|
||||
0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
|
||||
0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
|
||||
0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
|
||||
0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
|
||||
0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
|
||||
0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
|
||||
0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
|
||||
0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
|
||||
0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
|
||||
0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
|
||||
0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
|
||||
0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
|
||||
0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
|
||||
0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
|
||||
0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
|
||||
0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
|
||||
0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
|
||||
0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
|
||||
0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
|
||||
0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
|
||||
0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
|
||||
|
||||
static const unsigned long SP8[64] = {
|
||||
0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
|
||||
0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
|
||||
0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
|
||||
0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
|
||||
0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
|
||||
0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
|
||||
0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
|
||||
0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
|
||||
0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
|
||||
0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
|
||||
0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
|
||||
0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
|
||||
0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
|
||||
0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
|
||||
0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
|
||||
0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
|
||||
0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
|
||||
0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
|
||||
0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
|
||||
0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
|
||||
0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
|
||||
0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
|
||||
0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
|
||||
0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
|
||||
0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
|
||||
0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
|
||||
0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
|
||||
0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
|
||||
0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
|
||||
0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
|
||||
0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
|
||||
0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
|
||||
|
||||
static void desfunc(register unsigned long *block, register unsigned long *keys)
|
||||
{
|
||||
register unsigned long fval, work, right, leftt;
|
||||
register int round;
|
||||
register unsigned long fval, work, right, leftt;
|
||||
register int round;
|
||||
|
||||
leftt = block[0];
|
||||
right = block[1];
|
||||
work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 4);
|
||||
work = ((leftt >> 16) ^ right) & 0x0000ffffL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 16);
|
||||
work = ((right >> 2) ^ leftt) & 0x33333333L;
|
||||
leftt ^= work;
|
||||
right ^= (work << 2);
|
||||
work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 8);
|
||||
right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
|
||||
work = (leftt ^ right) & 0xaaaaaaaaL;
|
||||
leftt ^= work;
|
||||
right ^= work;
|
||||
leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
|
||||
leftt = block[0];
|
||||
right = block[1];
|
||||
work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 4);
|
||||
work = ((leftt >> 16) ^ right) & 0x0000ffffL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 16);
|
||||
work = ((right >> 2) ^ leftt) & 0x33333333L;
|
||||
leftt ^= work;
|
||||
right ^= (work << 2);
|
||||
work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 8);
|
||||
right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
|
||||
work = (leftt ^ right) & 0xaaaaaaaaL;
|
||||
leftt ^= work;
|
||||
right ^= work;
|
||||
leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
|
||||
|
||||
for( round = 0; round < 8; round++ ) {
|
||||
work = (right << 28) | (right >> 4);
|
||||
work ^= *keys++;
|
||||
fval = SP7[ work & 0x3fL];
|
||||
fval |= SP5[(work >> 8) & 0x3fL];
|
||||
fval |= SP3[(work >> 16) & 0x3fL];
|
||||
fval |= SP1[(work >> 24) & 0x3fL];
|
||||
work = right ^ *keys++;
|
||||
fval |= SP8[ work & 0x3fL];
|
||||
fval |= SP6[(work >> 8) & 0x3fL];
|
||||
fval |= SP4[(work >> 16) & 0x3fL];
|
||||
fval |= SP2[(work >> 24) & 0x3fL];
|
||||
leftt ^= fval;
|
||||
work = (leftt << 28) | (leftt >> 4);
|
||||
work ^= *keys++;
|
||||
fval = SP7[ work & 0x3fL];
|
||||
fval |= SP5[(work >> 8) & 0x3fL];
|
||||
fval |= SP3[(work >> 16) & 0x3fL];
|
||||
fval |= SP1[(work >> 24) & 0x3fL];
|
||||
work = leftt ^ *keys++;
|
||||
fval |= SP8[ work & 0x3fL];
|
||||
fval |= SP6[(work >> 8) & 0x3fL];
|
||||
fval |= SP4[(work >> 16) & 0x3fL];
|
||||
fval |= SP2[(work >> 24) & 0x3fL];
|
||||
right ^= fval;
|
||||
}
|
||||
for( round = 0; round < 8; round++ ) {
|
||||
work = (right << 28) | (right >> 4);
|
||||
work ^= *keys++;
|
||||
fval = SP7[ work & 0x3fL];
|
||||
fval |= SP5[(work >> 8) & 0x3fL];
|
||||
fval |= SP3[(work >> 16) & 0x3fL];
|
||||
fval |= SP1[(work >> 24) & 0x3fL];
|
||||
work = right ^ *keys++;
|
||||
fval |= SP8[ work & 0x3fL];
|
||||
fval |= SP6[(work >> 8) & 0x3fL];
|
||||
fval |= SP4[(work >> 16) & 0x3fL];
|
||||
fval |= SP2[(work >> 24) & 0x3fL];
|
||||
leftt ^= fval;
|
||||
work = (leftt << 28) | (leftt >> 4);
|
||||
work ^= *keys++;
|
||||
fval = SP7[ work & 0x3fL];
|
||||
fval |= SP5[(work >> 8) & 0x3fL];
|
||||
fval |= SP3[(work >> 16) & 0x3fL];
|
||||
fval |= SP1[(work >> 24) & 0x3fL];
|
||||
work = leftt ^ *keys++;
|
||||
fval |= SP8[ work & 0x3fL];
|
||||
fval |= SP6[(work >> 8) & 0x3fL];
|
||||
fval |= SP4[(work >> 16) & 0x3fL];
|
||||
fval |= SP2[(work >> 24) & 0x3fL];
|
||||
right ^= fval;
|
||||
}
|
||||
|
||||
right = (right << 31) | (right >> 1);
|
||||
work = (leftt ^ right) & 0xaaaaaaaaL;
|
||||
leftt ^= work;
|
||||
right ^= work;
|
||||
leftt = (leftt << 31) | (leftt >> 1);
|
||||
work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 8);
|
||||
work = ((leftt >> 2) ^ right) & 0x33333333L;
|
||||
right ^= work;
|
||||
leftt ^= (work << 2);
|
||||
work = ((right >> 16) ^ leftt) & 0x0000ffffL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 16);
|
||||
work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 4);
|
||||
*block++ = right;
|
||||
*block = leftt;
|
||||
return;
|
||||
}
|
||||
right = (right << 31) | (right >> 1);
|
||||
work = (leftt ^ right) & 0xaaaaaaaaL;
|
||||
leftt ^= work;
|
||||
right ^= work;
|
||||
leftt = (leftt << 31) | (leftt >> 1);
|
||||
work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 8);
|
||||
work = ((leftt >> 2) ^ right) & 0x33333333L;
|
||||
right ^= work;
|
||||
leftt ^= (work << 2);
|
||||
work = ((right >> 16) ^ leftt) & 0x0000ffffL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 16);
|
||||
work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 4);
|
||||
*block++ = right;
|
||||
*block = leftt;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Validation sets:
|
||||
*
|
||||
|
|
|
@ -19,3 +19,4 @@ CONFIG_I8259=y
|
|||
CONFIG_MC146818RTC=y
|
||||
CONFIG_ISA_TESTDEV=y
|
||||
CONFIG_SMC37C669=y
|
||||
CONFIG_DP264=y
|
||||
|
|
|
@ -6,7 +6,6 @@ CONFIG_VGA=y
|
|||
CONFIG_NAND=y
|
||||
CONFIG_ECC=y
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_SERIAL_ISA=y
|
||||
CONFIG_PTIMER=y
|
||||
CONFIG_SD=y
|
||||
CONFIG_MAX7310=y
|
||||
|
@ -124,7 +123,9 @@ CONFIG_VERSATILE=y
|
|||
CONFIG_VERSATILE_PCI=y
|
||||
CONFIG_VERSATILE_I2C=y
|
||||
|
||||
CONFIG_PCI_GENERIC=y
|
||||
CONFIG_PCI_EXPRESS_GENERIC_BRIDGE=y
|
||||
CONFIG_VFIO=$(CONFIG_LINUX)
|
||||
CONFIG_VFIO_PLATFORM=y
|
||||
CONFIG_VFIO_XGMAC=y
|
||||
CONFIG_VFIO_AMD_XGBE=y
|
||||
|
||||
|
@ -149,13 +150,15 @@ CONFIG_XIO3130=y
|
|||
CONFIG_IOH3420=y
|
||||
CONFIG_I82801B11=y
|
||||
CONFIG_ACPI=y
|
||||
CONFIG_ARM_VIRT=y
|
||||
CONFIG_SMBIOS=y
|
||||
CONFIG_ASPEED_SOC=y
|
||||
CONFIG_SMBUS_EEPROM=y
|
||||
CONFIG_GPIO_KEY=y
|
||||
CONFIG_MSF2=y
|
||||
CONFIG_FW_CFG_DMA=y
|
||||
CONFIG_XILINX_AXI=y
|
||||
CONFIG_PCI_DESIGNWARE=y
|
||||
CONFIG_PCI_EXPRESS_DESIGNWARE=y
|
||||
|
||||
CONFIG_STRONGARM=y
|
||||
CONFIG_HIGHBANK=y
|
||||
|
|
|
@ -4,3 +4,4 @@ CONFIG_ETRAXFS=y
|
|||
CONFIG_NAND=y
|
||||
CONFIG_PTIMER=y
|
||||
CONFIG_PFLASH_CFI02=y
|
||||
CONFIG_AXIS=y
|
||||
|
|
|
@ -10,3 +10,4 @@ CONFIG_IDE_CMD646=y
|
|||
# CONFIG_IDE_MMIO=y
|
||||
CONFIG_VIRTIO_VGA=y
|
||||
CONFIG_MC146818RTC=y
|
||||
CONFIG_DINO=y
|
||||
|
|
|
@ -47,7 +47,7 @@ CONFIG_ISA_TESTDEV=y
|
|||
CONFIG_VMPORT=y
|
||||
CONFIG_SGA=y
|
||||
CONFIG_LPC_ICH9=y
|
||||
CONFIG_PCI_Q35=y
|
||||
CONFIG_PCI_EXPRESS_Q35=y
|
||||
CONFIG_APIC=y
|
||||
CONFIG_IOAPIC=y
|
||||
CONFIG_PVPANIC=y
|
||||
|
@ -62,8 +62,13 @@ CONFIG_I82801B11=y
|
|||
CONFIG_SMBIOS=y
|
||||
CONFIG_PXB=y
|
||||
CONFIG_ACPI_VMGENID=y
|
||||
CONFIG_ACPI_SMBUS=y
|
||||
CONFIG_SMBUS_EEPROM=y
|
||||
CONFIG_FW_CFG_DMA=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_SEV=$(CONFIG_KVM)
|
||||
CONFIG_VTD=y
|
||||
CONFIG_AMD_IOMMU=y
|
||||
CONFIG_PAM=y
|
||||
CONFIG_I440FX=y
|
||||
CONFIG_Q35=y
|
||||
|
|
|
@ -2,3 +2,5 @@
|
|||
|
||||
CONFIG_COLDFIRE=y
|
||||
CONFIG_PTIMER=y
|
||||
CONFIG_AN5206=y
|
||||
CONFIG_MCF5208=y
|
||||
|
|
|
@ -10,3 +10,6 @@ CONFIG_XILINX_ETHLITE=y
|
|||
CONFIG_SSI=y
|
||||
CONFIG_SSI_M25P80=y
|
||||
CONFIG_XLNX_ZYNQMP=y
|
||||
CONFIG_PETALOGIX_S3ADSP1800=y
|
||||
CONFIG_PETALOGIX_ML605=y
|
||||
CONFIG_XLNX_ZYNQMP_PMU=y
|
||||
|
|
|
@ -36,3 +36,8 @@ CONFIG_EMPTY_SLOT=y
|
|||
CONFIG_MIPS_CPS=y
|
||||
CONFIG_MIPS_ITU=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_R4K=y
|
||||
CONFIG_MALTA=y
|
||||
CONFIG_MIPSSIM=y
|
||||
CONFIG_ACPI_SMBUS=y
|
||||
CONFIG_SMBUS_EEPROM=y
|
||||
|
|
|
@ -12,4 +12,4 @@ CONFIG_JAZZ_LED=y
|
|||
CONFIG_VT82C686=y
|
||||
CONFIG_MIPS_BOSTON=y
|
||||
CONFIG_FITLOADER=y
|
||||
CONFIG_PCI_XILINX=y
|
||||
CONFIG_PCI_EXPRESS_XILINX=y
|
||||
|
|
|
@ -5,3 +5,4 @@ CONFIG_MC146818RTC=y
|
|||
CONFIG_SERIAL=y
|
||||
CONFIG_SERIAL_ISA=y
|
||||
CONFIG_VGA=y
|
||||
CONFIG_MOXIESIM=y
|
||||
|
|
|
@ -4,3 +4,4 @@ CONFIG_NIOS2=y
|
|||
CONFIG_SERIAL=y
|
||||
CONFIG_PTIMER=y
|
||||
CONFIG_ALTERA_TIMER=y
|
||||
CONFIG_NIOS2_10M50=y
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
CONFIG_SERIAL=y
|
||||
CONFIG_OPENCORES_ETH=y
|
||||
CONFIG_OMPIC=y
|
||||
CONFIG_OR1K_SIM=y
|
||||
|
|
|
@ -22,7 +22,7 @@ CONFIG_MEGASAS_SCSI_PCI=y
|
|||
CONFIG_MPTSAS_SCSI_PCI=y
|
||||
CONFIG_RTL8139_PCI=y
|
||||
CONFIG_E1000_PCI=y
|
||||
CONFIG_E1000E_PCI=y
|
||||
CONFIG_E1000E_PCI_EXPRESS=y
|
||||
CONFIG_IDE_CORE=y
|
||||
CONFIG_IDE_QDEV=y
|
||||
CONFIG_IDE_PCI=y
|
||||
|
@ -47,3 +47,5 @@ CONFIG_VGA_PCI=y
|
|||
CONFIG_BOCHS_DISPLAY=y
|
||||
CONFIG_IVSHMEM_DEVICE=$(CONFIG_IVSHMEM)
|
||||
CONFIG_ROCKER=y
|
||||
CONFIG_VFIO=$(CONFIG_LINUX)
|
||||
CONFIG_VFIO_PCI=y
|
||||
|
|
|
@ -21,6 +21,10 @@ CONFIG_E500=y
|
|||
CONFIG_OPENPIC_KVM=$(call land,$(CONFIG_E500),$(CONFIG_KVM))
|
||||
CONFIG_PLATFORM_BUS=y
|
||||
CONFIG_ETSEC=y
|
||||
CONFIG_PPC405=y
|
||||
CONFIG_PPC440=y
|
||||
CONFIG_VIRTEX=y
|
||||
|
||||
# For Sam460ex
|
||||
CONFIG_SAM460EX=y
|
||||
CONFIG_USB_EHCI_SYSBUS=y
|
||||
|
@ -32,9 +36,9 @@ CONFIG_AT24C=y
|
|||
CONFIG_BITBANG_I2C=y
|
||||
CONFIG_M41T80=y
|
||||
CONFIG_VGA_CIRRUS=y
|
||||
CONFIG_SMBUS_EEPROM=y
|
||||
|
||||
# For Macs
|
||||
CONFIG_MAC=y
|
||||
CONFIG_ESCC=y
|
||||
CONFIG_MACIO=y
|
||||
CONFIG_MACIO_GPIO=y
|
||||
|
@ -50,6 +54,8 @@ CONFIG_GRACKLE_PCI=y
|
|||
CONFIG_UNIN_PCI=y
|
||||
CONFIG_DEC_PCI=y
|
||||
CONFIG_IDE_MACIO=y
|
||||
CONFIG_MAC_OLDWORLD=y
|
||||
CONFIG_MAC_NEWWORLD=y
|
||||
|
||||
# For PReP
|
||||
CONFIG_PREP=y
|
||||
|
|
|
@ -8,7 +8,14 @@ CONFIG_VIRTIO_MMIO=y
|
|||
|
||||
CONFIG_CADENCE=y
|
||||
|
||||
CONFIG_PCI_GENERIC=y
|
||||
CONFIG_PCI_EXPRESS_GENERIC_BRIDGE=y
|
||||
|
||||
CONFIG_VGA=y
|
||||
CONFIG_VGA_PCI=y
|
||||
|
||||
CONFIG_SPIKE=y
|
||||
CONFIG_HART=y
|
||||
CONFIG_SIFIVE_E=y
|
||||
CONFIG_SIFIVE=y
|
||||
CONFIG_SIFIVE_U=y
|
||||
CONFIG_RISCV_VIRT=y
|
||||
|
|
|
@ -8,7 +8,14 @@ CONFIG_VIRTIO_MMIO=y
|
|||
|
||||
CONFIG_CADENCE=y
|
||||
|
||||
CONFIG_PCI_GENERIC=y
|
||||
CONFIG_PCI_EXPRESS_GENERIC_BRIDGE=y
|
||||
|
||||
CONFIG_VGA=y
|
||||
CONFIG_VGA_PCI=y
|
||||
|
||||
CONFIG_SPIKE=y
|
||||
CONFIG_HART=y
|
||||
CONFIG_SIFIVE_E=y
|
||||
CONFIG_SIFIVE=y
|
||||
CONFIG_SIFIVE_U=y
|
||||
CONFIG_RISCV_VIRT=y
|
||||
|
|
|
@ -5,6 +5,8 @@ CONFIG_SCLPCONSOLE=y
|
|||
CONFIG_TERMINAL3270=y
|
||||
CONFIG_S390_FLIC=y
|
||||
CONFIG_S390_FLIC_KVM=$(CONFIG_KVM)
|
||||
CONFIG_VFIO_CCW=$(CONFIG_LINUX)
|
||||
CONFIG_WDT_DIAG288=y
|
||||
CONFIG_VFIO_AP=$(CONFIG_LINUX)
|
||||
CONFIG_S390_CCW_VIRTIO=y
|
||||
CONFIG_VFIO=$(CONFIG_LINUX)
|
||||
CONFIG_VFIO_CCW=y
|
||||
CONFIG_VFIO_AP=y
|
||||
|
|
|
@ -19,3 +19,5 @@ CONFIG_PCSPK=y
|
|||
CONFIG_I82374=y
|
||||
CONFIG_I8257=y
|
||||
CONFIG_MC146818RTC=y
|
||||
CONFIG_R2D=y
|
||||
CONFIG_SHIX=y
|
||||
|
|
|
@ -19,3 +19,5 @@ CONFIG_PCSPK=y
|
|||
CONFIG_I82374=y
|
||||
CONFIG_I8257=y
|
||||
CONFIG_MC146818RTC=y
|
||||
CONFIG_R2D=y
|
||||
CONFIG_SHIX=y
|
||||
|
|
|
@ -18,4 +18,6 @@ CONFIG_CS4231=y
|
|||
CONFIG_GRLIB=y
|
||||
CONFIG_STP2000=y
|
||||
CONFIG_ECCMEMCTL=y
|
||||
|
||||
CONFIG_SUN4M=y
|
||||
CONFIG_LEON3=y
|
||||
|
|
|
@ -17,3 +17,5 @@ CONFIG_SUNHME=y
|
|||
CONFIG_MC146818RTC=y
|
||||
CONFIG_ISA_TESTDEV=y
|
||||
CONFIG_SUN4V_RTC=y
|
||||
CONFIG_SUN4U=y
|
||||
CONFIG_NIAGARA=y
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
CONFIG_TRICORE=y
|
|
@ -3,3 +3,6 @@
|
|||
CONFIG_SERIAL=y
|
||||
CONFIG_OPENCORES_ETH=y
|
||||
CONFIG_PFLASH_CFI01=y
|
||||
|
||||
CONFIG_XTENSA_SIM=y
|
||||
CONFIG_XTENSA_FPGA=y
|
||||
|
|
|
@ -3,3 +3,6 @@
|
|||
CONFIG_SERIAL=y
|
||||
CONFIG_OPENCORES_ETH=y
|
||||
CONFIG_PFLASH_CFI01=y
|
||||
|
||||
CONFIG_XTENSA_SIM=y
|
||||
CONFIG_XTENSA_FPGA=y
|
||||
|
|
|
@ -190,10 +190,6 @@ The appropriate DEVNAME depends on the machine type. For type "pc":
|
|||
|
||||
-device usb-braille,chardev=braille -chardev braille,id=braille
|
||||
|
||||
* -virtioconsole becomes
|
||||
-device virtio-serial-pci,class=C,vectors=V,ioeventfd=IOEVENTFD,max_ports=N
|
||||
-device virtconsole,is_console=NUM,nr=NR,name=NAME
|
||||
|
||||
LEGACY-CHARDEV translates to -chardev HOST-OPTS... as follows:
|
||||
|
||||
* null becomes -chardev null
|
||||
|
|
47
exec.c
47
exec.c
|
@ -2851,10 +2851,10 @@ static const MemoryRegionOps watch_mem_ops = {
|
|||
};
|
||||
|
||||
static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
|
||||
MemTxAttrs attrs, uint8_t *buf, int len);
|
||||
MemTxAttrs attrs, uint8_t *buf, hwaddr len);
|
||||
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
|
||||
const uint8_t *buf, int len);
|
||||
static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
|
||||
const uint8_t *buf, hwaddr len);
|
||||
static bool flatview_access_valid(FlatView *fv, hwaddr addr, hwaddr len,
|
||||
bool is_write, MemTxAttrs attrs);
|
||||
|
||||
static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data,
|
||||
|
@ -3102,10 +3102,10 @@ MemoryRegion *get_system_io(void)
|
|||
/* physical memory access (slow version, mainly for debug) */
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
|
||||
uint8_t *buf, int len, int is_write)
|
||||
uint8_t *buf, target_ulong len, int is_write)
|
||||
{
|
||||
int l, flags;
|
||||
target_ulong page;
|
||||
int flags;
|
||||
target_ulong l, page;
|
||||
void * p;
|
||||
|
||||
while (len > 0) {
|
||||
|
@ -3231,7 +3231,7 @@ static bool prepare_mmio_access(MemoryRegion *mr)
|
|||
static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
|
||||
MemTxAttrs attrs,
|
||||
const uint8_t *buf,
|
||||
int len, hwaddr addr1,
|
||||
hwaddr len, hwaddr addr1,
|
||||
hwaddr l, MemoryRegion *mr)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
|
@ -3276,7 +3276,7 @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
|
|||
|
||||
/* Called from RCU critical section. */
|
||||
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
|
||||
const uint8_t *buf, int len)
|
||||
const uint8_t *buf, hwaddr len)
|
||||
{
|
||||
hwaddr l;
|
||||
hwaddr addr1;
|
||||
|
@ -3294,7 +3294,7 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
|
|||
/* Called within RCU critical section. */
|
||||
MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
|
||||
MemTxAttrs attrs, uint8_t *buf,
|
||||
int len, hwaddr addr1, hwaddr l,
|
||||
hwaddr len, hwaddr addr1, hwaddr l,
|
||||
MemoryRegion *mr)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
|
@ -3337,7 +3337,7 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
|
|||
|
||||
/* Called from RCU critical section. */
|
||||
static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
|
||||
MemTxAttrs attrs, uint8_t *buf, int len)
|
||||
MemTxAttrs attrs, uint8_t *buf, hwaddr len)
|
||||
{
|
||||
hwaddr l;
|
||||
hwaddr addr1;
|
||||
|
@ -3350,7 +3350,7 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
|
|||
}
|
||||
|
||||
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
|
||||
MemTxAttrs attrs, uint8_t *buf, int len)
|
||||
MemTxAttrs attrs, uint8_t *buf, hwaddr len)
|
||||
{
|
||||
MemTxResult result = MEMTX_OK;
|
||||
FlatView *fv;
|
||||
|
@ -3367,7 +3367,7 @@ MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
|
|||
|
||||
MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
|
||||
MemTxAttrs attrs,
|
||||
const uint8_t *buf, int len)
|
||||
const uint8_t *buf, hwaddr len)
|
||||
{
|
||||
MemTxResult result = MEMTX_OK;
|
||||
FlatView *fv;
|
||||
|
@ -3383,7 +3383,7 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
|
|||
}
|
||||
|
||||
MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
|
||||
uint8_t *buf, int len, bool is_write)
|
||||
uint8_t *buf, hwaddr len, bool is_write)
|
||||
{
|
||||
if (is_write) {
|
||||
return address_space_write(as, addr, attrs, buf, len);
|
||||
|
@ -3393,7 +3393,7 @@ MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
|
|||
}
|
||||
|
||||
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
|
||||
int len, int is_write)
|
||||
hwaddr len, int is_write)
|
||||
{
|
||||
address_space_rw(&address_space_memory, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
buf, len, is_write);
|
||||
|
@ -3408,7 +3408,7 @@ static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
|
|||
hwaddr addr,
|
||||
MemTxAttrs attrs,
|
||||
const uint8_t *buf,
|
||||
int len,
|
||||
hwaddr len,
|
||||
enum write_rom_type type)
|
||||
{
|
||||
hwaddr l;
|
||||
|
@ -3448,13 +3448,13 @@ static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
|
|||
/* used for ROM loading : can write in RAM and ROM */
|
||||
MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
|
||||
MemTxAttrs attrs,
|
||||
const uint8_t *buf, int len)
|
||||
const uint8_t *buf, hwaddr len)
|
||||
{
|
||||
return address_space_write_rom_internal(as, addr, attrs,
|
||||
buf, len, WRITE_DATA);
|
||||
}
|
||||
|
||||
void cpu_flush_icache_range(hwaddr start, int len)
|
||||
void cpu_flush_icache_range(hwaddr start, hwaddr len)
|
||||
{
|
||||
/*
|
||||
* This function should do the same thing as an icache flush that was
|
||||
|
@ -3557,7 +3557,7 @@ static void cpu_notify_map_clients(void)
|
|||
qemu_mutex_unlock(&map_client_list_lock);
|
||||
}
|
||||
|
||||
static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
|
||||
static bool flatview_access_valid(FlatView *fv, hwaddr addr, hwaddr len,
|
||||
bool is_write, MemTxAttrs attrs)
|
||||
{
|
||||
MemoryRegion *mr;
|
||||
|
@ -3580,7 +3580,7 @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
|
|||
}
|
||||
|
||||
bool address_space_access_valid(AddressSpace *as, hwaddr addr,
|
||||
int len, bool is_write,
|
||||
hwaddr len, bool is_write,
|
||||
MemTxAttrs attrs)
|
||||
{
|
||||
FlatView *fv;
|
||||
|
@ -3833,7 +3833,7 @@ static inline MemoryRegion *address_space_translate_cached(
|
|||
*/
|
||||
void
|
||||
address_space_read_cached_slow(MemoryRegionCache *cache, hwaddr addr,
|
||||
void *buf, int len)
|
||||
void *buf, hwaddr len)
|
||||
{
|
||||
hwaddr addr1, l;
|
||||
MemoryRegion *mr;
|
||||
|
@ -3851,7 +3851,7 @@ address_space_read_cached_slow(MemoryRegionCache *cache, hwaddr addr,
|
|||
*/
|
||||
void
|
||||
address_space_write_cached_slow(MemoryRegionCache *cache, hwaddr addr,
|
||||
const void *buf, int len)
|
||||
const void *buf, hwaddr len)
|
||||
{
|
||||
hwaddr addr1, l;
|
||||
MemoryRegion *mr;
|
||||
|
@ -3874,11 +3874,10 @@ address_space_write_cached_slow(MemoryRegionCache *cache, hwaddr addr,
|
|||
|
||||
/* virtual memory access for debug (includes writing to ROM) */
|
||||
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
|
||||
uint8_t *buf, int len, int is_write)
|
||||
uint8_t *buf, target_ulong len, int is_write)
|
||||
{
|
||||
int l;
|
||||
hwaddr phys_addr;
|
||||
target_ulong page;
|
||||
target_ulong l, page;
|
||||
|
||||
cpu_synchronize_state(cpu);
|
||||
while (len > 0) {
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2010-2015 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.i386.core">
|
||||
<flags id="i386_eflags" size="4">
|
||||
<field name="CF" start="0" end="0"/>
|
||||
<field name="" start="1" end="1"/>
|
||||
<field name="PF" start="2" end="2"/>
|
||||
<field name="AF" start="4" end="4"/>
|
||||
<field name="ZF" start="6" end="6"/>
|
||||
<field name="SF" start="7" end="7"/>
|
||||
<field name="TF" start="8" end="8"/>
|
||||
<field name="IF" start="9" end="9"/>
|
||||
<field name="DF" start="10" end="10"/>
|
||||
<field name="OF" start="11" end="11"/>
|
||||
<field name="NT" start="14" end="14"/>
|
||||
<field name="RF" start="16" end="16"/>
|
||||
<field name="VM" start="17" end="17"/>
|
||||
<field name="AC" start="18" end="18"/>
|
||||
<field name="VIF" start="19" end="19"/>
|
||||
<field name="VIP" start="20" end="20"/>
|
||||
<field name="ID" start="21" end="21"/>
|
||||
</flags>
|
||||
|
||||
<reg name="eax" bitsize="32" type="int32"/>
|
||||
<reg name="ecx" bitsize="32" type="int32"/>
|
||||
<reg name="edx" bitsize="32" type="int32"/>
|
||||
<reg name="ebx" bitsize="32" type="int32"/>
|
||||
<reg name="esp" bitsize="32" type="data_ptr"/>
|
||||
<reg name="ebp" bitsize="32" type="data_ptr"/>
|
||||
<reg name="esi" bitsize="32" type="int32"/>
|
||||
<reg name="edi" bitsize="32" type="int32"/>
|
||||
|
||||
<reg name="eip" bitsize="32" type="code_ptr"/>
|
||||
<reg name="eflags" bitsize="32" type="i386_eflags"/>
|
||||
<reg name="cs" bitsize="32" type="int32"/>
|
||||
<reg name="ss" bitsize="32" type="int32"/>
|
||||
<reg name="ds" bitsize="32" type="int32"/>
|
||||
<reg name="es" bitsize="32" type="int32"/>
|
||||
<reg name="fs" bitsize="32" type="int32"/>
|
||||
<reg name="gs" bitsize="32" type="int32"/>
|
||||
|
||||
<reg name="st0" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st1" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st2" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st3" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st4" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st5" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st6" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st7" bitsize="80" type="i387_ext"/>
|
||||
|
||||
<reg name="fctrl" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fstat" bitsize="32" type="int" group="float"/>
|
||||
<reg name="ftag" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fiseg" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fioff" bitsize="32" type="int" group="float"/>
|
||||
<reg name="foseg" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fooff" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fop" bitsize="32" type="int" group="float"/>
|
||||
</feature>
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.i386.32bit.sse">
|
||||
<vector id="v4f" type="ieee_single" count="4"/>
|
||||
<vector id="v2d" type="ieee_double" count="2"/>
|
||||
<vector id="v16i8" type="int8" count="16"/>
|
||||
<vector id="v8i16" type="int16" count="8"/>
|
||||
<vector id="v4i32" type="int32" count="4"/>
|
||||
<vector id="v2i64" type="int64" count="2"/>
|
||||
<union id="vec128">
|
||||
<field name="v4_float" type="v4f"/>
|
||||
<field name="v2_double" type="v2d"/>
|
||||
<field name="v16_int8" type="v16i8"/>
|
||||
<field name="v8_int16" type="v8i16"/>
|
||||
<field name="v4_int32" type="v4i32"/>
|
||||
<field name="v2_int64" type="v2i64"/>
|
||||
<field name="uint128" type="uint128"/>
|
||||
</union>
|
||||
<flags id="i386_mxcsr" size="4">
|
||||
<field name="IE" start="0" end="0"/>
|
||||
<field name="DE" start="1" end="1"/>
|
||||
<field name="ZE" start="2" end="2"/>
|
||||
<field name="OE" start="3" end="3"/>
|
||||
<field name="UE" start="4" end="4"/>
|
||||
<field name="PE" start="5" end="5"/>
|
||||
<field name="DAZ" start="6" end="6"/>
|
||||
<field name="IM" start="7" end="7"/>
|
||||
<field name="DM" start="8" end="8"/>
|
||||
<field name="ZM" start="9" end="9"/>
|
||||
<field name="OM" start="10" end="10"/>
|
||||
<field name="UM" start="11" end="11"/>
|
||||
<field name="PM" start="12" end="12"/>
|
||||
<field name="FZ" start="15" end="15"/>
|
||||
</flags>
|
||||
|
||||
<reg name="xmm0" bitsize="128" type="vec128" regnum="32"/>
|
||||
<reg name="xmm1" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm2" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm3" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm4" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm5" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm6" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm7" bitsize="128" type="vec128"/>
|
||||
|
||||
<reg name="mxcsr" bitsize="32" type="i386_mxcsr" group="vector"/>
|
||||
</feature>
|
|
@ -8,7 +8,185 @@
|
|||
<!-- I386 with SSE -->
|
||||
|
||||
<!DOCTYPE target SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.i386.32bit">
|
||||
<xi:include href="i386-32bit-core.xml"/>
|
||||
<xi:include href="i386-32bit-sse.xml"/>
|
||||
<feature name="org.gnu.gdb.i386.core">
|
||||
<flags id="i386_eflags" size="4">
|
||||
<field name="" start="22" end="31"/>
|
||||
<field name="ID" start="21" end="21"/>
|
||||
<field name="VIP" start="20" end="20"/>
|
||||
<field name="VIF" start="19" end="19"/>
|
||||
<field name="AC" start="18" end="18"/>
|
||||
<field name="VM" start="17" end="17"/>
|
||||
<field name="RF" start="16" end="16"/>
|
||||
<field name="" start="15" end="15"/>
|
||||
<field name="NT" start="14" end="14"/>
|
||||
<field name="IOPL" start="12" end="13"/>
|
||||
<field name="OF" start="11" end="11"/>
|
||||
<field name="DF" start="10" end="10"/>
|
||||
<field name="IF" start="9" end="9"/>
|
||||
<field name="TF" start="8" end="8"/>
|
||||
<field name="SF" start="7" end="7"/>
|
||||
<field name="ZF" start="6" end="6"/>
|
||||
<field name="" start="5" end="5"/>
|
||||
<field name="AF" start="4" end="4"/>
|
||||
<field name="" start="3" end="3"/>
|
||||
<field name="PF" start="2" end="2"/>
|
||||
<field name="" start="1" end="1"/>
|
||||
<field name="CF" start="0" end="0"/>
|
||||
</flags>
|
||||
|
||||
<reg name="eax" bitsize="32" type="int32" regnum="0"/>
|
||||
<reg name="ecx" bitsize="32" type="int32"/>
|
||||
<reg name="edx" bitsize="32" type="int32"/>
|
||||
<reg name="ebx" bitsize="32" type="int32"/>
|
||||
<reg name="esp" bitsize="32" type="data_ptr"/>
|
||||
<reg name="ebp" bitsize="32" type="data_ptr"/>
|
||||
<reg name="esi" bitsize="32" type="int32"/>
|
||||
<reg name="edi" bitsize="32" type="int32"/>
|
||||
|
||||
<reg name="eip" bitsize="32" type="code_ptr"/>
|
||||
<reg name="eflags" bitsize="32" type="i386_eflags"/>
|
||||
|
||||
<reg name="cs" bitsize="32" type="int32"/>
|
||||
<reg name="ss" bitsize="32" type="int32"/>
|
||||
<reg name="ds" bitsize="32" type="int32"/>
|
||||
<reg name="es" bitsize="32" type="int32"/>
|
||||
<reg name="fs" bitsize="32" type="int32"/>
|
||||
<reg name="gs" bitsize="32" type="int32"/>
|
||||
|
||||
<!-- Segment descriptor caches and TLS base MSRs -->
|
||||
|
||||
<!--reg name="cs_base" bitsize="32" type="int32"/>
|
||||
<reg name="ss_base" bitsize="32" type="int32"/>
|
||||
<reg name="ds_base" bitsize="32" type="int32"/>
|
||||
<reg name="es_base" bitsize="32" type="int32"/-->
|
||||
<reg name="fs_base" bitsize="32" type="int32"/>
|
||||
<reg name="gs_base" bitsize="32" type="int32"/>
|
||||
<reg name="k_gs_base" bitsize="32" type="int32"/>
|
||||
|
||||
<flags id="i386_cr0" size="4">
|
||||
<field name="PG" start="31" end="31"/>
|
||||
<field name="CD" start="30" end="30"/>
|
||||
<field name="NW" start="29" end="29"/>
|
||||
<field name="AM" start="18" end="18"/>
|
||||
<field name="WP" start="16" end="16"/>
|
||||
<field name="NE" start="5" end="5"/>
|
||||
<field name="ET" start="4" end="4"/>
|
||||
<field name="TS" start="3" end="3"/>
|
||||
<field name="EM" start="2" end="2"/>
|
||||
<field name="MP" start="1" end="1"/>
|
||||
<field name="PE" start="0" end="0"/>
|
||||
</flags>
|
||||
|
||||
<flags id="i386_cr3" size="4">
|
||||
<field name="PDBR" start="12" end="31"/>
|
||||
<!--field name="" start="3" end="11"/>
|
||||
<field name="WT" start="2" end="2"/>
|
||||
<field name="CD" start="1" end="1"/>
|
||||
<field name="" start="0" end="0"/-->
|
||||
<field name="PCID" start="0" end="11"/>
|
||||
</flags>
|
||||
|
||||
<flags id="i386_cr4" size="4">
|
||||
<field name="VME" start="0" end="0"/>
|
||||
<field name="PVI" start="1" end="1"/>
|
||||
<field name="TSD" start="2" end="2"/>
|
||||
<field name="DE" start="3" end="3"/>
|
||||
<field name="PSE" start="4" end="4"/>
|
||||
<field name="PAE" start="5" end="5"/>
|
||||
<field name="MCE" start="6" end="6"/>
|
||||
<field name="PGE" start="7" end="7"/>
|
||||
<field name="PCE" start="8" end="8"/>
|
||||
<field name="OSFXSR" start="9" end="9"/>
|
||||
<field name="OSXMMEXCPT" start="10" end="10"/>
|
||||
<field name="UMIP" start="11" end="11"/>
|
||||
<field name="LA57" start="12" end="12"/>
|
||||
<field name="VMXE" start="13" end="13"/>
|
||||
<field name="SMXE" start="14" end="14"/>
|
||||
<field name="FSGSBASE" start="16" end="16"/>
|
||||
<field name="PCIDE" start="17" end="17"/>
|
||||
<field name="OSXSAVE" start="18" end="18"/>
|
||||
<field name="SMEP" start="20" end="20"/>
|
||||
<field name="SMAP" start="21" end="21"/>
|
||||
<field name="PKE" start="22" end="22"/>
|
||||
</flags>
|
||||
|
||||
<flags id="i386_efer" size="8">
|
||||
<field name="TCE" start="15" end="15"/>
|
||||
<field name="FFXSR" start="14" end="14"/>
|
||||
<field name="LMSLE" start="13" end="13"/>
|
||||
<field name="SVME" start="12" end="12"/>
|
||||
<field name="NXE" start="11" end="11"/>
|
||||
<field name="LMA" start="10" end="10"/>
|
||||
<field name="LME" start="8" end="8"/>
|
||||
<field name="SCE" start="0" end="0"/>
|
||||
</flags>
|
||||
|
||||
<reg name="cr0" bitsize="32" type="i386_cr0"/>
|
||||
<reg name="cr2" bitsize="32" type="int32"/>
|
||||
<reg name="cr3" bitsize="32" type="i386_cr3"/>
|
||||
<reg name="cr4" bitsize="32" type="i386_cr4"/>
|
||||
<reg name="cr8" bitsize="32" type="int32"/>
|
||||
<reg name="efer" bitsize="32" type="i386_efer"/>
|
||||
|
||||
<reg name="st0" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st1" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st2" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st3" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st4" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st5" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st6" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st7" bitsize="80" type="i387_ext"/>
|
||||
|
||||
<reg name="fctrl" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fstat" bitsize="32" type="int" group="float"/>
|
||||
<reg name="ftag" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fiseg" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fioff" bitsize="32" type="int" group="float"/>
|
||||
<reg name="foseg" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fooff" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fop" bitsize="32" type="int" group="float"/>
|
||||
<!--/feature>
|
||||
<feature name="org.gnu.gdb.i386.32bit.sse"-->
|
||||
<vector id="v4f" type="ieee_single" count="4"/>
|
||||
<vector id="v2d" type="ieee_double" count="2"/>
|
||||
<vector id="v16i8" type="int8" count="16"/>
|
||||
<vector id="v8i16" type="int16" count="8"/>
|
||||
<vector id="v4i32" type="int32" count="4"/>
|
||||
<vector id="v2i64" type="int64" count="2"/>
|
||||
<union id="vec128">
|
||||
<field name="v4_float" type="v4f"/>
|
||||
<field name="v2_double" type="v2d"/>
|
||||
<field name="v16_int8" type="v16i8"/>
|
||||
<field name="v8_int16" type="v8i16"/>
|
||||
<field name="v4_int32" type="v4i32"/>
|
||||
<field name="v2_int64" type="v2i64"/>
|
||||
<field name="uint128" type="uint128"/>
|
||||
</union>
|
||||
<flags id="i386_mxcsr" size="4">
|
||||
<field name="IE" start="0" end="0"/>
|
||||
<field name="DE" start="1" end="1"/>
|
||||
<field name="ZE" start="2" end="2"/>
|
||||
<field name="OE" start="3" end="3"/>
|
||||
<field name="UE" start="4" end="4"/>
|
||||
<field name="PE" start="5" end="5"/>
|
||||
<field name="DAZ" start="6" end="6"/>
|
||||
<field name="IM" start="7" end="7"/>
|
||||
<field name="DM" start="8" end="8"/>
|
||||
<field name="ZM" start="9" end="9"/>
|
||||
<field name="OM" start="10" end="10"/>
|
||||
<field name="UM" start="11" end="11"/>
|
||||
<field name="PM" start="12" end="12"/>
|
||||
<field name="FZ" start="15" end="15"/>
|
||||
</flags>
|
||||
|
||||
<reg name="xmm0" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm1" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm2" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm3" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm4" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm5" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm6" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm7" bitsize="128" type="vec128"/>
|
||||
|
||||
<reg name="mxcsr" bitsize="32" type="i386_mxcsr" group="vector"/>
|
||||
</feature>
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2010-2015 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.i386.core">
|
||||
<flags id="i386_eflags" size="4">
|
||||
<field name="CF" start="0" end="0"/>
|
||||
<field name="" start="1" end="1"/>
|
||||
<field name="PF" start="2" end="2"/>
|
||||
<field name="AF" start="4" end="4"/>
|
||||
<field name="ZF" start="6" end="6"/>
|
||||
<field name="SF" start="7" end="7"/>
|
||||
<field name="TF" start="8" end="8"/>
|
||||
<field name="IF" start="9" end="9"/>
|
||||
<field name="DF" start="10" end="10"/>
|
||||
<field name="OF" start="11" end="11"/>
|
||||
<field name="NT" start="14" end="14"/>
|
||||
<field name="RF" start="16" end="16"/>
|
||||
<field name="VM" start="17" end="17"/>
|
||||
<field name="AC" start="18" end="18"/>
|
||||
<field name="VIF" start="19" end="19"/>
|
||||
<field name="VIP" start="20" end="20"/>
|
||||
<field name="ID" start="21" end="21"/>
|
||||
</flags>
|
||||
|
||||
<reg name="rax" bitsize="64" type="int64"/>
|
||||
<reg name="rbx" bitsize="64" type="int64"/>
|
||||
<reg name="rcx" bitsize="64" type="int64"/>
|
||||
<reg name="rdx" bitsize="64" type="int64"/>
|
||||
<reg name="rsi" bitsize="64" type="int64"/>
|
||||
<reg name="rdi" bitsize="64" type="int64"/>
|
||||
<reg name="rbp" bitsize="64" type="data_ptr"/>
|
||||
<reg name="rsp" bitsize="64" type="data_ptr"/>
|
||||
<reg name="r8" bitsize="64" type="int64"/>
|
||||
<reg name="r9" bitsize="64" type="int64"/>
|
||||
<reg name="r10" bitsize="64" type="int64"/>
|
||||
<reg name="r11" bitsize="64" type="int64"/>
|
||||
<reg name="r12" bitsize="64" type="int64"/>
|
||||
<reg name="r13" bitsize="64" type="int64"/>
|
||||
<reg name="r14" bitsize="64" type="int64"/>
|
||||
<reg name="r15" bitsize="64" type="int64"/>
|
||||
|
||||
<reg name="rip" bitsize="64" type="code_ptr"/>
|
||||
<reg name="eflags" bitsize="32" type="i386_eflags"/>
|
||||
<reg name="cs" bitsize="32" type="int32"/>
|
||||
<reg name="ss" bitsize="32" type="int32"/>
|
||||
<reg name="ds" bitsize="32" type="int32"/>
|
||||
<reg name="es" bitsize="32" type="int32"/>
|
||||
<reg name="fs" bitsize="32" type="int32"/>
|
||||
<reg name="gs" bitsize="32" type="int32"/>
|
||||
|
||||
<reg name="st0" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st1" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st2" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st3" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st4" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st5" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st6" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st7" bitsize="80" type="i387_ext"/>
|
||||
|
||||
<reg name="fctrl" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fstat" bitsize="32" type="int" group="float"/>
|
||||
<reg name="ftag" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fiseg" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fioff" bitsize="32" type="int" group="float"/>
|
||||
<reg name="foseg" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fooff" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fop" bitsize="32" type="int" group="float"/>
|
||||
</feature>
|
|
@ -1,60 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.i386.64bit.sse">
|
||||
<vector id="v4f" type="ieee_single" count="4"/>
|
||||
<vector id="v2d" type="ieee_double" count="2"/>
|
||||
<vector id="v16i8" type="int8" count="16"/>
|
||||
<vector id="v8i16" type="int16" count="8"/>
|
||||
<vector id="v4i32" type="int32" count="4"/>
|
||||
<vector id="v2i64" type="int64" count="2"/>
|
||||
<union id="vec128">
|
||||
<field name="v4_float" type="v4f"/>
|
||||
<field name="v2_double" type="v2d"/>
|
||||
<field name="v16_int8" type="v16i8"/>
|
||||
<field name="v8_int16" type="v8i16"/>
|
||||
<field name="v4_int32" type="v4i32"/>
|
||||
<field name="v2_int64" type="v2i64"/>
|
||||
<field name="uint128" type="uint128"/>
|
||||
</union>
|
||||
<flags id="i386_mxcsr" size="4">
|
||||
<field name="IE" start="0" end="0"/>
|
||||
<field name="DE" start="1" end="1"/>
|
||||
<field name="ZE" start="2" end="2"/>
|
||||
<field name="OE" start="3" end="3"/>
|
||||
<field name="UE" start="4" end="4"/>
|
||||
<field name="PE" start="5" end="5"/>
|
||||
<field name="DAZ" start="6" end="6"/>
|
||||
<field name="IM" start="7" end="7"/>
|
||||
<field name="DM" start="8" end="8"/>
|
||||
<field name="ZM" start="9" end="9"/>
|
||||
<field name="OM" start="10" end="10"/>
|
||||
<field name="UM" start="11" end="11"/>
|
||||
<field name="PM" start="12" end="12"/>
|
||||
<field name="FZ" start="15" end="15"/>
|
||||
</flags>
|
||||
|
||||
<reg name="xmm0" bitsize="128" type="vec128" regnum="40"/>
|
||||
<reg name="xmm1" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm2" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm3" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm4" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm5" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm6" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm7" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm8" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm9" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm10" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm11" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm12" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm13" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm14" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm15" bitsize="128" type="vec128"/>
|
||||
|
||||
<reg name="mxcsr" bitsize="32" type="i386_mxcsr" group="vector"/>
|
||||
</feature>
|
|
@ -5,10 +5,212 @@
|
|||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!-- I386 64bit -->
|
||||
<!-- x86_64 64bit -->
|
||||
|
||||
<!DOCTYPE target SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.i386.64bit">
|
||||
<xi:include href="i386-64bit-core.xml"/>
|
||||
<xi:include href="i386-64bit-sse.xml"/>
|
||||
|
||||
<feature name="org.gnu.gdb.i386.core">
|
||||
<flags id="x64_eflags" size="4">
|
||||
<field name="" start="22" end="31"/>
|
||||
<field name="ID" start="21" end="21"/>
|
||||
<field name="VIP" start="20" end="20"/>
|
||||
<field name="VIF" start="19" end="19"/>
|
||||
<field name="AC" start="18" end="18"/>
|
||||
<field name="VM" start="17" end="17"/>
|
||||
<field name="RF" start="16" end="16"/>
|
||||
<field name="" start="15" end="15"/>
|
||||
<field name="NT" start="14" end="14"/>
|
||||
<field name="IOPL" start="12" end="13"/>
|
||||
<field name="OF" start="11" end="11"/>
|
||||
<field name="DF" start="10" end="10"/>
|
||||
<field name="IF" start="9" end="9"/>
|
||||
<field name="TF" start="8" end="8"/>
|
||||
<field name="SF" start="7" end="7"/>
|
||||
<field name="ZF" start="6" end="6"/>
|
||||
<field name="" start="5" end="5"/>
|
||||
<field name="AF" start="4" end="4"/>
|
||||
<field name="" start="3" end="3"/>
|
||||
<field name="PF" start="2" end="2"/>
|
||||
<field name="" start="1" end="1"/>
|
||||
<field name="CF" start="0" end="0"/>
|
||||
</flags>
|
||||
|
||||
<!-- General registers -->
|
||||
|
||||
<reg name="rax" bitsize="64" type="int64" regnum="0"/>
|
||||
<reg name="rbx" bitsize="64" type="int64"/>
|
||||
<reg name="rcx" bitsize="64" type="int64"/>
|
||||
<reg name="rdx" bitsize="64" type="int64"/>
|
||||
<reg name="rsi" bitsize="64" type="int64"/>
|
||||
<reg name="rdi" bitsize="64" type="int64"/>
|
||||
<reg name="rbp" bitsize="64" type="data_ptr"/>
|
||||
<reg name="rsp" bitsize="64" type="data_ptr"/>
|
||||
<reg name="r8" bitsize="64" type="int64"/>
|
||||
<reg name="r9" bitsize="64" type="int64"/>
|
||||
<reg name="r10" bitsize="64" type="int64"/>
|
||||
<reg name="r11" bitsize="64" type="int64"/>
|
||||
<reg name="r12" bitsize="64" type="int64"/>
|
||||
<reg name="r13" bitsize="64" type="int64"/>
|
||||
<reg name="r14" bitsize="64" type="int64"/>
|
||||
<reg name="r15" bitsize="64" type="int64"/>
|
||||
|
||||
<reg name="rip" bitsize="64" type="code_ptr"/>
|
||||
<reg name="eflags" bitsize="32" type="x64_eflags"/>
|
||||
|
||||
<!-- Segment registers -->
|
||||
|
||||
<reg name="cs" bitsize="32" type="int32"/>
|
||||
<reg name="ss" bitsize="32" type="int32"/>
|
||||
<reg name="ds" bitsize="32" type="int32"/>
|
||||
<reg name="es" bitsize="32" type="int32"/>
|
||||
<reg name="fs" bitsize="32" type="int32"/>
|
||||
<reg name="gs" bitsize="32" type="int32"/>
|
||||
|
||||
<!-- Segment descriptor caches and TLS base MSRs -->
|
||||
|
||||
<!--reg name="cs_base" bitsize="64" type="int64"/>
|
||||
<reg name="ss_base" bitsize="64" type="int64"/>
|
||||
<reg name="ds_base" bitsize="64" type="int64"/>
|
||||
<reg name="es_base" bitsize="64" type="int64"/-->
|
||||
<reg name="fs_base" bitsize="64" type="int64"/>
|
||||
<reg name="gs_base" bitsize="64" type="int64"/>
|
||||
<reg name="k_gs_base" bitsize="64" type="int64"/>
|
||||
|
||||
<!-- Control registers -->
|
||||
|
||||
<flags id="x64_cr0" size="8">
|
||||
<field name="PG" start="31" end="31"/>
|
||||
<field name="CD" start="30" end="30"/>
|
||||
<field name="NW" start="29" end="29"/>
|
||||
<field name="AM" start="18" end="18"/>
|
||||
<field name="WP" start="16" end="16"/>
|
||||
<field name="NE" start="5" end="5"/>
|
||||
<field name="ET" start="4" end="4"/>
|
||||
<field name="TS" start="3" end="3"/>
|
||||
<field name="EM" start="2" end="2"/>
|
||||
<field name="MP" start="1" end="1"/>
|
||||
<field name="PE" start="0" end="0"/>
|
||||
</flags>
|
||||
|
||||
<flags id="x64_cr3" size="8">
|
||||
<field name="PDBR" start="12" end="63"/>
|
||||
<!--field name="" start="3" end="11"/>
|
||||
<field name="WT" start="2" end="2"/>
|
||||
<field name="CD" start="1" end="1"/>
|
||||
<field name="" start="0" end="0"/-->
|
||||
<field name="PCID" start="0" end="11"/>
|
||||
</flags>
|
||||
|
||||
<flags id="x64_cr4" size="8">
|
||||
<field name="PKE" start="22" end="22"/>
|
||||
<field name="SMAP" start="21" end="21"/>
|
||||
<field name="SMEP" start="20" end="20"/>
|
||||
<field name="OSXSAVE" start="18" end="18"/>
|
||||
<field name="PCIDE" start="17" end="17"/>
|
||||
<field name="FSGSBASE" start="16" end="16"/>
|
||||
<field name="SMXE" start="14" end="14"/>
|
||||
<field name="VMXE" start="13" end="13"/>
|
||||
<field name="LA57" start="12" end="12"/>
|
||||
<field name="UMIP" start="11" end="11"/>
|
||||
<field name="OSXMMEXCPT" start="10" end="10"/>
|
||||
<field name="OSFXSR" start="9" end="9"/>
|
||||
<field name="PCE" start="8" end="8"/>
|
||||
<field name="PGE" start="7" end="7"/>
|
||||
<field name="MCE" start="6" end="6"/>
|
||||
<field name="PAE" start="5" end="5"/>
|
||||
<field name="PSE" start="4" end="4"/>
|
||||
<field name="DE" start="3" end="3"/>
|
||||
<field name="TSD" start="2" end="2"/>
|
||||
<field name="PVI" start="1" end="1"/>
|
||||
<field name="VME" start="0" end="0"/>
|
||||
</flags>
|
||||
|
||||
<flags id="x64_efer" size="8">
|
||||
<field name="TCE" start="15" end="15"/>
|
||||
<field name="FFXSR" start="14" end="14"/>
|
||||
<field name="LMSLE" start="13" end="13"/>
|
||||
<field name="SVME" start="12" end="12"/>
|
||||
<field name="NXE" start="11" end="11"/>
|
||||
<field name="LMA" start="10" end="10"/>
|
||||
<field name="LME" start="8" end="8"/>
|
||||
<field name="SCE" start="0" end="0"/>
|
||||
</flags>
|
||||
|
||||
<reg name="cr0" bitsize="64" type="x64_cr0"/>
|
||||
<reg name="cr2" bitsize="64" type="int64"/>
|
||||
<reg name="cr3" bitsize="64" type="x64_cr3"/>
|
||||
<reg name="cr4" bitsize="64" type="x64_cr4"/>
|
||||
<reg name="cr8" bitsize="64" type="int64"/>
|
||||
<reg name="efer" bitsize="64" type="x64_efer"/>
|
||||
|
||||
<!-- x87 FPU -->
|
||||
|
||||
<reg name="st0" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st1" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st2" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st3" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st4" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st5" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st6" bitsize="80" type="i387_ext"/>
|
||||
<reg name="st7" bitsize="80" type="i387_ext"/>
|
||||
|
||||
<reg name="fctrl" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fstat" bitsize="32" type="int" group="float"/>
|
||||
<reg name="ftag" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fiseg" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fioff" bitsize="32" type="int" group="float"/>
|
||||
<reg name="foseg" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fooff" bitsize="32" type="int" group="float"/>
|
||||
<reg name="fop" bitsize="32" type="int" group="float"/>
|
||||
|
||||
<vector id="v4f" type="ieee_single" count="4"/>
|
||||
<vector id="v2d" type="ieee_double" count="2"/>
|
||||
<vector id="v16i8" type="int8" count="16"/>
|
||||
<vector id="v8i16" type="int16" count="8"/>
|
||||
<vector id="v4i32" type="int32" count="4"/>
|
||||
<vector id="v2i64" type="int64" count="2"/>
|
||||
<union id="vec128">
|
||||
<field name="v4_float" type="v4f"/>
|
||||
<field name="v2_double" type="v2d"/>
|
||||
<field name="v16_int8" type="v16i8"/>
|
||||
<field name="v8_int16" type="v8i16"/>
|
||||
<field name="v4_int32" type="v4i32"/>
|
||||
<field name="v2_int64" type="v2i64"/>
|
||||
<field name="uint128" type="uint128"/>
|
||||
</union>
|
||||
<flags id="x64_mxcsr" size="4">
|
||||
<field name="IE" start="0" end="0"/>
|
||||
<field name="DE" start="1" end="1"/>
|
||||
<field name="ZE" start="2" end="2"/>
|
||||
<field name="OE" start="3" end="3"/>
|
||||
<field name="UE" start="4" end="4"/>
|
||||
<field name="PE" start="5" end="5"/>
|
||||
<field name="DAZ" start="6" end="6"/>
|
||||
<field name="IM" start="7" end="7"/>
|
||||
<field name="DM" start="8" end="8"/>
|
||||
<field name="ZM" start="9" end="9"/>
|
||||
<field name="OM" start="10" end="10"/>
|
||||
<field name="UM" start="11" end="11"/>
|
||||
<field name="PM" start="12" end="12"/>
|
||||
<field name="FZ" start="15" end="15"/>
|
||||
</flags>
|
||||
|
||||
<reg name="xmm0" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm1" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm2" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm3" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm4" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm5" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm6" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm7" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm8" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm9" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm10" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm11" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm12" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm13" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm14" bitsize="128" type="vec128"/>
|
||||
<reg name="xmm15" bitsize="128" type="vec128"/>
|
||||
|
||||
<reg name="mxcsr" bitsize="32" type="x64_mxcsr" group="vector"/>
|
||||
</feature>
|
||||
|
|
|
@ -30,7 +30,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += ssi/
|
|||
devices-dirs-$(CONFIG_SOFTMMU) += timer/
|
||||
devices-dirs-$(CONFIG_TPM) += tpm/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += usb/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += vfio/
|
||||
devices-dirs-$(CONFIG_VFIO) += vfio/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += virtio/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += watchdog/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += xen/
|
||||
|
|
|
@ -1 +1 @@
|
|||
obj-y += dp264.o pci.o typhoon.o
|
||||
obj-$(CONFIG_DP264) += dp264.o pci.o typhoon.o
|
||||
|
|
|
@ -114,7 +114,7 @@ static void clipper_init(MachineState *machine)
|
|||
error_report("no palcode provided");
|
||||
exit(1);
|
||||
}
|
||||
size = load_elf(palcode_filename, cpu_alpha_superpage_to_phys,
|
||||
size = load_elf(palcode_filename, NULL, cpu_alpha_superpage_to_phys,
|
||||
NULL, &palcode_entry, &palcode_low, &palcode_high,
|
||||
0, EM_ALPHA, 0, 0);
|
||||
if (size < 0) {
|
||||
|
@ -133,7 +133,7 @@ static void clipper_init(MachineState *machine)
|
|||
if (kernel_filename) {
|
||||
uint64_t param_offset;
|
||||
|
||||
size = load_elf(kernel_filename, cpu_alpha_superpage_to_phys,
|
||||
size = load_elf(kernel_filename, NULL, cpu_alpha_superpage_to_phys,
|
||||
NULL, &kernel_entry, &kernel_low, &kernel_high,
|
||||
0, EM_ALPHA, 0, 0);
|
||||
if (size < 0) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
obj-y += boot.o virt.o sysbus-fdt.o
|
||||
obj-y += boot.o sysbus-fdt.o
|
||||
obj-$(CONFIG_ARM_VIRT) += virt.o
|
||||
obj-$(CONFIG_ACPI) += virt-acpi-build.o
|
||||
obj-$(CONFIG_DIGIC) += digic_boards.o
|
||||
obj-$(CONFIG_EXYNOS4) += exynos4_boards.o
|
||||
|
|
|
@ -310,7 +310,8 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size)
|
|||
as = cpu_get_address_space(cs, asidx);
|
||||
|
||||
if (kernel_filename) {
|
||||
image_size = load_elf_as(kernel_filename, NULL, NULL, &entry, &lowaddr,
|
||||
image_size = load_elf_as(kernel_filename, NULL, NULL, NULL,
|
||||
&entry, &lowaddr,
|
||||
NULL, big_endian, EM_ARM, 1, 0, as);
|
||||
if (image_size < 0) {
|
||||
image_size = load_image_targphys_as(kernel_filename, 0,
|
||||
|
|
|
@ -881,7 +881,7 @@ static int64_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry,
|
|||
}
|
||||
}
|
||||
|
||||
ret = load_elf_as(info->kernel_filename, NULL, NULL,
|
||||
ret = load_elf_as(info->kernel_filename, NULL, NULL, NULL,
|
||||
pentry, lowaddr, highaddr, big_endian, elf_machine,
|
||||
1, data_swab, as);
|
||||
if (ret <= 0) {
|
||||
|
|
|
@ -136,7 +136,7 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
|
|||
AddressSpace *as = s->cpu ? s->cpu->as : NULL;
|
||||
|
||||
if (!s->force_raw) {
|
||||
size = load_elf_as(s->file, NULL, NULL, &entry, NULL, NULL,
|
||||
size = load_elf_as(s->file, NULL, NULL, NULL, &entry, NULL, NULL,
|
||||
big_endian, 0, 0, 0, as);
|
||||
|
||||
if (size < 0) {
|
||||
|
|
|
@ -77,21 +77,20 @@ int64_t get_image_size(const char *filename)
|
|||
ssize_t load_image_size(const char *filename, void *addr, size_t size)
|
||||
{
|
||||
int fd;
|
||||
ssize_t actsize;
|
||||
ssize_t actsize, l = 0;
|
||||
|
||||
fd = open(filename, O_RDONLY | O_BINARY);
|
||||
if (fd < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
actsize = read(fd, addr, size);
|
||||
if (actsize < 0) {
|
||||
close(fd);
|
||||
return -1;
|
||||
while ((actsize = read(fd, addr + l, size - l)) > 0) {
|
||||
l += actsize;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
return actsize;
|
||||
return actsize < 0 ? -1 : l;
|
||||
}
|
||||
|
||||
/* read()-like version */
|
||||
|
@ -396,37 +395,42 @@ fail:
|
|||
}
|
||||
|
||||
/* return < 0 if error, otherwise the number of bytes loaded in memory */
|
||||
int load_elf(const char *filename, uint64_t (*translate_fn)(void *, uint64_t),
|
||||
int load_elf(const char *filename,
|
||||
uint64_t (*elf_note_fn)(void *, void *, bool),
|
||||
uint64_t (*translate_fn)(void *, uint64_t),
|
||||
void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
|
||||
uint64_t *highaddr, int big_endian, int elf_machine,
|
||||
int clear_lsb, int data_swab)
|
||||
{
|
||||
return load_elf_as(filename, translate_fn, translate_opaque, pentry,
|
||||
lowaddr, highaddr, big_endian, elf_machine, clear_lsb,
|
||||
data_swab, NULL);
|
||||
return load_elf_as(filename, elf_note_fn, translate_fn, translate_opaque,
|
||||
pentry, lowaddr, highaddr, big_endian, elf_machine,
|
||||
clear_lsb, data_swab, NULL);
|
||||
}
|
||||
|
||||
/* return < 0 if error, otherwise the number of bytes loaded in memory */
|
||||
int load_elf_as(const char *filename,
|
||||
uint64_t (*elf_note_fn)(void *, void *, bool),
|
||||
uint64_t (*translate_fn)(void *, uint64_t),
|
||||
void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
|
||||
uint64_t *highaddr, int big_endian, int elf_machine,
|
||||
int clear_lsb, int data_swab, AddressSpace *as)
|
||||
{
|
||||
return load_elf_ram(filename, translate_fn, translate_opaque,
|
||||
return load_elf_ram(filename, elf_note_fn, translate_fn, translate_opaque,
|
||||
pentry, lowaddr, highaddr, big_endian, elf_machine,
|
||||
clear_lsb, data_swab, as, true);
|
||||
}
|
||||
|
||||
/* return < 0 if error, otherwise the number of bytes loaded in memory */
|
||||
int load_elf_ram(const char *filename,
|
||||
uint64_t (*elf_note_fn)(void *, void *, bool),
|
||||
uint64_t (*translate_fn)(void *, uint64_t),
|
||||
void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
|
||||
uint64_t *highaddr, int big_endian, int elf_machine,
|
||||
int clear_lsb, int data_swab, AddressSpace *as,
|
||||
bool load_rom)
|
||||
{
|
||||
return load_elf_ram_sym(filename, translate_fn, translate_opaque,
|
||||
return load_elf_ram_sym(filename, elf_note_fn,
|
||||
translate_fn, translate_opaque,
|
||||
pentry, lowaddr, highaddr, big_endian,
|
||||
elf_machine, clear_lsb, data_swab, as,
|
||||
load_rom, NULL);
|
||||
|
@ -434,6 +438,7 @@ int load_elf_ram(const char *filename,
|
|||
|
||||
/* return < 0 if error, otherwise the number of bytes loaded in memory */
|
||||
int load_elf_ram_sym(const char *filename,
|
||||
uint64_t (*elf_note_fn)(void *, void *, bool),
|
||||
uint64_t (*translate_fn)(void *, uint64_t),
|
||||
void *translate_opaque, uint64_t *pentry,
|
||||
uint64_t *lowaddr, uint64_t *highaddr, int big_endian,
|
||||
|
@ -476,11 +481,13 @@ int load_elf_ram_sym(const char *filename,
|
|||
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
if (e_ident[EI_CLASS] == ELFCLASS64) {
|
||||
ret = load_elf64(filename, fd, translate_fn, translate_opaque, must_swab,
|
||||
ret = load_elf64(filename, fd, elf_note_fn,
|
||||
translate_fn, translate_opaque, must_swab,
|
||||
pentry, lowaddr, highaddr, elf_machine, clear_lsb,
|
||||
data_swab, as, load_rom, sym_cb);
|
||||
} else {
|
||||
ret = load_elf32(filename, fd, translate_fn, translate_opaque, must_swab,
|
||||
ret = load_elf32(filename, fd, elf_note_fn,
|
||||
translate_fn, translate_opaque, must_swab,
|
||||
pentry, lowaddr, highaddr, elf_machine, clear_lsb,
|
||||
data_swab, as, load_rom, sym_cb);
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
obj-y += boot.o
|
||||
obj-y += axis_dev88.o
|
||||
obj-$(CONFIG_AXIS) += axis_dev88.o
|
||||
|
|
|
@ -75,7 +75,8 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li)
|
|||
env->load_info = li;
|
||||
/* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis
|
||||
devboard SDK. */
|
||||
image_size = load_elf(li->image_filename, translate_kernel_address, NULL,
|
||||
image_size = load_elf(li->image_filename, NULL,
|
||||
translate_kernel_address, NULL,
|
||||
&entry, NULL, &high, 0, EM_CRIS, 0, 0);
|
||||
li->entry = entry;
|
||||
if (image_size < 0) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
obj-y += machine.o pci.o dino.o
|
||||
obj-$(CONFIG_DINO) += pci.o machine.o dino.o
|
||||
|
|
|
@ -135,8 +135,8 @@ static void machine_hppa_init(MachineState *machine)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
size = load_elf(firmware_filename, NULL,
|
||||
NULL, &firmware_entry, &firmware_low, &firmware_high,
|
||||
size = load_elf(firmware_filename, NULL, NULL, NULL,
|
||||
&firmware_entry, &firmware_low, &firmware_high,
|
||||
true, EM_PARISC, 0, 0);
|
||||
|
||||
/* Unfortunately, load_elf sign-extends reading elf32. */
|
||||
|
@ -165,7 +165,7 @@ static void machine_hppa_init(MachineState *machine)
|
|||
|
||||
/* Load kernel */
|
||||
if (kernel_filename) {
|
||||
size = load_elf(kernel_filename, &cpu_hppa_to_phys,
|
||||
size = load_elf(kernel_filename, NULL, &cpu_hppa_to_phys,
|
||||
NULL, &kernel_entry, &kernel_low, &kernel_high,
|
||||
true, EM_PARISC, 0, 0);
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
common-obj-$(CONFIG_I2C) += core.o smbus.o smbus_eeprom.o
|
||||
common-obj-$(CONFIG_I2C) += core.o smbus.o
|
||||
common-obj-$(CONFIG_SMBUS_EEPROM) += smbus_eeprom.o
|
||||
common-obj-$(CONFIG_DDC) += i2c-ddc.o
|
||||
common-obj-$(CONFIG_VERSATILE_I2C) += versatile_i2c.o
|
||||
common-obj-$(CONFIG_ACPI_X86) += smbus_ich9.o
|
||||
common-obj-$(CONFIG_APM) += pm_smbus.o
|
||||
common-obj-$(CONFIG_ACPI_SMBUS) += pm_smbus.o
|
||||
common-obj-$(CONFIG_BITBANG_I2C) += bitbang_i2c.o
|
||||
common-obj-$(CONFIG_EXYNOS4) += exynos4210_i2c.o
|
||||
common-obj-$(CONFIG_IMX_I2C) += imx_i2c.o
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
obj-$(CONFIG_KVM) += kvm/
|
||||
obj-y += multiboot.o
|
||||
obj-y += pc.o pc_piix.o pc_q35.o
|
||||
obj-y += pc.o
|
||||
obj-$(CONFIG_I440FX) += pc_piix.o
|
||||
obj-$(CONFIG_Q35) += pc_q35.o
|
||||
obj-y += pc_sysfw.o
|
||||
obj-$(CONFIG_VTD) += x86-iommu.o intel_iommu.o
|
||||
obj-$(CONFIG_AMD_IOMMU) += x86-iommu.o amd_iommu.o
|
||||
|
|
|
@ -199,7 +199,7 @@ int load_multiboot(FWCfgState *fw_cfg,
|
|||
exit(1);
|
||||
}
|
||||
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL, &elf_entry,
|
||||
&elf_low, &elf_high, 0, I386_ELF_MACHINE,
|
||||
0, 0);
|
||||
if (kernel_size < 0) {
|
||||
|
|
221
hw/i386/pc.c
221
hw/i386/pc.c
|
@ -54,6 +54,7 @@
|
|||
#include "sysemu/qtest.h"
|
||||
#include "kvm_i386.h"
|
||||
#include "hw/xen/xen.h"
|
||||
#include "hw/xen/start_info.h"
|
||||
#include "ui/qemu-spice.h"
|
||||
#include "exec/memory.h"
|
||||
#include "exec/address-spaces.h"
|
||||
|
@ -75,6 +76,7 @@
|
|||
#include "hw/usb.h"
|
||||
#include "hw/i386/intel_iommu.h"
|
||||
#include "hw/net/ne2000-isa.h"
|
||||
#include "standard-headers/asm-x86/bootparam.h"
|
||||
|
||||
/* debug PC/ISA interrupts */
|
||||
//#define DEBUG_IRQ
|
||||
|
@ -110,6 +112,9 @@ static struct e820_entry *e820_table;
|
|||
static unsigned e820_entries;
|
||||
struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};
|
||||
|
||||
/* Physical Address of PVH entry point read from kernel ELF NOTE */
|
||||
static size_t pvh_start_addr;
|
||||
|
||||
GlobalProperty pc_compat_3_1[] = {
|
||||
{ "intel-iommu", "dma-drain", "off" },
|
||||
{ "Opteron_G3" "-" TYPE_X86_CPU, "rdtscp", "off" },
|
||||
|
@ -1055,13 +1060,6 @@ static long get_file_size(FILE *f)
|
|||
return size;
|
||||
}
|
||||
|
||||
/* setup_data types */
|
||||
#define SETUP_NONE 0
|
||||
#define SETUP_E820_EXT 1
|
||||
#define SETUP_DTB 2
|
||||
#define SETUP_PCI 3
|
||||
#define SETUP_EFI 4
|
||||
|
||||
struct setup_data {
|
||||
uint64_t next;
|
||||
uint32_t type;
|
||||
|
@ -1069,6 +1067,109 @@ struct setup_data {
|
|||
uint8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
/*
|
||||
* The entry point into the kernel for PVH boot is different from
|
||||
* the native entry point. The PVH entry is defined by the x86/HVM
|
||||
* direct boot ABI and is available in an ELFNOTE in the kernel binary.
|
||||
*
|
||||
* This function is passed to load_elf() when it is called from
|
||||
* load_elfboot() which then additionally checks for an ELF Note of
|
||||
* type XEN_ELFNOTE_PHYS32_ENTRY and passes it to this function to
|
||||
* parse the PVH entry address from the ELF Note.
|
||||
*
|
||||
* Due to trickery in elf_opts.h, load_elf() is actually available as
|
||||
* load_elf32() or load_elf64() and this routine needs to be able
|
||||
* to deal with being called as 32 or 64 bit.
|
||||
*
|
||||
* The address of the PVH entry point is saved to the 'pvh_start_addr'
|
||||
* global variable. (although the entry point is 32-bit, the kernel
|
||||
* binary can be either 32-bit or 64-bit).
|
||||
*/
|
||||
static uint64_t read_pvh_start_addr(void *arg1, void *arg2, bool is64)
|
||||
{
|
||||
size_t *elf_note_data_addr;
|
||||
|
||||
/* Check if ELF Note header passed in is valid */
|
||||
if (arg1 == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is64) {
|
||||
struct elf64_note *nhdr64 = (struct elf64_note *)arg1;
|
||||
uint64_t nhdr_size64 = sizeof(struct elf64_note);
|
||||
uint64_t phdr_align = *(uint64_t *)arg2;
|
||||
uint64_t nhdr_namesz = nhdr64->n_namesz;
|
||||
|
||||
elf_note_data_addr =
|
||||
((void *)nhdr64) + nhdr_size64 +
|
||||
QEMU_ALIGN_UP(nhdr_namesz, phdr_align);
|
||||
} else {
|
||||
struct elf32_note *nhdr32 = (struct elf32_note *)arg1;
|
||||
uint32_t nhdr_size32 = sizeof(struct elf32_note);
|
||||
uint32_t phdr_align = *(uint32_t *)arg2;
|
||||
uint32_t nhdr_namesz = nhdr32->n_namesz;
|
||||
|
||||
elf_note_data_addr =
|
||||
((void *)nhdr32) + nhdr_size32 +
|
||||
QEMU_ALIGN_UP(nhdr_namesz, phdr_align);
|
||||
}
|
||||
|
||||
pvh_start_addr = *elf_note_data_addr;
|
||||
|
||||
return pvh_start_addr;
|
||||
}
|
||||
|
||||
static bool load_elfboot(const char *kernel_filename,
|
||||
int kernel_file_size,
|
||||
uint8_t *header,
|
||||
size_t pvh_xen_start_addr,
|
||||
FWCfgState *fw_cfg)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
uint32_t mh_load_addr = 0;
|
||||
uint32_t elf_kernel_size = 0;
|
||||
uint64_t elf_entry;
|
||||
uint64_t elf_low, elf_high;
|
||||
int kernel_size;
|
||||
|
||||
if (ldl_p(header) != 0x464c457f) {
|
||||
return false; /* no elfboot */
|
||||
}
|
||||
|
||||
bool elf_is64 = header[EI_CLASS] == ELFCLASS64;
|
||||
flags = elf_is64 ?
|
||||
((Elf64_Ehdr *)header)->e_flags : ((Elf32_Ehdr *)header)->e_flags;
|
||||
|
||||
if (flags & 0x00010004) { /* LOAD_ELF_HEADER_HAS_ADDR */
|
||||
error_report("elfboot unsupported flags = %x", flags);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
uint64_t elf_note_type = XEN_ELFNOTE_PHYS32_ENTRY;
|
||||
kernel_size = load_elf(kernel_filename, read_pvh_start_addr,
|
||||
NULL, &elf_note_type, &elf_entry,
|
||||
&elf_low, &elf_high, 0, I386_ELF_MACHINE,
|
||||
0, 0);
|
||||
|
||||
if (kernel_size < 0) {
|
||||
error_report("Error while loading elf kernel");
|
||||
exit(1);
|
||||
}
|
||||
mh_load_addr = elf_low;
|
||||
elf_kernel_size = elf_high - elf_low;
|
||||
|
||||
if (pvh_start_addr == 0) {
|
||||
error_report("Error loading uncompressed kernel without PVH ELF Note");
|
||||
exit(1);
|
||||
}
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ENTRY, pvh_start_addr);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, mh_load_addr);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, elf_kernel_size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void load_linux(PCMachineState *pcms,
|
||||
FWCfgState *fw_cfg)
|
||||
{
|
||||
|
@ -1108,6 +1209,59 @@ static void load_linux(PCMachineState *pcms,
|
|||
if (ldl_p(header+0x202) == 0x53726448) {
|
||||
protocol = lduw_p(header+0x206);
|
||||
} else {
|
||||
/*
|
||||
* Check if the file is an uncompressed kernel file (ELF) and load it,
|
||||
* saving the PVH entry point used by the x86/HVM direct boot ABI.
|
||||
* If load_elfboot() is successful, populate the fw_cfg info.
|
||||
*/
|
||||
if (pcmc->pvh_enabled &&
|
||||
load_elfboot(kernel_filename, kernel_size,
|
||||
header, pvh_start_addr, fw_cfg)) {
|
||||
fclose(f);
|
||||
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE,
|
||||
strlen(kernel_cmdline) + 1);
|
||||
fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, kernel_cmdline);
|
||||
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_SETUP_SIZE, sizeof(header));
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_SETUP_DATA,
|
||||
header, sizeof(header));
|
||||
|
||||
/* load initrd */
|
||||
if (initrd_filename) {
|
||||
gsize initrd_size;
|
||||
gchar *initrd_data;
|
||||
GError *gerr = NULL;
|
||||
|
||||
if (!g_file_get_contents(initrd_filename, &initrd_data,
|
||||
&initrd_size, &gerr)) {
|
||||
fprintf(stderr, "qemu: error reading initrd %s: %s\n",
|
||||
initrd_filename, gerr->message);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
initrd_max = pcms->below_4g_mem_size - pcmc->acpi_data_size - 1;
|
||||
if (initrd_size >= initrd_max) {
|
||||
fprintf(stderr, "qemu: initrd is too large, cannot support."
|
||||
"(max: %"PRIu32", need %"PRId64")\n",
|
||||
initrd_max, (uint64_t)initrd_size);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
initrd_addr = (initrd_max - initrd_size) & ~4095;
|
||||
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_addr);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, initrd_data,
|
||||
initrd_size);
|
||||
}
|
||||
|
||||
option_rom[nb_option_roms].bootindex = 0;
|
||||
option_rom[nb_option_roms].name = "pvh.bin";
|
||||
nb_option_roms++;
|
||||
|
||||
return;
|
||||
}
|
||||
/* This looks like a multiboot kernel. If it is, let's stop
|
||||
treating it like a Linux kernel. */
|
||||
if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename,
|
||||
|
@ -1145,7 +1299,26 @@ static void load_linux(PCMachineState *pcms,
|
|||
#endif
|
||||
|
||||
/* highest address for loading the initrd */
|
||||
if (protocol >= 0x203) {
|
||||
if (protocol >= 0x20c &&
|
||||
lduw_p(header+0x236) & XLF_CAN_BE_LOADED_ABOVE_4G) {
|
||||
/*
|
||||
* Linux has supported initrd up to 4 GB for a very long time (2007,
|
||||
* long before XLF_CAN_BE_LOADED_ABOVE_4G which was added in 2013),
|
||||
* though it only sets initrd_max to 2 GB to "work around bootloader
|
||||
* bugs". Luckily, QEMU firmware(which does something like bootloader)
|
||||
* has supported this.
|
||||
*
|
||||
* It's believed that if XLF_CAN_BE_LOADED_ABOVE_4G is set, initrd can
|
||||
* be loaded into any address.
|
||||
*
|
||||
* In addition, initrd_max is uint32_t simply because QEMU doesn't
|
||||
* support the 64-bit boot protocol (specifically the ext_ramdisk_image
|
||||
* field).
|
||||
*
|
||||
* Therefore here just limit initrd_max to UINT32_MAX simply as well.
|
||||
*/
|
||||
initrd_max = UINT32_MAX;
|
||||
} else if (protocol >= 0x203) {
|
||||
initrd_max = ldl_p(header+0x22c);
|
||||
} else {
|
||||
initrd_max = 0x37ffffff;
|
||||
|
@ -1557,6 +1730,7 @@ void xen_load_linux(PCMachineState *pcms)
|
|||
for (i = 0; i < nb_option_roms; i++) {
|
||||
assert(!strcmp(option_rom[i].name, "linuxboot.bin") ||
|
||||
!strcmp(option_rom[i].name, "linuxboot_dma.bin") ||
|
||||
!strcmp(option_rom[i].name, "pvh.bin") ||
|
||||
!strcmp(option_rom[i].name, "multiboot.bin"));
|
||||
rom_add_option(option_rom[i].name, option_rom[i].bootindex);
|
||||
}
|
||||
|
@ -1948,7 +2122,6 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|||
static void pc_memory_plug(HotplugHandler *hotplug_dev,
|
||||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
HotplugHandlerClass *hhc;
|
||||
Error *local_err = NULL;
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
|
||||
|
@ -1962,8 +2135,7 @@ static void pc_memory_plug(HotplugHandler *hotplug_dev,
|
|||
nvdimm_plug(&pcms->acpi_nvdimm_state);
|
||||
}
|
||||
|
||||
hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
|
||||
hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &error_abort);
|
||||
hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &error_abort);
|
||||
out:
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
@ -1971,7 +2143,6 @@ out:
|
|||
static void pc_memory_unplug_request(HotplugHandler *hotplug_dev,
|
||||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
HotplugHandlerClass *hhc;
|
||||
Error *local_err = NULL;
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
|
||||
|
@ -1992,9 +2163,8 @@ static void pc_memory_unplug_request(HotplugHandler *hotplug_dev,
|
|||
goto out;
|
||||
}
|
||||
|
||||
hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
|
||||
hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
|
||||
hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev,
|
||||
&local_err);
|
||||
out:
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
@ -2003,12 +2173,9 @@ static void pc_memory_unplug(HotplugHandler *hotplug_dev,
|
|||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
HotplugHandlerClass *hhc;
|
||||
Error *local_err = NULL;
|
||||
|
||||
hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
|
||||
hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
|
||||
hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
if (local_err) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -2050,14 +2217,12 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev,
|
|||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
CPUArchId *found_cpu;
|
||||
HotplugHandlerClass *hhc;
|
||||
Error *local_err = NULL;
|
||||
X86CPU *cpu = X86_CPU(dev);
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
|
||||
if (pcms->acpi_dev) {
|
||||
hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
|
||||
hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
if (local_err) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -2081,7 +2246,6 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
|
|||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
int idx = -1;
|
||||
HotplugHandlerClass *hhc;
|
||||
Error *local_err = NULL;
|
||||
X86CPU *cpu = X86_CPU(dev);
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
|
@ -2098,9 +2262,8 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
|
|||
goto out;
|
||||
}
|
||||
|
||||
hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
|
||||
hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
|
||||
hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev,
|
||||
&local_err);
|
||||
if (local_err) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -2114,14 +2277,11 @@ static void pc_cpu_unplug_cb(HotplugHandler *hotplug_dev,
|
|||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
CPUArchId *found_cpu;
|
||||
HotplugHandlerClass *hhc;
|
||||
Error *local_err = NULL;
|
||||
X86CPU *cpu = X86_CPU(dev);
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
|
||||
hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
|
||||
hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
|
||||
hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
if (local_err) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -2623,6 +2783,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
|
|||
pcmc->acpi_data_size = 0x20000 + 0x8000;
|
||||
pcmc->save_tsc_khz = true;
|
||||
pcmc->linuxboot_dma_enabled = true;
|
||||
pcmc->pvh_enabled = true;
|
||||
assert(!mc->get_hotplug_handler);
|
||||
mc->get_hotplug_handler = pc_get_hotplug_handler;
|
||||
mc->cpu_index_to_instance_props = pc_cpu_index_to_props;
|
||||
|
|
|
@ -440,9 +440,12 @@ DEFINE_I440FX_MACHINE(v4_0, "pc-i440fx-4.0", NULL,
|
|||
|
||||
static void pc_i440fx_3_1_machine_options(MachineClass *m)
|
||||
{
|
||||
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
|
||||
pc_i440fx_4_0_machine_options(m);
|
||||
m->is_default = 0;
|
||||
m->alias = NULL;
|
||||
pcmc->pvh_enabled = false;
|
||||
compat_props_add(m->compat_props, hw_compat_3_1, hw_compat_3_1_len);
|
||||
compat_props_add(m->compat_props, pc_compat_3_1, pc_compat_3_1_len);
|
||||
}
|
||||
|
|
|
@ -376,9 +376,12 @@ DEFINE_Q35_MACHINE(v4_0, "pc-q35-4.0", NULL,
|
|||
|
||||
static void pc_q35_3_1_machine_options(MachineClass *m)
|
||||
{
|
||||
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
|
||||
pc_q35_4_0_machine_options(m);
|
||||
m->default_kernel_irqchip_split = false;
|
||||
m->alias = NULL;
|
||||
pcmc->pvh_enabled = false;
|
||||
compat_props_add(m->compat_props, hw_compat_3_1, hw_compat_3_1_len);
|
||||
compat_props_add(m->compat_props, pc_compat_3_1, pc_compat_3_1_len);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
common-obj-$(CONFIG_IDE_CORE) += core.o atapi.o
|
||||
common-obj-$(CONFIG_IDE_QDEV) += qdev.o
|
||||
common-obj-$(CONFIG_IDE_PCI) += pci.o
|
||||
common-obj-$(CONFIG_IDE_ISA) += isa.o
|
||||
common-obj-$(CONFIG_IDE_PIIX) += piix.o
|
||||
common-obj-$(CONFIG_IDE_ISA) += isa.o ioport.o
|
||||
common-obj-$(CONFIG_IDE_PIIX) += piix.o ioport.o
|
||||
common-obj-$(CONFIG_IDE_CMD646) += cmd646.o
|
||||
common-obj-$(CONFIG_IDE_MACIO) += macio.o
|
||||
common-obj-$(CONFIG_IDE_MMIO) += mmio.o
|
||||
|
|
|
@ -2686,31 +2686,6 @@ void ide_exit(IDEState *s)
|
|||
qemu_vfree(s->io_buffer);
|
||||
}
|
||||
|
||||
static const MemoryRegionPortio ide_portio_list[] = {
|
||||
{ 0, 8, 1, .read = ide_ioport_read, .write = ide_ioport_write },
|
||||
{ 0, 1, 2, .read = ide_data_readw, .write = ide_data_writew },
|
||||
{ 0, 1, 4, .read = ide_data_readl, .write = ide_data_writel },
|
||||
PORTIO_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static const MemoryRegionPortio ide_portio2_list[] = {
|
||||
{ 0, 1, 1, .read = ide_status_read, .write = ide_cmd_write },
|
||||
PORTIO_END_OF_LIST(),
|
||||
};
|
||||
|
||||
void ide_init_ioport(IDEBus *bus, ISADevice *dev, int iobase, int iobase2)
|
||||
{
|
||||
/* ??? Assume only ISA and PCI configurations, and that the PCI-ISA
|
||||
bridge has been setup properly to always register with ISA. */
|
||||
isa_register_portio_list(dev, &bus->portio_list,
|
||||
iobase, ide_portio_list, bus, "ide");
|
||||
|
||||
if (iobase2) {
|
||||
isa_register_portio_list(dev, &bus->portio2_list,
|
||||
iobase2, ide_portio2_list, bus, "ide");
|
||||
}
|
||||
}
|
||||
|
||||
static bool is_identify_set(void *opaque, int version_id)
|
||||
{
|
||||
IDEState *s = opaque;
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* QEMU IDE disk and CD/DVD-ROM Emulator
|
||||
*
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
* Copyright (c) 2006 Openedhand Ltd.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/hw.h"
|
||||
#include "hw/isa/isa.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "sysemu/blockdev.h"
|
||||
#include "sysemu/dma.h"
|
||||
#include "hw/block/block.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "sysemu/replay.h"
|
||||
|
||||
#include "hw/ide/internal.h"
|
||||
#include "trace.h"
|
||||
|
||||
static const MemoryRegionPortio ide_portio_list[] = {
|
||||
{ 0, 8, 1, .read = ide_ioport_read, .write = ide_ioport_write },
|
||||
{ 0, 1, 2, .read = ide_data_readw, .write = ide_data_writew },
|
||||
{ 0, 1, 4, .read = ide_data_readl, .write = ide_data_writel },
|
||||
PORTIO_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static const MemoryRegionPortio ide_portio2_list[] = {
|
||||
{ 0, 1, 1, .read = ide_status_read, .write = ide_cmd_write },
|
||||
PORTIO_END_OF_LIST(),
|
||||
};
|
||||
|
||||
void ide_init_ioport(IDEBus *bus, ISADevice *dev, int iobase, int iobase2)
|
||||
{
|
||||
/* ??? Assume only ISA and PCI configurations, and that the PCI-ISA
|
||||
bridge has been setup properly to always register with ISA. */
|
||||
isa_register_portio_list(dev, &bus->portio_list,
|
||||
iobase, ide_portio_list, bus, "ide");
|
||||
|
||||
if (iobase2) {
|
||||
isa_register_portio_list(dev, &bus->portio2_list,
|
||||
iobase2, ide_portio2_list, bus, "ide");
|
||||
}
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
# LM32 boards
|
||||
obj-y += lm32_boards.o
|
||||
obj-y += milkymist.o
|
||||
obj-$(CONFIG_LM32) += lm32_boards.o
|
||||
obj-$(CONFIG_MILKYMIST) += milkymist.o
|
||||
|
|
|
@ -138,7 +138,8 @@ static void lm32_evr_init(MachineState *machine)
|
|||
uint64_t entry;
|
||||
int kernel_size;
|
||||
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
||||
&entry, NULL, NULL,
|
||||
1, EM_LATTICEMICO32, 0, 0);
|
||||
reset_info->bootstrap_pc = entry;
|
||||
|
||||
|
@ -231,7 +232,8 @@ static void lm32_uclinux_init(MachineState *machine)
|
|||
uint64_t entry;
|
||||
int kernel_size;
|
||||
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
||||
&entry, NULL, NULL,
|
||||
1, EM_LATTICEMICO32, 0, 0);
|
||||
reset_info->bootstrap_pc = entry;
|
||||
|
||||
|
|
|
@ -176,7 +176,8 @@ milkymist_init(MachineState *machine)
|
|||
uint64_t entry;
|
||||
|
||||
/* Boots a kernel elf binary. */
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
||||
&entry, NULL, NULL,
|
||||
1, EM_LATTICEMICO32, 0, 0);
|
||||
reset_info->bootstrap_pc = entry;
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
obj-y += an5206.o mcf5208.o
|
||||
obj-y += mcf5206.o mcf_intc.o
|
||||
obj-$(CONFIG_AN5206) += an5206.o mcf5206.o
|
||||
obj-$(CONFIG_MCF5208) += mcf5208.o mcf_intc.o
|
||||
|
|
|
@ -66,7 +66,7 @@ static void an5206_init(MachineState *machine)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL, &elf_entry,
|
||||
NULL, NULL, 1, EM_68K, 0, 0);
|
||||
entry = elf_entry;
|
||||
if (kernel_size < 0) {
|
||||
|
|
|
@ -294,7 +294,7 @@ static void mcf5208evb_init(MachineState *machine)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL, &elf_entry,
|
||||
NULL, NULL, 1, EM_68K, 0, 0);
|
||||
entry = elf_entry;
|
||||
if (kernel_size < 0) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
obj-y += petalogix_s3adsp1800_mmu.o
|
||||
obj-y += petalogix_ml605_mmu.o
|
||||
obj-y += xlnx-zynqmp-pmu.o
|
||||
obj-$(CONFIG_PETALOGIX_S3ADSP1800) += petalogix_s3adsp1800_mmu.o
|
||||
obj-$(CONFIG_PETALOGIX_ML605) += petalogix_ml605_mmu.o
|
||||
obj-$(CONFIG_XLNX_ZYNQMP_PMU) += xlnx-zynqmp-pmu.o
|
||||
obj-y += boot.o
|
||||
|
|
|
@ -142,13 +142,14 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base,
|
|||
#endif
|
||||
|
||||
/* Boots a kernel elf binary. */
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
||||
&entry, &low, &high,
|
||||
big_endian, EM_MICROBLAZE, 0, 0);
|
||||
base32 = entry;
|
||||
if (base32 == 0xc0000000) {
|
||||
kernel_size = load_elf(kernel_filename, translate_kernel_address,
|
||||
NULL, &entry, NULL, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL,
|
||||
translate_kernel_address, NULL,
|
||||
&entry, NULL, NULL,
|
||||
big_endian, EM_MICROBLAZE, 0, 0);
|
||||
}
|
||||
/* Always boot into physical ram. */
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
obj-y += mips_r4k.o mips_malta.o mips_mipssim.o
|
||||
obj-y += addr.o mips_int.o
|
||||
obj-$(CONFIG_R4K) += mips_r4k.o
|
||||
obj-$(CONFIG_MALTA) += gt64xxx_pci.o mips_malta.o
|
||||
obj-$(CONFIG_MIPSSIM) += mips_mipssim.o
|
||||
obj-$(CONFIG_JAZZ) += mips_jazz.o
|
||||
obj-$(CONFIG_FULONG) += mips_fulong2e.o
|
||||
obj-y += gt64xxx_pci.o
|
||||
obj-$(CONFIG_MIPS_CPS) += cps.o
|
||||
obj-$(CONFIG_MIPS_BOSTON) += boston.o
|
||||
|
|
|
@ -111,8 +111,9 @@ static int64_t load_kernel (CPUMIPSState *env)
|
|||
uint32_t *prom_buf;
|
||||
long prom_size;
|
||||
|
||||
kernel_size = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys,
|
||||
NULL, (uint64_t *)&kernel_entry,
|
||||
kernel_size = load_elf(loaderparams.kernel_filename, NULL,
|
||||
cpu_mips_kseg0_to_phys, NULL,
|
||||
(uint64_t *)&kernel_entry,
|
||||
(uint64_t *)&kernel_low, (uint64_t *)&kernel_high,
|
||||
0, EM_MIPS, 1, 0);
|
||||
if (kernel_size < 0) {
|
||||
|
|
|
@ -1010,8 +1010,9 @@ static int64_t load_kernel (void)
|
|||
big_endian = 0;
|
||||
#endif
|
||||
|
||||
kernel_size = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys,
|
||||
NULL, (uint64_t *)&kernel_entry, NULL,
|
||||
kernel_size = load_elf(loaderparams.kernel_filename, NULL,
|
||||
cpu_mips_kseg0_to_phys, NULL,
|
||||
(uint64_t *)&kernel_entry, NULL,
|
||||
(uint64_t *)&kernel_high, big_endian, EM_MIPS, 1, 0);
|
||||
if (kernel_size < 0) {
|
||||
error_report("could not load kernel '%s': %s",
|
||||
|
|
|
@ -69,8 +69,9 @@ static int64_t load_kernel(void)
|
|||
big_endian = 0;
|
||||
#endif
|
||||
|
||||
kernel_size = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys,
|
||||
NULL, (uint64_t *)&entry, NULL,
|
||||
kernel_size = load_elf(loaderparams.kernel_filename, NULL,
|
||||
cpu_mips_kseg0_to_phys, NULL,
|
||||
(uint64_t *)&entry, NULL,
|
||||
(uint64_t *)&kernel_high, big_endian,
|
||||
EM_MIPS, 1, 0);
|
||||
if (kernel_size >= 0) {
|
||||
|
|
|
@ -92,8 +92,9 @@ static int64_t load_kernel(void)
|
|||
#else
|
||||
big_endian = 0;
|
||||
#endif
|
||||
kernel_size = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys,
|
||||
NULL, (uint64_t *)&entry, NULL,
|
||||
kernel_size = load_elf(loaderparams.kernel_filename, NULL,
|
||||
cpu_mips_kseg0_to_phys, NULL,
|
||||
(uint64_t *)&entry, NULL,
|
||||
(uint64_t *)&kernel_high, big_endian,
|
||||
EM_MIPS, 1, 0);
|
||||
if (kernel_size >= 0) {
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# moxie boards
|
||||
obj-y += moxiesim.o
|
||||
obj-$(CONFIG_MOXIESIM) += moxiesim.o
|
||||
|
|
|
@ -57,7 +57,7 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params)
|
|||
long kernel_size;
|
||||
ram_addr_t initrd_offset;
|
||||
|
||||
kernel_size = load_elf(loader_params->kernel_filename, NULL, NULL,
|
||||
kernel_size = load_elf(loader_params->kernel_filename, NULL, NULL, NULL,
|
||||
&entry, &kernel_low, &kernel_high, 1, EM_MOXIE,
|
||||
0, 0);
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ common-obj-$(CONFIG_EEPRO100_PCI) += eepro100.o
|
|||
common-obj-$(CONFIG_PCNET_PCI) += pcnet-pci.o
|
||||
common-obj-$(CONFIG_PCNET_COMMON) += pcnet.o
|
||||
common-obj-$(CONFIG_E1000_PCI) += e1000.o e1000x_common.o
|
||||
common-obj-$(CONFIG_E1000E_PCI) += net_tx_pkt.o net_rx_pkt.o
|
||||
common-obj-$(CONFIG_E1000E_PCI) += e1000e.o e1000e_core.o e1000x_common.o
|
||||
common-obj-$(CONFIG_E1000E_PCI_EXPRESS) += net_tx_pkt.o net_rx_pkt.o
|
||||
common-obj-$(CONFIG_E1000E_PCI_EXPRESS) += e1000e.o e1000e_core.o e1000x_common.o
|
||||
common-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o
|
||||
common-obj-$(CONFIG_VMXNET3_PCI) += net_tx_pkt.o net_rx_pkt.o
|
||||
common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet3.o
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
obj-y = boot.o cpu_pic.o 10m50_devboard.o
|
||||
obj-y = boot.o cpu_pic.o
|
||||
obj-$(CONFIG_NIOS2_10M50) += 10m50_devboard.o
|
||||
|
|
|
@ -146,13 +146,14 @@ void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base,
|
|||
#endif
|
||||
|
||||
/* Boots a kernel elf binary. */
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
||||
&entry, &low, &high,
|
||||
big_endian, EM_ALTERA_NIOS2, 0, 0);
|
||||
base32 = entry;
|
||||
if (base32 == 0xc0000000) {
|
||||
kernel_size = load_elf(kernel_filename, translate_kernel_address,
|
||||
NULL, &entry, NULL, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL,
|
||||
translate_kernel_address, NULL,
|
||||
&entry, NULL, NULL,
|
||||
big_endian, EM_ALTERA_NIOS2, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
obj-y = pic_cpu.o cputimer.o
|
||||
obj-y += openrisc_sim.o
|
||||
obj-$(CONFIG_OR1K_SIM) += openrisc_sim.o
|
||||
|
|
|
@ -96,7 +96,7 @@ static void openrisc_load_kernel(ram_addr_t ram_size,
|
|||
hwaddr entry;
|
||||
|
||||
if (kernel_filename && !qtest_enabled()) {
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
||||
&elf_entry, NULL, NULL, 1, EM_OPENRISC,
|
||||
1, 0);
|
||||
entry = elf_entry;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
common-obj-y += pam.o
|
||||
common-obj-$(CONFIG_PAM) += pam.o
|
||||
|
||||
# PPC devices
|
||||
common-obj-$(CONFIG_PREP_PCI) += prep.o
|
||||
|
@ -14,8 +14,8 @@ common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o
|
|||
common-obj-$(CONFIG_PCI_SABRE) += sabre.o
|
||||
common-obj-$(CONFIG_FULONG) += bonito.o
|
||||
common-obj-$(CONFIG_PCI_PIIX) += piix.o
|
||||
common-obj-$(CONFIG_PCI_Q35) += q35.o
|
||||
common-obj-$(CONFIG_PCI_GENERIC) += gpex.o
|
||||
common-obj-$(CONFIG_PCI_XILINX) += xilinx-pcie.o
|
||||
common-obj-$(CONFIG_PCI_EXPRESS_Q35) += q35.o
|
||||
common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) += gpex.o
|
||||
common-obj-$(CONFIG_PCI_EXPRESS_XILINX) += xilinx-pcie.o
|
||||
|
||||
common-obj-$(CONFIG_PCI_DESIGNWARE) += designware.o
|
||||
common-obj-$(CONFIG_PCI_EXPRESS_DESIGNWARE) += designware.o
|
||||
|
|
|
@ -331,7 +331,7 @@ static void raven_realize(PCIDevice *d, Error **errp)
|
|||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, s->bios_name);
|
||||
if (filename) {
|
||||
if (s->elf_machine != EM_NONE) {
|
||||
bios_size = load_elf(filename, NULL, NULL, NULL,
|
||||
bios_size = load_elf(filename, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, 1, s->elf_machine, 0, 0);
|
||||
}
|
||||
if (bios_size < 0) {
|
||||
|
|
|
@ -13,19 +13,20 @@ obj-y += spapr_pci_vfio.o
|
|||
endif
|
||||
obj-$(CONFIG_PSERIES) += spapr_rtas_ddw.o
|
||||
# PowerPC 4xx boards
|
||||
obj-$(CONFIG_PPC4XX) += ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
|
||||
obj-$(CONFIG_PPC4XX) += ppc440_bamboo.o ppc440_pcix.o ppc440_uc.o
|
||||
obj-$(CONFIG_PPC405) += ppc405_boards.o ppc405_uc.o
|
||||
obj-$(CONFIG_PPC440) += ppc440_bamboo.o ppc440_pcix.o ppc440_uc.o
|
||||
obj-$(CONFIG_PPC4XX) += ppc4xx_pci.o ppc4xx_devs.o
|
||||
obj-$(CONFIG_SAM460EX) += sam460ex.o
|
||||
# PReP
|
||||
obj-$(CONFIG_PREP) += prep.o
|
||||
obj-$(CONFIG_PREP) += prep_systemio.o
|
||||
obj-${CONFIG_RS6000_MC} += rs6000_mc.o
|
||||
# OldWorld PowerMac
|
||||
obj-$(CONFIG_MAC) += mac_oldworld.o
|
||||
obj-$(CONFIG_MAC_OLDWORLD) += mac_oldworld.o
|
||||
# NewWorld PowerMac
|
||||
obj-$(CONFIG_MAC) += mac_newworld.o
|
||||
obj-$(CONFIG_MAC_NEWWORLD) += mac_newworld.o
|
||||
# e500
|
||||
obj-$(CONFIG_E500) += e500.o mpc8544ds.o e500plat.o
|
||||
obj-$(CONFIG_E500) += mpc8544_guts.o ppce500_spin.o
|
||||
# PowerPC 440 Xilinx ML507 reference board.
|
||||
obj-$(CONFIG_XILINX) += virtex_ml507.o
|
||||
obj-$(CONFIG_VIRTEX) += virtex_ml507.o
|
||||
|
|
|
@ -988,7 +988,8 @@ void ppce500_init(MachineState *machine)
|
|||
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, payload_name);
|
||||
|
||||
payload_size = load_elf(filename, NULL, NULL, &bios_entry, &loadaddr, NULL,
|
||||
payload_size = load_elf(filename, NULL, NULL, NULL,
|
||||
&bios_entry, &loadaddr, NULL,
|
||||
1, PPC_ELF_MACHINE, 0, 0);
|
||||
if (payload_size < 0) {
|
||||
/*
|
||||
|
|
|
@ -164,7 +164,7 @@ static void ppc_core99_init(MachineState *machine)
|
|||
|
||||
/* Load OpenBIOS (ELF) */
|
||||
if (filename) {
|
||||
bios_size = load_elf(filename, NULL, NULL, NULL,
|
||||
bios_size = load_elf(filename, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0);
|
||||
|
||||
g_free(filename);
|
||||
|
@ -187,7 +187,8 @@ static void ppc_core99_init(MachineState *machine)
|
|||
#endif
|
||||
kernel_base = KERNEL_LOAD_ADDR;
|
||||
|
||||
kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL,
|
||||
translate_kernel_address, NULL,
|
||||
NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE,
|
||||
0, 0);
|
||||
if (kernel_size < 0)
|
||||
|
|
|
@ -139,7 +139,7 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
|
||||
/* Load OpenBIOS (ELF) */
|
||||
if (filename) {
|
||||
bios_size = load_elf(filename, 0, NULL, NULL, NULL, NULL,
|
||||
bios_size = load_elf(filename, NULL, 0, NULL, NULL, NULL, NULL,
|
||||
1, PPC_ELF_MACHINE, 0, 0);
|
||||
g_free(filename);
|
||||
} else {
|
||||
|
@ -160,7 +160,8 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
bswap_needed = 0;
|
||||
#endif
|
||||
kernel_base = KERNEL_LOAD_ADDR;
|
||||
kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL,
|
||||
translate_kernel_address, NULL,
|
||||
NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE,
|
||||
0, 0);
|
||||
if (kernel_size < 0)
|
||||
|
|
|
@ -256,7 +256,7 @@ static void bamboo_init(MachineState *machine)
|
|||
success = load_uimage(kernel_filename, &entry, &loadaddr, NULL,
|
||||
NULL, NULL);
|
||||
if (success < 0) {
|
||||
success = load_elf(kernel_filename, NULL, NULL, &elf_entry,
|
||||
success = load_elf(kernel_filename, NULL, NULL, NULL, &elf_entry,
|
||||
&elf_lowaddr, NULL, 1, PPC_ELF_MACHINE,
|
||||
0, 0);
|
||||
entry = elf_entry;
|
||||
|
|
|
@ -426,7 +426,8 @@ static void sam460ex_init(MachineState *machine)
|
|||
if (success < 0) {
|
||||
uint64_t elf_entry, elf_lowaddr;
|
||||
|
||||
success = load_elf(machine->kernel_filename, NULL, NULL, &elf_entry,
|
||||
success = load_elf(machine->kernel_filename, NULL,
|
||||
NULL, NULL, &elf_entry,
|
||||
&elf_lowaddr, NULL, 1, PPC_ELF_MACHINE, 0, 0);
|
||||
entry = elf_entry;
|
||||
loadaddr = elf_lowaddr;
|
||||
|
|
|
@ -2851,11 +2851,12 @@ static void spapr_machine_init(MachineState *machine)
|
|||
if (kernel_filename) {
|
||||
uint64_t lowaddr = 0;
|
||||
|
||||
spapr->kernel_size = load_elf(kernel_filename, translate_kernel_address,
|
||||
NULL, NULL, &lowaddr, NULL, 1,
|
||||
spapr->kernel_size = load_elf(kernel_filename, NULL,
|
||||
translate_kernel_address, NULL,
|
||||
NULL, &lowaddr, NULL, 1,
|
||||
PPC_ELF_MACHINE, 0, 0);
|
||||
if (spapr->kernel_size == ELF_LOAD_WRONG_ENDIAN) {
|
||||
spapr->kernel_size = load_elf(kernel_filename,
|
||||
spapr->kernel_size = load_elf(kernel_filename, NULL,
|
||||
translate_kernel_address, NULL, NULL,
|
||||
&lowaddr, NULL, 0, PPC_ELF_MACHINE,
|
||||
0, 0);
|
||||
|
|
|
@ -258,7 +258,7 @@ static void virtex_init(MachineState *machine)
|
|||
hwaddr boot_offset;
|
||||
|
||||
/* Boots a kernel elf binary. */
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL,
|
||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
||||
&entry, &low, &high, 1, PPC_ELF_MACHINE,
|
||||
0, 0);
|
||||
boot_info.bootstrap_pc = entry & 0x00ffffff;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
obj-y += riscv_htif.o
|
||||
obj-y += riscv_hart.o
|
||||
obj-y += sifive_e.o
|
||||
obj-y += sifive_clint.o
|
||||
obj-y += sifive_prci.o
|
||||
obj-y += sifive_plic.o
|
||||
obj-y += sifive_test.o
|
||||
obj-y += sifive_u.o
|
||||
obj-y += sifive_uart.o
|
||||
obj-y += spike.o
|
||||
obj-y += virt.o
|
||||
obj-$(CONFIG_SPIKE) += riscv_htif.o
|
||||
obj-$(CONFIG_HART) += riscv_hart.o
|
||||
obj-$(CONFIG_SIFIVE_E) += sifive_e.o
|
||||
obj-$(CONFIG_SIFIVE) += sifive_clint.o
|
||||
obj-$(CONFIG_SIFIVE) += sifive_prci.o
|
||||
obj-$(CONFIG_SIFIVE) += sifive_plic.o
|
||||
obj-$(CONFIG_SIFIVE) += sifive_test.o
|
||||
obj-$(CONFIG_SIFIVE_U) += sifive_u.o
|
||||
obj-$(CONFIG_SIFIVE) += sifive_uart.o
|
||||
obj-$(CONFIG_SPIKE) += spike.o
|
||||
obj-$(CONFIG_RISCV_VIRT) += virt.o
|
||||
|
|
|
@ -78,7 +78,7 @@ static uint64_t load_kernel(const char *kernel_filename)
|
|||
{
|
||||
uint64_t kernel_entry, kernel_high;
|
||||
|
||||
if (load_elf(kernel_filename, NULL, NULL,
|
||||
if (load_elf(kernel_filename, NULL, NULL, NULL,
|
||||
&kernel_entry, NULL, &kernel_high,
|
||||
0, EM_RISCV, 1, 0) < 0) {
|
||||
error_report("could not load kernel '%s'", kernel_filename);
|
||||
|
|
|
@ -69,7 +69,7 @@ static uint64_t load_kernel(const char *kernel_filename)
|
|||
{
|
||||
uint64_t kernel_entry, kernel_high;
|
||||
|
||||
if (load_elf(kernel_filename, NULL, NULL,
|
||||
if (load_elf(kernel_filename, NULL, NULL, NULL,
|
||||
&kernel_entry, NULL, &kernel_high,
|
||||
0, EM_RISCV, 1, 0) < 0) {
|
||||
error_report("could not load kernel '%s'", kernel_filename);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue