qemu-svn: Upgrade from r4027 -> 4242. Removes the need for gcc 3.x, adds USB networking for the n800

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4332 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie 2008-04-24 22:10:12 +00:00
parent 0e1fe2007d
commit 927ad49866
31 changed files with 2565 additions and 14293 deletions

View File

@ -149,9 +149,9 @@ SRCREV_pn-opkg ?= "4209"
SRCREV_pn-opkg-native ?= "4209"
SRCREV_pn-opkg-sdk ?= "4209"
SRCREV_pn-libxosd ?= "627"
SRCREV_pn-qemu-native ?= "4027"
SRCREV_pn-qemu-sdk ?= "4027"
SRCREV_pn-qemu ?= "4027"
SRCREV_pn-qemu-native ?= "4242"
SRCREV_pn-qemu-sdk ?= "4242"
SRCREV_pn-qemu ?= "4242"
SRCREV_pn-vincent ?= "246"
# Previously floating revisions

View File

@ -1,23 +0,0 @@
#DPATCHLEVEL=0
---
# block.c | 6 +++++-
# 1 file changed, 5 insertions(+), 1 deletion(-)
#
Index: block.c
===================================================================
--- block.c.orig 2007-12-03 23:47:25.000000000 +0000
+++ block.c 2007-12-03 23:47:31.000000000 +0000
@@ -191,8 +191,12 @@ void get_tmp_filename(char *filename, in
void get_tmp_filename(char *filename, int size)
{
int fd;
+ char *tmpdir;
/* XXX: race condition possible */
- pstrcpy(filename, size, "/tmp/vl.XXXXXX");
+ tmpdir = getenv("TMPDIR");
+ if (!tmpdir)
+ tmpdir = "/tmp";
+ snprintf(filename, size, "%s/vl.XXXXXX", tmpdir);
fd = mkstemp(filename);
close(fd);
}

View File

@ -1,26 +0,0 @@
#DPATCHLEVEL=1
---
# vl.c | 5 ++++-
# 1 file changed, 4 insertions(+), 1 deletion(-)
#
Index: qemu/vl.c
===================================================================
--- qemu.orig/vl.c 2007-12-03 15:44:35.000000000 +0000
+++ qemu/vl.c 2007-12-03 15:51:03.000000000 +0000
@@ -1289,12 +1289,15 @@ static void hpet_stop_timer(struct qemu_
static int rtc_start_timer(struct qemu_alarm_timer *t)
{
+ unsigned long current_rtc_freq = 0;
int rtc_fd;
TFR(rtc_fd = open("/dev/rtc", O_RDONLY));
if (rtc_fd < 0)
return -1;
- if (ioctl(rtc_fd, RTC_IRQP_SET, RTC_FREQ) < 0) {
+ ioctl(rtc_fd, RTC_IRQP_READ, &current_rtc_freq);
+ if (current_rtc_freq != RTC_FREQ &&
+ ioctl(rtc_fd, RTC_IRQP_SET, RTC_FREQ) < 0) {
fprintf(stderr, "Could not configure '/dev/rtc' to have a 1024 Hz timer. This is not a fatal\n"
"error, but for better emulation accuracy either use a 2.6 host Linux kernel or\n"
"type 'echo 1024 > /proc/sys/dev/rtc/max-user-freq' as root.\n");

View File

@ -3,12 +3,12 @@
# hw/pc.c | 1 -
# 1 file changed, 1 deletion(-)
#
Index: qemu/hw/pc.c
Index: trunk/hw/pc.c
===================================================================
--- qemu.orig/hw/pc.c 2007-12-03 23:47:25.000000000 +0000
+++ qemu/hw/pc.c 2007-12-03 23:47:38.000000000 +0000
@@ -385,7 +385,6 @@ static void generate_bootsect(uint32_t g
if (bs_table[0] == NULL) {
--- trunk.orig/hw/pc.c 2008-04-24 20:15:46.000000000 +0100
+++ trunk/hw/pc.c 2008-04-24 20:15:49.000000000 +0100
@@ -399,7 +399,6 @@
if (hda == -1) {
fprintf(stderr, "A disk image must be given for 'hda' when booting "
"a Linux kernel\n");
- exit(1);

View File

@ -5,9 +5,9 @@
#
Index: linux-user/main.c
===================================================================
--- linux-user/main.c.orig 2007-12-03 23:47:25.000000000 +0000
+++ linux-user/main.c 2007-12-03 23:47:41.000000000 +0000
@@ -714,7 +714,7 @@ void cpu_loop (CPUSPARCState *env)
--- linux-user/main.c.orig 2008-04-24 20:15:46.000000000 +0100
+++ linux-user/main.c 2008-04-24 20:15:53.000000000 +0100
@@ -765,7 +765,7 @@
default:
printf ("Unhandled trap: 0x%x\n", trapnr);
cpu_dump_state(env, stderr, fprintf, 0);
@ -16,7 +16,7 @@ Index: linux-user/main.c
}
process_pending_signals (env);
}
@@ -1634,7 +1634,7 @@ void cpu_loop (CPUState *env)
@@ -1697,7 +1697,7 @@
default:
printf ("Unhandled trap: 0x%x\n", trapnr);
cpu_dump_state(env, stderr, fprintf, 0);
@ -25,7 +25,7 @@ Index: linux-user/main.c
}
process_pending_signals (env);
}
@@ -1954,7 +1954,7 @@ int main(int argc, char **argv)
@@ -2026,7 +2026,7 @@
for(item = cpu_log_items; item->mask != 0; item++) {
printf("%-10s %s\n", item->name, item->help);
}
@ -34,7 +34,7 @@ Index: linux-user/main.c
}
cpu_set_log(mask);
} else if (!strcmp(r, "s")) {
@@ -1973,7 +1973,7 @@ int main(int argc, char **argv)
@@ -2045,7 +2045,7 @@
if (qemu_host_page_size == 0 ||
(qemu_host_page_size & (qemu_host_page_size - 1)) != 0) {
fprintf(stderr, "page size must be a power of two\n");

View File

@ -5,9 +5,9 @@
#
Index: linux-user/signal.c
===================================================================
--- linux-user/signal.c.orig 2007-12-03 15:40:26.000000000 +0000
+++ linux-user/signal.c 2007-12-03 15:55:49.000000000 +0000
@@ -364,10 +364,15 @@ int queue_signal(int sig, target_siginfo
--- linux-user/signal.c.orig 2008-04-24 20:15:46.000000000 +0100
+++ linux-user/signal.c 2008-04-24 20:15:55.000000000 +0100
@@ -364,10 +364,15 @@
k = &sigact_table[sig - 1];
handler = k->sa._sa_handler;
if (handler == TARGET_SIG_DFL) {

View File

@ -5,9 +5,9 @@
#
Index: linux-user/signal.c
===================================================================
--- linux-user/signal.c.orig 2007-12-03 23:47:44.000000000 +0000
+++ linux-user/signal.c 2007-12-03 23:47:46.000000000 +0000
@@ -512,6 +512,11 @@ int do_sigaction(int sig, const struct t
--- linux-user/signal.c.orig 2008-04-24 20:15:55.000000000 +0100
+++ linux-user/signal.c 2008-04-24 20:15:57.000000000 +0100
@@ -512,6 +512,11 @@
if (sig < 1 || sig > TARGET_NSIG || sig == SIGKILL || sig == SIGSTOP)
return -EINVAL;

View File

@ -5,9 +5,9 @@
#
Index: vl.c
===================================================================
--- vl.c.orig 2007-12-03 23:47:36.000000000 +0000
+++ vl.c 2007-12-03 23:47:48.000000000 +0000
@@ -4023,7 +4023,7 @@ static int tap_open(char *ifname, int if
--- vl.c.orig 2008-04-24 20:15:46.000000000 +0100
+++ vl.c 2008-04-24 20:15:58.000000000 +0100
@@ -4155,7 +4155,7 @@
return -1;
}
memset(&ifr, 0, sizeof(ifr));

View File

@ -5,9 +5,9 @@
#
Index: linux-user/syscall.c
===================================================================
--- linux-user/syscall.c.orig 2007-12-03 19:32:56.000000000 +0000
+++ linux-user/syscall.c 2007-12-03 19:33:41.000000000 +0000
@@ -250,6 +250,7 @@ extern int getresuid(uid_t *, uid_t *, u
--- linux-user/syscall.c.orig 2008-04-24 20:15:46.000000000 +0100
+++ linux-user/syscall.c 2008-04-24 20:15:59.000000000 +0100
@@ -250,6 +250,7 @@
extern int setresgid(gid_t, gid_t, gid_t);
extern int getresgid(gid_t *, gid_t *, gid_t *);
extern int setgroups(int, gid_t *);
@ -15,7 +15,7 @@ Index: linux-user/syscall.c
#define ERRNO_TABLE_SIZE 1200
@@ -4024,7 +4025,8 @@ abi_long do_syscall(void *cpu_env, int n
@@ -4041,7 +4042,8 @@
#endif
#ifdef TARGET_NR_uselib
case TARGET_NR_uselib:
@ -25,7 +25,7 @@ Index: linux-user/syscall.c
#endif
#ifdef TARGET_NR_swapon
case TARGET_NR_swapon:
@@ -5289,7 +5291,9 @@ abi_long do_syscall(void *cpu_env, int n
@@ -5322,7 +5324,9 @@
goto unimplemented;
#ifdef TARGET_NR_mincore
case TARGET_NR_mincore:
@ -36,7 +36,7 @@ Index: linux-user/syscall.c
#endif
#ifdef TARGET_NR_madvise
case TARGET_NR_madvise:
@@ -5429,7 +5433,8 @@ abi_long do_syscall(void *cpu_env, int n
@@ -5462,7 +5466,8 @@
break;
#ifdef TARGET_NR_readahead
case TARGET_NR_readahead:

View File

@ -5,8 +5,8 @@
#
Index: linux-user/syscall.c
===================================================================
--- linux-user/syscall.c.orig 2007-12-03 15:56:24.000000000 +0000
+++ linux-user/syscall.c 2007-12-03 15:57:36.000000000 +0000
--- linux-user/syscall.c.orig 2008-04-24 20:15:59.000000000 +0100
+++ linux-user/syscall.c 2008-04-24 20:16:01.000000000 +0100
@@ -52,6 +52,7 @@
//#include <sys/user.h>
#include <netinet/ip.h>
@ -15,7 +15,7 @@ Index: linux-user/syscall.c
#define termios host_termios
#define winsize host_winsize
@@ -4739,9 +4740,34 @@ abi_long do_syscall(void *cpu_env, int n
@@ -4758,9 +4759,34 @@
break;
#endif
case TARGET_NR__sysctl:

View File

@ -5,9 +5,9 @@
#
Index: linux-user/syscall.c
===================================================================
--- linux-user/syscall.c.orig 2007-12-03 15:58:11.000000000 +0000
+++ linux-user/syscall.c 2007-12-03 15:58:46.000000000 +0000
@@ -2750,11 +2750,7 @@ int do_fork(CPUState *env, unsigned int
--- linux-user/syscall.c.orig 2008-04-24 20:16:01.000000000 +0100
+++ linux-user/syscall.c 2008-04-24 20:16:02.000000000 +0100
@@ -2760,11 +2760,7 @@
if (!newsp)
newsp = env->gpr[1];
new_env->gpr[1] = newsp;

View File

@ -4,9 +4,9 @@
Index: linux-user/syscall.c
===================================================================
--- linux-user/syscall.c.orig 2007-12-03 19:33:47.000000000 +0000
+++ linux-user/syscall.c 2007-12-03 19:33:48.000000000 +0000
@@ -5317,6 +5317,12 @@ abi_long do_syscall(void *cpu_env, int n
--- linux-user/syscall.c.orig 2008-04-24 20:16:02.000000000 +0100
+++ linux-user/syscall.c 2008-04-24 20:16:03.000000000 +0100
@@ -5350,6 +5350,12 @@
ret = get_errno(mincore((void*)arg1, (size_t)arg2, (unsigned char*)arg3));
break;
#endif

View File

@ -1,104 +0,0 @@
#DPATCHLEVEL=0
---
# linux-user/main.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-
# target-arm/nwfpe/fpa11.c | 7 ++++++
# 2 files changed, 57 insertions(+), 1 deletion(-)
#
Index: linux-user/main.c
===================================================================
--- linux-user/main.c.orig 2007-12-03 15:59:10.000000000 +0000
+++ linux-user/main.c 2007-12-03 16:01:27.000000000 +0000
@@ -377,18 +377,67 @@ void cpu_loop(CPUARMState *env)
{
TaskState *ts = env->opaque;
uint32_t opcode;
+ int rc;
/* we handle the FPU emulation here, as Linux */
/* we get the opcode */
/* FIXME - what to do if get_user() fails? */
get_user_u32(opcode, env->regs[15]);
- if (EmulateAll(opcode, &ts->fpa, env) == 0) {
+ rc = EmulateAll(opcode, &ts->fpa, env);
+ if (rc == 0) { /* illegal instruction */
info.si_signo = SIGILL;
info.si_errno = 0;
info.si_code = TARGET_ILL_ILLOPN;
info._sifields._sigfault._addr = env->regs[15];
queue_signal(info.si_signo, &info);
+ } else if (rc < 0) { /* FP exception */
+ int arm_fpe=0;
+
+ /* translate softfloat flags to FPSR flags */
+ if (-rc & float_flag_invalid)
+ arm_fpe |= BIT_IOC;
+ if (-rc & float_flag_divbyzero)
+ arm_fpe |= BIT_DZC;
+ if (-rc & float_flag_overflow)
+ arm_fpe |= BIT_OFC;
+ if (-rc & float_flag_underflow)
+ arm_fpe |= BIT_UFC;
+ if (-rc & float_flag_inexact)
+ arm_fpe |= BIT_IXC;
+
+ FPSR fpsr = ts->fpa.fpsr;
+ //printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe);
+
+ if (fpsr & (arm_fpe << 16)) { /* exception enabled? */
+ info.si_signo = SIGFPE;
+ info.si_errno = 0;
+
+ /* ordered by priority, least first */
+ if (arm_fpe & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;
+ if (arm_fpe & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;
+ if (arm_fpe & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;
+ if (arm_fpe & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;
+ if (arm_fpe & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;
+
+ info._sifields._sigfault._addr = env->regs[15];
+ queue_signal(info.si_signo, &info);
+ } else {
+ env->regs[15] += 4;
+ }
+
+ /* accumulate unenabled exceptions */
+ if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC))
+ fpsr |= BIT_IXC;
+ if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC))
+ fpsr |= BIT_UFC;
+ if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC))
+ fpsr |= BIT_OFC;
+ if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC))
+ fpsr |= BIT_DZC;
+ if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC))
+ fpsr |= BIT_IOC;
+ ts->fpa.fpsr=fpsr;
} else {
/* increment PC */
env->regs[15] += 4;
Index: target-arm/nwfpe/fpa11.c
===================================================================
--- target-arm/nwfpe/fpa11.c.orig 2007-12-03 15:40:26.000000000 +0000
+++ target-arm/nwfpe/fpa11.c 2007-12-03 15:59:11.000000000 +0000
@@ -162,6 +162,8 @@ unsigned int EmulateAll(unsigned int opc
fpa11->initflag = 1;
}
+ set_float_exception_flags(0, &fpa11->fp_status);
+
if (TEST_OPCODE(opcode,MASK_CPRT))
{
//fprintf(stderr,"emulating CPRT\n");
@@ -191,6 +193,11 @@ unsigned int EmulateAll(unsigned int opc
}
// restore_flags(flags);
+ if(nRc == 1 && get_float_exception_flags(&fpa11->fp_status))
+ {
+ //printf("fef 0x%x\n",float_exception_flags);
+ nRc=-get_float_exception_flags(&fpa11->fp_status);
+ }
//printf("returning %d\n",nRc);
return(nRc);

View File

@ -2,11 +2,11 @@
hw/ne2000.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: qemu/hw/ne2000.c
Index: trunk/hw/ne2000.c
===================================================================
--- qemu.orig/hw/ne2000.c 2007-12-03 19:32:52.000000000 +0000
+++ qemu/hw/ne2000.c 2007-12-03 19:33:55.000000000 +0000
@@ -217,7 +217,7 @@ static int ne2000_can_receive(void *opaq
--- trunk.orig/hw/ne2000.c 2008-04-24 20:15:46.000000000 +0100
+++ trunk/hw/ne2000.c 2008-04-24 20:16:05.000000000 +0100
@@ -217,7 +217,7 @@
NE2000State *s = opaque;
if (s->cmd & E8390_STOP)

View File

@ -5,8 +5,8 @@
#
Index: dyngen-exec.h
===================================================================
--- dyngen-exec.h.orig 2007-12-31 13:06:21.000000000 +0000
+++ dyngen-exec.h 2007-12-31 13:08:54.000000000 +0000
--- dyngen-exec.h.orig 2008-04-24 20:15:46.000000000 +0100
+++ dyngen-exec.h 2008-04-24 20:16:06.000000000 +0100
@@ -38,7 +38,7 @@
// Linux/Sparc64 defines uint64_t
#if !(defined (__sparc_v9__) && defined(__linux__))

View File

@ -5,9 +5,9 @@
#
Index: sparc.ld
===================================================================
--- sparc.ld.orig 2007-12-03 15:40:26.000000000 +0000
+++ sparc.ld 2007-12-03 16:05:06.000000000 +0000
@@ -6,7 +6,7 @@ ENTRY(_start)
--- sparc.ld.orig 2008-04-24 20:15:46.000000000 +0100
+++ sparc.ld 2008-04-24 20:16:07.000000000 +0100
@@ -6,7 +6,7 @@
SECTIONS
{
/* Read-only sections, merged into text segment: */

View File

@ -3,11 +3,11 @@
# cpu-all.h | 2 +-
# 1 file changed, 1 insertion(+), 1 deletion(-)
#
Index: qemu/cpu-all.h
Index: trunk/cpu-all.h
===================================================================
--- qemu.orig/cpu-all.h 2007-06-13 11:48:22.000000000 +0100
+++ qemu/cpu-all.h 2007-06-13 11:51:56.000000000 +0100
@@ -250,7 +250,7 @@ static inline void stw_le_p(void *ptr, i
--- trunk.orig/cpu-all.h 2008-04-24 20:15:46.000000000 +0100
+++ trunk/cpu-all.h 2008-04-24 20:16:08.000000000 +0100
@@ -285,7 +285,7 @@
static inline void stl_le_p(void *ptr, int v)
{
#ifdef __powerpc__

View File

@ -5,9 +5,9 @@
Index: configure
===================================================================
--- configure.orig 2007-12-03 15:40:26.000000000 +0000
+++ configure 2007-12-03 16:05:34.000000000 +0000
@@ -129,6 +129,12 @@ if [ "$cpu" = "i386" -o "$cpu" = "x86_64
--- configure.orig 2008-04-24 20:15:46.000000000 +0100
+++ configure 2008-04-24 20:16:09.000000000 +0100
@@ -135,6 +135,12 @@
kqemu="yes"
fi
;;
@ -22,8 +22,8 @@ Index: configure
oss="yes"
Index: vl.c
===================================================================
--- vl.c.orig 2007-12-03 16:05:32.000000000 +0000
+++ vl.c 2007-12-03 16:05:34.000000000 +0000
--- vl.c.orig 2008-04-24 20:15:58.000000000 +0100
+++ vl.c 2008-04-24 20:16:09.000000000 +0100
@@ -97,6 +97,8 @@
#include <stropts.h>
#endif

View File

@ -5,9 +5,9 @@
Index: arm.ld
===================================================================
--- arm.ld.orig 2007-06-13 11:48:22.000000000 +0100
+++ arm.ld 2007-06-13 11:51:56.000000000 +0100
@@ -26,6 +26,10 @@ SECTIONS
--- arm.ld.orig 2008-04-24 20:15:45.000000000 +0100
+++ arm.ld 2008-04-24 20:16:11.000000000 +0100
@@ -26,6 +26,10 @@
{ *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
.rela.rodata :
{ *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
@ -18,7 +18,7 @@ Index: arm.ld
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
@@ -58,6 +62,9 @@ SECTIONS
@@ -58,6 +62,9 @@
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
__exidx_end = .;
.reginfo : { *(.reginfo) }
@ -30,9 +30,9 @@ Index: arm.ld
. = ALIGN(0x100000) + (. & (0x100000 - 1));
Index: i386.ld
===================================================================
--- i386.ld.orig 2007-06-13 11:48:22.000000000 +0100
+++ i386.ld 2007-06-13 11:51:56.000000000 +0100
@@ -28,6 +28,10 @@ SECTIONS
--- i386.ld.orig 2008-04-24 20:15:45.000000000 +0100
+++ i386.ld 2008-04-24 20:16:11.000000000 +0100
@@ -28,6 +28,10 @@
{ *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
.rela.rodata :
{ *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
@ -43,7 +43,7 @@ Index: i386.ld
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
@@ -53,6 +57,9 @@ SECTIONS
@@ -53,6 +57,9 @@
_etext = .;
PROVIDE (etext = .);
.fini : { *(.fini) } =0x47ff041f

View File

@ -5,9 +5,9 @@
Index: sdl.c
===================================================================
--- sdl.c.orig 2007-12-03 19:32:15.000000000 +0000
+++ sdl.c 2007-12-03 19:34:04.000000000 +0000
@@ -247,7 +247,7 @@ static void sdl_hide_cursor(void)
--- sdl.c.orig 2008-04-24 20:15:45.000000000 +0100
+++ sdl.c 2008-04-24 20:16:12.000000000 +0100
@@ -247,7 +247,7 @@
if (kbd_mouse_is_absolute()) {
SDL_ShowCursor(1);

View File

@ -1,6 +1,8 @@
--- qemu/linux-user/syscall.c1 (revision 16)
+++ qemu/linux-user/syscall.c (working copy)
@@ -441,7 +441,7 @@
Index: trunk/linux-user/syscall.c
===================================================================
--- trunk.orig/linux-user/syscall.c 2008-04-24 20:16:24.000000000 +0100
+++ trunk/linux-user/syscall.c 2008-04-24 20:16:32.000000000 +0100
@@ -440,7 +440,7 @@
if (!new_brk)
return target_brk;
if (new_brk < target_original_brk)
@ -9,7 +11,7 @@
brk_page = HOST_PAGE_ALIGN(target_brk);
@@ -456,12 +456,11 @@
@@ -455,12 +455,11 @@
mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size,
PROT_READ|PROT_WRITE,
MAP_ANON|MAP_FIXED|MAP_PRIVATE, 0, 0));
@ -26,9 +28,11 @@
}
static inline abi_long copy_from_user_fdset(fd_set *fds,
--- qemu/linux-user/mmap.c1 (revision 16)
+++ qemu/linux-user/mmap.c (working copy)
@@ -260,6 +259,9 @@
Index: trunk/linux-user/mmap.c
===================================================================
--- trunk.orig/linux-user/mmap.c 2008-04-24 20:16:16.000000000 +0100
+++ trunk/linux-user/mmap.c 2008-04-24 20:16:32.000000000 +0100
@@ -264,6 +264,9 @@
host_start += offset - host_offset;
start = h2g(host_start);
} else {
@ -38,7 +42,7 @@
if (start & ~TARGET_PAGE_MASK) {
errno = EINVAL;
return -1;
@@ -267,6 +269,14 @@
@@ -271,6 +274,14 @@
end = start + len;
real_end = HOST_PAGE_ALIGN(end);

View File

@ -2,11 +2,11 @@
linux-user/syscall.c | 22 ----------------------
1 file changed, 22 deletions(-)
Index: qemu/linux-user/syscall.c
Index: trunk/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c 2007-12-03 23:40:11.000000000 +0000
+++ qemu/linux-user/syscall.c 2007-12-03 23:40:21.000000000 +0000
@@ -5695,28 +5695,6 @@ abi_long do_syscall(void *cpu_env, int n
--- trunk.orig/linux-user/syscall.c 2008-04-24 20:16:21.000000000 +0100
+++ trunk/linux-user/syscall.c 2008-04-24 20:16:24.000000000 +0100
@@ -5728,28 +5728,6 @@
goto unimplemented_nowarn;
#endif

View File

@ -1,6 +1,8 @@
--- qemu.orig/Makefile 2008-01-29 23:16:27.000000000 -0800
+++ qemu-0.9.1/Makefile 2008-01-29 23:16:38.000000000 -0800
@@ -174,7 +174,7 @@
Index: trunk/Makefile
===================================================================
--- trunk.orig/Makefile 2008-04-24 20:15:37.000000000 +0100
+++ trunk/Makefile 2008-04-24 20:16:30.000000000 +0100
@@ -196,7 +196,7 @@
install: all $(if $(BUILD_DOCS),install-doc)
mkdir -p "$(DESTDIR)$(bindir)"
ifneq ($(TOOLS),)
@ -8,10 +10,12 @@
+ $(INSTALL) -m 755 $(TOOLS) "$(DESTDIR)$(bindir)"
endif
mkdir -p "$(DESTDIR)$(datadir)"
for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
--- qemu.orig/Makefile.target 2008-01-29 23:16:27.000000000 -0800
+++ qemu-0.9.1/Makefile.target 2008-01-29 23:17:33.000000000 -0800
@@ -632,7 +632,7 @@
set -e; for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
Index: trunk/Makefile.target
===================================================================
--- trunk.orig/Makefile.target 2008-04-24 20:15:37.000000000 +0100
+++ trunk/Makefile.target 2008-04-24 20:16:30.000000000 +0100
@@ -685,7 +685,7 @@
install: all
ifneq ($(PROGS),)
@ -19,4 +23,4 @@
+ $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
endif
ifneq ($(wildcard .depend),)
# Include automatically generated dependency files

View File

@ -1,219 +0,0 @@
---
linux-user/main.c | 7 ++-
linux-user/syscall.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 111 insertions(+), 10 deletions(-)
Index: qemu/linux-user/main.c
===================================================================
--- qemu.orig/linux-user/main.c 2007-12-03 19:34:09.000000000 +0000
+++ qemu/linux-user/main.c 2007-12-03 23:44:45.000000000 +0000
@@ -391,7 +391,7 @@ do_kernel_trap(CPUARMState *env)
cpu_unlock();
break;
case 0xffff0fe0: /* __kernel_get_tls */
- env->regs[0] = env->cp15.c13_tls;
+ env->regs[0] = env->cp15.c13_tls2;
break;
default:
return 1;
@@ -2037,6 +2037,11 @@ int main(int argc, char **argv)
int drop_ld_preload = 0, environ_count = 0;
char **target_environ, **wrk, **dst;
+ char *assume_kernel = getenv("QEMU_ASSUME_KERNEL");
+
+ if (assume_kernel)
+ setenv("LD_ASSUME_KERNEL", assume_kernel, 1);
+
if (argc <= 1)
usage();
Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c 2007-12-03 19:34:09.000000000 +0000
+++ qemu/linux-user/syscall.c 2007-12-03 23:46:54.000000000 +0000
@@ -61,6 +61,7 @@
#define tchars host_tchars /* same as target */
#define ltchars host_ltchars /* same as target */
+#include <linux/futex.h>
#include <linux/termios.h>
#include <linux/unistd.h>
#include <linux/utsname.h>
@@ -2694,7 +2695,6 @@ abi_long do_arch_prctl(CPUX86State *env,
return 0;
}
#endif
-
#endif /* defined(TARGET_I386) */
/* this stack is the equivalent of the kernel stack associated with a
@@ -2729,16 +2729,19 @@ int do_fork(CPUState *env, unsigned int
TaskState *ts;
uint8_t *new_stack;
CPUState *new_env;
-
+#if defined(TARGET_I386)
+ uint64_t *new_gdt_table;
+#endif
#ifdef USE_NPTL
unsigned int nptl_flags;
if (flags & CLONE_PARENT_SETTID)
*parent_tidptr = gettid();
#endif
-
if (flags & CLONE_VM) {
ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE);
+ if (!ts)
+ return -ENOMEM;
memset(ts, 0, sizeof(TaskState));
new_stack = ts->stack;
ts->used = 1;
@@ -2750,6 +2753,29 @@ int do_fork(CPUState *env, unsigned int
#if defined(TARGET_I386)
if (!newsp)
newsp = env->regs[R_ESP];
+ new_gdt_table = malloc(9 * 8);
+ if (!new_gdt_table) {
+ free(new_env);
+ return -ENOMEM;
+ }
+ /* Copy main GDT table from parent, but clear TLS entries */
+ memcpy(new_gdt_table, g2h(env->gdt.base), 6 * 8);
+ memset(&new_gdt_table[6], 0, 3 * 8);
+ new_env->gdt.base = h2g(new_gdt_table);
+ if (flags & 0x00080000 /* CLONE_SETTLS */) {
+ ret = do_set_thread_area(new_env, new_env->regs[R_ESI]);
+ if (ret) {
+ free(new_gdt_table);
+ free(new_env);
+ return ret;
+ }
+ }
+ cpu_x86_load_seg(env, R_CS, new_env->regs[R_CS]);
+ cpu_x86_load_seg(env, R_DS, new_env->regs[R_DS]);
+ cpu_x86_load_seg(env, R_ES, new_env->regs[R_ES]);
+ cpu_x86_load_seg(env, R_SS, new_env->regs[R_SS]);
+ cpu_x86_load_seg(env, R_FS, new_env->regs[R_FS]);
+ cpu_x86_load_seg(env, R_GS, new_env->regs[R_GS]);
new_env->regs[R_ESP] = newsp;
new_env->regs[R_EAX] = 0;
#elif defined(TARGET_ARM)
@@ -3121,6 +3147,68 @@ static inline abi_long host_to_target_ti
unlock_user_struct(target_ts, target_addr, 1);
}
+static long do_futex(target_ulong uaddr, int op, uint32_t val,
+ target_ulong utime, target_ulong uaddr2,
+ uint32_t val3)
+{
+ struct timespec host_utime;
+ unsigned long val2 = utime;
+
+ if (utime && (op == FUTEX_WAIT || op == FUTEX_LOCK_PI)) {
+ target_to_host_timespec(&host_utime, utime);
+ val2 = (unsigned long)&host_utime;
+ }
+
+#ifdef BSWAP_NEEDED
+ switch(op) {
+ case FUTEX_CMP_REQUEUE:
+ val3 = tswap32(val3);
+ case FUTEX_REQUEUE:
+ val2 = tswap32(val2);
+ case FUTEX_WAIT:
+ case FUTEX_WAKE:
+ val = tswap32(val);
+ case FUTEX_LOCK_PI: /* This one's icky, but comes out OK */
+ case FUTEX_UNLOCK_PI:
+ break;
+ default:
+ gemu_log("qemu: Unsupported futex op %d\n", op);
+ return -ENOSYS;
+ }
+#if 0 /* No, it's worse than this */
+ if (op == FUTEX_WAKE_OP) {
+ /* Need to munge the secondary operation (val3) */
+ val3 = tswap32(val3);
+ int op2 = (val3 >> 28) & 7;
+ int cmp = (val3 >> 24) & 15;
+ int oparg = (val3 << 8) >> 20;
+ int cmparg = (val3 << 20) >> 20;
+ int shift = val3 & (FUTEX_OP_OPARG_SHIFT << 28);
+
+ if (shift)
+ oparg = (oparg & 7) + 24 - (oparg & 24);
+ else oparg =
+ if (op2 == FUTEX_OP_ADD) {
+ gemu_log("qemu: Unsupported wrong-endian FUTEX_OP_ADD\n");
+ return -ENOSYS;
+ }
+ if (cmparg == FUTEX_OP_CMP_LT || cmparg == FUTEX_OP_CMP_GE ||
+ cmparg == FUTEX_OP_CMP_LE || cmparg == FUTEX_OP_CMP_GT) {
+ gemu_log("qemu: Unsupported wrong-endian futex cmparg %d\n", cmparg);
+ return -ENOSYS;
+ }
+ val3 = shift | (op2<<28) | (cmp<<24) | (oparg<<12) | cmparg;
+ }
+#endif
+#endif
+ return syscall(__NR_futex, g2h(uaddr), op, val, val2, g2h(uaddr2), val3);
+}
+
+int do_set_tid_address(target_ulong tidptr)
+{
+ return syscall(__NR_set_tid_address, g2h(tidptr));
+}
+
/* do_syscall() should always have a single exit point at the end so
that actions, such as logging of syscall results, can be performed.
All errnos that do_syscall() returns must be -TARGET_<errcode>. */
@@ -3145,7 +3233,7 @@ abi_long do_syscall(void *cpu_env, int n
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
- /* XXX: should free thread stack and CPU env */
+ /* XXX: should free thread stack, GDT and CPU env */
_exit(arg1);
ret = 0; /* avoid warning */
break;
@@ -5569,6 +5657,9 @@ abi_long do_syscall(void *cpu_env, int n
#elif defined(TARGET_I386) && defined(TARGET_ABI32)
ret = do_set_thread_area(cpu_env, arg1);
break;
+#elif TARGET_i386
+ ret = get_errno(do_set_thread_area(cpu_env, arg1));
+ break;
#else
goto unimplemented_nowarn;
#endif
@@ -5586,6 +5677,16 @@ abi_long do_syscall(void *cpu_env, int n
goto unimplemented_nowarn;
#endif
+#ifdef TARGET_NR_futex
+ case TARGET_NR_futex:
+ ret = get_errno(do_futex(arg1, arg2, arg3, arg4, arg5, arg6));
+ break;
+#endif
+#ifdef TARGET_NR_set_robust_list
+ case TARGET_NR_set_robust_list:
+ goto unimplemented_nowarn;
+#endif
+
#ifdef TARGET_NR_clock_gettime
case TARGET_NR_clock_gettime:
{
@@ -5627,11 +5728,6 @@ abi_long do_syscall(void *cpu_env, int n
break;
#endif
-#ifdef TARGET_NR_set_robust_list
- case TARGET_NR_set_robust_list:
- goto unimplemented_nowarn;
-#endif
-
#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
case TARGET_NR_utimensat:
{

View File

@ -1,19 +1,3 @@
These are Paul Brook's patches to QEMU-0.8.2 to enable the running of single
ARM binaries under QEMU's user-emulation mode. Without them, QEMU-0.8.1
immediately dies saying:
Error: f0005
qemu: uncaught target signal 6 (Aborted) - exiting
while qemu-0.8.2 dies saying:
qemu: Unsupported syscall: 983045
cannot set up thread-local storage: unknown error
This file is a rediffing of the patches visible at
https://nowt.dyndns.org/patch.qemu_nptl on 27 Sept 2006
which "patch" fails to apply automatically.
See also http://lists.gnu.org/archive/html/qemu-devel/2006-09/msg00194.html
Martin Guy, 27 Sept 2006
---
configure | 25 ++++++
exec-all.h | 165 ------------------------------------------
@ -27,11 +11,11 @@ See also http://lists.gnu.org/archive/html/qemu-devel/2006-09/msg00194.html
target-arm/translate.c | 9 ++
10 files changed, 405 insertions(+), 183 deletions(-)
Index: qemu/configure
Index: trunk/configure
===================================================================
--- qemu.orig/configure 2008-04-09 23:02:37.000000000 +0100
+++ qemu/configure 2008-04-09 23:06:36.000000000 +0100
@@ -109,6 +109,7 @@
--- trunk.orig/configure 2008-04-24 20:16:52.000000000 +0100
+++ trunk/configure 2008-04-24 20:16:53.000000000 +0100
@@ -112,6 +112,7 @@
build_docs="no"
uname_release=""
curses="yes"
@ -39,7 +23,7 @@ Index: qemu/configure
# OS specific
targetos=`uname -s`
@@ -334,6 +335,8 @@
@@ -339,6 +340,8 @@
;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
@ -48,7 +32,7 @@ Index: qemu/configure
esac
done
@@ -429,6 +432,7 @@
@@ -436,6 +439,7 @@
echo " --disable-linux-user disable all linux usermode emulation targets"
echo " --enable-darwin-user enable all darwin usermode emulation targets"
echo " --disable-darwin-user disable all darwin usermode emulation targets"
@ -56,7 +40,7 @@ Index: qemu/configure
echo " --fmod-lib path to FMOD library"
echo " --fmod-inc path to FMOD includes"
echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
@@ -595,6 +599,23 @@
@@ -647,6 +651,23 @@
}
EOF
@ -80,7 +64,7 @@ Index: qemu/configure
##########################################
# SDL probe
@@ -778,6 +799,7 @@
@@ -845,6 +866,7 @@
echo "Documentation $build_docs"
[ ! -z "$uname_release" ] && \
echo "uname -r $uname_release"
@ -88,24 +72,48 @@ Index: qemu/configure
if test $sdl_too_old = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1115,6 +1137,9 @@
echo "TARGET_ARCH=arm" >> $config_mak
echo "#define TARGET_ARCH \"arm\"" >> $config_h
echo "#define TARGET_ARM 1" >> $config_h
+ if test "$nptl" = "yes" ; then
+ echo "#define USE_NPTL 1" >> $config_h
+ fi
bflt="yes"
elif test "$target_cpu" = "sparc" ; then
echo "TARGET_ARCH=sparc" >> $config_mak
Index: qemu/exec-all.h
@@ -1228,6 +1250,9 @@
echo "#define TARGET_ARM 1" >> $config_h
echo "#define CONFIG_NO_DYNGEN_OP 1" >> $config_h
bflt="yes"
+ if test "$nptl" = "yes" ; then
+ echo "#define USE_NPTL 1" >> $config_h
+ fi
;;
cris)
echo "TARGET_ARCH=cris" >> $config_mak
Index: trunk/exec-all.h
===================================================================
--- qemu.orig/exec-all.h 2008-04-09 22:39:38.000000000 +0100
+++ qemu/exec-all.h 2008-04-09 23:05:55.000000000 +0100
@@ -297,170 +297,7 @@
--- trunk.orig/exec-all.h 2008-04-24 20:16:41.000000000 +0100
+++ trunk/exec-all.h 2008-04-24 20:16:53.000000000 +0100
@@ -303,217 +303,7 @@
extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];
extern void *io_mem_opaque[IO_MEM_NB_ENTRIES];
-#if defined(__hppa__)
-
-typedef int spinlock_t[4];
-
-#define SPIN_LOCK_UNLOCKED { 1, 1, 1, 1 }
-
-static inline void resetlock (spinlock_t *p)
-{
- (*p)[0] = (*p)[1] = (*p)[2] = (*p)[3] = 1;
-}
-
-#else
-
-typedef int spinlock_t;
-
-#define SPIN_LOCK_UNLOCKED 0
-
-static inline void resetlock (spinlock_t *p)
-{
- *p = SPIN_LOCK_UNLOCKED;
-}
-
-#endif
-
-#if defined(__powerpc__)
-static inline int testandset (int *p)
-{
@ -205,6 +213,33 @@ Index: qemu/exec-all.h
- : "cc","memory");
- return ret;
-}
-#elif defined(__hppa__)
-
-/* Because malloc only guarantees 8-byte alignment for malloc'd data,
- and GCC only guarantees 8-byte alignment for stack locals, we can't
- be assured of 16-byte alignment for atomic lock data even if we
- specify "__attribute ((aligned(16)))" in the type declaration. So,
- we use a struct containing an array of four ints for the atomic lock
- type and dynamically select the 16-byte aligned int from the array
- for the semaphore. */
-#define __PA_LDCW_ALIGNMENT 16
-static inline void *ldcw_align (void *p) {
- unsigned long a = (unsigned long)p;
- a = (a + __PA_LDCW_ALIGNMENT - 1) & ~(__PA_LDCW_ALIGNMENT - 1);
- return (void *)a;
-}
-
-static inline int testandset (spinlock_t *p)
-{
- unsigned int ret;
- p = ldcw_align(p);
- __asm__ __volatile__("ldcw 0(%1),%0"
- : "=r" (ret)
- : "r" (p)
- : "memory" );
- return !ret;
-}
-
-#elif defined(__ia64)
-
-#include <ia64intrin.h>
@ -237,10 +272,6 @@ Index: qemu/exec-all.h
-#error unimplemented CPU support
-#endif
-
-typedef int spinlock_t;
-
-#define SPIN_LOCK_UNLOCKED 0
-
-#if defined(CONFIG_USER_ONLY)
-static inline void spin_lock(spinlock_t *lock)
-{
@ -249,7 +280,7 @@ Index: qemu/exec-all.h
-
-static inline void spin_unlock(spinlock_t *lock)
-{
- *lock = 0;
- resetlock(lock);
-}
-
-static inline int spin_trylock(spinlock_t *lock)
@ -274,10 +305,10 @@ Index: qemu/exec-all.h
extern spinlock_t tb_lock;
Index: qemu/linux-user/arm/syscall.h
Index: trunk/linux-user/arm/syscall.h
===================================================================
--- qemu.orig/linux-user/arm/syscall.h 2007-11-27 12:09:33.000000000 +0000
+++ qemu/linux-user/arm/syscall.h 2008-04-09 23:05:55.000000000 +0100
--- trunk.orig/linux-user/arm/syscall.h 2008-04-24 20:16:41.000000000 +0100
+++ trunk/linux-user/arm/syscall.h 2008-04-24 20:16:53.000000000 +0100
@@ -28,7 +28,9 @@
#define ARM_SYSCALL_BASE 0x900000
#define ARM_THUMB_SYSCALL 0
@ -289,11 +320,11 @@ Index: qemu/linux-user/arm/syscall.h
#define ARM_NR_semihosting 0x123456
#define ARM_NR_thumb_semihosting 0xAB
Index: qemu/linux-user/main.c
Index: trunk/linux-user/main.c
===================================================================
--- qemu.orig/linux-user/main.c 2008-04-09 23:02:37.000000000 +0100
+++ qemu/linux-user/main.c 2008-04-09 23:05:55.000000000 +0100
@@ -364,6 +364,50 @@
--- trunk.orig/linux-user/main.c 2008-04-24 20:16:47.000000000 +0100
+++ trunk/linux-user/main.c 2008-04-24 20:17:38.000000000 +0100
@@ -365,6 +365,50 @@
}
}
@ -325,7 +356,7 @@ Index: qemu/linux-user/main.c
+ cpu_unlock();
+ break;
+ case 0xffff0fe0: /* __kernel_get_tls */
+ env->regs[0] = env->cp15.c13_tls;
+ env->regs[0] = env->cp15.c13_tls2;
+ break;
+ default:
+ return 1;
@ -344,7 +375,7 @@ Index: qemu/linux-user/main.c
void cpu_loop(CPUARMState *env)
{
int trapnr;
@@ -474,10 +518,8 @@
@@ -475,10 +519,8 @@
}
}
@ -357,7 +388,7 @@ Index: qemu/linux-user/main.c
env->regs[0] = do_arm_semihosting (env);
} else if (n == 0 || n >= ARM_SYSCALL_BASE
|| (env->thumb && n == ARM_THUMB_SYSCALL)) {
@@ -488,14 +530,34 @@
@@ -489,14 +531,34 @@
n -= ARM_SYSCALL_BASE;
env->eabi = 0;
}
@ -400,7 +431,7 @@ Index: qemu/linux-user/main.c
} else {
goto error;
}
@@ -534,6 +596,10 @@
@@ -535,6 +597,10 @@
}
}
break;
@ -411,7 +442,19 @@ Index: qemu/linux-user/main.c
default:
error:
fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
@@ -2402,6 +2468,10 @@
@@ -1994,6 +2060,11 @@
int drop_ld_preload = 0, environ_count = 0;
char **target_environ, **wrk, **dst;
+ char *assume_kernel = getenv("QEMU_ASSUME_KERNEL");
+
+ if (assume_kernel)
+ setenv("LD_ASSUME_KERNEL", assume_kernel, 1);
+
if (argc <= 1)
usage();
@@ -2403,6 +2474,10 @@
ts->heap_base = info->brk;
/* This will be filled in on the first SYS_HEAPINFO call. */
ts->heap_limit = 0;
@ -422,10 +465,10 @@ Index: qemu/linux-user/main.c
#endif
if (gdbstub_port) {
Index: qemu/linux-user/qemu.h
Index: trunk/linux-user/qemu.h
===================================================================
--- qemu.orig/linux-user/qemu.h 2008-01-02 15:48:21.000000000 +0000
+++ qemu/linux-user/qemu.h 2008-04-09 23:05:55.000000000 +0100
--- trunk.orig/linux-user/qemu.h 2008-04-24 20:16:41.000000000 +0100
+++ trunk/linux-user/qemu.h 2008-04-24 20:16:53.000000000 +0100
@@ -107,6 +107,9 @@
uint32_t heap_base;
uint32_t heap_limit;
@ -436,11 +479,19 @@ Index: qemu/linux-user/qemu.h
int used; /* non zero if used */
struct image_info *info;
uint8_t stack[0];
Index: qemu/linux-user/syscall.c
Index: trunk/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c 2008-04-09 23:02:38.000000000 +0100
+++ qemu/linux-user/syscall.c 2008-04-09 23:05:55.000000000 +0100
@@ -71,9 +71,18 @@
--- trunk.orig/linux-user/syscall.c 2008-04-24 20:16:50.000000000 +0100
+++ trunk/linux-user/syscall.c 2008-04-24 20:19:52.000000000 +0100
@@ -61,6 +61,7 @@
#define tchars host_tchars /* same as target */
#define ltchars host_ltchars /* same as target */
+#include <linux/futex.h>
#include <linux/termios.h>
#include <linux/unistd.h>
#include <linux/utsname.h>
@@ -71,9 +72,18 @@
#include <linux/kd.h>
#include "qemu.h"
@ -459,7 +510,14 @@ Index: qemu/linux-user/syscall.c
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
|| defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
/* 16 bit uid wrappers emulation */
@@ -2702,9 +2711,19 @@
@@ -2695,16 +2705,25 @@
return 0;
}
#endif
-
#endif /* defined(TARGET_I386) */
/* this stack is the equivalent of the kernel stack associated with a
thread/process */
#define NEW_STACK_SIZE 8192
@ -479,7 +537,7 @@ Index: qemu/linux-user/syscall.c
cpu_loop(env);
/* never exits */
return 0;
@@ -2712,13 +2731,22 @@
@@ -2712,15 +2731,27 @@
/* do_fork() Must return host values and target errnos (unlike most
do_*() functions). */
@ -492,18 +550,53 @@ Index: qemu/linux-user/syscall.c
TaskState *ts;
uint8_t *new_stack;
CPUState *new_env;
+#if defined(TARGET_I386)
+ uint64_t *new_gdt_table;
+#endif
+#ifdef USE_NPTL
+ unsigned int nptl_flags;
+
+ if (flags & CLONE_PARENT_SETTID)
+ *parent_tidptr = gettid();
+#endif
+
if (flags & CLONE_VM) {
ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE);
+ if (!ts)
+ return -ENOMEM;
memset(ts, 0, sizeof(TaskState));
@@ -2784,16 +2812,67 @@
new_stack = ts->stack;
ts->used = 1;
@@ -2732,6 +2763,29 @@
#if defined(TARGET_I386)
if (!newsp)
newsp = env->regs[R_ESP];
+ new_gdt_table = malloc(9 * 8);
+ if (!new_gdt_table) {
+ free(new_env);
+ return -ENOMEM;
+ }
+ /* Copy main GDT table from parent, but clear TLS entries */
+ memcpy(new_gdt_table, g2h(env->gdt.base), 6 * 8);
+ memset(&new_gdt_table[6], 0, 3 * 8);
+ new_env->gdt.base = h2g(new_gdt_table);
+ if (flags & 0x00080000 /* CLONE_SETTLS */) {
+ ret = do_set_thread_area(new_env, new_env->regs[R_ESI]);
+ if (ret) {
+ free(new_gdt_table);
+ free(new_env);
+ return ret;
+ }
+ }
+ cpu_x86_load_seg(env, R_CS, new_env->regs[R_CS]);
+ cpu_x86_load_seg(env, R_DS, new_env->regs[R_DS]);
+ cpu_x86_load_seg(env, R_ES, new_env->regs[R_ES]);
+ cpu_x86_load_seg(env, R_SS, new_env->regs[R_SS]);
+ cpu_x86_load_seg(env, R_FS, new_env->regs[R_FS]);
+ cpu_x86_load_seg(env, R_GS, new_env->regs[R_GS]);
new_env->regs[R_ESP] = newsp;
new_env->regs[R_EAX] = 0;
#elif defined(TARGET_ARM)
@@ -2784,16 +2838,67 @@
#error unsupported target CPU
#endif
new_env->opaque = ts;
@ -572,7 +665,85 @@ Index: qemu/linux-user/syscall.c
}
return ret;
}
@@ -3118,7 +3197,7 @@
@@ -3052,6 +3157,68 @@
unlock_user_struct(target_ts, target_addr, 1);
}
+static long do_futex(target_ulong uaddr, int op, uint32_t val,
+ target_ulong utime, target_ulong uaddr2,
+ uint32_t val3)
+{
+ struct timespec host_utime;
+ unsigned long val2 = utime;
+
+ if (utime && (op == FUTEX_WAIT || op == FUTEX_LOCK_PI)) {
+ target_to_host_timespec(&host_utime, utime);
+ val2 = (unsigned long)&host_utime;
+ }
+
+#ifdef BSWAP_NEEDED
+ switch(op) {
+ case FUTEX_CMP_REQUEUE:
+ val3 = tswap32(val3);
+ case FUTEX_REQUEUE:
+ val2 = tswap32(val2);
+ case FUTEX_WAIT:
+ case FUTEX_WAKE:
+ val = tswap32(val);
+ case FUTEX_LOCK_PI: /* This one's icky, but comes out OK */
+ case FUTEX_UNLOCK_PI:
+ break;
+ default:
+ gemu_log("qemu: Unsupported futex op %d\n", op);
+ return -ENOSYS;
+ }
+#if 0 /* No, it's worse than this */
+ if (op == FUTEX_WAKE_OP) {
+ /* Need to munge the secondary operation (val3) */
+ val3 = tswap32(val3);
+ int op2 = (val3 >> 28) & 7;
+ int cmp = (val3 >> 24) & 15;
+ int oparg = (val3 << 8) >> 20;
+ int cmparg = (val3 << 20) >> 20;
+ int shift = val3 & (FUTEX_OP_OPARG_SHIFT << 28);
+
+ if (shift)
+ oparg = (oparg & 7) + 24 - (oparg & 24);
+ else oparg =
+ if (op2 == FUTEX_OP_ADD) {
+ gemu_log("qemu: Unsupported wrong-endian FUTEX_OP_ADD\n");
+ return -ENOSYS;
+ }
+ if (cmparg == FUTEX_OP_CMP_LT || cmparg == FUTEX_OP_CMP_GE ||
+ cmparg == FUTEX_OP_CMP_LE || cmparg == FUTEX_OP_CMP_GT) {
+ gemu_log("qemu: Unsupported wrong-endian futex cmparg %d\n", cmparg);
+ return -ENOSYS;
+ }
+ val3 = shift | (op2<<28) | (cmp<<24) | (oparg<<12) | cmparg;
+ }
+#endif
+#endif
+ return syscall(__NR_futex, g2h(uaddr), op, val, val2, g2h(uaddr2), val3);
+}
+
+int do_set_tid_address(target_ulong tidptr)
+{
+ return syscall(__NR_set_tid_address, g2h(tidptr));
+}
+
/* do_syscall() should always have a single exit point at the end so
that actions, such as logging of syscall results, can be performed.
All errnos that do_syscall() returns must be -TARGET_<errcode>. */
@@ -3076,7 +3243,7 @@
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
- /* XXX: should free thread stack and CPU env */
+ /* XXX: should free thread stack, GDT and CPU env */
_exit(arg1);
ret = 0; /* avoid warning */
break;
@@ -3118,7 +3285,7 @@
ret = do_brk(arg1);
break;
case TARGET_NR_fork:
@ -581,7 +752,7 @@ Index: qemu/linux-user/syscall.c
break;
#ifdef TARGET_NR_waitpid
case TARGET_NR_waitpid:
@@ -4481,7 +4560,8 @@
@@ -4482,7 +4649,8 @@
ret = get_errno(fsync(arg1));
break;
case TARGET_NR_clone:
@ -591,7 +762,7 @@ Index: qemu/linux-user/syscall.c
break;
#ifdef __NR_exit_group
/* new thread calls */
@@ -4928,7 +5008,8 @@
@@ -4943,7 +5111,8 @@
#endif
#ifdef TARGET_NR_vfork
case TARGET_NR_vfork:
@ -601,11 +772,34 @@ Index: qemu/linux-user/syscall.c
break;
#endif
#ifdef TARGET_NR_ugetrlimit
Index: qemu/qemu_spinlock.h
@@ -5521,6 +5690,9 @@
#elif defined(TARGET_I386) && defined(TARGET_ABI32)
ret = do_set_thread_area(cpu_env, arg1);
break;
+#elif TARGET_i386
+ ret = get_errno(do_set_thread_area(cpu_env, arg1));
+ break;
#else
goto unimplemented_nowarn;
#endif
@@ -5538,6 +5710,12 @@
goto unimplemented_nowarn;
#endif
+#ifdef TARGET_NR_futex
+ case TARGET_NR_futex:
+ ret = get_errno(do_futex(arg1, arg2, arg3, arg4, arg5, arg6));
+ break;
+#endif
+
#ifdef TARGET_NR_clock_gettime
case TARGET_NR_clock_gettime:
{
Index: trunk/qemu_spinlock.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ qemu/qemu_spinlock.h 2008-04-09 23:05:55.000000000 +0100
@@ -0,0 +1,181 @@
+++ trunk/qemu_spinlock.h 2008-04-24 20:16:53.000000000 +0100
@@ -0,0 +1,250 @@
+/*
+ * Atomic operation helper include
+ *
@ -743,6 +937,33 @@ Index: qemu/qemu_spinlock.h
+}
+#endif
+
+#ifdef __hppa__
+/* Because malloc only guarantees 8-byte alignment for malloc'd data,
+ and GCC only guarantees 8-byte alignment for stack locals, we can't
+ be assured of 16-byte alignment for atomic lock data even if we
+ specify "__attribute ((aligned(16)))" in the type declaration. So,
+ we use a struct containing an array of four ints for the atomic lock
+ type and dynamically select the 16-byte aligned int from the array
+ for the semaphore. */
+#define __PA_LDCW_ALIGNMENT 16
+static inline void *ldcw_align (void *p) {
+ unsigned long a = (unsigned long)p;
+ a = (a + __PA_LDCW_ALIGNMENT - 1) & ~(__PA_LDCW_ALIGNMENT - 1);
+ return (void *)a;
+}
+
+static inline int testandset (spinlock_t *p)
+{
+ unsigned int ret;
+ p = ldcw_align(p);
+ __asm__ __volatile__("ldcw 0(%1),%0"
+ : "=r" (ret)
+ : "r" (p)
+ : "memory" );
+ return !ret;
+}
+#endif
+
+#ifdef __ia64
+#include <ia64intrin.h>
+
@ -752,10 +973,52 @@ Index: qemu/qemu_spinlock.h
+}
+#endif
+
+#ifdef __mips__
+static inline int testandset (int *p)
+{
+ int ret;
+
+ __asm__ __volatile__ (
+ " .set push \n"
+ " .set noat \n"
+ " .set mips2 \n"
+ "1: li $1, 1 \n"
+ " ll %0, %1 \n"
+ " sc $1, %1 \n"
+ " beqz $1, 1b \n"
+ " .set pop "
+ : "=r" (ret), "+R" (*p)
+ :
+ : "memory");
+
+ return ret;
+}
+#endif
+
+#if defined(__hppa__)
+
+typedef int spinlock_t[4];
+
+#define SPIN_LOCK_UNLOCKED { 1, 1, 1, 1 }
+
+static inline void resetlock (spinlock_t *p)
+{
+ (*p)[0] = (*p)[1] = (*p)[2] = (*p)[3] = 1;
+}
+
+#else
+
+typedef int spinlock_t;
+
+#define SPIN_LOCK_UNLOCKED 0
+
+static inline void resetlock (spinlock_t *p)
+{
+ *p = SPIN_LOCK_UNLOCKED;
+}
+
+#endif
+
+#if defined(CONFIG_USER_ONLY)
+static inline void spin_lock(spinlock_t *lock)
+{
@ -764,7 +1027,7 @@ Index: qemu/qemu_spinlock.h
+
+static inline void spin_unlock(spinlock_t *lock)
+{
+ *lock = 0;
+ resetlock(lock);
+}
+
+static inline int spin_trylock(spinlock_t *lock)
@ -787,10 +1050,10 @@ Index: qemu/qemu_spinlock.h
+#endif
+
+#endif
Index: qemu/target-arm/cpu.h
Index: trunk/target-arm/cpu.h
===================================================================
--- qemu.orig/target-arm/cpu.h 2007-11-27 12:09:57.000000000 +0000
+++ qemu/target-arm/cpu.h 2008-04-09 23:05:55.000000000 +0100
--- trunk.orig/target-arm/cpu.h 2008-04-24 20:16:41.000000000 +0100
+++ trunk/target-arm/cpu.h 2008-04-24 20:16:53.000000000 +0100
@@ -38,6 +38,7 @@
#define EXCP_FIQ 6
#define EXCP_BKPT 7
@ -799,7 +1062,7 @@ Index: qemu/target-arm/cpu.h
#define ARMV7M_EXCP_RESET 1
#define ARMV7M_EXCP_NMI 2
@@ -222,6 +223,15 @@
@@ -218,6 +219,15 @@
void cpu_lock(void);
void cpu_unlock(void);
@ -815,36 +1078,19 @@ Index: qemu/target-arm/cpu.h
#define CPSR_M (0x1f)
#define CPSR_T (1 << 5)
#define CPSR_F (1 << 6)
Index: qemu/target-arm/op.c
Index: trunk/target-arm/translate.c
===================================================================
--- qemu.orig/target-arm/op.c 2008-04-09 22:40:01.000000000 +0100
+++ qemu/target-arm/op.c 2008-04-09 23:05:55.000000000 +0100
@@ -994,6 +994,12 @@
cpu_loop_exit();
}
+void OPPROTO op_kernel_trap(void)
+{
+ env->exception_index = EXCP_KERNEL_TRAP;
+ cpu_loop_exit();
+}
+
/* VFP support. We follow the convention used for VFP instrunctions:
Single precition routines have a "s" suffix, double precision a
"d" suffix. */
Index: qemu/target-arm/translate.c
===================================================================
--- qemu.orig/target-arm/translate.c 2008-04-09 22:40:01.000000000 +0100
+++ qemu/target-arm/translate.c 2008-04-09 23:05:55.000000000 +0100
@@ -7496,7 +7496,14 @@
gen_op_exception_exit();
--- trunk.orig/target-arm/translate.c 2008-04-24 20:16:41.000000000 +0100
+++ trunk/target-arm/translate.c 2008-04-24 20:16:53.000000000 +0100
@@ -8606,7 +8606,14 @@
gen_exception(EXCP_EXCEPTION_EXIT);
}
#endif
-
+#ifdef CONFIG_USER_ONLY
+ /* Intercept jump to the magic kernel page. */
+ if (dc->pc > 0xffff0000) {
+ gen_op_kernel_trap();
+ gen_exception(EXCP_KERNEL_TRAP);
+ dc->is_jmp = DISAS_UPDATE;
+ break;
+ }

View File

@ -2,10 +2,10 @@
linux-user/mmap.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: qemu/linux-user/mmap.c
Index: trunk/linux-user/mmap.c
===================================================================
--- qemu.orig/linux-user/mmap.c 2007-12-03 15:40:25.000000000 +0000
+++ qemu/linux-user/mmap.c 2007-12-03 16:37:21.000000000 +0000
--- trunk.orig/linux-user/mmap.c 2008-04-24 20:15:37.000000000 +0100
+++ trunk/linux-user/mmap.c 2008-04-24 20:16:16.000000000 +0100
@@ -29,6 +29,10 @@
//#define DEBUG_MMAP
@ -17,7 +17,7 @@ Index: qemu/linux-user/mmap.c
/* NOTE: all the constants are the HOST ones, but addresses are target. */
int target_mprotect(abi_ulong start, abi_ulong len, int prot)
{
@@ -251,7 +255,7 @@ abi_long target_mmap(abi_ulong start, ab
@@ -251,7 +255,7 @@
especially important if qemu_host_page_size >
qemu_real_host_page_size */
p = mmap(g2h(mmap_start),
@ -26,7 +26,7 @@ Index: qemu/linux-user/mmap.c
if (p == MAP_FAILED)
return -1;
/* update start so that it points to the file position at 'offset' */
@@ -406,7 +410,7 @@ abi_long target_mremap(abi_ulong old_add
@@ -406,7 +410,7 @@
unsigned long host_addr;
/* XXX: use 5 args syscall */

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,4 @@
02_snapshot_use_tmpdir.patch -p0
05_non-fatal_if_linux_hd_missing.patch -p1
05_non-fatal_if_linux_hd_missing.patch
06_exit_segfault.patch -p0
10_signal_jobs.patch -p0
11_signal_sigaction.patch -p0
@ -8,18 +7,19 @@
32_syscall_sysctl.patch -p0
33_syscall_ppc_clone.patch -p0
39_syscall_fadvise64.patch -p0
41_arm_fpa_sigfpe.patch -p0
52_ne2000_return.patch -p1
52_ne2000_return.patch
61_safe_64bit_int.patch -p0
63_sparc_build.patch -p0
64_ppc_asm_constraints.patch -p1
64_ppc_asm_constraints.patch
65_kfreebsd.patch -p0
66_tls_ld.patch -p0
91-oh-sdl-cursor.patch -p0
qemu-0.9.0-nptl.patch -p1
qemu-0.9.0-nptl-update.patch -p1
qemu-amd64-32b-mapping-0.9.0.patch -p1
qemu-0.9.0-nptl.patch
qemu-0.9.0-nptl-update.patch
qemu-amd64-32b-mapping-0.9.0.patch
workaround_bad_futex_headers.patch -p1
fix_segfault.patch -p1
no-strip.patch -p1
fix_segfault.patch
no-strip.patch
fix_brk.patch
fix_protection_bits.patch -p1
qemu-n800-support.patch -p1

View File

@ -1,17 +0,0 @@
---
linux-user/syscall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: qemu-0.9.1/linux-user/syscall.c
===================================================================
--- qemu-0.9.1.orig/linux-user/syscall.c 2008-02-03 00:00:00.000000000 +0000
+++ qemu-0.9.1/linux-user/syscall.c 2008-02-03 00:00:38.000000000 +0000
@@ -1048,7 +1048,7 @@ static abi_long lock_iovec(int type, str
base = tswapl(target_vec[i].iov_base);
vec[i].iov_len = tswapl(target_vec[i].iov_len);
vec[i].iov_base = lock_user(type, base, vec[i].iov_len, copy);
- if (!vec[i].iov_base)
+ if (!vec[i].iov_base && vec[i].iov_len)
goto fail;
}
unlock_user (target_vec, target_addr, 0);

View File

@ -7,7 +7,6 @@ FILESDIR = "${WORKDIR}"
SRC_URI = "\
http://fabrice.bellard.free.fr/qemu/qemu-0.9.1.tar.gz \
file://02_snapshot_use_tmpdir.patch;patch=1;pnum=0 \
file://04_do_not_print_rtc_freq_if_ok.patch;patch=1;pnum=1 \
file://05_non-fatal_if_linux_hd_missing.patch;patch=1;pnum=1 \
file://06_exit_segfault.patch;patch=1;pnum=0 \

View File

@ -1,13 +1,12 @@
LICENSE = "GPL"
DEPENDS = "zlib"
PV = "0.9.1+svnr${SRCREV}"
PR = "r3"
PR = "r5"
FILESPATH = "${FILE_DIRNAME}/qemu-0.9.1+svn/"
SRC_URI = "\
svn://svn.savannah.nongnu.org/qemu;module=trunk \
file://02_snapshot_use_tmpdir.patch;patch=1;pnum=0 \
file://05_non-fatal_if_linux_hd_missing.patch;patch=1;pnum=1 \
file://06_exit_segfault.patch;patch=1;pnum=0 \
file://10_signal_jobs.patch;patch=1;pnum=0 \
@ -17,7 +16,6 @@ SRC_URI = "\
file://32_syscall_sysctl.patch;patch=1;pnum=0 \
file://33_syscall_ppc_clone.patch;patch=1;pnum=0 \
file://39_syscall_fadvise64.patch;patch=1;pnum=0 \
file://41_arm_fpa_sigfpe.patch;patch=1;pnum=0 \
file://52_ne2000_return.patch;patch=1;pnum=1 \
file://61_safe_64bit_int.patch;patch=1;pnum=0 \
file://63_sparc_build.patch;patch=1;pnum=0 \
@ -26,7 +24,6 @@ SRC_URI = "\
file://66_tls_ld.patch;patch=1;pnum=0 \
file://91-oh-sdl-cursor.patch;patch=1;pnum=0 \
file://qemu-0.9.0-nptl.patch;patch=1 \
file://qemu-0.9.0-nptl-update.patch;patch=1 \
file://qemu-amd64-32b-mapping-0.9.0.patch;patch=1 \
file://workaround_bad_futex_headers.patch;patch=1 \
file://fix_segfault.patch;patch=1 \