Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Apr 2014 10:53:51 +0000 (UTC)
From:      Juergen Lock <nox@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r351530 - in head/emulators/qemu-devel: . files
Message-ID:  <201404181053.s3IArp8N097134@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nox
Date: Fri Apr 18 10:53:51 2014
New Revision: 351530
URL: http://svnweb.freebsd.org/changeset/ports/351530
QAT: https://qat.redports.org/buildarchive/r351530/

Log:
  - Update to 2.0.0 - announce message is here:
  
  	http://article.gmane.org/gmane.comp.emulators.qemu/267615
  
  - Take updated bsd-user patches from sbruno's github repo. [1]
  - Add headers to my recent bsd-user patches. (they are applied as in
    the EXTRA_PATCHES order in the port Makefile)
  
  Submitted by:	sbruno [1]
  Obtained from:	https://github.com/seanbruno/qemu/commits/bsd-user [1]

Added:
  head/emulators/qemu-devel/files/extra-patch-38f8d5aaebdb4b1624bae86b374b5265c9f01b54   (contents, props changed)
  head/emulators/qemu-devel/files/extra-patch-3d175d6ed5b809976662135369c639f53780ca5c   (contents, props changed)
  head/emulators/qemu-devel/files/extra-patch-790d0ef625d22ff3f1a895d266a48e2bacd63776   (contents, props changed)
  head/emulators/qemu-devel/files/extra-patch-9ac2c49c734a49025fe1647ce84728d3988ea5d2   (contents, props changed)
  head/emulators/qemu-devel/files/extra-patch-a3129eea10f188bfd39ce83b18b25dcefbc5bffc   (contents, props changed)
  head/emulators/qemu-devel/files/extra-patch-c13_tls2   (contents, props changed)
  head/emulators/qemu-devel/files/extra-patch-fd7ec8e06cd1876ef478975f052ff64134d19c6c   (contents, props changed)
Deleted:
  head/emulators/qemu-devel/files/patch-tcg-i386-tcg-target.c
  head/emulators/qemu-devel/files/prepatch-configure
Modified:
  head/emulators/qemu-devel/Makefile
  head/emulators/qemu-devel/distinfo
  head/emulators/qemu-devel/files/extra-patch-bsd-user-freebsd-os-proc.c
  head/emulators/qemu-devel/files/extra-patch-bsd-user-mips-target_arch_vmparam.h
  head/emulators/qemu-devel/files/extra-patch-bsd-user-mmap.c
  head/emulators/qemu-devel/files/extra-patch-bsd-user-syscall.c
  head/emulators/qemu-devel/files/extra-patch-inherit-interp_prefix
  head/emulators/qemu-devel/files/extra-patch-sysctl-0oldlen
  head/emulators/qemu-devel/files/extra-patch-sysctl-hw-availpages
  head/emulators/qemu-devel/files/patch-configure
  head/emulators/qemu-devel/files/pcap-patch

Modified: head/emulators/qemu-devel/Makefile
==============================================================================
--- head/emulators/qemu-devel/Makefile	Fri Apr 18 10:36:22 2014	(r351529)
+++ head/emulators/qemu-devel/Makefile	Fri Apr 18 10:53:51 2014	(r351530)
@@ -2,8 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	qemu
-PORTVERSION=	1.7.1
-PORTREVISION=	5
+PORTVERSION=	2.0.0
 CATEGORIES=	emulators
 MASTER_SITES=	http://wiki.qemu.org/download/:release \
 		LOCAL/nox:snapshot
@@ -45,27 +44,14 @@ OPTIONS_DEFAULT=X11 GTK2 OPENGL GNUTLS S
 .include <bsd.port.options.mk>
 
 .if ${PORT_OPTIONS:MBSD_USER}
-PATCH_SITES=	http://people.freebsd.org/~sson/qemu/qemu-bsd-user/
-PATCHFILES= \
-	0001-bsd-user-refresh-freebsd-system-call-numbers.patch \
-	0002-bsd-user-add-HOST_VARIANT_DIR-for-various-BSD-depend.patch \
-	0003-bsd-user-move-strace-OS-arch-dependent-code-to-host-.patch \
-	0004-bsd-user-move-arch-OS-dependent-code-out-of-main.c.patch \
-	0005-bsd-user-move-arch-OS-dependent-code-out-of-syscall..patch \
-	0006-bsd-user-add-support-for-freebsd-time-related-system.patch \
-	0007-bsd-user-add-support-for-freebsd-signal-related-syst.patch \
-	0008-bsd-user-move-arch-OS-dependent-code-out-of-elfload..patch \
-	0009-bsd-user-add-support-for-freebsd-process-related-sys.patch \
-	0010-bsd-user-add-support-for-file-system-related-system-.patch \
-	0011-bsd-user-add-support-for-stat-dir-and-fcntl-related-.patch \
-	0012-bsd-user-add-support-for-memory-management-related-s.patch \
-	0013-bsd-user-add-support-for-socket-related-system-calls.patch \
-	0014-bsd-user-add-support-for-thread-related-system-calls.patch \
-	0015-bsd-user-add-support-for-the-ioctl-system-call.patch \
-	0016-bsd-user-add-support-for-extattr-and-ACL-related-sys.patch \
-	0017-bsd-user-add-support-for-miscellaneous-system-calls.patch \
-	0018-bsd-user-add-arm-mips-and-mips64-options-to-configur.patch
-PATCH_DIST_STRIP=	-p1
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-790d0ef625d22ff3f1a895d266a48e2bacd63776
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-3d175d6ed5b809976662135369c639f53780ca5c
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-a3129eea10f188bfd39ce83b18b25dcefbc5bffc
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-fd7ec8e06cd1876ef478975f052ff64134d19c6c
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-9ac2c49c734a49025fe1647ce84728d3988ea5d2
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-38f8d5aaebdb4b1624bae86b374b5265c9f01b54
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-c13_tls2
+#
 EXTRA_PATCHES+=	${FILESDIR}/extra-patch-bsd-user-freebsd-os-proc.c
 EXTRA_PATCHES+=	${FILESDIR}/extra-patch-05ee8495804599b52a88eb36b13ea9c06b3207cd
 EXTRA_PATCHES+=	${FILESDIR}/extra-patch-bsd-user-mips-target_arch_vmparam.h
