diff --git a/Makefile b/Makefile index 33be78e..e1f7e52 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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 \ @@ -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 @@ -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)" @@ -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 ) @@ -222,7 +172,6 @@ $(QEMU_OBJS): _dir_qemu _dir_qemu: dummy +$(QEMUMAKE) -C $(QEMU) -f Makefile-small -endif %.o: %.c $(CC) $(CFLAGS) -o $@ -c $< @@ -230,36 +179,6 @@ endif 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 @@ -277,6 +196,5 @@ depend-and-build: depend depend: depend-libs $(MAKEDEPEND) $(CFLAGS) $(SRCS) >.depend -endif dummy: diff --git a/block-qcow.c b/block-qcow.c index 86425aa..693b50f 100644 --- a/block-qcow.c +++ b/block-qcow.c @@ -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 #if 0 diff --git a/block-raw.c b/block-raw.c index 294a680..2f1796e 100644 --- a/block-raw.c +++ b/block-raw.c @@ -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 #ifndef _WIN32 diff --git a/block-vvfat.c b/block-vvfat.c index 3864a67..e95e386 100644 --- a/block-vvfat.c +++ b/block-vvfat.c @@ -25,12 +25,8 @@ #include #include #include -#ifdef QEMU_OLD -#include "vl.h" -#else #include "qemu-common.h" #include "block.h" -#endif #include "block_int.h" #ifndef S_IWGRP diff --git a/block.c b/block.c index 3148d7a..3a4e76d 100644 --- a/block.c +++ b/block.c @@ -8,13 +8,9 @@ #include #include -#ifndef QEMU_OLD #include "qemu-common.h" -#endif #include -#ifndef QEMU_OLD #include "block_int.h" -#endif #define SECTOR_BITS 9 #define SECTOR_SIZE (1 << SECTOR_BITS) diff --git a/flash.c b/flash.c index 8ca4dac..28a3757 100644 --- a/flash.c +++ b/flash.c @@ -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 { @@ -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 { @@ -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 { @@ -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 @@ -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 @@ -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); @@ -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; diff --git a/gdbstub.c b/gdbstub.c index 4158bc4..157d732 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -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 { @@ -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; @@ -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) diff --git a/include/block.h b/include/block.h index e4c285a..177d65d 100644 --- a/include/block.h +++ b/include/block.h @@ -17,9 +17,6 @@ it (default for bdrv_file_open()) */ -#ifdef QEMU_OLD -typedef struct BlockDriverState BlockDriverState; -#endif typedef struct BlockDriver BlockDriver; typedef struct SnapshotInfo QEMUSnapshotInfo; typedef struct BlockDriverInfo BlockDriverInfo; @@ -47,110 +44,6 @@ int bdrv_pread(BlockDriverState *bs, int64_t offset, int bdrv_pwrite(BlockDriverState *bs, int64_t offset, const void *buf, int count); -#ifdef QEMU_OLD -struct BlockDriver { - const char *format_name; - int instance_size; - int (*bdrv_probe)(const uint8_t *buf, int buf_size, const char *filename); - int (*bdrv_open)(BlockDriverState *bs, const char *filename, int flags); - int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors); - int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors); - void (*bdrv_close)(BlockDriverState *bs); - int (*bdrv_create)(const char *filename, int64_t total_sectors, - const char *backing_file, int flags); - void (*bdrv_flush)(BlockDriverState *bs); - int (*bdrv_is_allocated)(BlockDriverState *bs, int64_t sector_num, - int nb_sectors, int *pnum); - int (*bdrv_set_key)(BlockDriverState *bs, const char *key); - int (*bdrv_make_empty)(BlockDriverState *bs); - /* aio */ - BlockDriverAIOCB *(*bdrv_aio_read)(BlockDriverState *bs, - int64_t sector_num, uint8_t *buf, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); - BlockDriverAIOCB *(*bdrv_aio_write)(BlockDriverState *bs, - int64_t sector_num, const uint8_t *buf, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); - void (*bdrv_aio_cancel)(BlockDriverAIOCB *acb); - int aiocb_size; - - const char *protocol_name; - int (*bdrv_pread)(BlockDriverState *bs, int64_t offset, - uint8_t *buf, int count); - int (*bdrv_pwrite)(BlockDriverState *bs, int64_t offset, - const uint8_t *buf, int count); - int (*bdrv_truncate)(BlockDriverState *bs, int64_t offset); - int64_t (*bdrv_getlength)(BlockDriverState *bs); - int (*bdrv_write_compressed)(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors); - - int (*bdrv_snapshot_create)(BlockDriverState *bs, - QEMUSnapshotInfo *sn_info); - int (*bdrv_snapshot_goto)(BlockDriverState *bs, - const char *snapshot_id); - int (*bdrv_snapshot_delete)(BlockDriverState *bs, const char *snapshot_id); - int (*bdrv_snapshot_list)(BlockDriverState *bs, - QEMUSnapshotInfo **psn_info); - int (*bdrv_get_info)(BlockDriverState *bs, BlockDriverInfo *bdi); - - /* removable device specific */ - int (*bdrv_is_inserted)(BlockDriverState *bs); - int (*bdrv_media_changed)(BlockDriverState *bs); - int (*bdrv_eject)(BlockDriverState *bs, int eject_flag); - int (*bdrv_set_locked)(BlockDriverState *bs, int locked); - - BlockDriverAIOCB *free_aiocb; - struct BlockDriver *next; -}; - -struct BlockDriverState { - int64_t total_sectors; /* if we are reading a disk image, give its - size in sectors */ - int read_only; /* if true, the media is read only */ - int removable; /* if true, the media can be removed */ - int locked; /* if true, the media cannot temporarily be ejected */ - int encrypted; /* if true, the media is encrypted */ - /* event callback when inserting/removing */ - void (*change_cb)(void *opaque); - void *change_opaque; - - BlockDriver *drv; /* NULL means no media */ - void *opaque; - - int boot_sector_enabled; - uint8_t boot_sector_data[512]; - - char filename[1024]; - char backing_file[1024]; /* if non zero, the image is a diff of - this file image */ - int is_temporary; - int media_changed; - - BlockDriverState *backing_hd; -// /* async read/write emulation */ -// -// void *sync_aiocb; - - /* NOTE: the following infos are only hints for real hardware - drivers. They are not used by the block driver */ - int cyls, heads, secs, translation; - int type; - char device_name[32]; - BlockDriverState *next; -}; - -void *qemu_malloc(size_t size); -void *qemu_mallocz(size_t size); -void qemu_free(void *ptr); - -void pstrcpy(char *buf, int buf_size, const char *str); -char *pstrcat(char *buf, int buf_size, const char *s); -int strstart(const char *str, const char *val, const char **ptr); -int stristart(const char *str, const char *val, const char **ptr); -#endif /* QEMU_OLD */ - -#ifndef QEMU_OLD int bdrv_truncate(BlockDriverState *bs, int64_t offset); int64_t bdrv_getlength(BlockDriverState *bs); void bdrv_flush(BlockDriverState *bs); @@ -182,6 +75,4 @@ struct BlockDriverInfo { int64_t vm_state_offset; }; -#endif - #endif /* !(BLOCK_H) */ diff --git a/include/list.h b/include/list.h index ccf9148..c971ae0 100644 --- a/include/list.h +++ b/include/list.h @@ -9,20 +9,6 @@ static inline void prefetch(const void *x) {;} #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif -#ifdef QEMU_OLD -/** - * container_of - cast a member of a structure out to the containing structure - * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) -#endif - /* * These are non-NULL pointers that will result in page faults * under normal circumstances, used to verify that nobody uses diff --git a/include/x49gp.h b/include/x49gp.h index e2e09d4..2c6ea15 100644 --- a/include/x49gp.h +++ b/include/x49gp.h @@ -19,10 +19,8 @@ #include /* LD TEMPO HACK */ -#ifndef QEMU_OLD extern uint8_t *phys_ram_base; extern int phys_ram_size; -#endif typedef enum { X49GP_ARM_RUN = 0, diff --git a/main.c b/main.c index 0c106b8..66bd9cc 100644 --- a/main.c +++ b/main.c @@ -27,15 +27,11 @@ static x49gp_t *x49gp; -#ifdef QEMU_OLD // LD TEMPO HACK -extern -#endif +/* LD TEMPO HACK */ CPUState *__GLOBAL_env; int semihosting_enabled = 1; -/* LD TEMPO HACK */ -#ifndef QEMU_OLD uint8_t *phys_ram_base; int phys_ram_size; ram_addr_t ram_size = 0x80000; // LD ??? @@ -107,8 +103,6 @@ void gdb_register_coprocessor(CPUState * env, fprintf(stderr, "TODO: %s\n", __FUNCTION__); } -#endif /* !QEMU_OLD */ - void * qemu_malloc(size_t size) { @@ -146,45 +140,17 @@ qemu_vmalloc(size_t size) #endif } -#ifdef QEMU_OLD -int -term_vprintf(const char *fmt, va_list ap) -{ - return vprintf(fmt, ap); -} - -int -term_printf(const char *fmt, ...) -{ - va_list ap; - int n; - - va_start(ap, fmt); - n = vprintf(fmt, ap); - va_end(ap); - - return n; -} -#endif - #define SWI_Breakpoint 0x180000 -#ifdef QEMU_OLD -int -do_arm_semihosting(CPUState *env, uint32_t number) -#else uint32_t do_arm_semihosting(CPUState *env) -#endif { -#ifndef QEMU_OLD - uint32_t number; - if (env->thumb) { - number = lduw_code(env->regs[15] - 2) & 0xff; - } else { - number = ldl_code(env->regs[15] - 4) & 0xffffff; - } -#endif + uint32_t number; + if (env->thumb) { + number = lduw_code(env->regs[15] - 2) & 0xff; + } else { + number = ldl_code(env->regs[15] - 4) & 0xffffff; + } switch (number) { case SWI_Breakpoint: break; @@ -244,11 +210,7 @@ x49gp_set_idle(x49gp_t *x49gp, x49gp_arm_idle_t idle) x49gp->env->halted = 0; } else { x49gp->env->halted = 1; -#ifdef QEMU_OLD - cpu_interrupt(x49gp->env, CPU_INTERRUPT_EXIT); -#else - cpu_exit(x49gp->env); -#endif + cpu_exit(x49gp->env); } } @@ -551,11 +513,7 @@ ui_sighnd(int sig) case SIGQUIT: case SIGTERM: x49gp->arm_exit = 1; -#ifdef QEMU_OLD - cpu_interrupt(x49gp->env, CPU_INTERRUPT_EXIT); -#else - cpu_exit(x49gp->env); -#endif + cpu_exit(x49gp->env); break; } } @@ -606,13 +564,9 @@ main(int argc, char **argv) x49gp->PCLK_ratio = 4; x49gp->PCLK = 75000000 / 4; -#ifdef QEMU_OLD - x49gp->env = cpu_init(); -#else - //cpu_set_log(0xffffffff); - cpu_exec_init_all(0); + //cpu_set_log(0xffffffff); + cpu_exec_init_all(0); x49gp->env = cpu_init("arm926"); -#endif __GLOBAL_env = x49gp->env; // cpu_set_log(cpu_str_to_log_mask("all")); diff --git a/module.c b/module.c index 4e1a3b1..f746a56 100644 --- a/module.c +++ b/module.c @@ -44,12 +44,8 @@ x49gp_modules_init(x49gp_t *x49gp) phys_ram_dirty = qemu_vmalloc(phys_ram_size >> TARGET_PAGE_BITS); memset(phys_ram_dirty, 0xff, phys_ram_size >> TARGET_PAGE_BITS); -#ifndef QEMU_OLD - { - ram_addr_t x49gp_ram_alloc(ram_addr_t size, uint8_t *base); - x49gp_ram_alloc(phys_ram_size, phys_ram_base); - } -#endif + ram_addr_t x49gp_ram_alloc(ram_addr_t size, uint8_t *base); + x49gp_ram_alloc(phys_ram_size, phys_ram_base); return 0; } diff --git a/qemu/patches/q_block.c_hdled_1.diff b/qemu/patches/q_block.c_hdled_1.diff deleted file mode 100644 index ad53ba8..0000000 --- a/qemu/patches/q_block.c_hdled_1.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- block.c 2007-02-06 02:15:39.000000000 +0100 -+++ block2.c 2007-02-06 02:24:10.000000000 +0100 -@@ -497,6 +497,7 @@ - int bdrv_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) - { -+ bs->activityLED = 1; - BlockDriver *drv = bs->drv; - - if (!drv) -@@ -534,6 +535,7 @@ - int bdrv_write(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors) - { -+ bs->activityLED = 1; - BlockDriver *drv = bs->drv; - if (!bs->drv) - return -ENOMEDIUM; -@@ -1058,6 +1060,7 @@ - uint8_t *buf, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) - { -+ bs->activityLED = 1; - BlockDriver *drv = bs->drv; - - if (!drv) -@@ -1078,6 +1081,7 @@ - const uint8_t *buf, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) - { -+ bs->activityLED = 1; - BlockDriver *drv = bs->drv; - - if (!drv) diff --git a/qemu/patches/q_block_int.h_hdled_1.diff b/qemu/patches/q_block_int.h_hdled_1.diff deleted file mode 100644 index 835d7fb..0000000 --- a/qemu/patches/q_block_int.h_hdled_1.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- block_int.h 2006-06-21 18:46:53.000000000 +0200 -+++ block_int2.h 2006-07-03 17:20:04.000000000 +0200 -@@ -51,6 +51,7 @@ - int removable; /* if true, the media can be removed */ - int locked; /* if true, the media cannot temporarily be ejected */ - int encrypted; /* if true, the media is encrypted */ -+ int activityLED; /* if true, the media is accessed atm */ - /* event callback when inserting/removing */ - void (*change_cb)(void *opaque); - void *change_opaque; diff --git a/qemu/patches/q_host-cocoa_02.diff b/qemu/patches/q_host-cocoa_02.diff deleted file mode 100644 index 0423bba..0000000 --- a/qemu/patches/q_host-cocoa_02.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- Makefile.target 2007-01-31 13:24:18.000000000 +0100 -+++ Makefile.target 2007-02-02 14:45:02.000000000 +0100 -@@ -415,8 +419,8 @@ - endif - VL_OBJS+=vnc.o - ifdef CONFIG_COCOA --VL_OBJS+=cocoa.o --COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit -+VL_OBJS+=cocoaQemuMain.o cocoaQemuController.o cocoaQemu.o cocoaQemuProgressWindow.o cocoaQemuWindow.o cocoaQemuOpenGLView.o cocoaQemuQuartzView.o cocoaQemuQuickDrawView.o cocoaPopUpView.o cocoaCpuView.o FSController.o FSRoundedView.o FSToolbarController.o FSTransparentButton.o -+COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit -framework CoreFoundation -framework OpenGL -framework ApplicationServices - ifdef CONFIG_COREAUDIO - COCOA_LIBS+=-framework CoreAudio - endif -@@ -465,7 +469,11 @@ - $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a - $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) - --cocoa.o: cocoa.m -+ -+cocoa%.o: host-cocoa/cocoa%.m -+ $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< -+ -+FS%.o: host-cocoa/FSControls/FS%.m - $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< - - sdl.o: sdl.c keymaps.c sdl_keysym.h diff --git a/qemu/patches/q_vga.c_02.diff b/qemu/patches/q_vga.c_02.diff deleted file mode 100644 index 1eb4e28..0000000 --- a/qemu/patches/q_vga.c_02.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- vga.c 2005-12-19 23:51:53.000000000 +0100 -+++ vga2.c 2006-04-10 20:21:56.000000000 +0200 -@@ -788,22 +788,38 @@ - - static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g, unsigned b) - { -+#if __LITTLE_ENDIAN__ -+ return ((b >> 5) << 5) | ((g >> 5) << 2) | (r >> 6); -+#else - return ((r >> 5) << 5) | ((g >> 5) << 2) | (b >> 6); -+#endif - } - - static inline unsigned int rgb_to_pixel15(unsigned int r, unsigned int g, unsigned b) - { -+#if __LITTLE_ENDIAN__ -+ return ((b >> 3) << 10) | ((g >> 3) << 5) | (r >> 3); -+#else - return ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); -+#endif - } - - static inline unsigned int rgb_to_pixel16(unsigned int r, unsigned int g, unsigned b) - { -+#if __LITTLE_ENDIAN__ -+ return ((b >> 3) << 11) | ((g >> 2) << 5) | (r >> 3); -+#else - return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); -+#endif - } - - static inline unsigned int rgb_to_pixel32(unsigned int r, unsigned int g, unsigned b) - { -+#if __LITTLE_ENDIAN__ -+ return (b << 16) | (g << 8) | r; -+#else - return (r << 16) | (g << 8) | b; -+#endif - } - - #define DEPTH 8 diff --git a/qemu/patches/qemu-0.7.2-dyngen-check-stack-clobbers.patch b/qemu/patches/qemu-0.7.2-dyngen-check-stack-clobbers.patch deleted file mode 100644 index 8743037..0000000 --- a/qemu/patches/qemu-0.7.2-dyngen-check-stack-clobbers.patch +++ /dev/null @@ -1,137 +0,0 @@ -2005-11-11 Gwenole Beauchesne - - * Check for stack clobbers in functions using GOTO_LABEL_PARAM(). - ---- qemu-0.7.2/dyngen.c.dyngen-check-stack-clobbers 2005-11-11 16:26:33.000000000 +0100 -+++ qemu-0.7.2/dyngen.c 2005-11-11 17:30:29.000000000 +0100 -@@ -1414,6 +1414,9 @@ int arm_emit_ldr_info(const char *name, - #define FLAG_TARGET (1 << 3) - /* This is a magic instruction that needs fixing up. */ - #define FLAG_EXIT (1 << 4) -+/* This instruction clobbers the stack pointer. */ -+/* XXX only supports push, pop, add/sub $imm,%esp */ -+#define FLAG_STACK (1 << 5) - #define MAX_EXITS 5 - - static void -@@ -1454,6 +1457,7 @@ trace_i386_insn (const char *name, uint8 - int is_jmp; - int is_exit; - int is_pcrel; -+ int is_stack; - int immed; - int seen_rexw; - int32_t disp; -@@ -1476,6 +1480,7 @@ trace_i386_insn (const char *name, uint8 - is_exit = 0; - seen_rexw = 0; - is_pcrel = 0; -+ is_stack = 0; - - while (is_prefix) { - op = ptr[insn_size]; -@@ -1522,6 +1527,7 @@ trace_i386_insn (const char *name, uint8 - switch (op & 0x7) { - case 0: /* push fs/gs */ - case 1: /* pop fs/gs */ -+ is_stack = 1; - case 2: /* cpuid/rsm */ - modrm = 0; - break; -@@ -1594,6 +1600,7 @@ trace_i386_insn (const char *name, uint8 - #endif - case 5: /* push/pop general register. */ - modrm = 0; -+ is_stack = 1; - break; - - case 6: -@@ -1601,6 +1608,7 @@ trace_i386_insn (const char *name, uint8 - case 0: /* pusha */ - case 1: /* popa */ - modrm = 0; -+ is_stack = 1; - break; - case 2: /* bound */ - case 3: /* arpl */ -@@ -1620,10 +1628,12 @@ trace_i386_insn (const char *name, uint8 - case 8: /* push immediate */ - immed = op_size; - modrm = 0; -+ is_stack = 1; - break; - case 10: /* push 8-bit immediate */ - immed = 1; - modrm = 0; -+ is_stack = 1; - break; - case 9: /* imul immediate */ - immed = op_size; -@@ -1653,8 +1663,22 @@ trace_i386_insn (const char *name, uint8 - immed = op_size; - else - immed = 1; -+ if (op == 0x81 || op == 0x83) { -+ /* add, sub */ -+ op = ptr[insn_size]; -+ switch ((op >> 3) & 7) { -+ case 0: -+ case 5: -+ is_stack = (op & 7) == 4; -+ break; -+ } -+ } - } -- /* else test, xchg, mov, lea or pop general. */ -+ else if ((op & 0xf) == 0xf) { -+ /* pop general. */ -+ is_stack = 1; -+ } -+ /* else test, xchg, mov, lea. */ - break; - - case 9: -@@ -1904,6 +1928,9 @@ trace_i386_insn (const char *name, uint8 - if (is_exit) - flags[insn] |= FLAG_EXIT; - -+ if (is_stack) -+ flags[insn] |= FLAG_STACK; -+ - if (!(is_jmp || is_ret || is_exit)) - flags[insn + insn_size] |= FLAG_INSN; - } -@@ -1924,6 +1951,7 @@ static int trace_i386_op(const char * na - int num_exits; - int len; - int last_insn; -+ int stack_clobbered; - - len = *plen; - flags = malloc(len + 1); -@@ -1947,6 +1975,7 @@ static int trace_i386_op(const char * na - retpos = -1; - num_exits = 0; - last_insn = 0; -+ stack_clobbered = 0; - for (insn = 0; insn < len; insn++) { - if (flags[insn] & FLAG_RET) { - /* ??? In theory it should be possible to handle multiple return -@@ -1956,6 +1985,8 @@ static int trace_i386_op(const char * na - retpos = insn; - } - if (flags[insn] & FLAG_EXIT) { -+ if (stack_clobbered) -+ error("Stack clobbered in %s", name); - if (num_exits == MAX_EXITS) - error("Too many block exits in %s", name); - exit_addrs[num_exits] = insn; -@@ -1963,6 +1994,8 @@ static int trace_i386_op(const char * na - } - if (flags[insn] & FLAG_INSN) - last_insn = insn; -+ if (flags[insn] & FLAG_STACK) -+ stack_clobbered = 1; - } - - exit_addrs[num_exits] = -1; diff --git a/qemu/patches/qemu-0.7.2-gcc4-opts.patch b/qemu/patches/qemu-0.7.2-gcc4-opts.patch deleted file mode 100644 index ce5e3aa..0000000 --- a/qemu/patches/qemu-0.7.2-gcc4-opts.patch +++ /dev/null @@ -1,37 +0,0 @@ -2005-11-11 Gwenole Beauchesne - - * Globaaly save %ebx, %esi, %edi on entry to generated - function. This avoids some register spills in synthetic opcodes. - NOTE: this also easily fixes gcc4 compiled qemu-system-x86_64 on x86. - ---- qemu-0.7.2/cpu-exec.c.gcc4-opts 2005-09-04 19:11:31.000000000 +0200 -+++ qemu-0.7.2/cpu-exec.c 2005-11-11 17:40:47.000000000 +0100 -@@ -561,6 +561,15 @@ int cpu_exec(CPUState *env1) - : /* no outputs */ - : "r" (gen_func) - : "r1", "r2", "r3", "r8", "r9", "r10", "r12", "r14"); -+#elif defined(TARGET_X86_64) && defined(__i386__) -+ asm volatile ("push %%ebx\n" -+ "push %%esi\n" -+ "push %%edi\n" -+ "call *%0\n" -+ "pop %%edi\n" -+ "pop %%esi\n" -+ "pop %%ebx\n" -+ : : "r" (gen_func) : "ebx", "esi", "edi"); - #elif defined(TARGET_I386) && defined(USE_CODE_COPY) - { - if (!(tb->cflags & CF_CODE_COPY)) { ---- qemu-0.7.2/Makefile.target.gcc4-opts 2005-11-11 16:26:33.000000000 +0100 -+++ qemu-0.7.2/Makefile.target 2005-11-11 17:59:56.000000000 +0100 -@@ -65,6 +65,10 @@ OP_CFLAGS+= -falign-functions=0 -fno-gcs - else - OP_CFLAGS+= -malign-functions=0 - endif -+ifeq ($(TARGET_ARCH), x86_64) -+# XXX globally save %ebx, %esi, %edi on entry to generated function -+OP_CFLAGS+= -fcall-used-ebx -fcall-used-esi -fcall-used-edi -+endif - - ifdef TARGET_GPROF - USE_I386_LD=y diff --git a/qemu/patches/qemu-0.8.0-gcc4-hacks.patch b/qemu/patches/qemu-0.8.0-gcc4-hacks.patch deleted file mode 100644 index f7cbdcf..0000000 --- a/qemu/patches/qemu-0.8.0-gcc4-hacks.patch +++ /dev/null @@ -1,118 +0,0 @@ -2005-10-28 Gwenole Beauchesne - - * Various additional hacks for GCC4. - ---- qemu-0.7.2/target-i386/ops_sse.h.gcc4-hacks 2005-09-04 19:11:31.000000000 +0200 -+++ qemu-0.7.2/target-i386/ops_sse.h 2005-10-28 10:09:21.000000000 +0200 -@@ -34,6 +34,12 @@ - #define Q(n) XMM_Q(n) - #define SUFFIX _xmm - #endif -+#if defined(__i386__) && __GNUC__ >= 4 -+#define RegCopy(d, s) __builtin_memcpy(&(d), &(s), sizeof(d)) -+#endif -+#ifndef RegCopy -+#define RegCopy(d, s) d = s -+#endif - - void OPPROTO glue(op_psrlw, SUFFIX)(void) - { -@@ -570,7 +576,7 @@ void OPPROTO glue(op_pshufw, SUFFIX) (vo - r.W(1) = s->W((order >> 2) & 3); - r.W(2) = s->W((order >> 4) & 3); - r.W(3) = s->W((order >> 6) & 3); -- *d = r; -+ RegCopy(*d, r); - } - #else - void OPPROTO op_shufps(void) ---- qemu-0.7.2/target-i386/helper.c.gcc4-hacks 2005-09-04 19:11:31.000000000 +0200 -+++ qemu-0.7.2/target-i386/helper.c 2005-10-28 10:09:21.000000000 +0200 -@@ -3130,8 +3130,15 @@ void helper_fxrstor(target_ulong ptr, in - nb_xmm_regs = 8 << data64; - addr = ptr + 0xa0; - for(i = 0; i < nb_xmm_regs; i++) { -+#if defined(__i386__) && __GNUC__ >= 4 -+ env->xmm_regs[i].XMM_L(0) = ldl(addr); -+ env->xmm_regs[i].XMM_L(1) = ldl(addr + 4); -+ env->xmm_regs[i].XMM_L(2) = ldl(addr + 8); -+ env->xmm_regs[i].XMM_L(3) = ldl(addr + 12); -+#else - env->xmm_regs[i].XMM_Q(0) = ldq(addr); - env->xmm_regs[i].XMM_Q(1) = ldq(addr + 8); -+#endif - addr += 16; - } - } ---- qemu-0.7.2/cpu-all.h.gcc4-hacks 2005-09-04 19:11:31.000000000 +0200 -+++ qemu-0.7.2/cpu-all.h 2005-10-28 10:09:21.000000000 +0200 -@@ -339,7 +339,13 @@ - - static inline void stq_le_p(void *ptr, uint64_t v) - { -+#if defined(__i386__) && __GNUC__ >= 4 -+ const union { uint64_t v; uint32_t p[2]; } x = { .v = v }; -+ ((uint32_t *)ptr)[0] = x.p[0]; -+ ((uint32_t *)ptr)[1] = x.p[1]; -+#else - *(uint64_t *)ptr = v; -+#endif - } - - /* float access */ ---- qemu-0.7.2/softmmu_header.h.gcc4-hacks 2005-10-28 10:08:08.000000000 +0200 -+++ qemu-0.7.2/softmmu_header.h 2005-10-28 10:09:21.000000000 +0200 -@@ -104,7 +104,7 @@ - void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, DATA_TYPE v, int is_user); - - #if (DATA_SIZE <= 4) && (TARGET_LONG_BITS == 32) && defined(__i386__) && \ -- (ACCESS_TYPE <= 1) && defined(ASM_SOFTMMU) -+ (ACCESS_TYPE <= 1) && defined(ASM_SOFTMMU) && (__GNUC__ < 4) - - #define CPU_TLB_ENTRY_BITS 4 - -@@ -131,7 +131,7 @@ static inline RES_TYPE glue(glue(ld, USU - "m" (*(uint32_t *)offsetof(CPUState, tlb_read[CPU_MEM_INDEX][0].address)), - "i" (CPU_MEM_INDEX), - "m" (*(uint8_t *)&glue(glue(__ld, SUFFIX), MMUSUFFIX)) -- : "%eax", "%ecx", "%edx", "memory", "cc"); -+ : "%eax", "%edx", "memory", "cc"); - return res; - } - -@@ -178,13 +178,14 @@ static inline int glue(glue(lds, SUFFIX) - "m" (*(uint32_t *)offsetof(CPUState, tlb_read[CPU_MEM_INDEX][0].address)), - "i" (CPU_MEM_INDEX), - "m" (*(uint8_t *)&glue(glue(__ld, SUFFIX), MMUSUFFIX)) -- : "%eax", "%ecx", "%edx", "memory", "cc"); -+ : "%eax", "%edx", "memory", "cc"); - return res; - } - #endif - --static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE v) -+static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE val) - { -+ RES_TYPE v = val; - asm volatile ("movl %0, %%edx\n" - "movl %0, %%eax\n" - "shrl %3, %%edx\n" -@@ -236,16 +237,14 @@ - "2:\n" - : - : "r" (ptr), --/* NOTE: 'q' would be needed as constraint, but we could not use it -- with T1 ! */ -- "r" (v), -+ "q" (v), - "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS), - "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS), - "i" (TARGET_PAGE_MASK | (DATA_SIZE - 1)), - "m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_write)), - "i" (CPU_MEM_INDEX), - "m" (*(uint8_t *)&glue(glue(__st, SUFFIX), MMUSUFFIX)) -- : "%eax", "%ecx", "%edx", "memory", "cc"); -+ : "%eax", "%edx", "memory", "cc"); - } - - /* TODO: handle 64-bit access sizes and addresses */ diff --git a/qemu/patches/qemu-0.8.0-osx-bugfix.patch b/qemu/patches/qemu-0.8.0-osx-bugfix.patch deleted file mode 100644 index a04c0f5..0000000 --- a/qemu/patches/qemu-0.8.0-osx-bugfix.patch +++ /dev/null @@ -1,155 +0,0 @@ ---- qemu-0.8.0/target-i386/helper.c.osx-bugfix 2006-03-17 14:19:42.000000000 +0900 -+++ qemu-0.8.0/target-i386/helper.c 2006-03-17 07:27:57.000000000 +0900 -@@ -28,68 +28,6 @@ do {\ - (raise_exception_err)(a, b);\ - } while (0) - #endif -- --const uint8_t parity_table[256] = { -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -- 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, --}; -- --/* modulo 17 table */ --const uint8_t rclw_table[32] = { -- 0, 1, 2, 3, 4, 5, 6, 7, -- 8, 9,10,11,12,13,14,15, -- 16, 0, 1, 2, 3, 4, 5, 6, -- 7, 8, 9,10,11,12,13,14, --}; -- --/* modulo 9 table */ --const uint8_t rclb_table[32] = { -- 0, 1, 2, 3, 4, 5, 6, 7, -- 8, 0, 1, 2, 3, 4, 5, 6, -- 7, 8, 0, 1, 2, 3, 4, 5, -- 6, 7, 8, 0, 1, 2, 3, 4, --}; -- --const CPU86_LDouble f15rk[7] = --{ -- 0.00000000000000000000L, -- 1.00000000000000000000L, -- 3.14159265358979323851L, /*pi*/ -- 0.30102999566398119523L, /*lg2*/ -- 0.69314718055994530943L, /*ln2*/ -- 1.44269504088896340739L, /*l2e*/ -- 3.32192809488736234781L, /*l2t*/ --}; - - /* thread support */ - ---- qemu-0.8.0/target-i386/op.c.osx-bugfix 2006-03-17 14:20:37.000000000 +0900 -+++ qemu-0.8.0/target-i386/op.c 2006-03-17 07:28:40.000000000 +0900 -@@ -21,19 +21,69 @@ - #define ASM_SOFTMMU - #include "exec.h" - --#if defined(__APPLE__) --/* XXX avoid indirect symbols, correct address patched at code generation time. */ --static const uint8_t parity_table[256]; --static const uint8_t rclw_table[32]; --static const uint8_t rclb_table[32]; --static const CPU86_LDouble f15rk[7]; --#else --extern const uint8_t parity_table[256]; --extern const uint8_t rclw_table[32]; --extern const uint8_t rclb_table[32]; --extern const CPU86_LDouble f15rk[7]; --#endif -+const uint8_t parity_table[256] = { -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, -+ 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, -+}; - -+/* modulo 17 table */ -+const uint8_t rclw_table[32] = { -+ 0, 1, 2, 3, 4, 5, 6, 7, -+ 8, 9,10,11,12,13,14,15, -+ 16, 0, 1, 2, 3, 4, 5, 6, -+ 7, 8, 9,10,11,12,13,14, -+}; -+ -+/* modulo 9 table */ -+const uint8_t rclb_table[32] = { -+ 0, 1, 2, 3, 4, 5, 6, 7, -+ 8, 0, 1, 2, 3, 4, 5, 6, -+ 7, 8, 0, 1, 2, 3, 4, 5, -+ 6, 7, 8, 0, 1, 2, 3, 4, -+}; -+ -+const CPU86_LDouble f15rk[7] = -+{ -+ 0.00000000000000000000L, -+ 1.00000000000000000000L, -+ 3.14159265358979323851L, /*pi*/ -+ 0.30102999566398119523L, /*lg2*/ -+ 0.69314718055994530943L, /*ln2*/ -+ 1.44269504088896340739L, /*l2e*/ -+ 3.32192809488736234781L, /*l2t*/ -+}; -+ -+ - /* n must be a constant to be efficient */ - static inline target_long lshift(target_long x, int n) - { diff --git a/qemu/patches/qemu-0.9.0-arm-shift.patch b/qemu/patches/qemu-0.9.0-arm-shift.patch deleted file mode 100644 index 810f232..0000000 --- a/qemu/patches/qemu-0.9.0-arm-shift.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- qemu-0.9.0/target-arm/op.c 2007-07-23 06:57:25.000000000 +0200 -+++ qemu/target-arm/op.c 2007-07-23 06:58:25.000000000 +0200 -@@ -819,7 +819,7 @@ - int shift; - shift = PARAM1; - if (shift != 0) { -- env->CF = (T1 >> (32 - shift)) & 1; -+ env->CF = (T0 >> (32 - shift)) & 1; - T0 = T0 << shift; - } - env->NZF = T0; -@@ -832,7 +832,7 @@ - - shift = PARAM1; - if (shift == 0) { -- env->CF = ((uint32_t)shift) >> 31; -+ env->CF = ((uint32_t)T0) >> 31; - T0 = 0; - } else { - env->CF = (T0 >> (shift - 1)) & 1; diff --git a/qemu/patches/qemu-0.9.0-enforce-16byte-stack-boundary.patch b/qemu/patches/qemu-0.9.0-enforce-16byte-stack-boundary.patch deleted file mode 100644 index 65aaaf1..0000000 --- a/qemu/patches/qemu-0.9.0-enforce-16byte-stack-boundary.patch +++ /dev/null @@ -1,19 +0,0 @@ -2007-02-01 Mike kronenberg - - * Fix for QEMU 0.9.0. - -2006-02-12 Gwenole Beauchesne - - * Enforce 16-byte boundaries. - ---- qemu-0.8.0/Makefile.target.enforce-16byte-stack-boundary 2006-02-12 17:46:54.000000000 +0100 -+++ qemu-0.8.0/Makefile.target 2006-02-12 17:55:24.000000000 +0100 -@@ -67,7 +67,7 @@ endif - - ifeq ($(ARCH),i386) - HELPER_CFLAGS+=-fomit-frame-pointer --OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer -+OP_CFLAGS+=-fomit-frame-pointer - ifeq ($(HAVE_GCC3_OPTIONS),yes) - OP_CFLAGS+= -falign-functions=0 -fno-gcse - else diff --git a/qemu/patches/qemu-0.9.0-gcc4.patch b/qemu/patches/qemu-0.9.0-gcc4.patch deleted file mode 100644 index 5eca38b..0000000 --- a/qemu/patches/qemu-0.9.0-gcc4.patch +++ /dev/null @@ -1,892 +0,0 @@ -2007-02-01 Mike Kronenberg - - * target-ppc/exec.h: Fix for QEMU 0.9.0. - * dyngen-exec.h: Fix for QEMU 0.9.0. - -2005-06-02 Gwenole Beauchesne - - * dyngen.c (trace_i386_insn): Fix push/imul case with 8-bit - immediate. - -2005-05-11 Paul Brook - - * gcc4 host support. - ---- qemu-0.7.0/target-ppc/exec.h.gcc4 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/target-ppc/exec.h 2005-06-02 21:41:51.000000000 +0200 -@@ -33,11 +33,7 @@ #define FT0 (env->ft0) - #define FT1 (env->ft1) - #define FT2 (env->ft2) - --#if defined (DEBUG_OP) --# define RETURN() __asm__ __volatile__("nop" : : : "memory"); --#else --# define RETURN() __asm__ __volatile__("" : : : "memory"); --#endif -+#define RETURN() FORCE_RET() - - #include "cpu.h" - #include "exec-all.h" ---- qemu-0.7.0/dyngen-exec.h.gcc4 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/dyngen-exec.h 2005-06-02 21:41:51.000000000 +0200 -@@ -155,7 +155,12 @@ extern int printf(const char *, ...); - #endif - - /* force GCC to generate only one epilog at the end of the function */ -+#if defined(__i386__) || defined(__x86_64__) -+/* Also add 4 bytes of padding so that we can replace the ret with a jmp. */ -+#define FORCE_RET() asm volatile ("nop;nop;nop;nop"); -+#else - #define FORCE_RET() __asm__ __volatile__("" : : : "memory"); -+#endif - - #ifndef OPPROTO - #define OPPROTO -@@ -205,12 +210,19 @@ extern int __op_jmp0, __op_jmp1, __op_jm - #endif - - #ifdef __i386__ --#define EXIT_TB() asm volatile ("ret") --#define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n) -+/* Dyngen will replace hlt instructions with a ret instruction. Inserting a -+ ret directly would confuse dyngen. */ -+#define EXIT_TB() asm volatile ("hlt") -+/* Dyngen will replace cli with 0x9e (jmp). -+ We generate the offset manually. */ -+#define GOTO_LABEL_PARAM(n) \ -+ asm volatile ("cli;.long " ASM_NAME(__op_gen_label) #n " - 1f;1:") - #endif - #ifdef __x86_64__ --#define EXIT_TB() asm volatile ("ret") --#define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n) -+/* The same as i386. */ -+#define EXIT_TB() asm volatile ("hlt") -+#define GOTO_LABEL_PARAM(n) \ -+ asm volatile ("cli;.long " ASM_NAME(__op_gen_label) #n " - 1f;1:") - #endif - #ifdef __powerpc__ - #define EXIT_TB() asm volatile ("blr") ---- qemu-0.7.0/dyngen.c.gcc4 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/dyngen.c 2005-06-02 22:25:06.000000000 +0200 -@@ -32,6 +32,8 @@ - - #include "config-host.h" - -+//#define DEBUG_OP -+ - /* NOTE: we test CONFIG_WIN32 instead of _WIN32 to enabled cross - compilation */ - #if defined(CONFIG_WIN32) -@@ -1343,6 +1345,644 @@ int arm_emit_ldr_info(const char *name, - #endif - - -+#if defined(HOST_I386) || defined(HOST_X86_64) -+ -+/* This byte is the first byte of an instruction. */ -+#define FLAG_INSN (1 << 0) -+/* This byte has been processed as part of an instruction. */ -+#define FLAG_SCANNED (1 << 1) -+/* This instruction is a return instruction. Gcc cometimes generates prefix -+ bytes, so may be more than one byte long. */ -+#define FLAG_RET (1 << 2) -+/* This is either the target of a jump, or the preceeding instruction uses -+ a pc-relative offset. */ -+#define FLAG_TARGET (1 << 3) -+/* This is a magic instruction that needs fixing up. */ -+#define FLAG_EXIT (1 << 4) -+#define MAX_EXITS 5 -+ -+static void -+bad_opcode(const char *name, uint32_t op) -+{ -+ error("Unsupported opcode %0*x in %s", (op > 0xff) ? 4 : 2, op, name); -+} -+ -+/* Mark len bytes as scanned, Returns insn_size + len. Reports an error -+ if these bytes have already been scanned. */ -+static int -+eat_bytes(const char *name, char *flags, int insn, int insn_size, int len) -+{ -+ while (len > 0) { -+ /* This should never occur in sane code. */ -+ if (flags[insn + insn_size] & FLAG_SCANNED) -+ error ("Overlapping instructions in %s", name); -+ flags[insn + insn_size] |= FLAG_SCANNED; -+ insn_size++; -+ len--; -+ } -+ return insn_size; -+} -+ -+static void -+trace_i386_insn (const char *name, uint8_t *start_p, char *flags, int insn, -+ int len) -+{ -+ uint8_t *ptr; -+ uint8_t op; -+ int modrm; -+ int is_prefix; -+ int op_size; -+ int addr_size; -+ int insn_size; -+ int is_ret; -+ int is_condjmp; -+ int is_jmp; -+ int is_exit; -+ int is_pcrel; -+ int immed; -+ int seen_rexw; -+ int32_t disp; -+ -+ ptr = start_p + insn; -+ /* nonzero if this insn has a ModR/M byte. */ -+ modrm = 1; -+ /* The size of the immediate value in this instruction. */ -+ immed = 0; -+ /* The operand size. */ -+ op_size = 4; -+ /* The address size */ -+ addr_size = 4; -+ /* The total length of this instruction. */ -+ insn_size = 0; -+ is_prefix = 1; -+ is_ret = 0; -+ is_condjmp = 0; -+ is_jmp = 0; -+ is_exit = 0; -+ seen_rexw = 0; -+ is_pcrel = 0; -+ -+ while (is_prefix) { -+ op = ptr[insn_size]; -+ insn_size = eat_bytes(name, flags, insn, insn_size, 1); -+ is_prefix = 0; -+ switch (op >> 4) { -+ case 0: -+ case 1: -+ case 2: -+ case 3: -+ if (op == 0x0f) { -+ /* two-byte opcode. */ -+ op = ptr[insn_size]; -+ insn_size = eat_bytes(name, flags, insn, insn_size, 1); -+ switch (op >> 4) { -+ case 0: -+ if ((op & 0xf) > 3) -+ modrm = 0; -+ break; -+ case 1: /* vector move or prefetch */ -+ case 2: /* various moves and vector compares. */ -+ case 4: /* cmov */ -+ case 5: /* vector instructions */ -+ case 6: -+ case 13: -+ case 14: -+ case 15: -+ break; -+ case 7: /* mmx */ -+ if (op & 0x77) /* emms */ -+ modrm = 0; -+ break; -+ case 3: /* wrmsr, rdtsc, rdmsr, rdpmc, sysenter, sysexit */ -+ modrm = 0; -+ break; -+ case 8: /* long conditional jump */ -+ is_condjmp = 1; -+ immed = op_size; -+ modrm = 0; -+ break; -+ case 9: /* setcc */ -+ break; -+ case 10: -+ switch (op & 0x7) { -+ case 0: /* push fs/gs */ -+ case 1: /* pop fs/gs */ -+ case 2: /* cpuid/rsm */ -+ modrm = 0; -+ break; -+ case 4: /* shld/shrd immediate */ -+ immed = 1; -+ break; -+ default: /* Normal instructions with a ModR/M byte. */ -+ break; -+ } -+ break; -+ case 11: -+ switch (op & 0xf) { -+ case 10: /* bt, bts, btr, btc */ -+ immed = 1; -+ break; -+ default: -+ /* cmpxchg, lss, btr, lfs, lgs, movzx, btc, bsf, bsr -+ undefined, and movsx */ -+ break; -+ } -+ break; -+ case 12: -+ if (op & 8) { -+ /* bswap */ -+ modrm = 0; -+ } else { -+ switch (op & 0x7) { -+ case 2: -+ case 4: -+ case 5: -+ case 6: -+ immed = 1; -+ break; -+ default: -+ break; -+ } -+ } -+ break; -+ } -+ } else if ((op & 0x07) <= 0x3) { -+ /* General arithmentic ax. */ -+ } else if ((op & 0x07) <= 0x5) { -+ /* General arithmetic ax, immediate. */ -+ if (op & 0x01) -+ immed = op_size; -+ else -+ immed = 1; -+ modrm = 0; -+ } else if ((op & 0x23) == 0x22) { -+ /* Segment prefix. */ -+ is_prefix = 1; -+ } else { -+ /* Segment register push/pop or DAA/AAA/DAS/AAS. */ -+ modrm = 0; -+ } -+ break; -+ -+#if defined(HOST_X86_64) -+ case 4: /* rex prefix. */ -+ is_prefix = 1; -+ /* The address/operand size is actually 64-bit, but the immediate -+ values in the instruction are still 32-bit. */ -+ op_size = 4; -+ addr_size = 4; -+ if (op & 8) -+ seen_rexw = 1; -+ break; -+#else -+ case 4: /* inc/dec register. */ -+#endif -+ case 5: /* push/pop general register. */ -+ modrm = 0; -+ break; -+ -+ case 6: -+ switch (op & 0x0f) { -+ case 0: /* pusha */ -+ case 1: /* popa */ -+ modrm = 0; -+ break; -+ case 2: /* bound */ -+ case 3: /* arpl */ -+ break; -+ case 4: /* FS */ -+ case 5: /* GS */ -+ is_prefix = 1; -+ break; -+ case 6: /* opcode size prefix. */ -+ op_size = 2; -+ is_prefix = 1; -+ break; -+ case 7: /* Address size prefix. */ -+ addr_size = 2; -+ is_prefix = 1; -+ break; -+ case 8: /* push immediate */ -+ immed = op_size; -+ modrm = 0; -+ break; -+ case 10: /* push 8-bit immediate */ -+ immed = 1; -+ modrm = 0; -+ break; -+ case 9: /* imul immediate */ -+ immed = op_size; -+ break; -+ case 11: /* imul 8-bit immediate */ -+ immed = 1; -+ break; -+ case 12: /* insb */ -+ case 13: /* insw */ -+ case 14: /* outsb */ -+ case 15: /* outsw */ -+ modrm = 0; -+ break; -+ } -+ break; -+ -+ case 7: /* Short conditional jump. */ -+ is_condjmp = 1; -+ immed = 1; -+ modrm = 0; -+ break; -+ -+ case 8: -+ if ((op & 0xf) <= 3) { -+ /* arithmetic immediate. */ -+ if ((op & 3) == 1) -+ immed = op_size; -+ else -+ immed = 1; -+ } -+ /* else test, xchg, mov, lea or pop general. */ -+ break; -+ -+ case 9: -+ /* Various single-byte opcodes with no modrm byte. */ -+ modrm = 0; -+ if (op == 10) { -+ /* Call */ -+ immed = 4; -+ } -+ break; -+ -+ case 10: -+ switch ((op & 0xe) >> 1) { -+ case 0: /* mov absoliute immediate. */ -+ case 1: -+ if (seen_rexw) -+ immed = 8; -+ else -+ immed = addr_size; -+ break; -+ case 4: /* test immediate. */ -+ if (op & 1) -+ immed = op_size; -+ else -+ immed = 1; -+ break; -+ default: /* Various string ops. */ -+ break; -+ } -+ modrm = 0; -+ break; -+ -+ case 11: /* move immediate to register */ -+ if (op & 8) { -+ if (seen_rexw) -+ immed = 8; -+ else -+ immed = op_size; -+ } else { -+ immed = 1; -+ } -+ modrm = 0; -+ break; -+ -+ case 12: -+ switch (op & 0xf) { -+ case 0: /* shift immediate */ -+ case 1: -+ immed = 1; -+ break; -+ case 2: /* ret immediate */ -+ immed = 2; -+ modrm = 0; -+ bad_opcode(name, op); -+ break; -+ case 3: /* ret */ -+ modrm = 0; -+ is_ret = 1; -+ case 4: /* les */ -+ case 5: /* lds */ -+ break; -+ case 6: /* mov immediate byte */ -+ immed = 1; -+ break; -+ case 7: /* mov immediate */ -+ immed = op_size; -+ break; -+ case 8: /* enter */ -+ /* TODO: Is this right? */ -+ immed = 3; -+ modrm = 0; -+ break; -+ case 10: /* retf immediate */ -+ immed = 2; -+ modrm = 0; -+ bad_opcode(name, op); -+ break; -+ case 13: /* int */ -+ immed = 1; -+ modrm = 0; -+ break; -+ case 11: /* retf */ -+ case 15: /* iret */ -+ modrm = 0; -+ bad_opcode(name, op); -+ break; -+ default: /* leave, int3 or into */ -+ modrm = 0; -+ break; -+ } -+ break; -+ -+ case 13: -+ if ((op & 0xf) >= 8) { -+ /* Coprocessor escape. For our purposes this is just a normal -+ instruction with a ModR/M byte. */ -+ } else if ((op & 0xf) >= 4) { -+ /* AAM, AAD or XLAT */ -+ modrm = 0; -+ } -+ /* else shift instruction */ -+ break; -+ -+ case 14: -+ switch ((op & 0xc) >> 2) { -+ case 0: /* loop or jcxz */ -+ is_condjmp = 1; -+ immed = 1; -+ break; -+ case 1: /* in/out immed */ -+ immed = 1; -+ break; -+ case 2: /* call or jmp */ -+ switch (op & 3) { -+ case 0: /* call */ -+ immed = op_size; -+ break; -+ case 1: /* long jump */ -+ immed = 4; -+ is_jmp = 1; -+ break; -+ case 2: /* far jmp */ -+ bad_opcode(name, op); -+ break; -+ case 3: /* short jmp */ -+ immed = 1; -+ is_jmp = 1; -+ break; -+ } -+ break; -+ case 3: /* in/out register */ -+ break; -+ } -+ modrm = 0; -+ break; -+ -+ case 15: -+ switch ((op & 0xe) >> 1) { -+ case 0: -+ case 1: -+ is_prefix = 1; -+ break; -+ case 2: -+ case 4: -+ case 5: -+ case 6: -+ modrm = 0; -+ /* Some privileged insns are used as markers. */ -+ switch (op) { -+ case 0xf4: /* hlt: Exit translation block. */ -+ is_exit = 1; -+ break; -+ case 0xfa: /* cli: Jump to label. */ -+ is_exit = 1; -+ immed = 4; -+ break; -+ case 0xfb: /* sti: TB patch jump. */ -+ /* Mark the insn for patching, but continue sscanning. */ -+ flags[insn] |= FLAG_EXIT; -+ immed = 4; -+ break; -+ } -+ break; -+ case 3: /* unary grp3 */ -+ if ((ptr[insn_size] & 0x38) == 0) { -+ if (op == 0xf7) -+ immed = op_size; -+ else -+ immed = 1; /* test immediate */ -+ } -+ break; -+ case 7: /* inc/dec grp4/5 */ -+ /* TODO: This includes indirect jumps. We should fail if we -+ encounter one of these. */ -+ break; -+ } -+ break; -+ } -+ } -+ -+ if (modrm) { -+ if (addr_size != 4) -+ error("16-bit addressing mode used in %s", name); -+ -+ disp = 0; -+ modrm = ptr[insn_size]; -+ insn_size = eat_bytes(name, flags, insn, insn_size, 1); -+ modrm &= 0xc7; -+ switch ((modrm & 0xc0) >> 6) { -+ case 0: -+ if (modrm == 5) -+ disp = 4; -+ break; -+ case 1: -+ disp = 1; -+ break; -+ case 2: -+ disp = 4; -+ break; -+ } -+ if ((modrm & 0xc0) != 0xc0 && (modrm & 0x7) == 4) { -+ /* SIB byte */ -+ if (modrm == 4 && (ptr[insn_size] & 0x7) == 5) { -+ disp = 4; -+ is_pcrel = 1; -+ } -+ insn_size = eat_bytes(name, flags, insn, insn_size, 1); -+ } -+ insn_size = eat_bytes(name, flags, insn, insn_size, disp); -+ } -+ insn_size = eat_bytes(name, flags, insn, insn_size, immed); -+ if (is_condjmp || is_jmp) { -+ if (immed == 1) { -+ disp = (int8_t)*(ptr + insn_size - 1); -+ } else { -+ disp = (((int32_t)*(ptr + insn_size - 1)) << 24) -+ | (((int32_t)*(ptr + insn_size - 2)) << 16) -+ | (((int32_t)*(ptr + insn_size - 3)) << 8) -+ | *(ptr + insn_size - 4); -+ } -+ disp += insn_size; -+ /* Jumps to external symbols point to the address of the offset -+ before relocation. */ -+ /* ??? These are probably a tailcall. We could fix them up by -+ replacing them with jmp to EOB + call, but it's easier to just -+ prevent the compiler generating them. */ -+ if (disp == 1) -+ error("Unconditional jump (sibcall?) in %s", name); -+ disp += insn; -+ if (disp < 0 || disp > len) -+ error("Jump outside instruction in %s", name); -+ -+ if ((flags[disp] & (FLAG_INSN | FLAG_SCANNED)) == FLAG_SCANNED) -+ error("Overlapping instructions in %s", name); -+ -+ flags[disp] |= (FLAG_INSN | FLAG_TARGET); -+ is_pcrel = 1; -+ } -+ if (is_pcrel) { -+ /* Mark the following insn as a jump target. This will stop -+ this instruction being moved. */ -+ flags[insn + insn_size] |= FLAG_TARGET; -+ } -+ if (is_ret) -+ flags[insn] |= FLAG_RET; -+ -+ if (is_exit) -+ flags[insn] |= FLAG_EXIT; -+ -+ if (!(is_jmp || is_ret || is_exit)) -+ flags[insn + insn_size] |= FLAG_INSN; -+} -+ -+/* Scan a function body. Returns the position of the return sequence. -+ Sets *patch_bytes to the number of bytes that need to be copied from that -+ location. If no patching is required (ie. the return is the last insn) -+ *patch_bytes will be set to -1. *plen is the number of code bytes to copy. -+ */ -+static int trace_i386_op(const char * name, uint8_t *start_p, int *plen, -+ int *patch_bytes, int *exit_addrs) -+{ -+ char *flags; -+ int more; -+ int insn; -+ int retpos; -+ int bytes; -+ int num_exits; -+ int len; -+ int last_insn; -+ -+ len = *plen; -+ flags = malloc(len + 1); -+ memset(flags, 0, len + 1); -+ flags[0] |= FLAG_INSN; -+ more = 1; -+ while (more) { -+ more = 0; -+ for (insn = 0; insn < len; insn++) { -+ if ((flags[insn] & (FLAG_INSN | FLAG_SCANNED)) == FLAG_INSN) { -+ trace_i386_insn(name, start_p, flags, insn, len); -+ more = 1; -+ } -+ } -+ } -+ -+ /* Strip any unused code at the end of the function. */ -+ while (len > 0 && flags[len - 1] == 0) -+ len--; -+ -+ retpos = -1; -+ num_exits = 0; -+ last_insn = 0; -+ for (insn = 0; insn < len; insn++) { -+ if (flags[insn] & FLAG_RET) { -+ /* ??? In theory it should be possible to handle multiple return -+ points. In practice it's not worth the effort. */ -+ if (retpos != -1) -+ error("Multiple return instructions in %s", name); -+ retpos = insn; -+ } -+ if (flags[insn] & FLAG_EXIT) { -+ if (num_exits == MAX_EXITS) -+ error("Too many block exits in %s", name); -+ exit_addrs[num_exits] = insn; -+ num_exits++; -+ } -+ if (flags[insn] & FLAG_INSN) -+ last_insn = insn; -+ } -+ -+ exit_addrs[num_exits] = -1; -+ if (retpos == -1) { -+ if (num_exits == 0) { -+ error ("No return instruction found in %s", name); -+ } else { -+ retpos = len; -+ last_insn = len; -+ } -+ } -+ -+ /* If the return instruction is the last instruction we can just -+ remove it. */ -+ if (retpos == last_insn) -+ *patch_bytes = -1; -+ else -+ *patch_bytes = 0; -+ -+ /* Back up over any nop instructions. */ -+ while (retpos > 0 -+ && (flags[retpos] & FLAG_TARGET) == 0 -+ && (flags[retpos - 1] & FLAG_INSN) != 0 -+ && start_p[retpos - 1] == 0x90) { -+ retpos--; -+ } -+ -+ if (*patch_bytes == -1) { -+ *plen = retpos; -+ free (flags); -+ return retpos; -+ } -+ *plen = len; -+ -+ /* The ret is in the middle of the function. Find four more bytes that -+ so the ret can be replaced by a jmp. */ -+ /* ??? Use a short jump where possible. */ -+ bytes = 4; -+ insn = retpos + 1; -+ /* We can clobber everything up to the next jump target. */ -+ while (insn < len && bytes > 0 && (flags[insn] & FLAG_TARGET) == 0) { -+ insn++; -+ bytes--; -+ } -+ if (bytes > 0) { -+ /* ???: Strip out nop blocks. */ -+ /* We can't do the replacement without clobbering anything important. -+ Copy preceeding instructions(s) to give us some space. */ -+ while (retpos > 0) { -+ /* If this byte is the target of a jmp we can't move it. */ -+ if (flags[retpos] & FLAG_TARGET) -+ break; -+ -+ (*patch_bytes)++; -+ bytes--; -+ retpos--; -+ -+ /* Break out of the loop if we have enough space and this is either -+ the first byte of an instruction or a pad byte. */ -+ if ((flags[retpos] & (FLAG_INSN | FLAG_SCANNED)) != FLAG_SCANNED -+ && bytes <= 0) { -+ break; -+ } -+ } -+ } -+ -+ if (bytes > 0) -+ error("Unable to replace ret with jmp in %s\n", name); -+ -+ free(flags); -+ return retpos; -+} -+ -+#endif -+ - #define MAX_ARGS 3 - - /* generate op code */ -@@ -1356,6 +1996,11 @@ void gen_code(const char *name, host_ulo - uint8_t args_present[MAX_ARGS]; - const char *sym_name, *p; - EXE_RELOC *rel; -+#if defined(HOST_I386) || defined(HOST_X86_64) -+ int patch_bytes; -+ int retpos; -+ int exit_addrs[MAX_EXITS]; -+#endif - - /* Compute exact size excluding prologue and epilogue instructions. - * Increment start_offset to skip epilogue instructions, then compute -@@ -1366,33 +2011,12 @@ void gen_code(const char *name, host_ulo - p_end = p_start + size; - start_offset = offset; - #if defined(HOST_I386) || defined(HOST_X86_64) --#ifdef CONFIG_FORMAT_COFF -- { -- uint8_t *p; -- p = p_end - 1; -- if (p == p_start) -- error("empty code for %s", name); -- while (*p != 0xc3) { -- p--; -- if (p <= p_start) -- error("ret or jmp expected at the end of %s", name); -- } -- copy_size = p - p_start; -- } --#else - { - int len; - len = p_end - p_start; -- if (len == 0) -- error("empty code for %s", name); -- if (p_end[-1] == 0xc3) { -- len--; -- } else { -- error("ret or jmp expected at the end of %s", name); -- } -+ retpos = trace_i386_op(name, p_start, &len, &patch_bytes, exit_addrs); - copy_size = len; - } --#endif - #elif defined(HOST_PPC) - { - uint8_t *p; -@@ -1559,6 +2183,13 @@ void gen_code(const char *name, host_ulo - } - - if (gen_switch == 2) { -+#if defined(HOST_I386) || defined(HOST_X86_64) -+ if (patch_bytes != -1) -+ copy_size += patch_bytes; -+#ifdef DEBUG_OP -+ copy_size += 2; -+#endif -+#endif - fprintf(outfile, "DEF(%s, %d, %d)\n", name + 3, nb_args, copy_size); - } else if (gen_switch == 1) { - -@@ -1761,7 +2392,43 @@ void gen_code(const char *name, host_ulo - #error unsupport object format - #endif - } -+ } -+ /* Replace the marker instructions with the actual opcodes. */ -+ for (i = 0; exit_addrs[i] != -1; i++) { -+ int op; -+ switch (p_start[exit_addrs[i]]) -+ { -+ case 0xf4: op = 0xc3; break; /* hlt -> ret */ -+ case 0xfa: op = 0xe9; break; /* cli -> jmp */ -+ case 0xfb: op = 0xe9; break; /* sti -> jmp */ -+ default: error("Internal error"); -+ } -+ fprintf(outfile, -+ " *(uint8_t *)(gen_code_ptr + %d) = 0x%x;\n", -+ exit_addrs[i], op); - } -+ /* Fix up the return instruction. */ -+ if (patch_bytes != -1) { -+ if (patch_bytes) { -+ fprintf(outfile, " memcpy(gen_code_ptr + %d," -+ "gen_code_ptr + %d, %d);\n", -+ copy_size, retpos, patch_bytes); -+ } -+ fprintf(outfile, -+ " *(uint8_t *)(gen_code_ptr + %d) = 0xe9;\n", -+ retpos); -+ fprintf(outfile, -+ " *(uint32_t *)(gen_code_ptr + %d) = 0x%x;\n", -+ retpos + 1, copy_size - (retpos + 5)); -+ -+ copy_size += patch_bytes; -+ } -+#ifdef DEBUG_OP -+ fprintf(outfile, -+ " *(uint16_t *)(gen_code_ptr + %d) = 0x9090;\n", -+ copy_size); -+ copy_size += 2; -+#endif - } - #elif defined(HOST_X86_64) - { -@@ -1793,6 +2460,42 @@ void gen_code(const char *name, host_ulo - } - } - } -+ /* Replace the marker instructions with the actual opcodes. */ -+ for (i = 0; exit_addrs[i] != -1; i++) { -+ int op; -+ switch (p_start[exit_addrs[i]]) -+ { -+ case 0xf4: op = 0xc3; break; /* hlt -> ret */ -+ case 0xfa: op = 0xe9; break; /* cli -> jmp */ -+ case 0xfb: op = 0xe9; break; /* sti -> jmp */ -+ default: error("Internal error"); -+ } -+ fprintf(outfile, -+ " *(uint8_t *)(gen_code_ptr + %d) = 0x%x;\n", -+ exit_addrs[i], op); -+ } -+ /* Fix up the return instruction. */ -+ if (patch_bytes != -1) { -+ if (patch_bytes) { -+ fprintf(outfile, " memcpy(gen_code_ptr + %d," -+ "gen_code_ptr + %d, %d);\n", -+ copy_size, retpos, patch_bytes); -+ } -+ fprintf(outfile, -+ " *(uint8_t *)(gen_code_ptr + %d) = 0xe9;\n", -+ retpos); -+ fprintf(outfile, -+ " *(uint32_t *)(gen_code_ptr + %d) = 0x%x;\n", -+ retpos + 1, copy_size - (retpos + 5)); -+ -+ copy_size += patch_bytes; -+ } -+#ifdef DEBUG_OP -+ fprintf(outfile, -+ " *(uint16_t *)(gen_code_ptr + %d) = 0x9090;\n", -+ copy_size); -+ copy_size += 2; -+#endif - } - #elif defined(HOST_PPC) - { ---- qemu-0.7.0/exec-all.h.gcc4 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/exec-all.h 2005-06-02 21:41:51.000000000 +0200 -@@ -335,14 +335,15 @@ do {\ - - #elif defined(__i386__) && defined(USE_DIRECT_JUMP) - --/* we patch the jump instruction directly */ -+/* we patch the jump instruction directly. Use sti in place of the actual -+ jmp instruction so that dyngen can patch in the correct result. */ - #define GOTO_TB(opname, tbparam, n)\ - do {\ - asm volatile (".section .data\n"\ - ASM_OP_LABEL_NAME(n, opname) ":\n"\ - ".long 1f\n"\ - ASM_PREVIOUS_SECTION \ -- "jmp " ASM_NAME(__op_jmp) #n "\n"\ -+ "sti;.long " ASM_NAME(__op_jmp) #n " - 1f\n"\ - "1:\n");\ - } while (0) - diff --git a/qemu/patches/qemu-0.9.0-i386-FORCE_RET.patch b/qemu/patches/qemu-0.9.0-i386-FORCE_RET.patch deleted file mode 100644 index 820399d..0000000 --- a/qemu/patches/qemu-0.9.0-i386-FORCE_RET.patch +++ /dev/null @@ -1,26 +0,0 @@ -2007-02-01 Mike Kronenberg - - * Fix for QEMU 0.9.0. - -2006-06-12 Gwenole Beauchesne - - * Try to enforce one exit point per synthetic opcode (gcc4). - ---- qemu-0.8.0/target-i386/op.c.i386-FORCE_RET 2005-12-19 23:51:53.000000000 +0100 -+++ qemu-0.8.0/target-i386/op.c 2006-02-12 17:51:40.000000000 +0100 -@@ -1032,6 +1032,7 @@ void OPPROTO op_aaa(void) - } - EAX = (EAX & ~0xffff) | al | (ah << 8); - CC_SRC = eflags; -+ FORCE_RET(); - } - - void OPPROTO op_aas(void) -@@ -1056,6 +1057,7 @@ void OPPROTO op_aas(void) - } - EAX = (EAX & ~0xffff) | al | (ah << 8); - CC_SRC = eflags; -+ FORCE_RET(); - } - - /* segment handling */ diff --git a/qemu/patches/qemu-0.9.0-osx-intel-port.patch b/qemu/patches/qemu-0.9.0-osx-intel-port.patch deleted file mode 100644 index 348b823..0000000 --- a/qemu/patches/qemu-0.9.0-osx-intel-port.patch +++ /dev/null @@ -1,329 +0,0 @@ -2007-02-01 Mike Kronenberg - - * Fix for QEMU 0.9.0. - -2006-02-12 Gwenole Beauchesne - - * Port to MacOS X for Intel. - -TODO: - - try test-i386 - - use 80-bit long double? - ---- qemu-0.8.0/target-i386/exec.h.osx-intel-port 2005-12-19 23:51:53.000000000 +0100 -+++ qemu-0.8.0/target-i386/exec.h 2006-02-13 07:20:25.000000000 +0100 -@@ -457,8 +457,6 @@ static inline void helper_fstt(CPU86_LDo - - #define FPUC_EM 0x3f - --extern const CPU86_LDouble f15rk[7]; -- - void helper_fldt_ST0_A0(void); - void helper_fstt_ST0_A0(void); - void fpu_raise_exception(void); -@@ -492,10 +490,6 @@ float approx_rsqrt(float a); - float approx_rcp(float a); - void update_fp_status(void); - --extern const uint8_t parity_table[256]; --extern const uint8_t rclw_table[32]; --extern const uint8_t rclb_table[32]; -- - static inline uint32_t compute_eflags(void) - { - return env->eflags | cc_table[CC_OP].compute_all() | (DF & DF_MASK); ---- qemu-0.8.0/target-i386/op.c.osx-intel-port 2006-02-13 01:25:58.000000000 +0100 -+++ qemu-0.8.0/target-i386/op.c 2006-02-13 07:20:25.000000000 +0100 -@@ -21,6 +21,19 @@ - #define ASM_SOFTMMU - #include "exec.h" - -+#if defined(__APPLE__) -+/* XXX avoid indirect symbols, correct address patched at code generation time. */ -+static const uint8_t parity_table[256]; -+static const uint8_t rclw_table[32]; -+static const uint8_t rclb_table[32]; -+static const CPU86_LDouble f15rk[7]; -+#else -+extern const uint8_t parity_table[256]; -+extern const uint8_t rclw_table[32]; -+extern const uint8_t rclb_table[32]; -+extern const CPU86_LDouble f15rk[7]; -+#endif -+ - /* n must be a constant to be efficient */ - static inline target_long lshift(target_long x, int n) - { ---- qemu-0.8.0/Makefile.target.osx-intel-port 2006-02-13 01:25:58.000000000 +0100 -+++ qemu-0.8.0/Makefile.target 2006-02-13 01:25:58.000000000 +0100 -@@ -18,6 +18,9 @@ CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) - endif - BASE_CFLAGS= - BASE_LDFLAGS= -+ifeq ($(CONFIG_DARWIN),yes) -+CFLAGS+=-mdynamic-no-pic -+endif - #CFLAGS+=-Werror - LDFLAGS=-g - LIBS= ---- qemu-0.8.0/dyngen.c.osx-intel-port 2006-02-13 01:25:58.000000000 +0100 -+++ qemu-0.8.0/dyngen.c 2006-02-13 01:25:58.000000000 +0100 -@@ -183,6 +183,20 @@ typedef struct coff_rel { - #include - #include - -+#ifdef HOST_PPC -+ -+#define MACH_CPU_TYPE CPU_TYPE_POWERPC -+#define mach_check_cputype(x) ((x) == CPU_TYPE_POWERPC) -+ -+#elif defined(HOST_I386) -+ -+#define MACH_CPU_TYPE CPU_TYPE_I386 -+#define mach_check_cputype(x) ((x) == CPU_TYPE_I386) -+ -+#else -+#error unsupported CPU - please update the code -+#endif -+ - # define check_mach_header(x) (x.magic == MH_MAGIC) - typedef int32_t host_long; - typedef uint32_t host_ulong; -@@ -981,22 +995,23 @@ static const char * find_reloc_name_in_s - { - unsigned int tocindex, symindex, size; - const char *name = 0; -+ int section_type; - - /* Sanity check */ - if(!( address >= sec_hdr->addr && address < (sec_hdr->addr + sec_hdr->size) ) ) - return (char*)0; -- -- if( sec_hdr->flags & S_SYMBOL_STUBS ){ -+ -+ section_type = sec_hdr->flags & SECTION_TYPE; -+ if( section_type == S_SYMBOL_STUBS ){ - size = sec_hdr->reserved2; - if(size == 0) - error("size = 0"); -- - } -- else if( sec_hdr->flags & S_LAZY_SYMBOL_POINTERS || -- sec_hdr->flags & S_NON_LAZY_SYMBOL_POINTERS) -+ else if( section_type == S_LAZY_SYMBOL_POINTERS || -+ section_type == S_NON_LAZY_SYMBOL_POINTERS) - size = sizeof(unsigned long); - else -- return 0; -+ return NULL; - - /* Compute our index in toc */ - tocindex = (address - sec_hdr->addr)/size; -@@ -1030,8 +1045,27 @@ static const char * get_reloc_name(EXE_R - /* init the slide value */ - *sslide = 0; - -- if(R_SCATTERED & rel->r_address) -- return (char *)find_reloc_name_given_its_address(sca_rel->r_value); -+ if (R_SCATTERED & rel->r_address) { -+ char *name = (char *)find_reloc_name_given_its_address(sca_rel->r_value); -+ -+ /* search it in the full symbol list, if not found */ -+ if (!name) { -+ int i; -+ for (i = 0; i < nb_syms; i++) { -+ EXE_SYM *sym = &symtab[i]; -+ if (sym->st_value == sca_rel->r_value) { -+ name = get_sym_name(sym); -+ switch (sca_rel->r_type) { -+ case GENERIC_RELOC_VANILLA: -+ *sslide = *(uint32_t *)(text + sca_rel->r_address) - sca_rel->r_value; -+ break; -+ } -+ break; -+ } -+ } -+ } -+ return name; -+ } - - if(rel->r_extern) - { -@@ -1063,14 +1097,21 @@ static const char * get_reloc_name(EXE_R - sectoffset = ( *(uint32_t *)(text + rel->r_address) & 0x03fffffc ); - if (sectoffset & 0x02000000) sectoffset |= 0xfc000000; - break; -+ case GENERIC_RELOC_VANILLA: -+ sectoffset = *(uint32_t *)(text + rel->r_address); -+ break; - default: -- error("switch(rel->type) not found"); -+ error("switch(rel->type=%d) not found", rel->r_type); - } - -- if(rel->r_pcrel) -+ if(rel->r_pcrel) { - sectoffset += rel->r_address; -- -- if (rel->r_type == PPC_RELOC_BR24) -+#ifdef HOST_I386 -+ sectoffset += (1 << rel->r_length); -+#endif -+ } -+ -+ if (rel->r_type == PPC_RELOC_BR24 || rel->r_pcrel) - name = (char *)find_reloc_name_in_sec_ptr((int)sectoffset, §ion_hdr[sectnum-1]); - - /* search it in the full symbol list, if not found */ -@@ -1122,7 +1163,7 @@ int load_object(const char *filename) - error("bad Mach header"); - } - -- if (mach_hdr.cputype != CPU_TYPE_POWERPC) -+ if (!mach_check_cputype(mach_hdr.cputype)) - error("Unsupported CPU"); - - if (mach_hdr.filetype != MH_OBJECT) -@@ -2413,6 +2454,82 @@ void gen_code(const char *name, host_ulo - /* patch relocations */ - #if defined(HOST_I386) - { -+#ifdef CONFIG_FORMAT_MACH -+ struct scattered_relocation_info *scarel; -+ struct relocation_info * rel; -+ char final_sym_name[256]; -+ const char *sym_name; -+ const char *p; -+ int slide, sslide; -+ int i; -+ -+ for (i = 0, rel = relocs; i < nb_relocs; i++, rel++) { -+ unsigned int offset, length, value = 0; -+ unsigned int type, pcrel, isym = 0; -+ unsigned int usesym = 0; -+ -+ if (R_SCATTERED & rel->r_address) { -+ scarel = (struct scattered_relocation_info*)rel; -+ offset = (unsigned int)scarel->r_address; -+ length = scarel->r_length; -+ pcrel = scarel->r_pcrel; -+ type = scarel->r_type; -+ value = scarel->r_value; -+ } -+ else { -+ value = isym = rel->r_symbolnum; -+ usesym = (rel->r_extern); -+ offset = rel->r_address; -+ length = rel->r_length; -+ pcrel = rel->r_pcrel; -+ type = rel->r_type; -+ } -+ -+ slide = offset - start_offset; -+ -+ if (!(offset >= start_offset && offset < start_offset + size)) -+ continue; /* not in our range */ -+ -+ sym_name = get_reloc_name(rel, &sslide); -+ -+ if (usesym && symtab[isym].n_type & N_STAB) -+ continue; /* don't handle STAB (debug sym) */ -+ -+ if (sym_name && strstart(sym_name, "__op_jmp", &p)) { -+ int n; -+ n = strtol(p, NULL, 10); -+ fprintf(outfile, " jmp_offsets[%d] = %d + (gen_code_ptr - gen_code_buf);\n", n, slide); -+ continue; /* Nothing more to do */ -+ } -+ -+ if (!sym_name) { -+ fprintf(outfile, "/* #warning relocation not handled in %s (value 0x%x, %s, offset 0x%x, length 0x%x, %s, type 0x%x) */\n", -+ name, value, usesym ? "use sym" : "don't use sym", offset, length, pcrel ? "pcrel":"", type); -+ continue; /* dunno how to handle without final_sym_name */ -+ } -+ -+ get_reloc_expr(final_sym_name, sizeof(final_sym_name), -+ sym_name); -+ -+ if (length != 2) -+ error("unsupported %d-bit relocation", 8 * (1 << length)); -+ -+ switch (type) { -+ case GENERIC_RELOC_VANILLA: -+ if (pcrel || strstart(sym_name,"__op_gen_label",&p)) { -+ fprintf(outfile, " *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %d) - 4;\n", -+ slide, final_sym_name, slide); -+ } -+ else { -+ fprintf(outfile, " *(uint32_t *)(gen_code_ptr + %d) = (%s + %d);\n", -+ slide, final_sym_name, sslide); -+ } -+ break; -+ default: -+ error("unsupported i386 relocation (%d)", type); -+ } -+ } -+#else - char name[256]; - int type; - int addend; -@@ -2482,6 +2599,7 @@ void gen_code(const char *name, host_ulo - #endif - } - } -+#endif - /* Replace the marker instructions with the actual opcodes. */ - for (i = 0; exit_addrs[i] != -1; i++) { - int op; ---- qemu-0.8.0/dyngen-exec.h.osx-intel-port 2006-02-13 01:25:58.000000000 +0100 -+++ qemu-0.8.0/dyngen-exec.h 2006-02-13 01:25:58.000000000 +0100 -@@ -215,9 +215,16 @@ extern int __op_jmp0, __op_jmp1, __op_jm - #define EXIT_TB() asm volatile ("hlt") - /* Dyngen will replace cli with 0x9e (jmp). - We generate the offset manually. */ -+#if defined(__APPLE__) -+/* XXX Different relocations are generated for MacOS X for Intel -+ (please as from cctools). */ -+#define GOTO_LABEL_PARAM(n) \ -+ asm volatile ("cli;.long " ASM_NAME(__op_gen_label) #n) -+#else - #define GOTO_LABEL_PARAM(n) \ - asm volatile ("cli;.long " ASM_NAME(__op_gen_label) #n " - 1f;1:") - #endif -+#endif - #ifdef __x86_64__ - /* The same as i386. */ - #define EXIT_TB() asm volatile ("hlt") ---- qemu-0.8.0/exec-all.h.osx-intel-port 2006-02-13 01:25:58.000000000 +0100 -+++ qemu-0.8.0/exec-all.h 2006-02-13 01:25:58.000000000 +0100 -@@ -321,15 +321,29 @@ do {\ - - /* we patch the jump instruction directly. Use sti in place of the actual - jmp instruction so that dyngen can patch in the correct result. */ -+#if defined(__APPLE__) -+/* XXX Different relocations are generated for MacOS X for Intel -+ (please as from cctools). */ - #define GOTO_TB(opname, tbparam, n)\ - do {\ -- asm volatile (".section .data\n"\ -+ asm volatile (ASM_DATA_SECTION\ -+ ASM_OP_LABEL_NAME(n, opname) ":\n"\ -+ ".long 1f\n"\ -+ ASM_PREVIOUS_SECTION \ -+ "sti;.long " ASM_NAME(__op_jmp) #n "\n"\ -+ "1:\n");\ -+} while (0) -+#else -+#define GOTO_TB(opname, tbparam, n)\ -+do {\ -+ asm volatile (ASM_DATA_SECTION\ - ASM_OP_LABEL_NAME(n, opname) ":\n"\ - ".long 1f\n"\ - ASM_PREVIOUS_SECTION \ - "sti;.long " ASM_NAME(__op_jmp) #n " - 1f\n"\ - "1:\n");\ - } while (0) -+#endif - - #else - diff --git a/qemu/patches/qemu-0.9.0-qcow2.diff b/qemu/patches/qemu-0.9.0-qcow2.diff deleted file mode 100644 index 89a499c..0000000 --- a/qemu/patches/qemu-0.9.0-qcow2.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- block-qcow2.c 2006/08/07 02:38:06 1.4 -+++ block-qcow2.c 2007/04/02 12:48:47 1.6 -@@ -1886,6 +1886,8 @@ - int64_t table_offset; - uint64_t data64; - uint32_t data32; -+ int old_table_size; -+ int64_t old_table_offset; - - if (min_size <= s->refcount_table_size) - return 0; -@@ -1931,10 +1933,14 @@ - &data32, sizeof(data32)) != sizeof(data32)) - goto fail; - qemu_free(s->refcount_table); -+ old_table_offset = s->refcount_table_offset; -+ old_table_size = s->refcount_table_size; - s->refcount_table = new_table; - s->refcount_table_size = new_table_size; -+ s->refcount_table_offset = table_offset; - - update_refcount(bs, table_offset, new_table_size2, 1); -+ free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t)); - return 0; - fail: - free_clusters(bs, table_offset, new_table_size2); diff --git a/qemu/patches/qemu-0.9.0-sparc-clobber.patch b/qemu/patches/qemu-0.9.0-sparc-clobber.patch deleted file mode 100644 index dc6c792..0000000 --- a/qemu/patches/qemu-0.9.0-sparc-clobber.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- qemu-0.9.0/cpu-exec.c 2007-07-22 18:05:41.000000000 +0200 -+++ qemu/cpu-exec.c 2007-07-22 18:04:24.000000000 +0200 -@@ -645,6 +645,7 @@ - : /* no outputs */ - : "r" (gen_func) - : "i0", "i1", "i2", "i3", "i4", "i5", -+ "o0", "o1", "o2", "o3", "o4", "o5", - "l0", "l1", "l2", "l3", "l4", "l5", - "l6", "l7"); - #elif defined(__arm__) diff --git a/qemu/patches/qemu-0.9.0-sparc-compile-flags.patch b/qemu/patches/qemu-0.9.0-sparc-compile-flags.patch deleted file mode 100644 index 8d09aac..0000000 --- a/qemu/patches/qemu-0.9.0-sparc-compile-flags.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -ur qemu/Makefile.target qemu-ecd/Makefile.target ---- qemu/Makefile.target 2007-07-22 19:35:11.000000000 +0200 -+++ qemu-ecd/Makefile.target 2007-07-22 19:33:00.000000000 +0200 -@@ -122,14 +122,14 @@ - - ifeq ($(ARCH),sparc) - ifeq ($(CONFIG_SOLARIS),yes) --BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3 -+BASE_CFLAGS+=-mcpu=ultrasparc -m32 -U__sparc_v9__ - BASE_LDFLAGS+=-m32 --OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0 -+OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -Wa,-Av9a - else --BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 -+BASE_CFLAGS+=-mcpu=ultrasparc -m32 -U__sparc_v9__ - BASE_LDFLAGS+=-m32 --OP_CFLAGS+=-fno-delayed-branch -ffixed-i0 --HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat -+OP_CFLAGS+=-fno-delayed-branch -Wa,-Av9a -+HELPER_CFLAGS=$(CFLAGS) - # -static is used to avoid g1/g3 usage by the dynamic linker - BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static - endif diff --git a/qemu/patches/qemu-0.9.0-sparc-load-store-le.patch b/qemu/patches/qemu-0.9.0-sparc-load-store-le.patch deleted file mode 100644 index 7ec7453..0000000 --- a/qemu/patches/qemu-0.9.0-sparc-load-store-le.patch +++ /dev/null @@ -1,67 +0,0 @@ -diff -ur qemu/cpu-all.h qemu-0.9.0/cpu-all.h ---- qemu/cpu-all.h 2007-07-21 11:53:24.000000000 +0200 -+++ qemu-0.9.0/cpu-all.h 2007-07-04 09:48:06.000000000 +0200 -@@ -24,6 +24,12 @@ - #define WORDS_ALIGNED - #endif - -+#if defined(__sparc__) -+#ifndef ASI_PL -+#define ASI_PL 0x88 -+#endif -+#endif -+ - /* some important defines: - * - * WORDS_ALIGNED : if defined, the host cpu can only make word aligned -@@ -197,6 +203,10 @@ - int val; - __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (ptr)); - return val; -+#elif defined(__sparc__) -+ uint16_t val; -+ __asm__ __volatile__ ("lduha [%1] %2, %0" : "=r" (val) : "r" (ptr), "i" (ASI_PL)); -+ return val; - #else - uint8_t *p = ptr; - return p[0] | (p[1] << 8); -@@ -209,6 +219,10 @@ - int val; - __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (ptr)); - return (int16_t)val; -+#elif defined(__sparc__) -+ int16_t val; -+ __asm__ __volatile__ ("lduha [%1] %2, %0" : "=r" (val) : "r" (ptr), "i" (ASI_PL)); -+ return val; - #else - uint8_t *p = ptr; - return (int16_t)(p[0] | (p[1] << 8)); -@@ -221,6 +235,10 @@ - int val; - __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (ptr)); - return val; -+#elif defined(__sparc__) -+ uint32_t val; -+ __asm__ __volatile__ ("lduwa [%1] %2, %0" : "=r" (val) : "r" (ptr), "i" (ASI_PL)); -+ return val; - #else - uint8_t *p = ptr; - return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); -@@ -240,6 +258,8 @@ - { - #ifdef __powerpc__ - __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*(uint16_t *)ptr) : "r" (v), "r" (ptr)); -+#elif defined(__sparc__) -+ __asm__ __volatile__ ("stha %0, [%1] %2" : : "r" (v), "r" (ptr), "i" (ASI_PL)); - #else - uint8_t *p = ptr; - p[0] = v; -@@ -251,6 +271,8 @@ - { - #ifdef __powerpc__ - __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*(uint32_t *)ptr) : "r" (v), "r" (ptr)); -+#elif defined(__sparc__) -+ __asm__ __volatile__ ("stwa %0, [%1] %2" : : "r" (v), "r" (ptr), "i" (ASI_PL)); - #else - uint8_t *p = ptr; - p[0] = v; diff --git a/qemu/patches/qemu-0.9.0-sparc-register.patch b/qemu/patches/qemu-0.9.0-sparc-register.patch deleted file mode 100644 index 59a7e1f..0000000 --- a/qemu/patches/qemu-0.9.0-sparc-register.patch +++ /dev/null @@ -1,173 +0,0 @@ -diff -ur qemu/cpu-exec.c qemu-ecd/cpu-exec.c ---- qemu/cpu-exec.c 2007-07-22 19:35:11.000000000 +0200 -+++ qemu-ecd/cpu-exec.c 2007-07-22 19:26:22.000000000 +0200 -@@ -233,10 +233,6 @@ - uint32_t *saved_regwptr; - #endif - #endif --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- int saved_i7; -- target_ulong tmp_T0; --#endif - int ret, interrupt_request; - void (*gen_func)(void); - TranslationBlock *tb; -@@ -300,10 +296,6 @@ - #define SAVE_HOST_REGS 1 - #include "hostregs_helper.h" - env = env1; --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- /* we also save i7 because longjmp may not restore it */ -- asm volatile ("mov %%i7, %0" : "=r" (saved_i7)); --#endif - - #if defined(TARGET_I386) - env_to_regs(); -@@ -403,10 +395,6 @@ - - T0 = 0; /* force lookup of first TB */ - for(;;) { --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- /* g1 can be modified by some libc? functions */ -- tmp_T0 = T0; --#endif - interrupt_request = env->interrupt_request; - if (__builtin_expect(interrupt_request, 0)) { - #if defined(TARGET_I386) -@@ -414,11 +402,7 @@ - !(env->hflags & HF_SMM_MASK)) { - env->interrupt_request &= ~CPU_INTERRUPT_SMI; - do_smm_enter(); --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- tmp_T0 = 0; --#else - T0 = 0; --#endif - } else if ((interrupt_request & CPU_INTERRUPT_HARD) && - (env->eflags & IF_MASK) && - !(env->hflags & HF_INHIBIT_IRQ_MASK)) { -@@ -431,11 +415,7 @@ - do_interrupt(intno, 0, 0, 0, 1); - /* ensure that no TB jump will be modified as - the program flow was changed */ --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- tmp_T0 = 0; --#else - T0 = 0; --#endif - } - #elif defined(TARGET_PPC) - #if 0 -@@ -450,22 +430,14 @@ - env->error_code = 0; - do_interrupt(env); - env->interrupt_request &= ~CPU_INTERRUPT_HARD; --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- tmp_T0 = 0; --#else - T0 = 0; --#endif - } else if ((interrupt_request & CPU_INTERRUPT_TIMER)) { - /* Raise it */ - env->exception_index = EXCP_DECR; - env->error_code = 0; - do_interrupt(env); - env->interrupt_request &= ~CPU_INTERRUPT_TIMER; --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- tmp_T0 = 0; --#else - T0 = 0; --#endif - } - } - #elif defined(TARGET_MIPS) -@@ -479,11 +451,7 @@ - env->exception_index = EXCP_EXT_INTERRUPT; - env->error_code = 0; - do_interrupt(env); --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- tmp_T0 = 0; --#else - T0 = 0; --#endif - } - #elif defined(TARGET_SPARC) - if ((interrupt_request & CPU_INTERRUPT_HARD) && -@@ -497,11 +465,7 @@ - env->interrupt_request &= ~CPU_INTERRUPT_HARD; - do_interrupt(env->interrupt_index); - env->interrupt_index = 0; --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- tmp_T0 = 0; --#else - T0 = 0; --#endif - } - } else if (interrupt_request & CPU_INTERRUPT_TIMER) { - //do_interrupt(0, 0, 0, 0, 0); -@@ -532,11 +496,7 @@ - env->interrupt_request &= ~CPU_INTERRUPT_EXITTB; - /* ensure that no TB jump will be modified as - the program flow was changed */ --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- tmp_T0 = 0; --#else - T0 = 0; --#endif - } - if (interrupt_request & CPU_INTERRUPT_EXIT) { - env->interrupt_request &= ~CPU_INTERRUPT_EXIT; -@@ -606,9 +566,6 @@ - lookup_symbol(tb->pc)); - } - #endif --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- T0 = tmp_T0; --#endif - /* see if we can patch the calling TB. When the TB - spans two pages, we cannot safely do a direct - jump. */ -@@ -800,9 +757,6 @@ - #endif - - /* restore global registers */ --#if defined(__sparc__) && !defined(HOST_SOLARIS) -- asm volatile ("mov %0, %%i7" : : "r" (saved_i7)); --#endif - #include "hostregs_helper.h" - - /* fail safe : never use cpu_single_env outside cpu_exec() */ -diff -ur qemu/dyngen-exec.h qemu-ecd/dyngen-exec.h ---- qemu/dyngen-exec.h 2007-07-22 19:35:11.000000000 +0200 -+++ qemu-ecd/dyngen-exec.h 2007-07-22 19:26:22.000000000 +0200 -@@ -142,19 +142,6 @@ - #define AREG1 "g4" - #define AREG2 "g5" - #define AREG3 "g7" --#else --#define AREG0 "g6" --#define AREG1 "g1" --#define AREG2 "g2" --#define AREG3 "g3" --#define AREG4 "l0" --#define AREG5 "l1" --#define AREG6 "l2" --#define AREG7 "l3" --#define AREG8 "l4" --#define AREG9 "l5" --#define AREG10 "l6" --#define AREG11 "l7" - #endif - #endif - #define USE_FP_CONVERT -diff -ur qemu/target-arm/exec.h qemu-ecd/target-arm/exec.h ---- qemu/target-arm/exec.h 2007-02-06 00:01:54.000000000 +0100 -+++ qemu-ecd/target-arm/exec.h 2007-07-22 19:30:15.000000000 +0200 -@@ -17,6 +17,7 @@ - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -+#include "config.h" - #include "dyngen-exec.h" - - #if defined(__sparc__) diff --git a/qemu/patches/qemu-0.9.0-x49gp-arm-dump-state.patch b/qemu/patches/qemu-0.9.0-x49gp-arm-dump-state.patch deleted file mode 100644 index 11febb0..0000000 --- a/qemu/patches/qemu-0.9.0-x49gp-arm-dump-state.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff -ur qemu/target-arm/translate.c qemu-0.9.0/target-arm/translate.c ---- qemu/target-arm/translate.c 2007-02-06 00:01:54.000000000 +0100 -+++ qemu-0.9.0/target-arm/translate.c 2007-07-10 09:15:56.000000000 +0200 -@@ -2536,7 +2536,9 @@ - int (*cpu_fprintf)(FILE *f, const char *fmt, ...), - int flags) - { -+ uint32_t psr; - int i; -+#ifndef X49GP - union { - uint32_t i; - float s; -@@ -2548,7 +2550,7 @@ - float64 f64; - double d; - } d0; -- uint32_t psr; -+#endif - - for(i=0;i<16;i++) { - cpu_fprintf(f, "R%02d=%08x", i, env->regs[i]); -@@ -2567,6 +2567,7 @@ - psr & CPSR_T ? 'T' : 'A', - cpu_mode_names[psr & 0xf], (psr & 0x10) ? 32 : 26); - -+#ifndef X49GP - for (i = 0; i < 16; i++) { - d.d = env->vfp.regs[i]; - s0.i = d.l.lower; -@@ -2579,5 +2580,6 @@ - d0.d); - } - cpu_fprintf(f, "FPSCR: %08x\n", (int)env->vfp.xregs[ARM_VFP_FPSCR]); -+#endif - } - diff --git a/qemu/patches/qemu-0.9.0-x49gp-arm-mmu.patch b/qemu/patches/qemu-0.9.0-x49gp-arm-mmu.patch deleted file mode 100644 index 0a54ae1..0000000 --- a/qemu/patches/qemu-0.9.0-x49gp-arm-mmu.patch +++ /dev/null @@ -1,192 +0,0 @@ -diff -ur qemu-0.9.0/target-arm/helper.c qemu/target-arm/helper.c ---- qemu-0.9.0/target-arm/helper.c 2007-07-30 16:48:18.000000000 +0200 -+++ qemu/target-arm/helper.c 2007-07-30 16:46:50.000000000 +0200 -@@ -278,87 +280,101 @@ - static int get_phys_addr(CPUState *env, uint32_t address, int access_type, - int is_user, uint32_t *phys_ptr, int *prot) - { -- int code; -- uint32_t table; -- uint32_t desc; -- int type; -- int ap; -- int domain; -- uint32_t phys_addr; -+ int code; -+ uint32_t pgdp, ptep; -+ uint32_t pgd, pte = 0; -+ uint32_t index; -+ int ap = 0; -+ int domain = 0; -+ uint32_t phys_addr = 0; -+ -+ /* Fast Context Switch Extension. */ -+ if (address < 0x02000000) -+ address += env->cp15.c13_fcse; -+ -+ if ((env->cp15.c1_sys & 1) == 0) { -+ /* MMU disabled. */ -+ *phys_ptr = address; -+ *prot = PAGE_READ | PAGE_WRITE; -+ return 0; -+ } -+ -+ /* Pagetable walk. */ -+ -+ /* Lookup l1 descriptor. */ -+ pgdp = (env->cp15.c2 & 0xffffc000) | ((address >> 18) & 0x3ffc); -+ -+ pgd = ldl_phys(pgdp); -+ -+ switch (pgd & 3) { -+ case 0: /* Section translation fault. */ -+ code = 5; -+ goto do_fault; -+ -+ case 1: /* Coarse page table. */ -+ index = (address >> 10) & 0x3fc; -+ ptep = (pgd & 0xfffffc00) | index; -+ -+ pte = ldl_phys(ptep); -+ break; -+ -+ case 2: /* Section. */ -+ phys_addr = (pgd & 0xfff00000) | (address & 0x000fffff); -+ -+ domain = (pgd >> 5) & 0x0f; -+ ap = (pgd >> 10) & 0x03; -+ code = 13; -+ -+ goto do_check; -+ -+ case 3: /* Fine page table. */ -+ index = (address >> 8) & 0xffc; -+ ptep = (pgd & 0xfffff000) | index; -+ -+ pte = ldl_phys(ptep); -+ break; -+ } -+ -+ code = 15; -+ switch (pte & 3) { -+ case 0: /* Page translation fault. */ -+ code = 7; -+ goto do_fault; -+ -+ case 1: /* Large page. */ -+ phys_addr = (pte & 0xffff0000) | (address & 0x0000ffff); -+ -+ domain = (pgd >> 5) & 0x0f; -+ ap = (pte >> (4 + ((address >> 13) & 6))) & 3; -+ break; -+ -+ case 2: /* Small page. */ -+ phys_addr = (pte & 0xfffff000) | (address & 0x00000fff); -+ -+ domain = (pgd >> 5) & 0x0f; -+ ap = (pte >> (4 + ((address >> 13) & 6))) & 3; -+ break; -+ -+ case 3: /* Tiny page. */ -+ phys_addr = (pte & 0xfffffc00) | (address & 0x000003ff); -+ -+ domain = (pgd >> 5) & 0x0f; -+ ap = (pte >> 4) & 3; -+ break; -+ } -+ -+do_check: -+ *prot = check_ap(env, ap, domain, access_type, is_user); -+ if (!*prot) { -+ /* Access permission fault. */ -+ goto do_fault; -+ } - -- /* Fast Context Switch Extension. */ -- if (address < 0x02000000) -- address += env->cp15.c13_fcse; -- -- if ((env->cp15.c1_sys & 1) == 0) { -- /* MMU diusabled. */ -- *phys_ptr = address; -- *prot = PAGE_READ | PAGE_WRITE; -- } else { -- /* Pagetable walk. */ -- /* Lookup l1 descriptor. */ -- table = (env->cp15.c2 & 0xffffc000) | ((address >> 18) & 0x3ffc); -- desc = ldl_phys(table); -- type = (desc & 3); -- domain = (env->cp15.c3 >> ((desc >> 4) & 0x1e)) & 3; -- if (type == 0) { -- /* Secton translation fault. */ -- code = 5; -- goto do_fault; -- } -- if (domain == 0 || domain == 2) { -- if (type == 2) -- code = 9; /* Section domain fault. */ -- else -- code = 11; /* Page domain fault. */ -- goto do_fault; -- } -- if (type == 2) { -- /* 1Mb section. */ -- phys_addr = (desc & 0xfff00000) | (address & 0x000fffff); -- ap = (desc >> 10) & 3; -- code = 13; -- } else { -- /* Lookup l2 entry. */ -- table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc); -- desc = ldl_phys(table); -- switch (desc & 3) { -- case 0: /* Page translation fault. */ -- code = 7; -- goto do_fault; -- case 1: /* 64k page. */ -- phys_addr = (desc & 0xffff0000) | (address & 0xffff); -- ap = (desc >> (4 + ((address >> 13) & 6))) & 3; -- break; -- case 2: /* 4k page. */ -- phys_addr = (desc & 0xfffff000) | (address & 0xfff); -- ap = (desc >> (4 + ((address >> 13) & 6))) & 3; -- break; -- case 3: /* 1k page. */ -- if (type == 1) { -- /* Page translation fault. */ -- code = 7; -- goto do_fault; -- } -- phys_addr = (desc & 0xfffffc00) | (address & 0x3ff); -- ap = (desc >> 4) & 3; -- break; -- default: -- /* Never happens, but compiler isn't smart enough to tell. */ -- abort(); -- } -- code = 15; -- } -- *prot = check_ap(env, ap, domain, access_type, is_user); -- if (!*prot) { -- /* Access permission fault. */ -- goto do_fault; -- } - *phys_ptr = phys_addr; -- } -- return 0; -+ return 0; -+ - do_fault: -- return code | (domain << 4); -+ return code | (domain << 4); - } - - int cpu_arm_handle_mmu_fault (CPUState *env, target_ulong address, -@@ -532,7 +548,7 @@ - return; - bad_reg: - /* ??? For debugging only. Should raise illegal instruction exception. */ -- cpu_abort(env, "Unimplemented cp15 register read\n"); -+ cpu_abort(env, "Unimplemented cp15 register write\n"); - } - - uint32_t helper_get_cp15(CPUState *env, uint32_t insn) diff --git a/qemu/patches/qemu-0.9.0-x49gp-arm-semihosting.patch b/qemu/patches/qemu-0.9.0-x49gp-arm-semihosting.patch deleted file mode 100644 index f343239..0000000 --- a/qemu/patches/qemu-0.9.0-x49gp-arm-semihosting.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -ur qemu/arm-semi.c qemu-0.9.0/arm-semi.c ---- qemu/arm-semi.c 2007-02-06 00:01:54.000000000 +0100 -+++ qemu-0.9.0/arm-semi.c 2007-07-03 21:52:52.000000000 +0200 -@@ -196,7 +196,7 @@ - - #define ARG(n) tget32(args + (n) * 4) - #define SET_ARG(n, val) tput32(args + (n) * 4,val) --uint32_t do_arm_semihosting(CPUState *env) -+int do_arm_semihosting(CPUState *env, uint32_t mask) - { - target_ulong args; - char * s; -diff -ur qemu/linux-user/arm/syscall.h qemu-0.9.0/linux-user/arm/syscall.h ---- qemu/linux-user/arm/syscall.h 2007-02-06 00:01:54.000000000 +0100 -+++ qemu-0.9.0/linux-user/arm/syscall.h 2007-07-03 21:54:32.000000000 +0200 -@@ -39,4 +39,4 @@ - #define UNAME_MACHINE "armv5tel" - #endif - --uint32_t do_arm_semihosting(CPUState *); -+int do_arm_semihosting(CPUState *, uint32_t); -diff -ur qemu/target-arm/helper.c qemu-0.9.0/target-arm/helper.c ---- qemu/target-arm/helper.c 2007-02-06 00:01:54.000000000 +0100 -+++ qemu-0.9.0/target-arm/helper.c 2007-07-21 11:44:15.000000000 +0200 -@@ -5,6 +5,8 @@ - #include "cpu.h" - #include "exec-all.h" - -+extern int do_arm_semihosting(CPUARMState *env, uint32_t mask); -+ - void cpu_reset(CPUARMState *env) - { - #if defined (CONFIG_USER_ONLY) -@@ -184,14 +184,8 @@ - } else { - mask = ldl_code(env->regs[15] - 4) & 0xffffff; - } -- /* Only intercept calls from privileged modes, to provide some -- semblance of security. */ -- if (((mask == 0x123456 && !env->thumb) -- || (mask == 0xab && env->thumb)) -- && (env->uncached_cpsr & CPSR_M) != ARM_CPU_MODE_USR) { -- env->regs[0] = do_arm_semihosting(env); -- return; -- } -+ if (do_arm_semihosting(env, mask)) -+ return; - } - new_mode = ARM_CPU_MODE_SVC; - addr = 0x08; diff --git a/qemu/patches/qemu-0.9.0-x49gp-block.patch b/qemu/patches/qemu-0.9.0-x49gp-block.patch deleted file mode 100644 index 9f579b6..0000000 --- a/qemu/patches/qemu-0.9.0-x49gp-block.patch +++ /dev/null @@ -1,1302 +0,0 @@ -diff -ur qemu-0.9.0/block-qcow.c qemu/block-qcow.c ---- qemu-0.9.0/block-qcow.c 2007-02-06 00:01:54.000000000 +0100 -+++ qemu/block-qcow.c 2007-07-30 14:30:18.000000000 +0200 -@@ -69,10 +69,12 @@ - uint8_t *cluster_cache; - uint8_t *cluster_data; - uint64_t cluster_cache_offset; -+#ifndef X49GP - uint32_t crypt_method; /* current crypt method, 0 if no key yet */ - uint32_t crypt_method_header; - AES_KEY aes_encrypt_key; - AES_KEY aes_decrypt_key; -+#endif - } BDRVQcowState; - - static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset); -@@ -115,9 +117,11 @@ - goto fail; - if (header.crypt_method > QCOW_CRYPT_AES) - goto fail; -+#ifndef X49GP - s->crypt_method_header = header.crypt_method; - if (s->crypt_method_header) - bs->encrypted = 1; -+#endif - s->cluster_bits = header.cluster_bits; - s->cluster_size = 1 << s->cluster_bits; - s->cluster_sectors = 1 << (s->cluster_bits - 9); -@@ -172,6 +176,8 @@ - return -1; - } - -+#ifndef X49GP -+ - static int qcow_set_key(BlockDriverState *bs, const char *key) - { - BDRVQcowState *s = bs->opaque; -@@ -239,6 +245,8 @@ - } - } - -+#endif /* !(X49GP) */ -+ - /* 'allocate' is: - * - * 0 to not allocate. -@@ -344,6 +352,7 @@ - cluster_offset = (cluster_offset + s->cluster_size - 1) & - ~(s->cluster_size - 1); - bdrv_truncate(s->hd, cluster_offset + s->cluster_size); -+#ifndef X49GP - /* if encrypted, we must initialize the cluster - content which won't be written */ - if (s->crypt_method && -@@ -363,6 +372,7 @@ - } - } - } -+#endif /* !(X49GP) */ - } else { - cluster_offset |= QCOW_OFLAG_COMPRESSED | - (uint64_t)compressed_size << (63 - s->cluster_bits); -@@ -442,7 +452,7 @@ - return 0; - } - --#if 0 -+#ifdef X49GP - - static int qcow_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) -@@ -474,10 +484,12 @@ - ret = bdrv_pread(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512); - if (ret != n * 512) - return -1; -+#ifndef X49GP - if (s->crypt_method) { - encrypt_sectors(s, sector_num, buf, buf, n, 0, - &s->aes_decrypt_key); - } -+#endif /* !(X49GP) */ - } - nb_sectors -= n; - sector_num += n; -@@ -485,7 +497,8 @@ - } - return 0; - } --#endif -+ -+#endif /* X49GP */ - - static int qcow_write(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors) -@@ -504,12 +517,15 @@ - index_in_cluster + n); - if (!cluster_offset) - return -1; -+#ifndef X49GP - if (s->crypt_method) { - encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1, - &s->aes_encrypt_key); - ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, - s->cluster_data, n * 512); -- } else { -+ } else -+#endif /* !(X49GP) */ -+ { - ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512); - } - if (ret != n * 512) -@@ -522,6 +538,8 @@ - return 0; - } - -+#ifndef X49GP -+ - typedef struct QCowAIOCB { - BlockDriverAIOCB common; - int64_t sector_num; -@@ -554,12 +572,14 @@ - /* nothing to do */ - } else if (acb->cluster_offset & QCOW_OFLAG_COMPRESSED) { - /* nothing to do */ -+#ifndef X49GP - } else { - if (s->crypt_method) { - encrypt_sectors(s, acb->sector_num, acb->buf, acb->buf, - acb->n, 0, - &s->aes_decrypt_key); - } -+#endif - } - - acb->nb_sectors -= acb->n; -@@ -673,6 +693,7 @@ - ret = -EIO; - goto fail; - } -+#ifndef X49GP - if (s->crypt_method) { - if (!acb->cluster_data) { - acb->cluster_data = qemu_mallocz(s->cluster_size); -@@ -684,7 +705,9 @@ - encrypt_sectors(s, acb->sector_num, acb->cluster_data, acb->buf, - acb->n, 1, &s->aes_encrypt_key); - src_buf = acb->cluster_data; -- } else { -+ } else -+#endif /* !(X49GP) */ -+ { - src_buf = acb->buf; - } - acb->hd_aiocb = bdrv_aio_write(s->hd, -@@ -725,6 +748,8 @@ - qemu_aio_release(acb); - } - -+#endif /* !(X49GP) */ -+ - static void qcow_close(BlockDriverState *bs) - { - BDRVQcowState *s = bs->opaque; -@@ -887,19 +912,30 @@ - sizeof(BDRVQcowState), - qcow_probe, - qcow_open, -+#ifdef X49GP -+ qcow_read, -+ qcow_write, -+#else - NULL, - NULL, -+#endif - qcow_close, - qcow_create, - qcow_flush, - qcow_is_allocated, -+#ifndef X49GP - qcow_set_key, -+#else -+ NULL, -+#endif - qcow_make_empty, - -+#ifndef X49GP - .bdrv_aio_read = qcow_aio_read, - .bdrv_aio_write = qcow_aio_write, - .bdrv_aio_cancel = qcow_aio_cancel, - .aiocb_size = sizeof(QCowAIOCB), -+#endif - .bdrv_write_compressed = qcow_write_compressed, - .bdrv_get_info = qcow_get_info, - }; -diff -ur qemu-0.9.0/block-raw.c qemu/block-raw.c ---- qemu-0.9.0/block-raw.c 2007-02-06 00:01:54.000000000 +0100 -+++ qemu/block-raw.c 2007-07-30 14:30:18.000000000 +0200 -@@ -27,6 +27,10 @@ - #ifndef _WIN32 - #include - -+#ifdef X49GP -+#define QEMU_TOOL -+#endif -+ - #ifndef QEMU_TOOL - #include "exec-all.h" - #endif -@@ -157,6 +161,7 @@ - return ret; - } - -+#ifndef X49GP - /***********************************************************/ - /* Unix AIO using POSIX AIO */ - -@@ -379,6 +384,7 @@ - pacb = &acb->next; - } - } -+#endif /* !(X49GP) */ - - static void raw_close(BlockDriverState *bs) - { -@@ -479,11 +485,12 @@ - raw_close, - raw_create, - raw_flush, -- -+#ifndef X49GP - .bdrv_aio_read = raw_aio_read, - .bdrv_aio_write = raw_aio_write, - .bdrv_aio_cancel = raw_aio_cancel, - .aiocb_size = sizeof(RawAIOCB), -+#endif - .protocol_name = "file", - .bdrv_pread = raw_pread, - .bdrv_pwrite = raw_pwrite, -@@ -815,11 +822,12 @@ - raw_close, - NULL, - raw_flush, -- -+#ifndef X49GP - .bdrv_aio_read = raw_aio_read, - .bdrv_aio_write = raw_aio_write, - .bdrv_aio_cancel = raw_aio_cancel, - .aiocb_size = sizeof(RawAIOCB), -+#endif - .bdrv_pread = raw_pread, - .bdrv_pwrite = raw_pwrite, - .bdrv_getlength = raw_getlength, -diff -ur qemu-0.9.0/block-vvfat.c qemu/block-vvfat.c ---- qemu-0.9.0/block-vvfat.c 2007-02-06 00:01:54.000000000 +0100 -+++ qemu/block-vvfat.c 2007-07-30 16:04:03.000000000 +0200 -@@ -41,9 +41,9 @@ - Note that DOS assumes the system files to be the first files in the - file system (test if the boot sector still relies on that fact)! */ - /* MAYBE TODO: write block-visofs.c */ --/* TODO: call try_commit() only after a timeout */ - --/* #define DEBUG */ -+#define DEBUG -+#undef DEBUG_SECTORS - - #ifdef DEBUG - -@@ -53,7 +53,7 @@ - #define stderr STDERR - FILE* stderr = NULL; - --static void checkpoint(); -+static void checkpoint(const char *where); - - #ifdef __MINGW32__ - void nonono(const char* file, int line, const char* msg) { -@@ -70,9 +70,15 @@ - - #endif - -+#ifdef X49GP -+#define VOLUME_LABEL "X49GP-VVFAT" -+#else -+#define VOLUME_LABEL "QEMU-VVFAT" -+#endif -+ - /* dynamic array functions */ - typedef struct array_t { -- char* pointer; -+ unsigned char* pointer; - unsigned int size,next,item_size; - } array_t; - -@@ -144,9 +150,9 @@ - * index_to, but the order of all other elements is preserved. */ - static inline int array_roll(array_t* array,int index_to,int index_from,int count) - { -- char* buf; -- char* from; -- char* to; -+ unsigned char* buf; -+ unsigned char* from; -+ unsigned char* to; - int is; - - if(!array || -@@ -194,7 +200,7 @@ - /* return the index for a given member */ - int array_index(array_t* array, void* pointer) - { -- size_t offset = (char*)pointer - array->pointer; -+ size_t offset = (unsigned char*)pointer - array->pointer; - assert(offset >= 0); - assert((offset % array->item_size) == 0); - assert(offset/array->item_size < array->next); -@@ -204,6 +210,18 @@ - /* These structures are used to fake a disk and the VFAT filesystem. - * For this reason we need to use __attribute__((packed)). */ - -+#define BOOTCODE_SIZE 448 -+#define BOOTCODE_FAT32_SIZE 420 -+ -+typedef struct msdos_volume_info { -+ uint8_t drive_number; -+ uint8_t ignored; -+ uint8_t signature; -+ uint32_t id; -+ uint8_t volume_label[11]; -+ uint8_t fs_type[8]; -+} __attribute__((packed)) msdos_volume_info_t; -+ - typedef struct bootsector_t { - uint8_t jump[3]; - uint8_t name[8]; -@@ -221,11 +239,8 @@ - uint32_t total_sectors; - union { - struct { -- uint8_t drive_number; -- uint8_t current_head; -- uint8_t signature; -- uint32_t id; -- uint8_t volume_label[11]; -+ msdos_volume_info_t vi; -+ uint8_t boot_code[BOOTCODE_SIZE]; - } __attribute__((packed)) fat16; - struct { - uint32_t sectors_per_fat; -@@ -234,14 +249,43 @@ - uint32_t first_cluster_of_root_directory; - uint16_t info_sector; - uint16_t backup_boot_sector; -- uint16_t ignored; -+ uint16_t ignored[6]; -+ msdos_volume_info_t vi; -+ uint8_t boot_code[BOOTCODE_FAT32_SIZE]; - } __attribute__((packed)) fat32; - } u; -- uint8_t fat_type[8]; -- uint8_t ignored[0x1c0]; - uint8_t magic[2]; - } __attribute__((packed)) bootsector_t; - -+uint8_t dummy_boot_jump[3] = { 0xeb, 0x3c, 0x90 }; -+ -+uint8_t dummy_boot_code[BOOTCODE_SIZE] = -+ "\x0e" /* push cs */ -+ "\x1f" /* pop ds */ -+ "\xbe\x5b\x7c" /* mov si, */ -+/* write_msg: */ -+ "\xac" /* lodsb */ -+ "\x22\xc0" /* and al, al */ -+ "\x74\x0b" /* jz key_press */ -+ "\x56" /* push si */ -+ "\xb4\x0e" /* mov ah, 0eh */ -+ "\xbb\x07\x00" /* mov bx, 0007h */ -+ "\xcd\x10" /* int 10h */ -+ "\x5e" /* pop si */ -+ "\xeb\xf0" /* jmp write_msg */ -+/* key_press: */ -+ "\x32\xe4" /* xor ah, ah */ -+ "\xcd\x16" /* int 16h */ -+ "\xcd\x19" /* int 19h */ -+/* foo: */ -+ "\xeb\xfe" /* jmp foo */ -+/* message_text: */ -+ "This is not a bootable disk. Please insert a bootable floppy and\r\n" -+ "press any key to try again...\r\n"; -+ -+#define MSG_OFFSET_OFFSET 3 -+#define MESSAGE_OFFSET 29 /* Offset of message in above code */ -+ - typedef struct partition_t { - uint8_t attributes; /* 0x80 = bootable */ - uint8_t start_head; -@@ -340,7 +384,6 @@ - unsigned int current_cluster; - - /* write support */ -- BlockDriverState* write_target; - char* qcow_filename; - BlockDriverState* qcow; - void* fat2; -@@ -348,6 +391,7 @@ - array_t commits; - const char* path; - int downcase_short_names; -+ QEMUTimer *write_timer; - } BDRVVVFATState; - - -@@ -377,7 +421,7 @@ - /* direntry functions */ - - /* dest is assumed to hold 258 bytes, and pads with 0xffff up to next multiple of 26 */ --static inline int short2long_name(unsigned char* dest,const char* src) -+static inline int short2long_name(char* dest,const char* src) - { - int i; - for(i=0;i<129 && src[i];i++) { -@@ -423,7 +467,7 @@ - - static char is_volume_label(const direntry_t* direntry) - { -- return direntry->attributes == 0x28; -+ return (direntry->attributes & 0x1f) == 0x08; - } - - static char is_long_name(const direntry_t* direntry) -@@ -501,13 +545,16 @@ - { - if(s->fat_type==32) { - uint32_t* entry=array_get(&(s->fat),cluster); -+ DLOG(fprintf(stderr, "%s:%u: cluster %u: %08x\n", __FUNCTION__, __LINE__, cluster, value)); - *entry=cpu_to_le32(value); - } else if(s->fat_type==16) { - uint16_t* entry=array_get(&(s->fat),cluster); -+ DLOG(fprintf(stderr, "%s:%u: cluster %u: %04x\n", __FUNCTION__, __LINE__, cluster, value & 0xffff)); - *entry=cpu_to_le16(value&0xffff); - } else { - int offset = (cluster*3/2); - unsigned char* p = array_get(&(s->fat), offset); -+ DLOG(fprintf(stderr, "%s:%u: cluster %u: %03x\n", __FUNCTION__, __LINE__, cluster, value & 0xfff)); - switch (cluster&1) { - case 0: - p[0] = value&0xff; -@@ -561,7 +608,6 @@ - case 32: s->max_fat_value=0x0fffffff; break; - default: s->max_fat_value=0; /* error... */ - } -- - } - - /* TODO: in create_short_filename, 0xe5->0x05 is not yet handled! */ -@@ -575,7 +621,7 @@ - - if(is_dot) { - entry=array_get_next(&(s->directory)); -- memset(entry->name,0x20,11); -+ memset(entry->name,' ',11); - memcpy(entry->name,filename,strlen(filename)); - return entry; - } -@@ -590,8 +636,8 @@ - i = 8; - - entry=array_get_next(&(s->directory)); -- memset(entry->name,0x20,11); -- strncpy(entry->name,filename,i); -+ memset(entry->name,' ',11); -+ strncpy((char *) entry->name,filename,i); - - if(j > 0) - for (i = 0; i < 3 && filename[j+1+i]; i++) -@@ -700,6 +746,8 @@ - continue; - } - -+ DLOG(fprintf(stderr, "%s:%u: create direntry for '%s'\n", __FUNCTION__, __LINE__, entry->d_name)); -+ - /* create directory entry for this file */ - direntry=create_short_and_long_name(s, i, entry->d_name, - is_dot || is_dotdot); -@@ -726,6 +774,8 @@ - - /* create mapping for this file */ - if(!is_dot && !is_dotdot && (S_ISDIR(st.st_mode) || st.st_size)) { -+ DLOG(fprintf(stderr, "%s:%u: create mapping for '%s'\n", __FUNCTION__, __LINE__, entry->d_name)); -+ - s->current_mapping=(mapping_t*)array_get_next(&(s->mapping)); - s->current_mapping->begin=0; - s->current_mapping->end=st.st_size; -@@ -778,9 +828,9 @@ - return 0; - } - --static inline uint32_t sector2cluster(BDRVVVFATState* s,off_t sector_num) -+static inline int32_t sector2cluster(BDRVVVFATState* s, off_t sector_num) - { -- return (sector_num-s->faked_sectors)/s->sectors_per_cluster; -+ return (sector_num - s->faked_sectors) / s->sectors_per_cluster; - } - - static inline off_t cluster2sector(BDRVVVFATState* s, uint32_t cluster_num) -@@ -805,15 +855,19 @@ - static int init_directories(BDRVVVFATState* s, - const char* dirname) - { -+ msdos_volume_info_t *vi; - bootsector_t* bootsector; - mapping_t* mapping; - unsigned int i; - unsigned int cluster; -+ direntry_t *entry; -+ struct stat st; -+ size_t namelen; - - memset(&(s->first_sectors[0]),0,0x40*0x200); - -- s->cluster_size=s->sectors_per_cluster*0x200; -- s->cluster_buffer=malloc(s->cluster_size); -+ s->cluster_size = s->sectors_per_cluster * 0x200; -+ s->cluster_buffer = malloc(s->cluster_size); - assert(s->cluster_buffer); - - /* -@@ -823,18 +877,32 @@ - * spc is sectors_per_clusters, and - * fat_type = 12, 16 or 32. - */ -- i = 1+s->sectors_per_cluster*0x200*8/s->fat_type; -- s->sectors_per_fat=(s->sector_count+i)/i; /* round up */ -+ i = 1 + s->sectors_per_cluster * 0x200 * 8 / s->fat_type; -+ s->sectors_per_fat = (s->sector_count + i) / i; /* round up */ - - array_init(&(s->mapping),sizeof(mapping_t)); - array_init(&(s->directory),sizeof(direntry_t)); - -+ DLOG(fprintf(stderr, "%s:%u: create direntry for '%s'\n", __FUNCTION__, __LINE__, dirname)); -+ - /* add volume label */ -- { -- direntry_t* entry=array_get_next(&(s->directory)); -- entry->attributes=0x28; /* archive | volume label */ -- snprintf(entry->name,11,"QEMU VVFAT"); -- } -+ stat(dirname, &st); -+ entry = array_get_next(&(s->directory)); -+ entry->attributes = 0x08; /* archive | volume label */ -+ memset(entry->name, ' ', 11); -+ namelen = strlen(VOLUME_LABEL); -+ if (namelen > 11) -+ namelen = 11; -+ memcpy(entry->name, VOLUME_LABEL, namelen); -+ entry->reserved[0] = entry->reserved[1] = 0; -+ entry->ctime = fat_datetime(st.st_ctime, 1); -+ entry->cdate = fat_datetime(st.st_ctime, 0); -+ entry->adate = fat_datetime(st.st_atime, 0); -+ entry->begin_hi = 0; -+ entry->mtime = fat_datetime(st.st_ctime, 1); -+ entry->mdate = fat_datetime(st.st_ctime, 0); -+ entry->begin = 0; -+ entry->size = 0; - - /* Now build FAT, and write back information into directory */ - init_fat(s); -@@ -842,6 +910,8 @@ - s->faked_sectors=s->first_sectors_number+s->sectors_per_fat*2; - s->cluster_count=sector2cluster(s, s->sector_count); - -+ DLOG(fprintf(stderr, "%s:%u: create mapping for '%s'\n", __FUNCTION__, __LINE__, dirname)); -+ - mapping = array_get_next(&(s->mapping)); - mapping->begin = 0; - mapping->dir_index = 0; -@@ -910,16 +980,39 @@ - s->last_cluster_of_root_directory = mapping->end; - - /* the FAT signature */ -- fat_set(s,0,s->max_fat_value); -+ switch (s->fat_type) { -+ case 12: fat_set(s, 0, s->sector_count == 5760 ? 0xff9 : 0xff8); break; -+ case 16: fat_set(s, 0, 0xfff8); break; -+ case 32: fat_set(s, 0, 0x0ffffff0); break; -+ default: fat_set(s,0,s->max_fat_value); break; -+ } - fat_set(s,1,s->max_fat_value); - - s->current_mapping = NULL; - - bootsector=(bootsector_t*)(s->first_sectors+(s->first_sectors_number-1)*0x200); -- bootsector->jump[0]=0xeb; -- bootsector->jump[1]=0x3e; -- bootsector->jump[2]=0x90; -+ -+ memcpy(bootsector->jump, dummy_boot_jump, 3); -+ bootsector->jump[1] = ((s->fat_type == 32 ? -+ (char *) &bootsector->u.fat32.boot_code : -+ (char *) &bootsector->u.fat16.boot_code) - -+ (char *) &bootsector) - 2; -+ if (s->fat_type == 32) { -+ int offset = (char *) &bootsector->u.fat32.boot_code - -+ (char *) &bootsector + MESSAGE_OFFSET + 0x7c00; -+ memcpy(bootsector->u.fat32.boot_code, dummy_boot_code, -+ BOOTCODE_FAT32_SIZE); -+ bootsector->u.fat32.boot_code[MSG_OFFSET_OFFSET + 0] = offset & 0xff; -+ bootsector->u.fat32.boot_code[MSG_OFFSET_OFFSET + 1] = offset >> 8; -+ } else { -+ memcpy(bootsector->u.fat16.boot_code, dummy_boot_code, BOOTCODE_SIZE); -+ } -+ -+#ifdef X49GP -+ memcpy(bootsector->name,"X49GP ",8); -+#else - memcpy(bootsector->name,"QEMU ",8); -+#endif - bootsector->sector_size=cpu_to_le16(0x200); - bootsector->sectors_per_cluster=s->sectors_per_cluster; - bootsector->reserved_sectors=cpu_to_le16(1); -@@ -927,7 +1020,6 @@ - bootsector->root_entries=cpu_to_le16(s->sectors_of_root_directory*0x10); - bootsector->total_sectors16=s->sector_count>0xffff?0:cpu_to_le16(s->sector_count); - bootsector->media_type=(s->fat_type!=12?0xf8:s->sector_count==5760?0xf9:0xf8); /* media descriptor */ -- s->fat.pointer[0] = bootsector->media_type; - bootsector->sectors_per_fat=cpu_to_le16(s->sectors_per_fat); - bootsector->sectors_per_track=cpu_to_le16(s->bs->secs); - bootsector->number_of_heads=cpu_to_le16(s->bs->heads); -@@ -935,15 +1027,25 @@ - bootsector->total_sectors=cpu_to_le32(s->sector_count>0xffff?s->sector_count:0); - - /* LATER TODO: if FAT32, this is wrong */ -- bootsector->u.fat16.drive_number=s->fat_type==12?0:0x80; /* assume this is hda (TODO) */ -- bootsector->u.fat16.current_head=0; -- bootsector->u.fat16.signature=0x29; -- bootsector->u.fat16.id=cpu_to_le32(0xfabe1afd); -+ if (s->fat_type == 32) { -+ vi = &bootsector->u.fat32.vi; -+ memcpy(vi->fs_type, "FAT32 ", 8); -+ } else { -+ vi = &bootsector->u.fat16.vi; -+ memcpy(vi->fs_type, (s->fat_type == 12 ? "FAT12 " : "FAT16 "), 8); -+ } - -- memcpy(bootsector->u.fat16.volume_label,"QEMU VVFAT ",11); -- memcpy(bootsector->fat_type,(s->fat_type==12?"FAT12 ":s->fat_type==16?"FAT16 ":"FAT32 "),8); -- bootsector->magic[0]=0x55; bootsector->magic[1]=0xaa; -+ /* assume this is hda (TODO) */ -+ vi->drive_number = s->fat_type == 12 ? 0 : 0x80; -+ vi->signature = 0x29; -+ vi->id = cpu_to_le32(0xfabe1afd); -+ memset(vi->volume_label, ' ', 11); -+ namelen = strlen(VOLUME_LABEL); -+ if (namelen > 11) -+ namelen = 11; -+ memcpy(vi->volume_label, VOLUME_LABEL, namelen); - -+ bootsector->magic[0]=0x55; bootsector->magic[1]=0xaa; - return 0; - } - -@@ -951,7 +1053,7 @@ - static BDRVVVFATState *vvv = NULL; - #endif - --static int enable_write_target(BDRVVVFATState *s); -+static int enable_write(BDRVVVFATState *s); - static int is_consistent(BDRVVVFATState *s); - - static int vvfat_open(BlockDriverState *bs, const char* dirname, int flags) -@@ -964,10 +1066,10 @@ - vvv = s; - #endif - --DLOG(if (stderr == NULL) { -- stderr = fopen("vvfat.log", "a"); -- setbuf(stderr, NULL); --}) -+ DLOG(if (stderr == NULL) { -+ stderr = fopen("vvfat.log", "a"); -+ setbuf(stderr, NULL); -+ }) - - s->bs = bs; - -@@ -983,17 +1085,20 @@ - s->first_sectors_number=0x40; - /* read only is the default for safety */ - bs->read_only = 1; -- s->qcow = s->write_target = NULL; -+ s->qcow = NULL; - s->qcow_filename = NULL; - s->fat2 = NULL; - s->downcase_short_names = 1; - -- if (!strstart(dirname, "fat:", NULL)) -+ if (!strstart(dirname, "fat:", NULL)) { -+ DLOG(fprintf(stderr, "%s:%u: dirname '%s' not \"fat:\"\n", __FUNCTION__, __LINE__, dirname)); - return -1; -+ } - - if (strstr(dirname, ":rw:")) { -- if (enable_write_target(s)) -+ if (enable_write(s)) { - return -1; -+ } - bs->read_only = 0; - } - -@@ -1026,8 +1131,11 @@ - bs->total_sectors=bs->cyls*bs->heads*bs->secs; - if (s->sector_count > bs->total_sectors) - s->sector_count = bs->total_sectors; -- if(init_directories(s, dirname)) -+ -+ if (init_directories(s, dirname)) { -+ DLOG(fprintf(stderr, "%s:%u: init_directories failed\n", __FUNCTION__, __LINE__)); - return -1; -+ } - - if(s->first_sectors_number==0x40) - init_mbr(s); -@@ -1037,6 +1145,8 @@ - bs->heads = bs->cyls = bs->secs = 0; - - // assert(is_consistent(s)); -+ -+ DLOG(fprintf(stderr, "%s:%u: return 0\n", __FUNCTION__, __LINE__)); - return 0; - } - -@@ -1153,7 +1263,7 @@ - s->cluster = s->directory.pointer+offset - + 0x20*s->current_mapping->info.dir.first_dir_index; - assert(((s->cluster-(unsigned char*)s->directory.pointer)%s->cluster_size)==0); -- assert((char*)s->cluster+s->cluster_size <= s->directory.pointer+s->directory.next*s->directory.item_size); -+ assert(s->cluster+s->cluster_size <= s->directory.pointer+s->directory.next*s->directory.item_size); - s->current_cluster = cluster_num; - return 0; - } -@@ -1227,6 +1337,18 @@ - direntry->attributes, - begin_of_direntry(direntry),le32_to_cpu(direntry->size)); - } -+ { -+ unsigned char *p = (void *) direntry; -+ int i; -+ -+ fprintf(stderr, "%p:\t", p); -+ for (i = 0; i < 16; i++) -+ fprintf(stderr, " %02x", *p++); -+ fprintf(stderr, "\n%p:\t", p); -+ for ( ; i < 32; i++) -+ fprintf(stderr, " %02x", *p++); -+ fprintf(stderr, "\n"); -+ } - } - - static void print_mapping(const mapping_t* mapping) -@@ -1243,6 +1365,9 @@ - uint8_t *buf, int nb_sectors) - { - BDRVVVFATState *s = bs->opaque; -+#ifdef DEBUG_SECTORS -+ int32_t orig_sector = sector_num; -+#endif - int i; - - for(i=0;ifaked_sectors) { - if(sector_numfirst_sectors_number) -@@ -1280,6 +1405,14 @@ - memcpy(buf+i*0x200,s->cluster+sector_offset_in_cluster*0x200,0x200); - } - } -+ -+#ifdef DEBUG_SECTORS -+ for (i = 0; i < nb_sectors; i++) { -+ fprintf(stderr, "%s:%u: sector %u:\n", __FUNCTION__, __LINE__, orig_sector + i); -+ hexdump(buf + i * 0x200, 0x200); -+ } -+#endif -+ - return 0; - } - -@@ -1372,7 +1505,7 @@ - } - - typedef struct { -- unsigned char name[1024]; -+ char name[1024]; - int checksum, len; - int sequence_number; - } long_file_name; -@@ -1577,6 +1710,7 @@ - const char* basename; - - assert(mapping->mode & MODE_DELETED); -+ DLOG(fprintf(stderr, "%s:%u: clear delete: ", __FUNCTION__, __LINE__); print_mapping(mapping)); - mapping->mode &= ~MODE_DELETED; - - basename = get_basename(mapping->path); -@@ -1702,6 +1836,7 @@ - assert(mapping->mode & MODE_DIRECTORY); - - assert(mapping->mode & MODE_DELETED); -+ DLOG(fprintf(stderr, "%s:%u: clear delete: ", __FUNCTION__, __LINE__); print_mapping(mapping)); - mapping->mode &= ~MODE_DELETED; - - if (strcmp(basename, basename2)) -@@ -1736,9 +1871,9 @@ - for (i = 0; i < 0x10 * s->sectors_per_cluster; i++) { - int cluster_count; - --DLOG(fprintf(stderr, "check direntry %d: \n", i); print_direntry(direntries + i)); -- if (is_volume_label(direntries + i) || is_dot(direntries + i) || -- is_free(direntries + i)) -+DLOG(if (!is_free(direntries + i)) { fprintf(stderr, "check direntry %d: \n", i); print_direntry(direntries + i); }) -+ -+ if (is_volume_label(direntries + i) || is_dot(direntries + i) || is_free(direntries + i)) - continue; - - subret = parse_long_name(&lfn, direntries + i); -@@ -1806,7 +1941,10 @@ - int i, check; - int used_clusters_count = 0; - --DLOG(checkpoint()); -+DLOG(checkpoint(__FUNCTION__)); -+ -+ DLOG(fprintf(stderr, "%s:%u:\n", __FUNCTION__, __LINE__)); -+ - /* - * - get modified FAT - * - compare the two FATs (TODO) -@@ -1825,10 +1963,11 @@ - s->fat2 = malloc(size); - memcpy(s->fat2, s->fat.pointer, size); - } -- check = vvfat_read(s->bs, -- s->first_sectors_number, s->fat2, s->sectors_per_fat); -+ check = vvfat_read(s->bs, s->first_sectors_number, -+ s->fat2, s->sectors_per_fat); - if (check) { - fprintf(stderr, "Could not copy fat\n"); -+ DLOG(fprintf(stderr, "%s:%u: copy fat failed\n", __FUNCTION__, __LINE__)); - return 0; - } - assert (s->used_clusters); -@@ -1839,12 +1978,15 @@ - - /* mark every mapped file/directory as deleted. - * (check_directory_consistency() will unmark those still present). */ -- if (s->qcow) -+ if (s->qcow) { - for (i = 0; i < s->mapping.next; i++) { - mapping_t* mapping = array_get(&(s->mapping), i); -- if (mapping->first_mapping_index < 0) -+ if (mapping->first_mapping_index < 0) { -+ DLOG(fprintf(stderr, "%s:%u: mark delete: ", __FUNCTION__, __LINE__); print_mapping(mapping)); - mapping->mode |= MODE_DELETED; -+ } - } -+ } - - used_clusters_count = check_directory_consistency(s, 0, s->path); - if (used_clusters_count <= 0) { -@@ -1869,9 +2011,12 @@ - } - } - -- if (check != used_clusters_count) -+ if (check != used_clusters_count) { -+ DLOG(fprintf(stderr, "%s:%u: check: %u, used %u\n", __FUNCTION__, __LINE__, check, used_clusters_count)); - return 0; -+ } - -+ DLOG(fprintf(stderr, "%s:%u: return used %u\n", __FUNCTION__, __LINE__, used_clusters_count)); - return used_clusters_count; - } - -@@ -1928,6 +2073,8 @@ - ((next_mapping = array_get(&(s->mapping), index + 1)) && - next_mapping->begin >= end))); - -+ DLOG(fprintf(stderr, "insert mapping %u:\n", index); print_mapping(mapping)); -+ - if (s->current_mapping && first_mapping != (mapping_t*)s->mapping.pointer) - s->current_mapping = array_get(&(s->mapping), - s->current_mapping - first_mapping); -@@ -1940,6 +2087,8 @@ - mapping_t* mapping = array_get(&(s->mapping), mapping_index); - mapping_t* first_mapping = array_get(&(s->mapping), 0); - -+ DLOG(fprintf(stderr, "remove mapping %u:\n", mapping_index); print_mapping(mapping)); -+ - /* free mapping */ - if (mapping->first_mapping_index < 0) - free(mapping->path); -@@ -2090,7 +2239,7 @@ - int ret, i; - uint32_t c; - --DLOG(fprintf(stderr, "commit_direntries for %s, parent_mapping_index %d\n", mapping->path, parent_mapping_index)); -+ DLOG(fprintf(stderr, "commit_direntries for %s, parent_mapping_index %d\n", mapping->path, parent_mapping_index)); - - assert(direntry); - assert(mapping); -@@ -2130,7 +2279,7 @@ - s->sectors_per_cluster); - if (ret) - return ret; -- assert(!strncmp(s->directory.pointer, "QEMU", 4)); -+ assert(!strncmp((char *) s->directory.pointer, VOLUME_LABEL, strlen(VOLUME_LABEL))); - current_dir_index += factor; - } - -@@ -2164,7 +2313,7 @@ - uint32_t first_cluster = c; - mapping_t* mapping = find_mapping_for_cluster(s, c); - uint32_t size = filesize_of_direntry(direntry); -- char* cluster = malloc(s->cluster_size); -+ unsigned char* cluster = malloc(s->cluster_size); - uint32_t i; - int fd = 0; - -@@ -2217,13 +2366,13 @@ - - #ifdef DEBUG - /* test, if all mappings point to valid direntries */ --static void check1(BDRVVVFATState* s) -+static void check1(BDRVVVFATState* s, const char *where) - { - int i; - for (i = 0; i < s->mapping.next; i++) { - mapping_t* mapping = array_get(&(s->mapping), i); - if (mapping->mode & MODE_DELETED) { -- fprintf(stderr, "deleted\n"); -+ DLOG(fprintf(stderr, "%s: deleted\n", where); print_mapping(mapping)); - continue; - } - assert(mapping->dir_index >= 0); -@@ -2238,7 +2387,7 @@ - } - - /* test, if all direntries have mappings */ --static void check2(BDRVVVFATState* s) -+static void check2(BDRVVVFATState* s, const char *where) - { - int i; - int first_mapping = -1; -@@ -2485,7 +2634,9 @@ - mapping_t* mapping = array_get(&(s->mapping), i); - if (mapping->mode & MODE_DELETED) { - direntry_t* entry = array_get(&(s->directory), -- mapping->dir_index); -+ mapping->dir_index); -+ -+ DLOG(fprintf(stderr, "%s:%u: ", __FUNCTION__, __LINE__); print_mapping(mapping); print_direntry(entry)); - - if (is_free(entry)) { - /* remove file/directory */ -@@ -2515,14 +2666,15 @@ - next_dir_index - first_dir_index); - - deleted++; -+ } else { -+ if (unlink(mapping->path)) -+ return -4; -+ deleted++; - } -- } else { -- if (unlink(mapping->path)) -- return -4; -- deleted++; -+ -+ DLOG(fprintf(stderr, "DELETE (%d)\n", i); print_mapping(mapping); print_direntry(entry)); -+ remove_mapping(s, i); - } -- DLOG(fprintf(stderr, "DELETE (%d)\n", i); print_mapping(mapping); print_direntry(entry)); -- remove_mapping(s, i); - } - } - } -@@ -2530,6 +2682,20 @@ - return 0; - } - -+static int have_deletes(BDRVVVFATState* s) -+{ -+ int i; -+ -+ for (i = 0; i < s->mapping.next; i++) { -+ mapping_t* mapping = array_get(&(s->mapping), i); -+ if (mapping->mode & MODE_DELETED) { -+ return 1; -+ } -+ } -+ -+ return 0; -+} -+ - /* - * synchronize mapping with new state: - * -@@ -2543,8 +2709,10 @@ - int ret = 0; - - /* the real meat are the commits. Nothing to do? Move along! */ -- if (s->commits.next == 0) -+ if ((0 == s->commits.next) && (0 == have_deletes(s))) { -+ DLOG(fprintf(stderr, "%s:%u: nothing to do\n", __FUNCTION__, __LINE__)); - return 0; -+ } - - vvfat_close_current_file(s); - -@@ -2584,26 +2752,48 @@ - - memset(s->used_clusters, 0, sector2cluster(s, s->sector_count)); - --DLOG(checkpoint()); -+DLOG(checkpoint(__FUNCTION__)); - return 0; - } - - static int try_commit(BDRVVVFATState* s) - { - vvfat_close_current_file(s); --DLOG(checkpoint()); -+ -+DLOG(checkpoint(__FUNCTION__)); -+ - if(!is_consistent(s)) - return -1; -+ - return do_commit(s); - } - -+static void -+vvfat_write_timer(void *opaque) -+{ -+ BDRVVVFATState *s = opaque; -+ -+ DLOG(fprintf(stderr, "%s:%u:\n", __FUNCTION__, __LINE__)); -+ -+DLOG(checkpoint("vvfat_write_timer: before try_commits")); -+ -+ try_commit(s); -+ -+DLOG(checkpoint("vvfat_write_timer: after try_commits")); -+} -+ - static int vvfat_write(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors) - { - BDRVVVFATState *s = bs->opaque; -+ mapping_t* mapping; -+#ifdef DEBUG_SECTORS -+ int32_t orig_sector = sector_num; -+#endif -+ int64_t start_cluster, end_cluster; - int i, ret; - --DLOG(checkpoint()); -+DLOG(checkpoint(__FUNCTION__)); - - vvfat_close_current_file(s); - -@@ -2613,12 +2803,35 @@ - * - do not allow to write non-ASCII filenames - */ - -- if (sector_num < s->first_sectors_number) -+ if (sector_num < s->first_sectors_number) { -+ DLOG(fprintf(stderr, "%s:%u: sector: %u nb %u (first: %u)\n", __FUNCTION__, __LINE__, (int) sector_num, nb_sectors, s->first_sectors_number)); - return -1; -+ } - -- for (i = sector2cluster(s, sector_num); -- i <= sector2cluster(s, sector_num + nb_sectors - 1);) { -- mapping_t* mapping = find_mapping_for_cluster(s, i); -+#ifdef DEBUG_SECTORS -+ for (i = 0; i < nb_sectors; i++) { -+ fprintf(stderr, "%s:%u: sector %u:\n", __FUNCTION__, __LINE__, orig_sector + i); -+ hexdump(buf + i * 0x200, 0x200); -+ } -+#endif -+ -+ DLOG(fprintf(stderr, "%s:%u: check mappings, sector: %u nb %u (faked: %u)\n", __FUNCTION__, __LINE__, (int) sector_num, nb_sectors, s->faked_sectors)); -+ -+ if (sector_num >= s->faked_sectors) { -+ start_cluster = sector2cluster(s, sector_num); -+ } else { -+ start_cluster = 0; -+ } -+ if (sector_num + nb_sectors - 1 >= s->faked_sectors) { -+ end_cluster = sector2cluster(s, sector_num + nb_sectors - 1); -+ } else { -+ end_cluster = -1; -+ } -+ -+ for (i = start_cluster; i <= end_cluster; ) { -+ DLOG(fprintf(stderr, "%s:%u: cluster %u\n", __FUNCTION__, __LINE__, i)); -+ mapping = find_mapping_for_cluster(s, i); -+ DLOG(fprintf(stderr, "%s:%u: mapping %p\n", __FUNCTION__, __LINE__, mapping)); - if (mapping) { - if (mapping->read_only) { - fprintf(stderr, "Tried to write to write-protected file %s\n", -@@ -2662,30 +2875,25 @@ - } - } - i = mapping->end; -- } else -+ } else { - i++; -+ } - } - - /* - * Use qcow backend. Commit later. - */ --DLOG(fprintf(stderr, "Write to qcow backend: %d + %d\n", (int)sector_num, nb_sectors)); -+ DLOG(fprintf(stderr, "Write to qcow backend: %d + %d\n", (int)sector_num, nb_sectors)); - ret = s->qcow->drv->bdrv_write(s->qcow, sector_num, buf, nb_sectors); - if (ret < 0) { - fprintf(stderr, "Error writing to qcow backend\n"); - return ret; - } - -- for (i = sector2cluster(s, sector_num); -- i <= sector2cluster(s, sector_num + nb_sectors - 1); i++) -- if (i >= 0) -- s->used_clusters[i] |= USED_ALLOCATED; -- --DLOG(checkpoint()); -- /* TODO: add timeout */ -- try_commit(s); -+ for (i = start_cluster; i <= end_cluster; i++) -+ s->used_clusters[i] |= USED_ALLOCATED; - --DLOG(checkpoint()); -+ qemu_mod_timer(s->write_timer, qemu_get_clock(rt_clock) + ticks_per_sec); - return 0; - } - -@@ -2701,49 +2909,62 @@ - return 1; - } - --static int write_target_commit(BlockDriverState *bs, int64_t sector_num, -- const uint8_t* buffer, int nb_sectors) { -- BDRVVVFATState* s = bs->opaque; -- return try_commit(s); --} -- --static void write_target_close(BlockDriverState *bs) { -- BDRVVVFATState* s = bs->opaque; -- bdrv_delete(s->qcow); -- free(s->qcow_filename); --} -- --static BlockDriver vvfat_write_target = { -- "vvfat_write_target", 0, NULL, NULL, NULL, -- write_target_commit, -- write_target_close, -- NULL, NULL, NULL --}; -- --static int enable_write_target(BDRVVVFATState *s) -+static int enable_write(BDRVVVFATState *s) - { -- int size = sector2cluster(s, s->sector_count); -+ int error; -+ int size; -+ -+ DLOG(fprintf(stderr, "%s:%u:\n", __FUNCTION__, __LINE__)); -+ -+ size = sector2cluster(s, s->sector_count); - s->used_clusters = calloc(size, 1); - - array_init(&(s->commits), sizeof(commit_t)); - - s->qcow_filename = malloc(1024); - get_tmp_filename(s->qcow_filename, 1024); -- if (bdrv_create(&bdrv_qcow, -- s->qcow_filename, s->sector_count, "fat:", 0) < 0) -+ error = bdrv_create(&bdrv_qcow, s->qcow_filename, s->sector_count, "", 0); -+ if (error < 0) { -+ DLOG(fprintf(stderr, "%s:%u: bdrv_create '%s': %d\n", __FUNCTION__, __LINE__, s->qcow_filename, error)); - return -1; -+ } -+ - s->qcow = bdrv_new(""); -- if (s->qcow == NULL || bdrv_open(s->qcow, s->qcow_filename, 0) < 0) -+ if (s->qcow == NULL) { -+ DLOG(fprintf(stderr, "%s:%u: bdrv_new: Out of memory\n", __FUNCTION__, __LINE__)); -+#ifndef _WIN32 -+ unlink(s->qcow_filename); -+#endif - return -1; -+ } - -+ error = bdrv_open(s->qcow, s->qcow_filename, 0); -+ if (error < 0) { -+ DLOG(fprintf(stderr, "%s:%u: bdrv_open '%s': %d\n", __FUNCTION__, __LINE__, s->qcow_filename, error)); - #ifndef _WIN32 -- unlink(s->qcow_filename); -+ unlink(s->qcow_filename); - #endif -+ bdrv_delete(s->qcow); -+ return -1; -+ } - -- s->bs->backing_hd = calloc(sizeof(BlockDriverState), 1); -- s->bs->backing_hd->drv = &vvfat_write_target; -- s->bs->backing_hd->opaque = s; -+ s->write_timer = qemu_new_timer(rt_clock, vvfat_write_timer, s); -+ if (NULL == s->write_timer) { -+ DLOG(fprintf(stderr, "%s:%u: write_timer: Out of memory\n", __FUNCTION__, __LINE__)); -+#ifndef _WIN32 -+ unlink(s->qcow_filename); -+#endif -+ bdrv_delete(s->qcow); -+ return -1; -+ } -+ -+ s->qcow->is_temporary = 1; -+ -+#ifndef _WIN32 -+ unlink(s->qcow_filename); -+#endif - -+ DLOG(fprintf(stderr, "%s:%u: write enabled\n", __FUNCTION__, __LINE__)); - return 0; - } - -@@ -2751,10 +2972,24 @@ - { - BDRVVVFATState *s = bs->opaque; - -+ if (qemu_timer_pending(s->write_timer)) { -+ qemu_del_timer(s->write_timer); -+ vvfat_write_timer(s); -+ } -+ - vvfat_close_current_file(s); -+ -+ if (s->qcow) { -+ qemu_free(s->qcow_filename); -+ -+ bdrv_delete(s->qcow); -+ s->qcow = NULL; -+ } -+ - array_free(&(s->fat)); - array_free(&(s->directory)); - array_free(&(s->mapping)); -+ - if(s->cluster_buffer) - free(s->cluster_buffer); - } -@@ -2774,10 +3009,16 @@ - }; - - #ifdef DEBUG --static void checkpoint() { -+static void -+checkpoint(const char *where) -+{ -+ DLOG(fprintf(stderr, "%s:%u: checkpoint(%s)\n", __FUNCTION__, __LINE__, where)); -+ - assert(((mapping_t*)array_get(&(vvv->mapping), 0))->end == 2); -- check1(vvv); -- check2(vvv); -+ DLOG(fprintf(stderr, "checkpoint(%s): call check1()\n", where)); -+ check1(vvv, where); -+ DLOG(fprintf(stderr, "checkpoint(%s): call check2()\n", where)); -+ check2(vvv, where); - assert(!vvv->current_mapping || vvv->current_fd || (vvv->current_mapping->mode & MODE_DIRECTORY)); - #if 0 - if (((direntry_t*)vvv->directory.pointer)[1].attributes != 0xf) -@@ -2793,10 +3034,11 @@ - direntry = array_get(&(vvv->directory), mapping->dir_index); - assert(!memcmp(direntry->name, "USB H ", 11) || direntry->name[0]==0); - #endif -+ DLOG(fprintf(stderr, "checkpoint(%s): done\n", where)); - return; - /* avoid compiler warnings: */ - hexdump(NULL, 100); -- remove_mapping(vvv, NULL); -+ remove_mapping(vvv, 0); - print_mapping(NULL); - print_direntry(NULL); - } diff --git a/qemu/patches/qemu-0.9.0-x49gp-build-libqemu.patch b/qemu/patches/qemu-0.9.0-x49gp-build-libqemu.patch deleted file mode 100644 index 06f72ba..0000000 --- a/qemu/patches/qemu-0.9.0-x49gp-build-libqemu.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- qemu-0.9.0/Makefile 2007-07-26 11:10:25.000000000 +0200 -+++ qemu/Makefile 2007-07-26 11:10:38.000000000 +0200 -@@ -32,10 +32,10 @@ - endif - endif - --all: $(TOOLS) $(DOCS) recurse-all -+all: recurse-all - - subdir-%: dyngen$(EXESUF) -- $(MAKE) -C $(subst subdir-,,$@) all -+ $(MAKE) -C $(subst subdir-,,$@) libqemu.a - - recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) - diff --git a/qemu/patches/qemu-0.9.0-x49gp-debug-unassigned.patch b/qemu/patches/qemu-0.9.0-x49gp-debug-unassigned.patch deleted file mode 100644 index 9fca6a1..0000000 --- a/qemu/patches/qemu-0.9.0-x49gp-debug-unassigned.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -ur qemu/exec.c qemu-0.9.0/exec.c ---- qemu/exec.c 2007-02-06 00:01:54.000000000 +0100 -+++ qemu-0.9.0/exec.c 2007-07-10 09:14:31.000000000 +0200 -@@ -41,7 +41,7 @@ - //#define DEBUG_TB_INVALIDATE - //#define DEBUG_FLUSH - //#define DEBUG_TLB --//#define DEBUG_UNASSIGNED -+#define DEBUG_UNASSIGNED - - /* make various TB consistency checks */ - //#define DEBUG_TB_CHECK -@@ -1812,10 +1812,14 @@ - return p->phys_offset; - } - -+CPUState *__GLOBAL_env; -+ - static uint32_t unassigned_mem_readb(void *opaque, target_phys_addr_t addr) - { - #ifdef DEBUG_UNASSIGNED - printf("Unassigned mem read 0x%08x\n", (int)addr); -+ cpu_dump_state(__GLOBAL_env, stdout, fprintf, 0); -+ abort(); - #endif - return 0; - } -@@ -1824,6 +1828,8 @@ - { - #ifdef DEBUG_UNASSIGNED - printf("Unassigned mem write 0x%08x = 0x%x\n", (int)addr, val); -+ cpu_dump_state(__GLOBAL_env, stdout, fprintf, 0); -+ abort(); - #endif - } - diff --git a/qemu/patches/qemu-0.9.0-x49gp-phys_ram_dirty.patch b/qemu/patches/qemu-0.9.0-x49gp-phys_ram_dirty.patch deleted file mode 100644 index cdb7db6..0000000 --- a/qemu/patches/qemu-0.9.0-x49gp-phys_ram_dirty.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- qemu-0.9.0/exec.c 2007-07-23 13:57:29.000000000 +0200 -+++ qemu/exec.c 2007-07-23 13:53:06.000000000 +0200 -@@ -1942,9 +1942,11 @@ - cpu_register_io_memory(IO_MEM_NOTDIRTY >> IO_MEM_SHIFT, error_mem_read, notdirty_mem_write, NULL); - io_mem_nb = 5; - -- /* alloc dirty bits array */ -- phys_ram_dirty = qemu_vmalloc(phys_ram_size >> TARGET_PAGE_BITS); -- memset(phys_ram_dirty, 0xff, phys_ram_size >> TARGET_PAGE_BITS); -+ if (phys_ram_size) { -+ /* alloc dirty bits array */ -+ phys_ram_dirty = qemu_vmalloc(phys_ram_size >> TARGET_PAGE_BITS); -+ memset(phys_ram_dirty, 0xff, phys_ram_size >> TARGET_PAGE_BITS); -+ } - } - - /* mem_read and mem_write are arrays of functions containing the diff --git a/qemu/patches/qemu-2ndbootdevice_04.diff b/qemu/patches/qemu-2ndbootdevice_04.diff deleted file mode 100644 index 4220ec9..0000000 --- a/qemu/patches/qemu-2ndbootdevice_04.diff +++ /dev/null @@ -1,165 +0,0 @@ ---- vl.h 2007-02-05 21:20:30.000000000 +0100 -+++ vl.h_2 2007-03-14 16:22:14.000000000 +0100 -@@ -683,6 +683,9 @@ - - typedef void QEMUMachineInitFunc(int ram_size, int vga_ram_size, - int boot_device, -+#ifdef TARGET_I386 -+ int boot_device_2, -+#endif - DisplayState *ds, const char **fd_filename, int snapshot, - const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename); - ---- vl.c 2007-02-05 21:46:05.000000000 +0100 -+++ vl.c_2.c 2007-03-14 15:16:49.000000000 +0100 -@@ -131,6 +131,7 @@ - const char* keyboard_layout = NULL; - int64_t ticks_per_sec; - int boot_device = 'c'; -+int boot_device_2 = 'd'; - int ram_size; - int pit_min_timer_count = 0; - int nb_nics; -@@ -6021,7 +6022,11 @@ - "-hda/-hdb file use 'file' as IDE hard disk 0/1 image\n" - "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n" - "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n" -+#ifdef TARGET_I386 -+ "-boot d1(,d2) boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n" -+#else - "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n" -+#endif - "-snapshot write to temporary files instead of disk image files\n" - #ifdef CONFIG_SDL - "-no-quit disable SDL window close capability\n" -@@ -6721,6 +6734,15 @@ - break; - case QEMU_OPTION_boot: - boot_device = optarg[0]; -+#ifdef TARGET_I386 -+ if (strlen(optarg) == 3) { //we have a second bootdevice -+ boot_device_2 = optarg[2]; -+ if (boot_device_2 != 'a' && boot_device_2 != 'c' && boot_device_2 != 'd') { -+ fprintf(stderr, "qemu: invalid second boot device '%c'\n", boot_device_2); -+ exit(1); -+ } -+ } -+#endif - if (boot_device != 'a' && - #if defined(TARGET_SPARC) || defined(TARGET_I386) - // Network boot -@@ -7199,8 +7220,11 @@ - qemu_chr_printf(parallel_hds[i], "parallel%d console\r\n", i); - } - } -- -+#ifdef TARGET_I386 -+ machine->init(ram_size, vga_ram_size, boot_device, boot_device_2, -+#else - machine->init(ram_size, vga_ram_size, boot_device, -+#endif - ds, fd_filename, snapshot, - kernel_filename, kernel_cmdline, initrd_filename); - ---- hw/pc.c 2007-02-02 04:13:18.000000000 +0100 -+++ hw/pc.c_2 2007-03-14 15:58:38.000000000 +0100 -@@ -154,7 +154,7 @@ - } - - /* hd_table must contain 4 block drivers */ --static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table) -+static void cmos_init(int ram_size, int boot_device, int boot_device_2, BlockDriverState **hd_table) - { - RTCState *s = rtc_state; - int val; -@@ -185,19 +185,32 @@ - rtc_set_memory(s, 0x34, val); - rtc_set_memory(s, 0x35, val >> 8); - -+ int bd2_val; -+ switch(boot_device_2) { -+ case 'a': -+ bd2_val = 0x10; -+ break; -+ case 'c': -+ bd2_val = 0x20; -+ break; -+ case 'd': -+ bd2_val = 0x30; -+ break; -+ } -+ - switch(boot_device) { - case 'a': - case 'b': -- rtc_set_memory(s, 0x3d, 0x01); /* floppy boot */ -+ rtc_set_memory(s, 0x3d, bd2_val | 0x01); /* floppy boot */ - if (!fd_bootchk) -- rtc_set_memory(s, 0x38, 0x01); /* disable signature check */ -+ rtc_set_memory(s, 0x38, bd2_val | 0x01); /* disable signature check */ - break; - default: - case 'c': -- rtc_set_memory(s, 0x3d, 0x02); /* hard drive boot */ -+ rtc_set_memory(s, 0x3d, bd2_val | 0x02); /* hard drive boot */ - break; - case 'd': -- rtc_set_memory(s, 0x3d, 0x03); /* CD-ROM boot */ -+ rtc_set_memory(s, 0x3d, bd2_val | 0x03); /* CD-ROM boot */ - break; - } - -@@ -443,7 +459,8 @@ - } - - /* PC hardware initialisation */ --static void pc_init1(int ram_size, int vga_ram_size, int boot_device, -+static void pc_init1(int ram_size, int vga_ram_size, -+ int boot_device, int boot_device_2, - DisplayState *ds, const char **fd_filename, int snapshot, - const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename, -@@ -692,7 +709,7 @@ - - floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table); - -- cmos_init(ram_size, boot_device, bs_table); -+ cmos_init(ram_size, boot_device, boot_device_2, bs_table); - - if (pci_enabled && usb_enabled) { - usb_uhci_init(pci_bus, piix3_devfn + 2); -@@ -730,27 +747,29 @@ - #endif - } - --static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device, -+static void pc_init_pci(int ram_size, int vga_ram_size, -+ int boot_device, int boot_device_2, - DisplayState *ds, const char **fd_filename, - int snapshot, - const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename) - { -- pc_init1(ram_size, vga_ram_size, boot_device, -+ pc_init1(ram_size, vga_ram_size, boot_device, boot_device_2, - ds, fd_filename, snapshot, - kernel_filename, kernel_cmdline, - initrd_filename, 1); - } - --static void pc_init_isa(int ram_size, int vga_ram_size, int boot_device, -+static void pc_init_isa(int ram_size, int vga_ram_size, -+ int boot_device, int boot_device_2, - DisplayState *ds, const char **fd_filename, - int snapshot, - const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename) - { -- pc_init1(ram_size, vga_ram_size, boot_device, -+ pc_init1(ram_size, vga_ram_size, boot_device, boot_device_2, - ds, fd_filename, snapshot, - kernel_filename, kernel_cmdline, - initrd_filename, 0); diff --git a/qemu/prepare.sh b/qemu/prepare.sh deleted file mode 100755 index c6f66cd..0000000 --- a/qemu/prepare.sh +++ /dev/null @@ -1,61 +0,0 @@ -# get/update QEMU - -# export CVS_RSH="ssh" -# cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/qemu co -r "release_0_9_0" qemu - -rm -rf qemu -tar xzvf qemu-0.9.0.tar.gz -mv qemu-0.9.0 qemu - -# patch qemu sources -cd qemu - -#qemu hotfix for qcow2 -patch -p0 -u < ../patches/qemu-0.9.0-qcow2.diff - -#qemu gcc4 patches -patch -p1 -u < ../patches/qemu-0.9.0-gcc4.patch -patch -p1 -u < ../patches/qemu-0.7.2-dyngen-check-stack-clobbers.patch -patch -p1 -u < ../patches/qemu-0.7.2-gcc4-opts.patch -patch -p1 -u < ../patches/qemu-0.8.0-gcc4-hacks.patch - -#qemu OS X86 patches -patch -p1 -u < ../patches/qemu-0.9.0-enforce-16byte-stack-boundary.patch -patch -p1 -u -f < ../patches/qemu-0.9.0-i386-FORCE_RET.patch -patch -p1 -u < ../patches/qemu-0.9.0-osx-intel-port.patch - -patch -p1 -u < ../patches/qemu-0.8.0-osx-bugfix.patch - -# arm patches -patch -p1 -u < ../patches/qemu-0.9.0-arm-shift.patch - -# x49gp patches -patch -p1 -u < ../patches/qemu-0.9.0-sparc-compile-flags.patch -patch -p1 -u < ../patches/qemu-0.9.0-sparc-load-store-le.patch -patch -p1 -u < ../patches/qemu-0.9.0-sparc-clobber.patch -patch -p1 -u < ../patches/qemu-0.9.0-sparc-register.patch -patch -p1 -u < ../patches/qemu-0.9.0-x49gp-arm-dump-state.patch -patch -p1 -u < ../patches/qemu-0.9.0-x49gp-arm-mmu.patch -patch -p1 -u < ../patches/qemu-0.9.0-x49gp-arm-semihosting.patch -patch -p1 -u < ../patches/qemu-0.9.0-x49gp-debug-unassigned.patch -patch -p1 -u < ../patches/qemu-0.9.0-x49gp-phys_ram_dirty.patch -patch -p1 -u < ../patches/qemu-0.9.0-x49gp-block.patch - -# only build libqemu.a -patch -p1 -u < ../patches/qemu-0.9.0-x49gp-build-libqemu.patch - - -# configure -if [ "`uname -m`" = "sparc64" ]; then - STUB=sparc32 -fi - -if [ "`uname -s`" = "Darwin" ]; then - OPTIONS="--disable-gcc-check" -fi - -OPTIONS="${OPTIONS} --disable-gfx-check" - -${STUB} ./configure ${OPTIONS} --target-list=arm-softmmu - -cd .. diff --git a/s3c2410_adc.c b/s3c2410_adc.c index c8ccd9d..5ad85b4 100644 --- a/s3c2410_adc.c +++ b/s3c2410_adc.c @@ -56,9 +56,6 @@ s3c2410_adc_read(void *opaque, target_phys_addr_t offset) s3c2410_adc_t *adc = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_ADC_BASE; -#endif if (! S3C2410_OFFSET_OK(adc, offset)) { return ~(0); } @@ -89,9 +86,6 @@ s3c2410_adc_write(void *opaque, target_phys_addr_t offset, uint32_t data) s3c2410_adc_t *adc = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_ADC_BASE; -#endif if (! S3C2410_OFFSET_OK(adc, offset)) { return; } @@ -216,13 +210,8 @@ s3c2410_adc_init(x49gp_module_t *module) module->user_data = adc; -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_adc_readfn, - s3c2410_adc_writefn, adc); -#else iotype = cpu_register_io_memory(s3c2410_adc_readfn, s3c2410_adc_writefn, adc); -#endif #ifdef DEBUG_S3C2410_ADC printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_arm.c b/s3c2410_arm.c index d0e6a79..70624c6 100644 --- a/s3c2410_arm.c +++ b/s3c2410_arm.c @@ -13,11 +13,7 @@ #include #include -#ifdef QEMU_OLD -extern void tlb_flush(struct CPUState *, int global); -#else #include "cpu-all.h" -#endif static int s3c2410_arm_load(x49gp_module_t *module, GKeyFile *key) @@ -75,15 +71,10 @@ s3c2410_arm_load(x49gp_module_t *module, GKeyFile *key) error = -EAGAIN; if (x49gp_module_get_u32(module, key, "VF", 0, &env->VF)) error = -EAGAIN; -#ifdef QEMU_OLD - if (x49gp_module_get_u32(module, key, "NZF", 0, &env->NZF)) - error = -EAGAIN; -#else if (x49gp_module_get_u32(module, key, "NF", 0, &env->NF)) error = -EAGAIN; if (x49gp_module_get_u32(module, key, "ZF", 0, &env->ZF)) error = -EAGAIN; -#endif if (x49gp_module_get_u32(module, key, "QF", 0, &env->QF)) error = -EAGAIN; if (x49gp_module_get_u32(module, key, "thumb", 0, &env->thumb)) @@ -95,10 +86,6 @@ s3c2410_arm_load(x49gp_module_t *module, GKeyFile *key) error = -EAGAIN; if (x49gp_module_get_u32(module, key, "cp15-c1-coproc", 0, &env->cp15.c1_coproc)) error = -EAGAIN; -#ifdef QEMU_OLD - if (x49gp_module_get_u32(module, key, "cp15-c2", 0, &env->cp15.c2)) - error = -EAGAIN; -#else if (x49gp_module_get_u32(module, key, "cp15-c2-base0", 0, &env->cp15.c2_base0)) error = -EAGAIN; if (x49gp_module_get_u32(module, key, "cp15-c2-base1", 0, &env->cp15.c2_base1)) @@ -113,7 +100,6 @@ s3c2410_arm_load(x49gp_module_t *module, GKeyFile *key) error = -EAGAIN; if (x49gp_module_get_u32(module, key, "cp15-c2-insn", 0, &env->cp15.c2_insn)) error = -EAGAIN; -#endif if (x49gp_module_get_u32(module, key, "cp15-c3", 0, &env->cp15.c3)) error = -EAGAIN; if (x49gp_module_get_u32(module, key, "cp15-c5-insn", 0, &env->cp15.c5_insn)) @@ -197,21 +183,14 @@ s3c2410_arm_save(x49gp_module_t *module, GKeyFile *key) x49gp_module_set_u32(module, key, "CF", env->CF); x49gp_module_set_u32(module, key, "VF", env->VF); -#ifdef QEMU_OLD - x49gp_module_set_u32(module, key, "NZF", env->NZF); -#else x49gp_module_set_u32(module, key, "NF", env->NF); x49gp_module_set_u32(module, key, "ZF", env->ZF); -#endif x49gp_module_set_u32(module, key, "QF", env->QF); x49gp_module_set_int(module, key, "thumb", env->thumb); x49gp_module_set_u32(module, key, "cp15-c0-cpuid", env->cp15.c0_cpuid); x49gp_module_set_u32(module, key, "cp15-c1-sys", env->cp15.c1_sys); x49gp_module_set_u32(module, key, "cp15-c1-coproc", env->cp15.c1_coproc); -#ifdef QEMU_OLD - x49gp_module_set_u32(module, key, "cp15-c2", env->cp15.c2); -#else x49gp_module_set_u32(module, key, "cp15-c2-base0", env->cp15.c2_base0); x49gp_module_set_u32(module, key, "cp15-c2-base1", env->cp15.c2_base1); x49gp_module_set_u32(module, key, "cp15-c2-control", env->cp15.c2_control); @@ -219,7 +198,6 @@ s3c2410_arm_save(x49gp_module_t *module, GKeyFile *key) x49gp_module_set_u32(module, key, "cp15-c2-base-mask", env->cp15.c2_base_mask); x49gp_module_set_u32(module, key, "cp15-c2-data", env->cp15.c2_data); x49gp_module_set_u32(module, key, "cp15-c2-insn", env->cp15.c2_insn); -#endif x49gp_module_set_u32(module, key, "cp15-c3", env->cp15.c3); x49gp_module_set_u32(module, key, "cp15-c5-insn", env->cp15.c5_insn); x49gp_module_set_u32(module, key, "cp15-c5-data", env->cp15.c5_data); @@ -263,10 +241,6 @@ s3c2410_arm_init(x49gp_module_t *module) printf("%s: %s:%u\n", module->name, __FUNCTION__, __LINE__); #endif -#ifdef QEMU_OLD - cpu_arm_set_model(x49gp->env, ARM_CPUID_ARM926); -#endif - module->user_data = x49gp->env; return 0; } diff --git a/s3c2410_intc.c b/s3c2410_intc.c index 209a475..a7feb8a 100644 --- a/s3c2410_intc.c +++ b/s3c2410_intc.c @@ -495,9 +495,6 @@ s3c2410_intc_read(void *opaque, target_phys_addr_t offset) s3c2410_offset_t *reg; uint32_t data; -#ifdef QEMU_OLD - offset -= S3C2410_INTC_BASE; -#endif if (! S3C2410_OFFSET_OK(intc, offset)) { return ~(0); } @@ -530,9 +527,6 @@ s3c2410_intc_write(void *opaque, target_phys_addr_t offset, uint32_t data) #endif s3c2410_intc_t *intc = opaque; -#ifdef QEMU_OLD - offset -= S3C2410_INTC_BASE; -#endif if (! S3C2410_OFFSET_OK(intc, offset)) { return; } @@ -700,13 +694,8 @@ s3c2410_intc_init(x49gp_module_t *module) intc->x49gp = module->x49gp; intc->x49gp->s3c2410_intc = intc; -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_intc_readfn, - s3c2410_intc_writefn, intc); -#else iotype = cpu_register_io_memory(s3c2410_intc_readfn, s3c2410_intc_writefn, intc); -#endif #ifdef DEBUG_S3C2410_INTC printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_io_port.c b/s3c2410_io_port.c index 8ef29ab..13c3027 100644 --- a/s3c2410_io_port.c +++ b/s3c2410_io_port.c @@ -191,9 +191,6 @@ s3c2410_io_port_read(void *opaque, target_phys_addr_t offset) s3c2410_io_port_t *io = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_IO_PORT_BASE; -#endif if (! S3C2410_OFFSET_OK(io, offset)) { fprintf(stderr, "%s:%u: offset %08lx not OK\n", __FUNCTION__, __LINE__, (unsigned long) offset); abort(); @@ -277,9 +274,6 @@ s3c2410_io_port_write(void *opaque, target_phys_addr_t offset, uint32_t data) uint32_t change; static uint32_t lcd_data = 0; -#ifdef QEMU_OLD - offset -= S3C2410_IO_PORT_BASE; -#endif if (! S3C2410_OFFSET_OK(io, offset)) { return; } @@ -656,13 +650,8 @@ s3c2410_io_port_init(x49gp_module_t *module) module->x49gp->s3c2410_io_port = io; io->x49gp = module->x49gp; -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_io_port_readfn, - s3c2410_io_port_writefn, io); -#else iotype = cpu_register_io_memory(s3c2410_io_port_readfn, s3c2410_io_port_writefn, io); -#endif #ifdef DEBUG_S3C2410_IO_PORT printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_lcd.c b/s3c2410_lcd.c index 3d00326..3c77458 100644 --- a/s3c2410_lcd.c +++ b/s3c2410_lcd.c @@ -192,9 +192,6 @@ s3c2410_lcd_read(void *opaque, target_phys_addr_t offset) s3c2410_offset_t *reg; uint32_t linecnt; -#ifdef QEMU_OLD - offset -= S3C2410_LCD_BASE; -#endif if (! S3C2410_OFFSET_OK(lcd, offset)) { return ~(0); } @@ -230,9 +227,6 @@ s3c2410_lcd_write(void *opaque, target_phys_addr_t offset, uint32_t data) x49gp_t *x49gp = lcd->x49gp; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_LCD_BASE; -#endif if (! S3C2410_OFFSET_OK(lcd, offset)) { return; } @@ -372,13 +366,8 @@ s3c2410_lcd_init(x49gp_module_t *module) module->x49gp->s3c2410_lcd = lcd; lcd->x49gp = module->x49gp; -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_lcd_readfn, - s3c2410_lcd_writefn, lcd); -#else iotype = cpu_register_io_memory(s3c2410_lcd_readfn, s3c2410_lcd_writefn, lcd); -#endif #ifdef DEBUG_S3C2410_LCD printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_memc.c b/s3c2410_memc.c index 1e6de60..4d51a28 100644 --- a/s3c2410_memc.c +++ b/s3c2410_memc.c @@ -74,9 +74,6 @@ s3c2410_memc_read(void *opaque, target_phys_addr_t offset) s3c2410_memc_t *memc = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_MEMC_BASE; -#endif if (! S3C2410_OFFSET_OK(memc, offset)) { return ~(0); } @@ -98,9 +95,6 @@ s3c2410_memc_write(void *opaque, target_phys_addr_t offset, uint32_t data) s3c2410_memc_t *memc = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_MEMC_BASE; -#endif if (! S3C2410_OFFSET_OK(memc, offset)) { return; } @@ -230,13 +224,8 @@ s3c2410_memc_init(x49gp_module_t *module) module->user_data = memc; memc->x49gp = module->x49gp; -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_memc_readfn, - s3c2410_memc_writefn, memc); -#else iotype = cpu_register_io_memory(s3c2410_memc_readfn, s3c2410_memc_writefn, memc); -#endif #ifdef DEBUG_S3C2410_MEMC printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_nand.c b/s3c2410_nand.c index 36363be..3b13d6a 100644 --- a/s3c2410_nand.c +++ b/s3c2410_nand.c @@ -59,9 +59,6 @@ s3c2410_nand_read(void *opaque, target_phys_addr_t offset) s3c2410_nand_t *nand = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_NAND_BASE; -#endif if (! S3C2410_OFFSET_OK(nand, offset)) { return ~(0); } @@ -83,9 +80,6 @@ s3c2410_nand_write(void *opaque, target_phys_addr_t offset, uint32_t data) s3c2410_nand_t *nand = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_NAND_BASE; -#endif if (! S3C2410_OFFSET_OK(nand, offset)) { return; } @@ -211,13 +205,8 @@ s3c2410_nand_init(x49gp_module_t *module) module->user_data = nand; -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_nand_readfn, - s3c2410_nand_writefn, nand); -#else iotype = cpu_register_io_memory(s3c2410_nand_readfn, s3c2410_nand_writefn, nand); -#endif #ifdef DEBUG_S3C2410_NAND printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_power.c b/s3c2410_power.c index 3f1d6e0..cd9e725 100644 --- a/s3c2410_power.c +++ b/s3c2410_power.c @@ -62,9 +62,6 @@ s3c2410_power_read(void *opaque, target_phys_addr_t offset) s3c2410_power_t *power = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_POWER_BASE; -#endif if (! S3C2410_OFFSET_OK(power, offset)) { return ~(0); } @@ -90,9 +87,6 @@ s3c2410_power_write(void *opaque, target_phys_addr_t offset, uint32_t data) uint32_t uMdiv, uPdiv, uSdiv; uint32_t slow_bit, slow_val; -#ifdef QEMU_OLD - offset -= S3C2410_POWER_BASE; -#endif if (! S3C2410_OFFSET_OK(power, offset)) { return; } @@ -322,13 +316,8 @@ s3c2410_power_init(x49gp_module_t *module) module->user_data = power; power->x49gp = module->x49gp; -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_power_readfn, - s3c2410_power_writefn, power); -#else iotype = cpu_register_io_memory(s3c2410_power_readfn, s3c2410_power_writefn, power); -#endif #ifdef DEBUG_S3C2410_POWER printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_rtc.c b/s3c2410_rtc.c index a02ff87..920a03e 100644 --- a/s3c2410_rtc.c +++ b/s3c2410_rtc.c @@ -252,9 +252,6 @@ s3c2410_rtc_read(void *opaque, target_phys_addr_t offset) s3c2410_rtc_t *rtc = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_RTC_BASE; -#endif if (! S3C2410_OFFSET_OK(rtc, offset)) { return ~(0); } @@ -308,9 +305,6 @@ s3c2410_rtc_write(void *opaque, target_phys_addr_t offset, uint32_t data) s3c2410_rtc_t *rtc = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_RTC_BASE; -#endif if (! S3C2410_OFFSET_OK(rtc, offset)) { return; } @@ -458,13 +452,8 @@ s3c2410_rtc_init(x49gp_module_t *module) rtc->alarm_timer = x49gp_new_timer(X49GP_TIMER_REALTIME, s3c2410_rtc_alarm, rtc); -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_rtc_readfn, - s3c2410_rtc_writefn, rtc); -#else iotype = cpu_register_io_memory(s3c2410_rtc_readfn, s3c2410_rtc_writefn, rtc); -#endif #ifdef DEBUG_S3C2410_RTC printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_sdi.c b/s3c2410_sdi.c index da3bb93..b308094 100644 --- a/s3c2410_sdi.c +++ b/s3c2410_sdi.c @@ -219,9 +219,6 @@ s3c2410_sdi_read(void *opaque, target_phys_addr_t offset) s3c2410_offset_t *reg; unsigned int read_avail, write_avail; -#ifdef QEMU_OLD - offset -= S3C2410_SDI_BASE; -#endif if (! S3C2410_OFFSET_OK(sdi, offset)) { return ~(0); } @@ -307,9 +304,6 @@ s3c2410_sdi_write(void *opaque, target_phys_addr_t offset, uint32_t data) s3c2410_offset_t *reg; unsigned int read_avail, write_avail; -#ifdef QEMU_OLD - offset -= S3C2410_SDI_BASE; -#endif if (! S3C2410_OFFSET_OK(sdi, offset)) { return; } @@ -731,13 +725,8 @@ s3c2410_sdi_init(x49gp_module_t *module) module->x49gp->s3c2410_sdi = sdi; sdi->x49gp = module->x49gp; -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_sdi_readfn, - s3c2410_sdi_writefn, sdi); -#else iotype = cpu_register_io_memory(s3c2410_sdi_readfn, s3c2410_sdi_writefn, sdi); -#endif #ifdef DEBUG_S3C2410_SDI printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_spi.c b/s3c2410_spi.c index b18a71a..6a42540 100644 --- a/s3c2410_spi.c +++ b/s3c2410_spi.c @@ -74,9 +74,6 @@ s3c2410_spi_read(void *opaque, target_phys_addr_t offset) s3c2410_spi_t *spi = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_SPI_BASE; -#endif if (! S3C2410_OFFSET_OK(spi, offset)) { return ~(0); } @@ -109,9 +106,6 @@ s3c2410_spi_write(void *opaque, target_phys_addr_t offset, uint32_t data) x49gp_t *x49gp = spi->x49gp; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_SPI_BASE; -#endif if (! S3C2410_OFFSET_OK(spi, offset)) { return; } @@ -249,13 +243,8 @@ s3c2410_spi_init(x49gp_module_t *module) module->user_data = spi; spi->x49gp = module->x49gp; -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_spi_readfn, - s3c2410_spi_writefn, spi); -#else iotype = cpu_register_io_memory(s3c2410_spi_readfn, s3c2410_spi_writefn, spi); -#endif #ifdef DEBUG_S3C2410_SPI printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_timer.c b/s3c2410_timer.c index 69e90b0..76b400f 100644 --- a/s3c2410_timer.c +++ b/s3c2410_timer.c @@ -298,9 +298,6 @@ s3c2410_timer_read(void *opaque, target_phys_addr_t offset) s3c2410_offset_t *reg; uint32_t data; -#ifdef QEMU_OLD - offset -= S3C2410_TIMER_BASE; -#endif if (! S3C2410_OFFSET_OK(timer, offset)) { return ~(0); } @@ -343,9 +340,6 @@ s3c2410_timer_write(void *opaque, target_phys_addr_t offset, uint32_t data) s3c2410_timer_t *timer = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_TIMER_BASE; -#endif if (! S3C2410_OFFSET_OK(timer, offset)) { return; } @@ -515,13 +509,8 @@ s3c2410_timer_init(x49gp_module_t *module) t->timer = x49gp_new_timer(X49GP_TIMER_VIRTUAL, s3c2410_timer_timeout, t); } -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_timer_readfn, - s3c2410_timer_writefn, timer); -#else iotype = cpu_register_io_memory(s3c2410_timer_readfn, s3c2410_timer_writefn, timer); -#endif #ifdef DEBUG_S3C2410_TIMER printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_uart.c b/s3c2410_uart.c index ff4cf2e..62eb86b 100644 --- a/s3c2410_uart.c +++ b/s3c2410_uart.c @@ -381,13 +381,8 @@ s3c2410_uart_init(x49gp_module_t *module) printf("%s: %s:%u\n", module->name, __FUNCTION__, __LINE__); #endif -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_uart_readfn, - s3c2410_uart_writefn, uart_regs); -#else iotype = cpu_register_io_memory(s3c2410_uart_readfn, s3c2410_uart_writefn, uart_regs); -#endif #ifdef DEBUG_S3C2410_UART printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_usbdev.c b/s3c2410_usbdev.c index 97a060c..d909364 100644 --- a/s3c2410_usbdev.c +++ b/s3c2410_usbdev.c @@ -138,9 +138,6 @@ s3c2410_usbdev_read(void *opaque, target_phys_addr_t offset) s3c2410_usbdev_t *usbdev = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_USBDEV_BASE; -#endif if (! S3C2410_OFFSET_OK(usbdev, offset)) { return ~(0); } @@ -162,9 +159,6 @@ s3c2410_usbdev_write(void *opaque, target_phys_addr_t offset, uint32_t data) s3c2410_usbdev_t *usbdev = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_USBDEV_BASE; -#endif if (! S3C2410_OFFSET_OK(usbdev, offset)) { return; } @@ -289,13 +283,8 @@ s3c2410_usbdev_init(x49gp_module_t *module) module->user_data = usbdev; -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_usbdev_readfn, - s3c2410_usbdev_writefn, usbdev); -#else iotype = cpu_register_io_memory(s3c2410_usbdev_readfn, s3c2410_usbdev_writefn, usbdev); -#endif #ifdef DEBUG_S3C2410_USBDEV printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/s3c2410_watchdog.c b/s3c2410_watchdog.c index 93eb1be..785352f 100644 --- a/s3c2410_watchdog.c +++ b/s3c2410_watchdog.c @@ -164,9 +164,6 @@ s3c2410_watchdog_read(void *opaque, target_phys_addr_t offset) s3c2410_watchdog_t *watchdog = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_WATCHDOG_BASE; -#endif if (! S3C2410_OFFSET_OK(watchdog, offset)) { return ~(0); } @@ -189,9 +186,6 @@ s3c2410_watchdog_write(void *opaque, target_phys_addr_t offset, uint32_t data) s3c2410_watchdog_t *watchdog = opaque; s3c2410_offset_t *reg; -#ifdef QEMU_OLD - offset -= S3C2410_WATCHDOG_BASE; -#endif if (! S3C2410_OFFSET_OK(watchdog, offset)) { return; } @@ -335,13 +329,8 @@ s3c2410_watchdog_init(x49gp_module_t *module) watchdog->timer = x49gp_new_timer(X49GP_TIMER_VIRTUAL, s3c2410_watchdog_tick, watchdog); -#ifdef QEMU_OLD - iotype = cpu_register_io_memory(0, s3c2410_watchdog_readfn, - s3c2410_watchdog_writefn, watchdog); -#else iotype = cpu_register_io_memory(s3c2410_watchdog_readfn, s3c2410_watchdog_writefn, watchdog); -#endif #ifdef DEBUG_S3C2410_WATCHDOG printf("%s: iotype %08x\n", __FUNCTION__, iotype); #endif diff --git a/sram.c b/sram.c index 91243d7..4a810ec 100644 --- a/sram.c +++ b/sram.c @@ -387,9 +387,6 @@ sram_get_word(void *opaque, target_phys_addr_t offset) x49gp_sram_t *sram = opaque; uint32_t data; -#ifdef QEMU_OLD - offset -= (target_phys_addr_t)phys_ram_base + sram->offset; -#endif data = ldl_p(sram->data + offset); #if 0 @@ -423,9 +420,6 @@ sram_get_halfword(void *opaque, target_phys_addr_t offset) x49gp_sram_t *sram = opaque; unsigned short data; -#ifdef QEMU_OLD - offset -= (target_phys_addr_t)phys_ram_base + sram->offset; -#endif data = lduw_p(sram->data + offset); #ifdef DEBUG_X49GP_SYSRAM_READ @@ -453,9 +447,6 @@ sram_get_byte(void *opaque, target_phys_addr_t offset) x49gp_sram_t *sram = opaque; unsigned char data; -#ifdef QEMU_OLD - offset -= (target_phys_addr_t)phys_ram_base + sram->offset; -#endif data = ldub_p(sram->data + offset); #ifdef DEBUG_X49GP_SYSRAM_READ @@ -482,10 +473,6 @@ sram_put_word(void *opaque, target_phys_addr_t offset, uint32_t data) { x49gp_sram_t *sram = opaque; -#ifdef QEMU_OLD - offset -= (target_phys_addr_t)phys_ram_base + sram->offset; -#endif - if (offset == 0x00000a1c) { printf("write SRAM 4 at offset %08x: %08x (pc %08x)\n", offset, data, sram->x49gp->env->regs[15]); @@ -532,9 +519,6 @@ sram_put_halfword(void *opaque, target_phys_addr_t offset, uint32_t data) { x49gp_sram_t *sram = opaque; -#ifdef QEMU_OLD - offset -= (target_phys_addr_t)phys_ram_base + sram->offset; -#endif data &= 0xffff; #ifdef DEBUG_X49GP_SYSRAM_WRITE @@ -561,9 +545,6 @@ sram_put_byte(void *opaque, target_phys_addr_t offset, uint32_t data) { x49gp_sram_t *sram = opaque; -#ifdef QEMU_OLD - offset -= (target_phys_addr_t)phys_ram_base + sram->offset; -#endif data &= 0xff; #ifdef DEBUG_X49GP_SYSRAM_WRITE diff --git a/timer.c b/timer.c index aa3c7d4..2c213ee 100644 --- a/timer.c +++ b/timer.c @@ -149,7 +149,7 @@ x49gp_timer_expired(x49gp_timer_t *timer_head, int64_t current_time) return (timer_head->expires <= current_time); } -#ifndef QEMU_OLD // LD TEMPO HACK +/* LD TEMPO HACK */ QEMUTimer * qemu_new_timer(QEMUClock *clock, QEMUTimerCB cb, void *opaque) @@ -187,8 +187,6 @@ qemu_get_clock(QEMUClock *clock) return x49gp_get_clock(); } -#endif /* QEMU_OLD */ - static void x49gp_run_timers(x49gp_timer_t **ptimer_head, int64_t current_time) { @@ -218,15 +216,9 @@ x49gp_alarm_handler(int sig) x49gp_get_clock()) || x49gp_timer_expired(x49gp_timer_lists[X49GP_TIMER_REALTIME], x49gp_get_clock())) { -#ifdef QEMU_OLD - if (cpu_single_env && ! (cpu_single_env->interrupt_request & CPU_INTERRUPT_EXIT)) { - cpu_interrupt(cpu_single_env, CPU_INTERRUPT_EXIT); - } -#else if (cpu_single_env && ! cpu_single_env->exit_request) { cpu_exit(cpu_single_env); } -#endif } }