Am 11.09.2012 21:53, schrieb Blue Swirl: > On Mon, Sep 10, 2012 at 12:20 AM, <crwu...@gmail.com> wrote: >> diff --git a/hw/nios2_pic_cpu.c b/hw/nios2_pic_cpu.c >> new file mode 100644 >> index 0000000..c89b4ae >> --- /dev/null >> +++ b/hw/nios2_pic_cpu.c >> @@ -0,0 +1,48 @@ >> +/* >> + * QEMU Altera Nios II CPU interrupt wrapper logic. >> + * >> + * Copyright (c) 2012 Chris Wulff <crwu...@gmail.com> >> + * >> + * This library is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU Lesser General Public >> + * License as published by the Free Software Foundation; either >> + * version 2.1 of the License, or (at your option) any later version. >> + * >> + * This library is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> + * Lesser General Public License for more details. >> + * >> + * You should have received a copy of the GNU Lesser General Public >> + * License along with this library; if not, see >> + * <http://www.gnu.org/licenses/lgpl-2.1.html> >> + */ >> + >> +#include "hw.h"
>> +#include "pc.h" Why? >> +#include "nios2.h" >> + >> +void pic_info(Monitor *mon) >> +{ >> +} >> + >> +void irq_info(Monitor *mon) >> +{ >> +} Thought these stubs were no longer necessary... >> + >> +static void nios2_pic_cpu_handler(void *opaque, int irq, int level) >> +{ >> + CPUNios2State *env = (CPUNios2State *)opaque; > > Useless cast in C. Please use Nios2CPU so that we can more easily make cpu_interrupt() and cpu_reset_interrupt() take a CPUState argument in the future. Please also split this patch up per device and always cc the appropriate maintainers to facilitate review (e.g., --cc-cmd="scripts/get_maintainer.pl --nogit-fallback"). Regards, Andreas > >> + int type = irq ? CPU_INTERRUPT_NMI : CPU_INTERRUPT_HARD; >> + >> + if (level) { >> + cpu_interrupt(env, type); >> + } else { >> + cpu_reset_interrupt(env, type); >> + } >> +} >> + >> +qemu_irq *nios2_pic_init_cpu(CPUNios2State *env) >> +{ >> + return qemu_allocate_irqs(nios2_pic_cpu_handler, env, 2); >> +} -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg