Skip to content

Commit

Permalink
full system SPARC emulation (Blue Swirl)
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1087 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
bellard committed Sep 30, 2004
1 parent 4971b82 commit e95c8d5
Show file tree
Hide file tree
Showing 14 changed files with 307 additions and 78 deletions.
1 change: 1 addition & 0 deletions .cvsignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ qemu.1
qemu.pod
sparc-user
qemu-img
sparc-softmmu
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ version 0.6.1:
- Fixed Fedora Core 2 problems (now you can run qemu without any
LD_ASSUME_KERNEL tricks on FC2)
- DHCP fix for Windows (accept DHCPREQUEST alone)
- SPARC system emulation (Blue Swirl)

version 0.6.0:

Expand Down
29 changes: 28 additions & 1 deletion Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ endif
endif # ARCH = amd64

endif # TARGET_ARCH = ppc

ifeq ($(TARGET_ARCH), sparc)

ifeq ($(ARCH), ppc)
PROGS+=$(QEMU_SYSTEM)
endif

ifeq ($(ARCH), i386)
ifdef CONFIG_SOFTMMU
PROGS+=$(QEMU_SYSTEM)
endif
endif # ARCH = i386

ifeq ($(ARCH), amd64)
ifdef CONFIG_SOFTMMU
PROGS+=$(QEMU_SYSTEM)
endif
endif # ARCH = amd64

endif # TARGET_ARCH = sparc
endif # !CONFIG_USER_ONLY

ifdef CONFIG_STATIC
Expand Down Expand Up @@ -201,6 +221,10 @@ ifeq ($(TARGET_ARCH), ppc)
LIBOBJS+= op_helper.o helper.o
endif

ifeq ($(TARGET_ARCH), sparc)
LIBOBJS+= op_helper.o helper.o
endif

# NOTE: the disassembler code is only needed for debugging
LIBOBJS+=disas.o
ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
Expand Down Expand Up @@ -254,6 +278,9 @@ VL_OBJS+= ppc.o ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o
VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o
endif
ifeq ($(TARGET_ARCH), sparc)
VL_OBJS+= sun4m.o tcx.o lance.o iommu.o sched.o m48t08.o magic-load.o
endif
ifdef CONFIG_GDBSTUB
VL_OBJS+=gdbstub.o
endif
Expand Down Expand Up @@ -325,7 +352,7 @@ op.o: op.c op_template.h
endif

ifeq ($(TARGET_ARCH), sparc)
op.o: op.c op_template.h
op.o: op.c op_template.h op_mem.h
endif

ifeq ($(TARGET_ARCH), ppc)
Expand Down
6 changes: 3 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ar="ar"
make="make"
strip="strip"
cpu=`uname -m`
target_list="i386-user i386 i386-softmmu arm-user sparc-user ppc-user ppc-softmmu"
target_list="i386-user i386 i386-softmmu arm-user sparc-user ppc-user ppc-softmmu sparc-softmmu"
case "$cpu" in
i386|i486|i586|i686|i86pc|BePC)
cpu="i386"
Expand Down Expand Up @@ -99,7 +99,7 @@ if [ "$bsd" = "yes" ] ; then
if [ ! "$darwin" = "yes" ] ; then
make="gmake"
fi
target_list="i386-softmmu ppc-softmmu"
target_list="i386-softmmu ppc-softmmu sparc-softmmu"
fi

# find source path
Expand Down Expand Up @@ -160,7 +160,7 @@ ar="${cross_prefix}${ar}"
strip="${cross_prefix}${strip}"

