From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KdVcN-0003ef-6O for qemu-devel@nongnu.org; Wed, 10 Sep 2008 15:44:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KdVcL-0003dj-Sv for qemu-devel@nongnu.org; Wed, 10 Sep 2008 15:44:46 -0400 Received: from [199.232.76.173] (port=46393 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KdVcL-0003de-JN for qemu-devel@nongnu.org; Wed, 10 Sep 2008 15:44:45 -0400 Received: from smtp8-g19.free.fr ([212.27.42.65]:42108) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KdVcK-000465-Ha for qemu-devel@nongnu.org; Wed, 10 Sep 2008 15:44:45 -0400 Received: from smtp8-g19.free.fr (localhost [127.0.0.1]) by smtp8-g19.free.fr (Postfix) with ESMTP id 960DD32A81F for ; Wed, 10 Sep 2008 21:44:42 +0200 (CEST) Received: from [192.168.0.32] (rob92-10-88-171-126-33.fbx.proxad.net [88.171.126.33]) by smtp8-g19.free.fr (Postfix) with ESMTP id 5C7C632A7D6 for ; Wed, 10 Sep 2008 21:44:42 +0200 (CEST) Message-ID: <48C823A9.10103@reactos.org> Date: Wed, 10 Sep 2008 21:44:41 +0200 From: =?ISO-8859-1?Q?Herv=E9_Poussineau?= MIME-Version: 1.0 Subject: Re: [Qemu-devel] [Patch] Ali Chipset support for PC [+ questions about alpha-softmmu target] References: <1220975614.29130.86.camel@nibbler.dlib.indiana.edu> In-Reply-To: <1220975614.29130.86.camel@nibbler.dlib.indiana.edu> Content-Type: multipart/mixed; boundary="------------070309090501010208050402" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------070309090501010208050402 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Hi, Brian Wheeler a =E9crit : > Since the ES40 Alpha Emulation project seems to have stalled, I've been > looking at what it would take to get QEmu to a state where it could > emulate an alpha machine. =20 I tried some time ago to add an alpha-softmmu target to Qemu. Unfortunately, it doesn't even try to decode the first instruction, for=20 some unknown reason... Attached patch gives what I have. Herv=E9 --------------070309090501010208050402 Content-Type: plain/text; name="es40.diff" Content-Disposition: inline; filename="es40.diff" Content-Transfer-Encoding: quoted-printable =EF=BB=BFIndex: Makefile.target =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- Makefile.target (r=C3=A9vision 5185) +++ Makefile.target (copie de travail) @@ -211,7 +211,7 @@ endif =20 ifeq ($(TARGET_BASE_ARCH), alpha) -LIBOBJS+=3D alpha_palcode.o +LIBOBJS+=3D alpha_palcode.o alpha_es40.o endif =20 ifeq ($(TARGET_BASE_ARCH), cris) Index: target-alpha/cpu.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- target-alpha/cpu.h (r=C3=A9vision 5185) +++ target-alpha/cpu.h (copie de travail) @@ -223,6 +223,8 @@ IPR_LAST, }; =20 +typedef struct alpha_def_t alpha_def_t; + typedef struct CPUAlphaState CPUAlphaState; =20 typedef struct pal_handler_t pal_handler_t; @@ -297,6 +299,7 @@ #define cpu_exec cpu_alpha_exec #define cpu_gen_code cpu_alpha_gen_code #define cpu_signal_handler cpu_alpha_signal_handler +#define cpu_list alpha_cpu_list =20 /* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel @@ -401,6 +404,7 @@ }; =20 CPUAlphaState * cpu_alpha_init (const char *cpu_model); +void alpha_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fm= t, ...)); int cpu_alpha_exec(CPUAlphaState *s); /* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero Index: target-alpha/translate.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- target-alpha/translate.c (r=C3=A9vision 5185) +++ target-alpha/translate.c (copie de travail) @@ -2001,17 +2001,34 @@ gen_intermediate_code_internal(env, tb, 1); } =20 +#include "translate_init.c" + CPUAlphaState * cpu_alpha_init (const char *cpu_model) { CPUAlphaState *env; - uint64_t hwpcb; + const alpha_def_t *def; =20 + def =3D cpu_alpha_find_by_name(cpu_model); + if (!def) + return NULL; env =3D qemu_mallocz(sizeof(CPUAlphaState)); if (!env) return NULL; + //env->cpu_model =3D def; +=20 cpu_exec_init(env); + //env->cpu_model_str =3D cpu_model; + cpu_reset(env); + return env; +} + +void cpu_reset (CPUAlphaState *env) +{ + uint64_t hwpcb; + alpha_translate_init(); tlb_flush(env, 1); + =20 /* XXX: should not be hardcoded */ env->implver =3D IMPLVER_2106x; env->ps =3D 0x1F00; @@ -2037,8 +2054,6 @@ // env->ipr[IPR_PTBR] =3D ldq_raw(hwpcb + 32); env->ipr[IPR_SISR] =3D 0; env->ipr[IPR_VIRBND] =3D -1ULL; - - return env; } =20 void gen_pc_load(CPUState *env, TranslationBlock *tb, Index: monitor.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- monitor.c (r=C3=A9vision 5185) +++ monitor.c (copie de travail) @@ -319,6 +319,8 @@ term_printf(" pc=3D0x" TARGET_FMT_lx " npc=3D0x" TARGET_FMT_lx, = env->pc, env->npc); #elif defined(TARGET_MIPS) term_printf(" PC=3D0x" TARGET_FMT_lx, env->active_tc.PC); +#elif defined(TARGET_ALPHA) + term_printf(" pc=3D0x" TARGET_FMT_lx, env->pc); #endif if (env->halted) term_printf(" (halted)"); Index: configure =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- configure (r=C3=A9vision 5185) +++ configure (copie de travail) @@ -565,6 +565,7 @@ target_list=3D"\ i386-softmmu \ x86_64-softmmu \ +alpha-softmmu \ arm-softmmu \ cris-softmmu \ m68k-softmmu \ Index: sysemu.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sysemu.h (r=C3=A9vision 5185) +++ sysemu.h (copie de travail) @@ -110,6 +110,8 @@ #define BIOS_SIZE ((512 + 32) * 1024) #elif defined(TARGET_MIPS) #define BIOS_SIZE (4 * 1024 * 1024) +#elif defined(TARGET_ALPHA) +#define BIOS_SIZE (2 * 1024 * 1024) #endif =20 typedef enum { Index: hw/boards.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- hw/boards.h (r=C3=A9vision 5185) +++ hw/boards.h (copie de travail) @@ -26,6 +26,9 @@ /* Axis ETRAX. */ extern QEMUMachine bareetraxfs_machine; =20 +/* es40.c */ +extern QEMUMachine es40_machine; + /* pc.c */ extern QEMUMachine pc_machine; extern QEMUMachine isapc_machine; Index: hw/alpha_palcode.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- hw/alpha_palcode.c (r=C3=A9vision 5185) +++ hw/alpha_palcode.c (copie de travail) @@ -22,7 +22,6 @@ #include #include =20 -#include "qemu.h" #include "cpu.h" #include "exec-all.h" =20 --- /dev/null 2008-09-04 11:47:02.280381000 +0200 +++ target-alpha/translate_init.c 2008-06-12 15:39:18.000000000 +0200 @@ -0,0 +1,39 @@ +struct alpha_def_t { + const char *name; +}; + +/***********************************************************************= ******/ +/* Alpha CPU definitions */ +static alpha_def_t alpha_defs[] =3D +{ + { + .name =3D "ev68cb", + }, +}; + +static const alpha_def_t *cpu_alpha_find_by_name (const char *name) +{ + int i; + + for (i =3D 0; i < sizeof(alpha_defs) / sizeof(alpha_defs[0]); i++) { + if (strcasecmp(name, alpha_defs[i].name) =3D=3D 0) { + return &alpha_defs[i]; + } + } + return NULL; +} + +void alpha_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fm= t, ...)) +{ + int i; + + for (i =3D 0; i < sizeof(alpha_defs) / sizeof(alpha_defs[0]); i++) { + (*cpu_fprintf)(f, "Alpha '%s'\n", + alpha_defs[i].name); + } +} + +static int cpu_alpha_register (CPUAlphaState *env, const alpha_def_t *de= f) +{ + return 0; +} --- /dev/null 2008-09-04 11:47:02.280381000 +0200 +++ target-alpha/machine.c 2008-06-10 01:14:19.000000000 +0200 @@ -0,0 +1,28 @@ +#include "hw/hw.h" +#include "hw/boards.h" + +void register_machines(void) +{ + qemu_register_machine(&es40_machine); +} + +void cpu_save(QEMUFile *f, void *opaque) +{ +} + +int cpu_load(QEMUFile *f, void *opaque, int version_id) +{ + return 0; +} + +void DMA_run(void) +{ +} + +void irq_info(void) +{ +} + +void pic_info(void) +{ +} --- /dev/null 2008-09-04 11:47:02.280381000 +0200 +++ hw/alpha_es40.c 2008-06-12 12:33:03.000000000 +0200 @@ -0,0 +1,111 @@ +/* + * QEMU HP Alpha ES40 support + * + * Copyright (c) 2008 Herve Poussineau + * + * 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 includ= ed in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRE= SS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILI= TY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHA= LL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR = OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISI= NG FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALING= S IN + * THE SOFTWARE. + */ + +#include "hw.h" +#include "pc.h" +#include "sysemu.h" +#include "boards.h" + +static void main_cpu_reset(void *opaque) +{ + CPUState *env =3D opaque; + cpu_reset(env); +} + +#define BIOS_FILENAME "es40.rom" +#define ES40_BIOS_SIZE (2 * 1024 * 1024) + +static +void es40_init (ram_addr_t ram_size, int vga_ram_size, + const char *boot_device, DisplayState *ds, + const char *kernel_filename, const char *kernel_cmdline, + const char *initrd_filename, const char *cpu_model) +{ + char buf[1024]; + unsigned long bios_offset; + int bios_size; + CPUState *env; + + /* init CPUs */ + if (cpu_model =3D=3D NULL) { + cpu_model =3D "ev68cb"; + } + env =3D cpu_init(cpu_model); + if (!env) { + fprintf(stderr, "Unable to find CPU definition\n"); + exit(1); + } + //register_savevm("cpu", 0, 1, cpu_save, cpu_load, env); + qemu_register_reset(main_cpu_reset, env); + + /* allocate RAM */ + cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); + + /* load the BIOS image. */ + bios_offset =3D ram_size + vga_ram_size; + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME); + bios_size =3D load_image(buf, phys_ram_base + bios_offset); + if (bios_size < 0 || bios_size >=3D ES40_BIOS_SIZE) { + fprintf(stderr, "qemu: Could not load HP ES40 firmware '%s'\n", + buf); + exit(1); + } + + cpu_register_physical_memory(0, + ES40_BIOS_SIZE, bios_offset | IO_MEM_RO= M); + + /* Chipset */ + /* FIXME: at pci 0.7 */ + + /* Video card */ + /* FIXME: VGA */ + + /* Network adapter */ + /* FIXME: dec21143 */ + + /* SCSI controller */ + /* FIXME: 53c8x */ + + /* IDE controller */ + /* FIXME: at pci 0.15 */ + + /* USB controller */ + /* FIXME: at pci 0.19 */ + + /* Real time clock */ + + /* Serial ports */ + /* FIXME: 2 serial ports? */ + + /* Parallel port */ + + /* FIXME: flash? */ +} + +QEMUMachine es40_machine =3D { + "es40", + "HP AlphaServer ES 40", + es40_init, + VGA_RAM_SIZE + ES40_BIOS_SIZE, +}; --------------070309090501010208050402--