Skip to content

Commit

Permalink
[3298] Updated QEMU patches
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiol committed Aug 28, 2018
1 parent 1dd8295 commit 02ed9ab
Show file tree
Hide file tree
Showing 56 changed files with 16 additions and 4,551 deletions.
84 changes: 1 addition & 83 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,16 @@ QEMU_DEFINES = -DTARGET_ARM -DX49GP \
# Use this for speed
DEFINES = $(QEMU_DEFINES)

ifdef QEMU_OLD
QEMUSRC = qemu/prepare.sh \
$(wildcard qemu/patches/*.patch) \
$(wildcard qemu/patches/*.diff)

QEMU=qemu/qemu
else
QEMUSRC =
QEMU=qemu/qemu-git
endif

QEMUMAKE = $(shell if [ "`uname -s`" = "Linux" -a "`uname -m`" = "sun4u" ]; then echo "sparc32 $(MAKE)"; else echo "$(MAKE)"; fi)

ifdef QEMU_OLD
QEMU_DIR=$(QEMU)
QEMU_DEFINES+=-DQEMU_OLD
X49GP_LDFLAGS = -L$(QEMU)/arm-softmmu
X49GP_LIBS = -lqemu -lz
else
QEMU_DIR=$(QEMU)
QEMU_DIR_BUILD=$(QEMU_DIR)/arm-softmmu
QEMU_DEFINES+=-DNEED_CPU_H
QEMU_OBJS = $(QEMU_DIR_BUILD)/exec.o $(QEMU_DIR_BUILD)/translate-all.o $(QEMU_DIR_BUILD)/cpu-exec.o $(QEMU_DIR_BUILD)/translate.o $(QEMU_DIR_BUILD)/fpu/softfloat.o $(QEMU_DIR_BUILD)/op_helper.o $(QEMU_DIR_BUILD)/helper.o $(QEMU_DIR_BUILD)/disas.o $(QEMU_DIR_BUILD)/i386-dis.o $(QEMU_DIR_BUILD)/arm-dis.o $(QEMU_DIR_BUILD)/tcg/tcg.o $(QEMU_DIR_BUILD)/iwmmxt_helper.o $(QEMU_DIR_BUILD)/neon_helper.o
X49GP_LDFLAGS =
X49GP_LIBS = $(QEMU_OBJS)
endif
QEMU_INCDIR=$(QEMU_DIR)
QEMU_INC=-I$(QEMU_INCDIR)/target-arm -I$(QEMU_INCDIR) -I$(QEMU_INCDIR)/fpu -I$(QEMU_INCDIR)/arm-softmmu

Expand All @@ -89,11 +73,7 @@ INSTALL_MENU_DIR = "$(INSTALL_PREFIX)"/share/applications
INSTALL_MAN_DIR = "$(INSTALL_PREFIX)/share/man/man1"
DEFINES += -DX49GP_DATADIR=\"$(INSTALL_DATA_DIR)\"

ifdef QEMU_OLD
CC = $(shell if [ "`uname -s`" = "Darwin" ]; then echo "gcc"; else echo "gcc-3.4"; fi)
else
CC = gcc
endif
LD = $(CC)
AR = ar
RANLIB = ranlib
Expand All @@ -111,10 +91,6 @@ MAKEDEPEND = $(CC) -MM
CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
LDLIBS += $(shell pkg-config --libs gtk+-2.0) -lz -lm

ifdef QEMU_OLD
export MAKE MAKEDEPEND CC LD AR RANLIB CFLAGS LDFLAGS
endif

LIBS = $(QEMU)

SRCS = main.c module.c flash.c sram.c s3c2410.c \
Expand All @@ -139,22 +115,12 @@ SRCS = main.c module.c flash.c sram.c s3c2410.c \

OBJS = $(SRCS:.c=.o)

ifdef QEMU_OLD
VVFATOBJS = $(QEMU)/arm-softmmu/block-vvfat.o \
$(QEMU)/arm-softmmu/block-qcow.o \
$(QEMU)/arm-softmmu/block-raw.o
else
# TEMPO hack
VVFATOBJS = block-vvfat.o \
block-qcow.o \
block-raw.o
endif

ifdef QEMU_OLD
VVFATOBJS += $(QEMU)/arm-softmmu/cutils.o
else
VVFATOBJS += $(QEMU_DIR)/cutils.o
endif

TARGET = x49gp
TARGET_ALLCAPS = X49GP
Expand All @@ -168,13 +134,8 @@ else
do-it-all: depend-and-build
endif

ifdef QEMU_OLD
$(TARGET): $(OBJS) $(VVFATOBJS) $(QEMU)/arm-softmmu/libqemu.a
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(VVFATOBJS) $(LDLIBS)
else
$(TARGET): $(OBJS) $(VVFATOBJS) $(QEMU_OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(VVFATOBJS) $(LDLIBS)
endif

install: all $(TARGET).desktop $(TARGET).man
install -D -m 755 $(TARGET) "$(INSTALL_BINARY_DIR)/$(TARGET)"
Expand Down Expand Up @@ -202,18 +163,7 @@ endif
sim: dummy
$(MAKE) -C $@

ifdef QEMU_OLD
$(QEMU): $(QEMU)/config-host.h dummy
+$(QEMUMAKE) -C $@

$(QEMU)/config-host.h: $(QEMUSRC)
cd qemu; ./prepare.sh
$(MAKE) -C . all

$(QEMU)/arm-softmmu/%.o: $(QEMU)/%.c
+$(QEMUMAKE) BASE_CFLAGS=-DX49GP -C $(QEMU)/arm-softmmu $(shell basename $@)
else
$(QEMU)/config-host.h: $(QEMUSRC)
$(QEMU)/config-host.h:
+( cd $(QEMU); \
./configure-small --extra-cflags=-DX49GP; \
$(QEMUMAKE) -f Makefile-small )
Expand All @@ -222,44 +172,13 @@ $(QEMU_OBJS): _dir_qemu

_dir_qemu: dummy
+$(QEMUMAKE) -C $(QEMU) -f Makefile-small
endif

%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<

block-vvfat.o: block-vvfat.c
$(CC) $(CFLAGS) -fno-aggressive-loop-optimizations -o $@ -c $<

ifdef QEMU_OLD
clean-libs:
if [ -n "$(LIBS)" ]; then \
for d in $(LIBS); do \
$(MAKE) -C $$d clean; \
done \
fi

clean: clean-libs
rm -f *.o core *~ .depend

distclean: clean
rm -rf $(QEMU)
rm -f $(TARGET) $(TARGET).desktop $(TARGET).man

depend-and-build: depend
$(MAKE) -C . all

depend-libs: $(QEMU)/config-host.h
if [ -n "$(LIBS)" ]; then \
for d in $(LIBS); do \
if [ "$$d" != "$(QEMU)" ]; then \
$(MAKE) -C $$d depend; \
fi \
done \
fi

depend: depend-libs
$(MAKEDEPEND) $(CFLAGS) $(SRCS) >.depend
else
clean-qemu:
$(MAKE) -C $(QEMU) -f Makefile-small clean

Expand All @@ -277,6 +196,5 @@ depend-and-build: depend

depend: depend-libs
$(MAKEDEPEND) $(CFLAGS) $(SRCS) >.depend
endif

dummy:
4 changes: 0 additions & 4 deletions block-qcow.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifdef QEMU_OLD
#include "vl.h"
#else
#include "qemu-common.h"
#include "block.h"
#endif
#include "block_int.h"
#include <zlib.h>
#if 0
Expand Down
4 changes: 0 additions & 4 deletions block-raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifdef QEMU_OLD
#include "vl.h"
#else
#include "qemu-common.h"
#include "block.h"
#endif
#include "block_int.h"
#include <assert.h>
#ifndef _WIN32
Expand Down
4 changes: 0 additions & 4 deletions block-vvfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@
#include <sys/stat.h>
#include <dirent.h>
#include <assert.h>
#ifdef QEMU_OLD
#include "vl.h"
#else
#include "qemu-common.h"
#include "block.h"
#endif
#include "block_int.h"

#ifndef S_IWGRP
Expand Down
4 changes: 0 additions & 4 deletions block.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
#include <errno.h>
#include <sys/stat.h>

#ifndef QEMU_OLD
#include "qemu-common.h"
#endif
#include <block.h>
#ifndef QEMU_OLD
#include "block_int.h"
#endif

#define SECTOR_BITS 9
#define SECTOR_SIZE (1 << SECTOR_BITS)
Expand Down
29 changes: 0 additions & 29 deletions flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,6 @@ flash_readb(void *opaque, target_phys_addr_t offset)
uint32_t shift;
unsigned char data;

#ifdef QEMU_OLD
offset -= (target_phys_addr_t) phys_ram_base + flash->offset;
#endif

if (flash->state == FLASH_STATE_NORMAL) {
data = *(datap + offset);
} else {
Expand All @@ -357,10 +353,6 @@ flash_readw(void *opaque, target_phys_addr_t offset)
uint8_t *datap = flash->data;
uint32_t data;

#ifdef QEMU_OLD
offset -= (target_phys_addr_t) phys_ram_base + flash->offset;
#endif

if (flash->state == FLASH_STATE_NORMAL) {
data = lduw_p(datap + offset);
} else {
Expand All @@ -382,10 +374,6 @@ flash_readl(void *opaque, target_phys_addr_t offset)
uint8_t *datap = flash->data;
uint32_t data;

#ifdef QEMU_OLD
offset -= (target_phys_addr_t) phys_ram_base + flash->offset;
#endif

if (flash->state == FLASH_STATE_NORMAL) {
data = ldl_p(datap + offset);
} else {
Expand All @@ -407,10 +395,6 @@ flash_writeb(void *opaque, target_phys_addr_t offset, uint32_t data)
x49gp_flash_t *flash = opaque;
uint32_t shift;

#ifdef QEMU_OLD
offset -= (target_phys_addr_t) phys_ram_base + flash->offset;
#endif

data &= 0xff;

#ifdef DEBUG_X49GP_FLASH_WRITE
Expand All @@ -432,10 +416,6 @@ flash_writew(void *opaque, target_phys_addr_t offset, uint32_t data)
{
x49gp_flash_t *flash = opaque;

#ifdef QEMU_OLD
offset -= (target_phys_addr_t) phys_ram_base + flash->offset;
#endif

data &= 0xffff;

#ifdef DEBUG_X49GP_FLASH_WRITE
Expand All @@ -451,10 +431,6 @@ flash_writel(void *opaque, target_phys_addr_t offset, uint32_t data)
{
x49gp_flash_t *flash = opaque;

#ifdef QEMU_OLD
offset -= (target_phys_addr_t) phys_ram_base + flash->offset;
#endif

#ifdef DEBUG_X49GP_FLASH_WRITE
printf("write FLASH 4 (state %u) at offset %08lx: %08x\n",
flash->state, offset, data);
Expand Down Expand Up @@ -656,13 +632,8 @@ flash_init(x49gp_module_t *module)

module->user_data = flash;

#ifdef QEMU_OLD
flash->iotype = cpu_register_io_memory(0, flash_readfn,
flash_writefn, flash);
#else
flash->iotype = cpu_register_io_memory(flash_readfn,
flash_writefn, flash);
#endif

flash->data = (void *) -1;
flash->offset = phys_ram_size;
Expand Down
16 changes: 1 addition & 15 deletions gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
p++;
len = strtoull(p, (char **)&p, 16);
if (type == 0 || type == 1) {
if (
#ifdef QEMU_OLD
cpu_breakpoint_insert(env, addr) < 0
#else
cpu_breakpoint_insert(env, addr, BP_GDB, NULL) < 0
#endif
)
if (cpu_breakpoint_insert(env, addr, BP_GDB, NULL) < 0)
goto breakpoint_error;
put_packet(s, "OK");
} else {
Expand All @@ -376,11 +370,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
p++;
len = strtoull(p, (char **)&p, 16);
if (type == 0 || type == 1) {
#ifdef QEMU_OLD
cpu_breakpoint_remove(env, addr);
#else
cpu_breakpoint_remove(env, addr, BP_GDB);
#endif
put_packet(s, "OK");
} else {
goto breakpoint_error;
Expand Down Expand Up @@ -441,11 +431,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, char *fmt, ...)
}
va_end(va);
put_packet(s, buf);
#ifdef QEMU_OLD
cpu_interrupt(s->env, CPU_INTERRUPT_EXIT);
#else
cpu_exit(s->env);
#endif
}

static void gdb_read_byte(GDBState *s, int ch)
Expand Down
Loading

0 comments on commit 02ed9ab

Please sign in to comment.