if test "$mingw32" = "yes" ; then
target_list="i386-softmmu ppc-softmmu"
target_list="i386-softmmu ppc-softmmu sparc-softmmu"
EXESUF=".exe"
gdbstub="no"
fi
Expand Down
13 changes: 13 additions & 0 deletions cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ int cpu_exec(CPUState *env1)
env->exception_next_eip, 0);
#elif defined(TARGET_PPC)
do_interrupt(env);
#elif defined(TARGET_SPARC)
do_interrupt(env->exception_index,
0,
env->error_code,
env->exception_next_pc, 0);
#endif
}
env->exception_index = -1;
Expand Down Expand Up @@ -261,6 +266,14 @@ int cpu_exec(CPUState *env1)
env->interrupt_request &= ~CPU_INTERRUPT_TIMER;
}
}
#elif defined(TARGET_SPARC)
if (interrupt_request & CPU_INTERRUPT_HARD) {
do_interrupt(0, 0, 0, 0, 0);
env->interrupt_request &= ~CPU_INTERRUPT_HARD;
} else if (interrupt_request & CPU_INTERRUPT_TIMER) {
//do_interrupt(0, 0, 0, 0, 0);
env->interrupt_request &= ~CPU_INTERRUPT_TIMER;
}
#endif
if (interrupt_request & CPU_INTERRUPT_EXITTB) {
env->interrupt_request &= ~CPU_INTERRUPT_EXITTB;
Expand Down
6 changes: 4 additions & 2 deletions exec-all.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ struct TranslationBlock;
extern uint16_t gen_opc_buf[OPC_BUF_SIZE];
extern uint32_t gen_opparam_buf[OPPARAM_BUF_SIZE];
extern uint32_t gen_opc_pc[OPC_BUF_SIZE];
extern uint32_t gen_opc_npc[OPC_BUF_SIZE];
extern uint8_t gen_opc_cc_op[OPC_BUF_SIZE];
extern uint8_t gen_opc_instr_start[OPC_BUF_SIZE];

Expand Down Expand Up @@ -541,8 +542,7 @@ extern spinlock_t tb_lock;

extern int tb_invalidated_flag;

#if (defined(TARGET_I386) || defined(TARGET_PPC)) && \
!defined(CONFIG_USER_ONLY)
#if !defined(CONFIG_USER_ONLY)

void tlb_fill(unsigned long addr, int is_write, int is_user,
void *retaddr);
Expand Down Expand Up @@ -585,6 +585,8 @@ static inline target_ulong get_phys_addr_code(CPUState *env, target_ulong addr)
is_user = ((env->hflags & HF_CPL_MASK) == 3);
#elif defined (TARGET_PPC)
is_user = msr_pr;
#elif defined (TARGET_SPARC)
is_user = (env->psrs == 0);
#else
#error "Unimplemented !"
#endif
Expand Down
6 changes: 3 additions & 3 deletions exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ static void breakpoint_invalidate(CPUState *env, target_ulong pc)
breakpoint is reached */
int cpu_breakpoint_insert(CPUState *env, target_ulong pc)
{
#if defined(TARGET_I386) || defined(TARGET_PPC)
#if defined(TARGET_I386) || defined(TARGET_PPC) || defined(TARGET_SPARC)
int i;

for(i = 0; i < env->nb_breakpoints; i++) {
Expand All @@ -1099,7 +1099,7 @@ int cpu_breakpoint_insert(CPUState *env, target_ulong pc)
/* remove a breakpoint */
int cpu_breakpoint_remove(CPUState *env, target_ulong pc)
{
#if defined(TARGET_I386) || defined(TARGET_PPC)
#if defined(TARGET_I386) || defined(TARGET_PPC) || defined(TARGET_SPARC)
int i;
for(i = 0; i < env->nb_breakpoints; i++) {
if (env->breakpoints[i] == pc)
Expand All @@ -1122,7 +1122,7 @@ int cpu_breakpoint_remove(CPUState *env, target_ulong pc)
CPU loop after each instruction */
void cpu_single_step(CPUState *env, int enabled)
{
#if defined(TARGET_I386) || defined(TARGET_PPC)
#if defined(TARGET_I386) || defined(TARGET_PPC) || defined(TARGET_SPARC)
if (env->singlestep_enabled != enabled) {
env->singlestep_enabled = enabled;
/* must flush all the translated code to avoid inconsistancies */
Expand Down
Loading

0 comments on commit e95c8d5

Please sign in to comment.