@@ -97,7 +83,7 @@ CONFIGURE_ARGS+=	--target-list=i386-soft
 CONFIGURE_ARGS+=	--disable-bsd-user
 .else
 .if ${ARCH} != "amd64"
-CONFIGURE_ARGS+=	--target-list=i386-softmmu,x86_64-softmmu,alpha-softmmu,arm-softmmu,cris-softmmu,lm32-softmmu,m68k-softmmu,microblaze-softmmu,microblazeel-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu,or32-softmmu,ppc-softmmu,ppcemb-softmmu,ppc64-softmmu,sh4-softmmu,sh4eb-softmmu,sparc-softmmu,sparc64-softmmu,s390x-softmmu,xtensa-softmmu,xtensaeb-softmmu,unicore32-softmmu,moxie-softmmu,i386-bsd-user,sparc-bsd-user,arm-bsd-user,mips-bsd-user,mipsel-bsd-user
+CONFIGURE_ARGS+=	--target-list=i386-softmmu,x86_64-softmmu,aarch64-softmmu,alpha-softmmu,arm-softmmu,cris-softmmu,lm32-softmmu,m68k-softmmu,microblaze-softmmu,microblazeel-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu,or32-softmmu,ppc-softmmu,ppcemb-softmmu,ppc64-softmmu,sh4-softmmu,sh4eb-softmmu,sparc-softmmu,sparc64-softmmu,s390x-softmmu,xtensa-softmmu,xtensaeb-softmmu,unicore32-softmmu,moxie-softmmu,i386-bsd-user,sparc-bsd-user,arm-bsd-user,mips-bsd-user,mipsel-bsd-user
 .endif
 .endif
 .endif
@@ -144,7 +130,7 @@ USE_SDL=	sdl
 .endif
 
 .if empty(PORT_OPTIONS:MGTK2)
-CONFIGURE_ARGS+=	--disable-gtk
+CONFIGURE_ARGS+=	--disable-gtk --disable-vte
 PLIST_SUB+=	GTK2="@comment "
 .else
 USE_GNOME+=	gtk20 vte
@@ -241,11 +227,6 @@ MAKE_ENV+=	COMPILER_PATH=${LOCALBASE}/bi
 
 CONFIGURE_ARGS+= --python=${PYTHON_CMD}
 
-.if ${PORT_OPTIONS:MBSD_USER}
-pre-patch:
-	@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/prepatch-configure
-.endif
-
 # -lprocstat actually only _needs_ -lelf after r249666 or r250870 (MFC)
 # but it shouldn't matter much
 post-patch:

Modified: head/emulators/qemu-devel/distinfo
==============================================================================
--- head/emulators/qemu-devel/distinfo	Fri Apr 18 10:36:22 2014	(r351529)
+++ head/emulators/qemu-devel/distinfo	Fri Apr 18 10:53:51 2014	(r351530)
@@ -1,38 +1,2 @@
-SHA256 (qemu/1.7.1/qemu-1.7.1.tar.bz2) = d68942a004222eebae5d156ceefb308fabd98edb282d1dde49ec810bbf01bef4
-SIZE (qemu/1.7.1/qemu-1.7.1.tar.bz2) = 12246206
-SHA256 (qemu/1.7.1/0001-bsd-user-refresh-freebsd-system-call-numbers.patch) = 15fa3f286ae03636c9340de0b44ec4fc47e428025f103382a578029db45ec252
-SIZE (qemu/1.7.1/0001-bsd-user-refresh-freebsd-system-call-numbers.patch) = 36542
-SHA256 (qemu/1.7.1/0002-bsd-user-add-HOST_VARIANT_DIR-for-various-BSD-depend.patch) = 021f8c1fdba448c8eeb7a9f8035b8a47b1f463a59ee7da60d733bd63c2924b13
-SIZE (qemu/1.7.1/0002-bsd-user-add-HOST_VARIANT_DIR-for-various-BSD-depend.patch) = 2730
-SHA256 (qemu/1.7.1/0003-bsd-user-move-strace-OS-arch-dependent-code-to-host-.patch) = b0b08af1a4d6e7e660290c9f0293d7ad486c51df8fce29abed9db76143317d8a
-SIZE (qemu/1.7.1/0003-bsd-user-move-strace-OS-arch-dependent-code-to-host-.patch) = 50756
-SHA256 (qemu/1.7.1/0004-bsd-user-move-arch-OS-dependent-code-out-of-main.c.patch) = 184336d1e8a6fabfa4fc6043603ab4f373d1ae80aefd7c57ba23cc36038b81da
-SIZE (qemu/1.7.1/0004-bsd-user-move-arch-OS-dependent-code-out-of-main.c.patch) = 143116
-SHA256 (qemu/1.7.1/0005-bsd-user-move-arch-OS-dependent-code-out-of-syscall..patch) = 352b624cb09223a2c2df6281211719e20964829b5d776a18a8a0b5fe405ac9e3
-SIZE (qemu/1.7.1/0005-bsd-user-move-arch-OS-dependent-code-out-of-syscall..patch) = 44814
-SHA256 (qemu/1.7.1/0006-bsd-user-add-support-for-freebsd-time-related-system.patch) = fa6a24c90f451ba087964c3089b887cc97ef4aec66a251dd0b67279f66134737
-SIZE (qemu/1.7.1/0006-bsd-user-add-support-for-freebsd-time-related-system.patch) = 75063
-SHA256 (qemu/1.7.1/0007-bsd-user-add-support-for-freebsd-signal-related-syst.patch) = e4d78570ab787be5131a9336d06c51309a684a02b612099929f0bea728c99225
-SIZE (qemu/1.7.1/0007-bsd-user-add-support-for-freebsd-signal-related-syst.patch) = 100195
-SHA256 (qemu/1.7.1/0008-bsd-user-move-arch-OS-dependent-code-out-of-elfload..patch) = 6a5083c5257aea2da050cdf47a261b4e883a7b4e8a1410dd7dae4b1499f600c8
-SIZE (qemu/1.7.1/0008-bsd-user-move-arch-OS-dependent-code-out-of-elfload..patch) = 93309
-SHA256 (qemu/1.7.1/0009-bsd-user-add-support-for-freebsd-process-related-sys.patch) = 7e5e99ef2279c3023d21b9540eb9ad9355cd0010dd402cd60ab3abe6c40cb36f
-SIZE (qemu/1.7.1/0009-bsd-user-add-support-for-freebsd-process-related-sys.patch) = 60141
-SHA256 (qemu/1.7.1/0010-bsd-user-add-support-for-file-system-related-system-.patch) = 52f97f394b5c75778e4f003de1033896fdc07c235289a9e91a8771e75bb9fd18
-SIZE (qemu/1.7.1/0010-bsd-user-add-support-for-file-system-related-system-.patch) = 43516
-SHA256 (qemu/1.7.1/0011-bsd-user-add-support-for-stat-dir-and-fcntl-related-.patch) = 5d25f3363080806a939cc985c9866c409006b35840a81f8d3c74f2cb9451ed31
-SIZE (qemu/1.7.1/0011-bsd-user-add-support-for-stat-dir-and-fcntl-related-.patch) = 31292
-SHA256 (qemu/1.7.1/0012-bsd-user-add-support-for-memory-management-related-s.patch) = f9e39e7138ad8c995255a4300b6887fce468296f61467445d3d2438cb6e1a761
-SIZE (qemu/1.7.1/0012-bsd-user-add-support-for-memory-management-related-s.patch) = 37395
-SHA256 (qemu/1.7.1/0013-bsd-user-add-support-for-socket-related-system-calls.patch) = 3e9f586a7327424d449c5a7c9cd7a589d8b14091bbe860cfe00a518bd1f6800c
-SIZE (qemu/1.7.1/0013-bsd-user-add-support-for-socket-related-system-calls.patch) = 46894
-SHA256 (qemu/1.7.1/0014-bsd-user-add-support-for-thread-related-system-calls.patch) = f33d86896466ba39484715253ba9284d6c335b4e0e635150507bad63ef19e113
-SIZE (qemu/1.7.1/0014-bsd-user-add-support-for-thread-related-system-calls.patch) = 67546
-SHA256 (qemu/1.7.1/0015-bsd-user-add-support-for-the-ioctl-system-call.patch) = 90407a8e312ac5f4b3524cd5f65274baea49c4addf04a4614ce356e069983ab3
-SIZE (qemu/1.7.1/0015-bsd-user-add-support-for-the-ioctl-system-call.patch) = 77683
-SHA256 (qemu/1.7.1/0016-bsd-user-add-support-for-extattr-and-ACL-related-sys.patch) = b74903bfa42718edf4db21a2d746ab2c9548694c6dd6a270ea7c6885405505ec
-SIZE (qemu/1.7.1/0016-bsd-user-add-support-for-extattr-and-ACL-related-sys.patch) = 43940
-SHA256 (qemu/1.7.1/0017-bsd-user-add-support-for-miscellaneous-system-calls.patch) = 6238ab7325c95b64544e7e72e7c45e44d4625a2e64851248dbb621b86ac7ed0d
-SIZE (qemu/1.7.1/0017-bsd-user-add-support-for-miscellaneous-system-calls.patch) = 58081
-SHA256 (qemu/1.7.1/0018-bsd-user-add-arm-mips-and-mips64-options-to-configur.patch) = 694159e25187159709d449741446cc3218d31ea7eee47dde4946e8505d48a798
-SIZE (qemu/1.7.1/0018-bsd-user-add-arm-mips-and-mips64-options-to-configur.patch) = 2341
+SHA256 (qemu/2.0.0/qemu-2.0.0.tar.bz2) = 60cc1aa0cad39cec891f970bed60ca8a484f071adad4943123599ac223543a3b
+SIZE (qemu/2.0.0/qemu-2.0.0.tar.bz2) = 12839647

Added: head/emulators/qemu-devel/files/extra-patch-38f8d5aaebdb4b1624bae86b374b5265c9f01b54
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu-devel/files/extra-patch-38f8d5aaebdb4b1624bae86b374b5265c9f01b54	Fri Apr 18 10:53:51 2014	(r351530)
@@ -0,0 +1,29 @@
+diff --git a/bsd-user/freebsd/os-thread.c b/bsd-user/freebsd/os-thread.c
+index 6bf2a9f..bcd2445 100644
+--- a/bsd-user/freebsd/os-thread.c
++++ b/bsd-user/freebsd/os-thread.c
+@@ -899,11 +899,13 @@ abi_long do_freebsd_thr_new(CPUArchState *env,
+     pthread_attr_t attr;
+     TaskState *ts;
+     CPUArchState *new_env;
++    CPUState *new_cpu;
+     struct target_freebsd_thr_param *target_param;
+     abi_ulong target_rtp_addr;
+     struct target_freebsd_rtprio *target_rtp;
+     struct rtprio *rtp_ptr, rtp;
+-    TaskState *parent_ts = (TaskState *)env->opaque;
++    CPUState *parent_cpu = ENV_GET_CPU(env);
++    TaskState *parent_ts = parent_cpu->opaque;
+     sigset_t sigmask;
+     struct sched_param sched_param;
+     int sched_policy;
+@@ -948,7 +950,8 @@ abi_long do_freebsd_thr_new(CPUArchState *env,
+ 
+     /* init regs that differ from the parent thread. */
+     target_cpu_clone_regs(new_env, info.param.stack_base);
+-    new_env->opaque = ts;
++    new_cpu = ENV_GET_CPU(new_env);
++    new_cpu->opaque = ts;
+     ts->bprm = parent_ts->bprm;
+     ts->info = parent_ts->info;
+ 

Added: head/emulators/qemu-devel/files/extra-patch-3d175d6ed5b809976662135369c639f53780ca5c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu-devel/files/extra-patch-3d175d6ed5b809976662135369c639f53780ca5c	Fri Apr 18 10:53:51 2014	(r351530)
@@ -0,0 +1,38 @@
+diff --git a/bsd-user/main.c b/bsd-user/main.c
+index f27fcbc..16a0590 100644
+--- a/bsd-user/main.c
++++ b/bsd-user/main.c
+@@ -272,6 +272,7 @@ void init_task_state(TaskState *ts)
+ CPUArchState *cpu_copy(CPUArchState *env)
+ {
+     CPUArchState *new_env = cpu_init(cpu_model);
++    CPUState *cpu;
+ #if defined(TARGET_HAS_ICE)
+     CPUBreakpoint *bp;
+     CPUWatchpoint *wp;
+@@ -281,18 +282,19 @@ CPUArchState *cpu_copy(CPUArchState *env)
+     cpu_reset(ENV_GET_CPU(new_env));
+ 
+     memcpy(new_env, env, sizeof(CPUArchState));
++    cpu = ENV_GET_CPU(env);
+ 
+     /* Clone all break/watchpoints.
+        Note: Once we support ptrace with hw-debug register access, make sure
+        BP_CPU break/watchpoints are handled correctly on clone. */
+-    QTAILQ_INIT(&env->breakpoints);
+-    QTAILQ_INIT(&env->watchpoints);
++    QTAILQ_INIT(&cpu->breakpoints);
++    QTAILQ_INIT(&cpu->watchpoints);
+ #if defined(TARGET_HAS_ICE)
+-    QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
+-        cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
++    QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
++        cpu_breakpoint_insert(cpu, bp->pc, bp->flags, NULL);
+     }
+-    QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
+-        cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
++    QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
++        cpu_watchpoint_insert(cpu, wp->vaddr, (~wp->len_mask) + 1,
+                               wp->flags, NULL);
+     }
+ #endif

Added: head/emulators/qemu-devel/files/extra-patch-790d0ef625d22ff3f1a895d266a48e2bacd63776
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu-devel/files/extra-patch-790d0ef625d22ff3f1a895d266a48e2bacd63776	Fri Apr 18 10:53:51 2014	(r351530)
@@ -0,0 +1,30291 @@
+diff --git a/Makefile.target b/Makefile.target
+index ba12340..9e9a913 100644
+--- a/Makefile.target
++++ b/Makefile.target
+@@ -99,10 +99,11 @@ endif #CONFIG_LINUX_USER
+ 
+ ifdef CONFIG_BSD_USER
+ 
+-QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR)
++QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
++			 -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
+ 
+ obj-y += bsd-user/
+-obj-y += gdbstub.o user-exec.o
++obj-y += gdbstub.o thunk.o user-exec.o
+ 
+ endif #CONFIG_BSD_USER
+ 
+diff --git a/bsd-user/Makefile.objs b/bsd-user/Makefile.objs
+index 5e77f57..ab025a4 100644
+--- a/bsd-user/Makefile.objs
++++ b/bsd-user/Makefile.objs
+@@ -1,2 +1,6 @@
+ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
+-	        uaccess.o
++	        uaccess.o bsd-ioctl.o bsd-mem.o bsd-misc.o bsd-proc.o bsd-socket.o \
++			$(HOST_VARIANT_DIR)/os-extattr.o $(HOST_VARIANT_DIR)/os-proc.o \
++			$(HOST_VARIANT_DIR)/os-socket.o $(HOST_VARIANT_DIR)/os-stat.o \
++			$(HOST_VARIANT_DIR)/os-sys.o $(HOST_VARIANT_DIR)/os-thread.o \
++			$(HOST_VARIANT_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
+diff --git a/bsd-user/arm/syscall.h b/bsd-user/arm/syscall.h
+new file mode 100644
+index 0000000..bc3d6e6
+--- /dev/null
++++ b/bsd-user/arm/syscall.h
+@@ -0,0 +1,36 @@
++#ifndef __ARCH_SYSCALL_H_
++#define __ARCH_SYSCALL_H_
++
++struct target_pt_regs {
++    abi_long uregs[17];
++};
++
++#define ARM_cpsr    uregs[16]
++#define ARM_pc      uregs[15]
++#define ARM_lr      uregs[14]
++#define ARM_sp      uregs[13]
++#define ARM_ip      uregs[12]
++#define ARM_fp      uregs[11]
++#define ARM_r10     uregs[10]
++#define ARM_r9      uregs[9]
++#define ARM_r8      uregs[8]
++#define ARM_r7      uregs[7]
++#define ARM_r6      uregs[6]
++#define ARM_r5      uregs[5]
++#define ARM_r4      uregs[4]
++#define ARM_r3      uregs[3]
++#define ARM_r2      uregs[2]
++#define ARM_r1      uregs[1]
++#define ARM_r0      uregs[0]
++
++#define ARM_SYSCALL_BASE    0 /* XXX: FreeBSD only */
++
++#define TARGET_FREEBSD_ARM_SYNC_ICACHE      0
++#define TARGET_FREEBSD_ARM_DRAIN_WRITEBUF   1
++#define TARGET_FREEBSD_ARM_SET_TP       2
++#define TARGET_FREEBSD_ARM_GET_TP       3
++
++#define TARGET_HW_MACHINE       "arm"
++#define TARGET_HW_MACHINE_ARCH  "armv6"
++
++#endif /* !__ARCH_SYSCALL_H_ */
+diff --git a/bsd-user/arm/target_arch.h b/bsd-user/arm/target_arch.h
+new file mode 100644
+index 0000000..b5c5ddb
+--- /dev/null
++++ b/bsd-user/arm/target_arch.h
+@@ -0,0 +1,10 @@
++
++#ifndef _TARGET_ARCH_H_
++#define _TARGET_ARCH_H_
++
++#include "qemu.h"
++
++void target_cpu_set_tls(CPUARMState *env, target_ulong newtls);
++target_ulong target_cpu_get_tls(CPUARMState *env);
++
++#endif /* !_TARGET_ARCH_H_ */
+diff --git a/bsd-user/arm/target_arch_cpu.c b/bsd-user/arm/target_arch_cpu.c
+new file mode 100644
+index 0000000..d94a32a
+--- /dev/null
++++ b/bsd-user/arm/target_arch_cpu.c
+@@ -0,0 +1,27 @@
++/*
++ *  arm cpu related code
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; either version 2 of the License, or
++ *  (at your option) any later version.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++#include "target_arch.h"
++
++void target_cpu_set_tls(CPUARMState *env, target_ulong newtls)
++{
++    env->cp15.c13_tls2 = newtls;
++}
++
++target_ulong target_cpu_get_tls(CPUARMState *env)
++{
++    return (env->cp15.c13_tls2);
++}
+diff --git a/bsd-user/arm/target_arch_cpu.h b/bsd-user/arm/target_arch_cpu.h
+new file mode 100644
+index 0000000..3eeb34a
+--- /dev/null
++++ b/bsd-user/arm/target_arch_cpu.h
+@@ -0,0 +1,375 @@
++/*
++ *  arm cpu init and loop
++ *
++ *  Olivier Houchard
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; either version 2 of the License, or
++ *  (at your option) any later version.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifndef _TARGET_ARCH_CPU_H_
++#define _TARGET_ARCH_CPU_H_
++
++#include "target_arch.h"
++
++// #define DEBUG_PRINTF(...) fprintf(stderr, __VA_ARGS__)
++#define DEBUG_PRINTF(...)
++
++#define TARGET_DEFAULT_CPU_MODEL "any"
++
++#define TARGET_CPU_RESET(env)
++
++static inline void target_cpu_init(CPUARMState *env,
++        struct target_pt_regs *regs)
++{
++    int i;
++
++    cpsr_write(env, regs->uregs[16], 0xffffffff);
++    for (i = 0; i < 16; i++) {
++        env->regs[i] = regs->uregs[i];
++    }
++}
++
++static inline int do_strex(CPUARMState *env)
++{
++    uint32_t val;
++    int size;
++    int rc = 1;
++    int segv = 0;
++    uint32_t addr;
++    start_exclusive();
++    addr = env->exclusive_addr;
++    if (addr != env->exclusive_test) {
++        goto fail;
++    }
++    size = env->exclusive_info & 0xf;
++    switch (size) {
++    case 0:
++        segv = get_user_u8(val, addr);
++        break;
++    case 1:
++        segv = get_user_u16(val, addr);
++        break;
++    case 2:
++    case 3:
++        segv = get_user_u32(val, addr);
++        break;
++    default:
++        abort();
++    }
++    if (segv) {
++        env->cp15.c6_data = addr;
++        goto done;
++    }
++    if (val != env->exclusive_val) {
++        goto fail;
++    }
++    if (size == 3) {
++        segv = get_user_u32(val, addr + 4);
++        if (segv) {
++            env->cp15.c6_data = addr + 4;
++            goto done;
++        }
++        if (val != env->exclusive_high) {
++            goto fail;
++        }
++    }
++    val = env->regs[(env->exclusive_info >> 8) & 0xf];
++    switch (size) {
++    case 0:
++        segv = put_user_u8(val, addr);
++        break;
++    case 1:
++        segv = put_user_u16(val, addr);
++        break;
++    case 2:
++    case 3:
++        segv = put_user_u32(val, addr);
++        break;
++    }
++    if (segv) {
++        env->cp15.c6_data = addr;
++        goto done;
++    }
++    if (size == 3) {
++        val = env->regs[(env->exclusive_info >> 12) & 0xf];
++        segv = put_user_u32(val, addr + 4);
++        if (segv) {
++            env->cp15.c6_data = addr + 4;
++            goto done;
++        }
++    }
++    rc = 0;
++fail:
++    env->regs[15] += 4;
++    env->regs[(env->exclusive_info >> 4) & 0xf] = rc;
++done:
++    end_exclusive();
++    return segv;
++}
++
++static inline void target_cpu_loop(CPUARMState *env)
++{
++    int trapnr;
++    target_siginfo_t info;
++    unsigned int n;
++    uint32_t addr;
++    CPUState *cs = CPU(arm_env_get_cpu(env));
++
++    for (;;) {
++        DEBUG_PRINTF("CPU_LOOPING\n");
++        cpu_exec_start(cs);
++        DEBUG_PRINTF("EXECUTING...\n");
++        trapnr = cpu_arm_exec(env);
++        DEBUG_PRINTF("trapnr %d\n", trapnr);
++        cpu_exec_end(cs);
++        switch (trapnr) {
++        case EXCP_UDEF:
++            {
++                /* See arm/arm/undefined.c undefinedinstruction(); */
++                info.si_addr = env->regs[15];
++
++                /*
++                 * Make sure the PC is correctly aligned. (It should
++                 * be.)
++                 */
++                if ((info.si_addr & 3) != 0) {
++                    info.si_signo = SIGILL;
++                    info.si_errno = 0;
++                    info.si_code = TARGET_ILL_ILLADR;
++                    queue_signal(env, info.si_signo, &info);
++                } else {
++                    int rc = 0;
++#ifdef NOT_YET
++                    uint32_t opcode;
++
++                    /*
++                     * Get the opcode.
++                     *
++                     * FIXME - what to do if get_user() fails?
++                     */
++                    get_user_u32(opcode, env->regs[15]);
++
++                    /* Check the opcode with CP handlers we may have. */
++                    rc = EmulateAll(opcode, &ts-fpa, env);
++#endif /* NOT_YET */
++                    if (rc == 0) {
++                        /* illegal instruction */
++                        info.si_signo = SIGILL;
++                        info.si_errno = 0;
++                        info.si_code = TARGET_ILL_ILLOPC;
++                        queue_signal(env, info.si_signo, &info);
++                    }
++                }
++            }
++            break;
++        case EXCP_SWI:
++        case EXCP_BKPT:
++            {
++                unsigned int insn;
++#ifdef FREEBSD_ARM_OABI
++                env->eabi = 0;
++#else
++                env->eabi = 1;
++#endif
++                /*
++                 * system call
++                 * See arm/arm/trap.c cpu_fetch_syscall_args()
++                 */
++                if (trapnr == EXCP_BKPT) {
++                    if (env->thumb) {
++                        if (env->eabi) {
++                            n = env->regs[7];
++                        } else {
++                            /* FIXME - what to do if get_user() fails? */
++                            get_user_u16(insn, env->regs[15]);
++                            n = insn & 0xff;
++                        }
++                        env->regs[15] += 2;
++                    } else {
++                        if (env->eabi) {
++                            n = env->regs[7];
++                        } else {
++                            /* FIXME - what to do if get_user() fails? */
++                            get_user_u32(insn, env->regs[15]);
++                            n = (insn & 0xf) | ((insn >> 4) & 0xff0);
++                        }
++                        env->regs[15] += 4;
++                    }
++                } else { /* trapnr != EXCP_BKPT */
++                    if (env->thumb) {
++                        if (env->eabi) {
++                            n = env->regs[7];
++                        } else {
++                            /* FIXME - what to do if get_user() fails? */
++                            get_user_u16(insn, env->regs[15] - 2);
++                            n = insn & 0xff;
++                        }
++                    } else {
++                        if (env->eabi) {
++                            n = env->regs[7];
++                        } else {
++                            /* FIXME - what to do if get_user() fails? */
++                            get_user_u32(insn, env->regs[15] - 4);
++                            n = insn & 0xffffff;
++                        }
++                    }
++                }
++                DEBUG_PRINTF("AVANT CALL %d\n", n);
++                if (bsd_type == target_freebsd) {
++                    int ret;
++                    abi_ulong params = get_sp_from_cpustate(env);
++                    int32_t syscall_nr = n;
++                    int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8;
++
++                    /* See arm/arm/trap.c cpu_fetch_syscall_args() */
++                    if (syscall_nr == TARGET_FREEBSD_NR_syscall) {
++                        syscall_nr = env->regs[0];
++                        arg1 = env->regs[1];
++                        arg2 = env->regs[2];
++                        arg3 = env->regs[3];
++                        get_user_s32(arg4, params);
++                        params += sizeof(int32_t);
++                        get_user_s32(arg5, params);
++                        params += sizeof(int32_t);
++                        get_user_s32(arg6, params);
++                        params += sizeof(int32_t);
++                        get_user_s32(arg7, params);
++                        arg8 = 0;
++                    } else if (syscall_nr == TARGET_FREEBSD_NR___syscall) {
++#ifdef TARGET_WORDS_BIGENDIAN
++                        syscall_nr = env->regs[1];
++#else
++                        syscall_nr = env->regs[0];
++#endif
++                        arg1 = env->regs[2];
++                        arg2 = env->regs[3];
++                        get_user_s32(arg3, params);
++                        params += sizeof(int32_t);
++                        get_user_s32(arg4, params);
++                        params += sizeof(int32_t);
++                        get_user_s32(arg5, params);
++                        params += sizeof(int32_t);
++                        get_user_s32(arg6, params);
++                        arg7 = 0;
++                        arg8 = 0;
++                    } else {
++                        arg1 = env->regs[0];
++                        arg2 = env->regs[1];
++                        arg3 = env->regs[2];
++                        arg4 = env->regs[3];
++                        get_user_s32(arg5, params);
++                        params += sizeof(int32_t);
++                        get_user_s32(arg6, params);
++                        params += sizeof(int32_t);
++                        get_user_s32(arg7, params);
++                        params += sizeof(int32_t);
++                        get_user_s32(arg8, params);
++                    }
++                    ret = do_freebsd_syscall(env, syscall_nr, arg1, arg2, arg3,
++                            arg4, arg5, arg6, arg7, arg8);
++                    /*
++                     * Compare to arm/arm/vm_machdep.c
++                     * cpu_set_syscall_retval()
++                     */
++                    /* XXX armeb may need some extra magic here */
++                    if (-TARGET_EJUSTRETURN == ret) {
++                        /*
++                         * Returning from a successful sigreturn syscall.
++                         * Avoid clobbering register state.
++                         */
++                        break;
++                    }
++                    /*
++                     * XXX Need to handle ERESTART. Backup the PC by
++                     * 1 instruction.
++                     */
++                    if ((unsigned int)ret >= (unsigned int)(-515)) {
++                        ret = -ret;
++                        cpsr_write(env, CPSR_C, CPSR_C);
++                        env->regs[0] = ret;
++                    } else {
++                        cpsr_write(env, 0, CPSR_C);
++                        env->regs[0] = ret; /* XXX need to handle lseek()? */
++                        /* env->regs[1] = 0; */
++                    }
++                } /* else if (bsd_type == target_openbsd)... */
++                else {
++                    fprintf(stderr, "qemu: bsd_type (= %d) syscall "
++                            "not supported\n", bsd_type);
++                }
++                DEBUG_PRINTF("APRES CALL\n");
++            }
++            break;
++        case EXCP_INTERRUPT:
++            /* just indicate that signals should be handled asap */
++            break;
++        case EXCP_PREFETCH_ABORT:
++            /* See arm/arm/trap.c prefetch_abort_handler() */
++            addr = env->cp15.c6_insn;
++            goto do_segv;
++        case EXCP_DATA_ABORT:
++            /* See arm/arm/trap.c data_abort_handler() */
++            addr = env->cp15.c6_data;
++        do_segv:
++            {
++                info.si_signo = SIGSEGV;
++                info.si_errno = 0;
++                /* XXX: check env->error_code */
++                info.si_code = 0;
++                info.si_addr = addr;
++                queue_signal(env, info.si_signo, &info);
++            }
++            break;
++        case EXCP_DEBUG:
++            {
++                int sig;
++
++                sig = gdb_handlesig(cs, TARGET_SIGTRAP);
++                if (sig) {
++                    info.si_signo = sig;
++                    info.si_errno = 0;
++                    info.si_code = TARGET_TRAP_BRKPT;
++                    queue_signal(env, info.si_signo, &info);
++                }
++            }
++            break;
++        /* XXX case EXCP_KERNEL_TRAP: */
++        case EXCP_STREX:
++            if (do_strex(env)) {
++                addr = env->cp15.c6_data;
++                goto do_segv;
++            }
++            break;
++        default:
++            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
++                    trapnr);
++            cpu_dump_state(cs, stderr, fprintf, 0);
++            abort();
++        } /* switch() */
++        process_pending_signals(env);
++    } /* for (;;) */
++}
++
++static inline void target_cpu_clone_regs(CPUARMState *env, target_ulong newsp)
++{
++    if (newsp)
++        env->regs[13] = newsp;
++    env->regs[0] = 0;
++}
++
++static inline void target_cpu_reset(CPUArchState *cpu)
++{
++}
++
++#endif /* !_TARGET_ARCH_CPU_H */
+diff --git a/bsd-user/arm/target_arch_elf.h b/bsd-user/arm/target_arch_elf.h
+new file mode 100644
+index 0000000..c408cea
+--- /dev/null
++++ b/bsd-user/arm/target_arch_elf.h
+@@ -0,0 +1,54 @@
++/*
++ *  arm ELF definitions
++ *
++ *  Copyright (c) 2013 Stacey D. Son
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; either version 2 of the License, or
++ *  (at your option) any later version.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++#ifndef _TARGET_ARCH_ELF_H_
++#define _TARGET_ARCH_ELF_H_
++
++#define ELF_START_MMAP 0x80000000
++
++#define elf_check_arch(x) ( (x) == EM_ARM )
++
++#define ELF_CLASS       ELFCLASS32
++#ifdef TARGET_WORDS_BIGENDIAN
++#define ELF_DATA        ELFDATA2MSB
++#else
++#define ELF_DATA        ELFDATA2LSB
++#endif
++#define ELF_ARCH        EM_ARM
++
++#define USE_ELF_CORE_DUMP
++#define ELF_EXEC_PAGESIZE       4096
++
++enum
++{
++  ARM_HWCAP_ARM_SWP       = 1 << 0,
++  ARM_HWCAP_ARM_HALF      = 1 << 1,
++  ARM_HWCAP_ARM_THUMB     = 1 << 2,
++  ARM_HWCAP_ARM_26BIT     = 1 << 3,
++  ARM_HWCAP_ARM_FAST_MULT = 1 << 4,
++  ARM_HWCAP_ARM_FPA       = 1 << 5,
++  ARM_HWCAP_ARM_VFP       = 1 << 6,
++  ARM_HWCAP_ARM_EDSP      = 1 << 7,
++};
++
++#define ELF_HWCAP (ARM_HWCAP_ARM_SWP | ARM_HWCAP_ARM_HALF              \
++                    | ARM_HWCAP_ARM_THUMB | ARM_HWCAP_ARM_FAST_MULT     \
++                    | ARM_HWCAP_ARM_FPA | ARM_HWCAP_ARM_VFP)
++
++
++#endif /* _TARGET_ARCH_ELF_H_ */
+diff --git a/bsd-user/arm/target_arch_signal.h b/bsd-user/arm/target_arch_signal.h
+new file mode 100644
+index 0000000..048bd4f
+--- /dev/null
++++ b/bsd-user/arm/target_arch_signal.h
+@@ -0,0 +1,257 @@
++/*
++ *  arm signal definitions
++ *
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; either version 2 of the License, or
++ *  (at your option) any later version.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++#ifndef _TARGET_ARCH_SIGNAL_H_
++#define _TARGET_ARCH_SIGNAL_H_
++
++#include "cpu.h"
++
++#define TARGET_REG_R0   0
++#define TARGET_REG_R1   1
++#define TARGET_REG_R2   2
++#define TARGET_REG_R3   3
++#define TARGET_REG_R4   4
++#define TARGET_REG_R5   5
++#define TARGET_REG_R6   6
++#define TARGET_REG_R7   7
++#define TARGET_REG_R8   8
++#define TARGET_REG_R9   9
++#define TARGET_REG_R10  10
++#define TARGET_REG_R11  11
++#define TARGET_REG_R12  12
++#define TARGET_REG_R13  13
++#define TARGET_REG_R14  14
++#define TARGET_REG_R15  15
++#define TARGET_REG_CPSR 16
++#define TARGET__NGREG   17
++/* Convenience synonyms */
++#define TARGET_REG_FP   TARGET_REG_R11
++#define TARGET_REG_SP   TARGET_REG_R13
++#define TARGET_REG_LR   TARGET_REG_R14
++#define TARGET_REG_PC   TARGET_REG_R15
++
++#define TARGET_INSN_SIZE    4       /* arm instruction size */
++
++/* Size of the signal trampolin code. See _sigtramp(). */
++#define TARGET_SZSIGCODE    ((abi_ulong)(8 * TARGET_INSN_SIZE))
++
++/* compare to arm/include/_limits.h */
++#define TARGET_MINSIGSTKSZ  (1024 * 4)                  /* min sig stack size */
++#define TARGET_SIGSTKSZ     (TARGET_MINSIGSTKSZ + 32768)  /* recommended size */
++
++/* arm/arm/machdep.c */
++#define TARGET_MC_GET_CLEAR_RET 0x0001
++#define TARGET_MC_ADD_MAGIC     0x0002
++#define TARGET_MC_SET_ONSTACK   0x0004
++
++struct target_sigcontext {
++    target_sigset_t sc_mask;    /* signal mask to retstore */
++    int32_t     sc_onstack;     /* sigstack state to restore */
++    abi_long    sc_pc;          /* pc at time of signal */
++    abi_long    sc_reg[32];     /* processor regs 0 to 31 */
++    abi_long    mullo, mulhi;   /* mullo and mulhi registers */
++    int32_t     sc_fpused;      /* fp has been used */
++    abi_long    sc_fpregs[33];  /* fp regs 0 to 31 & csr */
++    abi_long    sc_fpc_eir;     /* fp exception instr reg */
++    /* int32_t reserved[8]; */
++};
++
++typedef struct {
++    uint32_t    __fp_fpsr;
++    struct {
++        uint32_t    __fp_exponent;
++        uint32_t    __fp_mantissa_hi;
++        uint32_t    __fp_mantissa_lo;
++    }       __fp_fr[8];
++} target__fpregset_t;
++
++typedef struct {
++    uint32_t    __vfp_fpscr;
++    uint32_t    __vfp_fstmx[33];
++    uint32_t    __vfp_fpsid;
++} target__vfpregset_t;
++
++typedef struct target_mcontext {
++    uint32_t        __gregs[TARGET__NGREG];
++    union {
++        target__fpregset_t  __fpregs;
++        target__vfpregset_t __vfpregs;
++    } __fpu;
++} target_mcontext_t;
++
++typedef struct target_ucontext {
++    target_sigset_t     uc_sigmask;
++    target_mcontext_t   uc_mcontext;
++    abi_ulong           uc_link;
++    target_stack_t      uc_stack;
++    int32_t             uc_flags;
++    int32_t             __spare__[4];
++} target_ucontext_t;
++
++struct target_sigframe {
++    target_siginfo_t    sf_si;  /* saved siginfo */
++    target_ucontext_t   sf_uc;  /* saved ucontext */
++};
++
++
++/* compare to sys/arm/include/frame.h */
++struct target_trapframe {
++    abi_ulong tf_spsr; /* Zero on arm26 */
++    abi_ulong tf_r0;
++    abi_ulong tf_r1;
++    abi_ulong tf_r2;
++    abi_ulong tf_r3;
++    abi_ulong tf_r4;
++    abi_ulong tf_r5;
++    abi_ulong tf_r6;
++    abi_ulong tf_r7;
++    abi_ulong tf_r8;
++    abi_ulong tf_r9;
++    abi_ulong tf_r10;
++    abi_ulong tf_r11;
++    abi_ulong tf_r12;
++    abi_ulong tf_usr_sp;
++    abi_ulong tf_usr_lr;
++    abi_ulong tf_svc_sp; /* Not used on arm26 */
++    abi_ulong tf_svc_lr; /* Not used on arm26 */
++    abi_ulong tf_pc;
++};
++
++/*
++ * Compare to arm/arm/machdep.c sendsig()
++ * Assumes that target stack frame memory is locked.
++ */
++static inline abi_long
++set_sigtramp_args(CPUARMState *regs, int sig, struct target_sigframe *frame,
++    abi_ulong frame_addr, struct target_sigaction *ka)
++{
++    /*
++     * Arguments to signal handler:
++     *  r0 = signal number
++     *  r1 = siginfo pointer
++     *  r2 = ucontext pointer
++     *  r5 = ucontext pointer
++     *  pc = signal handler pointer
++     *  sp = sigframe struct pointer
++     *  lr = sigtramp at base of user stack
++     */
++
++    regs->regs[0] = sig;
++    regs->regs[1] = frame_addr +
++        offsetof(struct target_sigframe, sf_si);
++    regs->regs[2] = frame_addr +
++        offsetof(struct target_sigframe, sf_uc);
++
++    /* the trampoline uses r5 as the uc address */
++    regs->regs[5] = frame_addr +
++        offsetof(struct target_sigframe, sf_uc);
++    regs->regs[TARGET_REG_PC] = ka->_sa_handler;
++    regs->regs[TARGET_REG_SP] = frame_addr;
++    regs->regs[TARGET_REG_LR] = TARGET_PS_STRINGS - TARGET_SZSIGCODE;
++
++    return 0;
++}
++
++/*
++ * Compare to arm/arm/machdep.c get_mcontext()
++ * Assumes that the memory is locked if mcp points to user memory.
++ */
++static inline abi_long get_mcontext(CPUARMState *regs, target_mcontext_t *mcp,
++        int flags)
++{
++    int err = 0;
++    uint32_t *gr = mcp->__gregs;
++
++
++    if (flags & TARGET_MC_GET_CLEAR_RET) {
++        gr[TARGET_REG_R0] = 0;
++    } else {
++        gr[TARGET_REG_R0] = tswap32(regs->regs[0]);
++    }
++
++    gr[TARGET_REG_R1] = tswap32(regs->regs[1]);
++    gr[TARGET_REG_R2] = tswap32(regs->regs[2]);
++    gr[TARGET_REG_R3] = tswap32(regs->regs[3]);
++    gr[TARGET_REG_R4] = tswap32(regs->regs[4]);
++    gr[TARGET_REG_R5] = tswap32(regs->regs[5]);
++    gr[TARGET_REG_R6] = tswap32(regs->regs[6]);
++    gr[TARGET_REG_R7] = tswap32(regs->regs[7]);
++    gr[TARGET_REG_R8] = tswap32(regs->regs[8]);
++    gr[TARGET_REG_R9] = tswap32(regs->regs[9]);
++    gr[TARGET_REG_R10] = tswap32(regs->regs[10]);
++    gr[TARGET_REG_R11] = tswap32(regs->regs[11]);
++    gr[TARGET_REG_R12] = tswap32(regs->regs[12]);
++
++    gr[TARGET_REG_SP] = tswap32(regs->regs[13]);
++    gr[TARGET_REG_LR] = tswap32(regs->regs[14]);
++    gr[TARGET_REG_PC] = tswap32(regs->regs[15]);
++    gr[TARGET_REG_CPSR] = tswap32(cpsr_read(regs));
++
++    return err;
++}
++
++/* Compare to arm/arm/machdep.c set_mcontext() */
++static inline abi_long set_mcontext(CPUARMState *regs, target_mcontext_t *mcp,
++        int srflag)
++{
++    int err = 0;
++    const uint32_t *gr = mcp->__gregs;
++    uint32_t cpsr;
++
++    regs->regs[0] = tswap32(gr[TARGET_REG_R0]);
++    regs->regs[1] = tswap32(gr[TARGET_REG_R1]);
++    regs->regs[2] = tswap32(gr[TARGET_REG_R2]);
++    regs->regs[3] = tswap32(gr[TARGET_REG_R3]);
++    regs->regs[4] = tswap32(gr[TARGET_REG_R4]);
++    regs->regs[5] = tswap32(gr[TARGET_REG_R5]);
++    regs->regs[6] = tswap32(gr[TARGET_REG_R6]);
++    regs->regs[7] = tswap32(gr[TARGET_REG_R7]);
++    regs->regs[8] = tswap32(gr[TARGET_REG_R8]);
++    regs->regs[9] = tswap32(gr[TARGET_REG_R9]);
++    regs->regs[10] = tswap32(gr[TARGET_REG_R10]);
++    regs->regs[11] = tswap32(gr[TARGET_REG_R11]);
++    regs->regs[12] = tswap32(gr[TARGET_REG_R12]);
++
++    regs->regs[13] = tswap32(gr[TARGET_REG_SP]);
++    regs->regs[14] = tswap32(gr[TARGET_REG_LR]);
++    regs->regs[15] = tswap32(gr[TARGET_REG_PC]);
++    cpsr = tswap32(gr[TARGET_REG_CPSR]);
++    cpsr_write(regs, cpsr, CPSR_USER | CPSR_EXEC);
++
++    return err;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404181053.s3IArp8N097134>