Re: [Qemu-devel] Insert module into kernel

2006-07-13 Thread Tieu Ma Dau
Hi,I tried your instruction as below:+ Download the installer Debian Sarge 3.1r0 on FreeOSZoo project: http://free.oszoo.org/download.php+ Run the ARM simulated system with the command: " ./qemu-system-arm -kernel my_own_2.6_compiled_kernel sarge.img "+ But I got the error: "VFS: Unable to mount root fs via NFS, trying floppyVFS: Cannot open root device "" or unknown-block(2,0)Please append a correct "root=" boot optionKernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)"The error arrives because this installer is only used for x86, not for ARM? or because I used wrong this installer? or the installer which Paul introduced is not the Debian Sarge on FreeOSZoo prj website?Do you have any idea?TieuPaul Brook <[EMAIL PROTECTED]> wrote: On Wednesday 12 July 2006 14:15, Tieu Ma Dau wrote:> Hi all,>  I want to simulate the ARM system and add a simple simulated device with> its corresponding module device driver. So: > 1. I must run the command "insmod" to insert this module into kernel. > But there is not this command in the ARM Linux shell> 2. I must run the command "mknod" to make a file > (exp: /dev/my_simulated_device) corresponding to the simulated device. But> this command is not run because the "read only" property of file system.> 3. I must make a small program in which I open the file by the command> "fopen("/dev/my_simulated_device","w")" but I think that I have the problem> as in the question 2 Do you have any idea?None of these problems have anything to do with qemu.  They are problems with your root FS. Qemu works exactly the same way as a
 real Arm machine.The arm_test image on the qemu website is a minimal cut-down test/demo system. It is not not intended to be a full general purpose linux system. Sounds like you need to get yourself a proper linux install. The Debian installers work pretty much out the box.If you already are using a different linux distro, you need to contact whoever supplied it.Paul __Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] Fix for accept

2006-07-13 Thread Pablo Virolainen

Following code crashes qemu user emulation.

#include 
#include 

int main() {
accept(0,NULL,NULL);
return 0;
}

Pablo Virolainen
Index: linux-user/syscall.c
===
RCS file: /sources/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.75
diff -u -r1.75 syscall.c
--- linux-user/syscall.c	27 Jun 2006 21:08:10 -	1.75
+++ linux-user/syscall.c	13 Jul 2006 10:18:57 -
@@ -878,9 +878,20 @@
 int sockfd = tgetl(vptr);
 target_ulong target_addr = tgetl(vptr + n);
 target_ulong target_addrlen = tgetl(vptr + 2 * n);
-socklen_t addrlen = tget32(target_addrlen);
-void *addr = alloca(addrlen);
-
+socklen_t addrlen=0;
+	/* Just to get rid of compiler warnings */
+	ulong addrt=0;
+void *addr;
+	
+	get_user(addrlen,&target_addrlen);
+	get_user(addrt,&target_addr);
+	
+	if (addrt!=0) {
+	addr = alloca(addrlen);
+	} else {
+	addr = NULL;
+	}
+	
 ret = get_errno(accept(sockfd, addr, &addrlen));
 if (!is_error(ret)) {
 host_to_target_sockaddr(target_addr, addr, addrlen);
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] [PATCH] for some socket operations and trivial compiler warning fix

2006-07-13 Thread Pablo Virolainen

The patch should add support for SO_LINGER, SO_RCVTIMEO, SO_SNDTIMEO,
SO_PEERCRED and SO_PEERNAME.


Index: linux-user/syscall.c
===
RCS file: /sources/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.75
diff -u -r1.75 syscall.c
--- linux-user/syscall.c	27 Jun 2006 21:08:10 -	1.75
+++ linux-user/syscall.c	13 Jul 2006 10:00:09 -
@@ -509,20 +509,28 @@
 msgh->msg_controllen = tswapl(space);
 }
 
+static long do_setsockopt_timehelper(int sockfd, int level, int optname, 
+ target_ulong optval, target_ulong optlen)
+{
+  int len;
+  struct timeval tv;
+  if (get_user(len, &optlen) ||
+  !access_ok(VERIFY_READ,optval,sizeof(struct target_timeval)))
+return -EFAULT;
+  
+  if (len != sizeof(struct target_timeval))
+return -EINVAL;
+  
+  target_to_host_timeval(&tv,optval); 
+  return get_errno(setsockopt(sockfd, level, optname, &tv, sizeof(struct timeval)));
+}
+
 static long do_setsockopt(int sockfd, int level, int optname, 
   target_ulong optval, socklen_t optlen)
 {
 int val, ret;
 
 switch(level) {
-case SOL_TCP:
-/* TCP options all take an 'int' value.  */
-if (optlen < sizeof(uint32_t))
-return -EINVAL;
-
-val = tget32(optval);
-ret = get_errno(setsockopt(sockfd, level, optname, &val, sizeof(val)));
-break;
 case SOL_IP:
 switch(optname) {
 case IP_TOS:
@@ -606,20 +614,39 @@
 		optname = SO_RCVLOWAT;
 		break;
 case TARGET_SO_RCVTIMEO:
-		optname = SO_RCVTIMEO;
+		ret = do_setsockopt_timehelper(sockfd,level,SO_RCVTIMEO,optval,optlen);
 		break;
 case TARGET_SO_SNDTIMEO:
-		optname = SO_SNDTIMEO;
+		ret = do_setsockopt_timehelper(sockfd,level,SO_SNDTIMEO,optval,optlen);
 		break;
+	case TARGET_SO_LINGER: {
+		struct linger tmp;
+		struct linger *target = (struct linger *) optval;
+		if (optlen == sizeof(struct linger) &&
+		get_user(tmp.l_onoff,&target->l_onoff) &&
+		get_user(tmp.l_linger,&target->l_linger)) {
+		  ret = get_errno(setsockopt(sockfd, level, SO_LINGER, &tmp, sizeof(struct linger)));
+		} else {
+		  /* Just to make strace look better */
+		  ret = get_errno(setsockopt(sockfd, level, SO_LINGER, &optval,optlen));
+		}
+		return ret;
+		break;
+	}
 break;
 default:
 goto unimplemented;
 }
-	if (optlen < sizeof(uint32_t))
-	return -EINVAL;
-
-	val = tget32(optval);
-	ret = get_errno(setsockopt(sockfd, SOL_SOCKET, optname, &val, sizeof(val)));
+	goto int_case;
+break;
+case SOL_TCP:
+int_case:
+/* TCP options all take an 'int' value.  */
+if (optlen < sizeof(uint32_t))
+return -EINVAL;
+
+val = tget32(optval);
+ret = get_errno(setsockopt(sockfd, level, optname, &val, sizeof(val)));
 break;
 default:
 unimplemented:
@@ -629,6 +656,40 @@
 return ret;
 }
 
+static long do_getsockopt_structhelper(int sockfd, int level, int optname, 
+   target_ulong optval, target_ulong optlen)
+{
+  int ret,len,i;
+  /* Let's assume 32-bit parameters */
+  if (get_user(len, &optlen))
+return -EFAULT;
+  if (len < 0)
+return -EINVAL;
+  ret = get_errno(getsockopt(sockfd, level, optname, &optval, &len));
+  for(i = 0; i < len && optval != 0; i += 4) {
+/* This could propably be done more efficiently */
+tput32(optval + i, optval + i);
+  }
+  return ret;
+}
+
+static long do_getsockopt_timehelper(int sockfd, int level, int optname, 
+ target_ulong optval, target_ulong optlen)
+{
+  int ret,len;
+  struct timeval tv;
+  static socklen_t olen=sizeof(struct timeval);
+  if (get_user(len, &optlen))
+return -EFAULT;
+  if (len != sizeof(struct target_timeval))
+return -EINVAL;
+  ret = get_errno(getsockopt(sockfd, level, optname, &tv, &olen));
+  if (ret==0) {
+host_to_target_timeval(optval,&tv);
+  }
+  return ret;
+}
+
 static long do_getsockopt(int sockfd, int level, int optname, 
   target_ulong optval, target_ulong optlen)
 {
@@ -638,13 +699,28 @@
 case TARGET_SOL_SOCKET:
 	level = SOL_SOCKET;
 	switch (optname) {
+	  /* These don't just return a single integer */
 	case TARGET_SO_LINGER:
+	  ret = do_getsockopt_structhelper(sockfd,level,SO_LINGER,optval,optlen);
+	  break;
 	case TARGET_SO_RCVTIMEO:
+	  ret = do_getsockopt_timehelper(sockfd,level,SO_RCVTIMEO,optval,optlen);
+	  break;
 	case TARGET_SO_SNDTIMEO:
+	  ret = do_getsockopt_timehelper(sockfd,level,SO_SNDTIMEO,optval,optlen);
+	  break;
 	case TARGET_SO_PEERCRED:
+	  ret = do_getsockopt_structhelper(sockfd,level,SO_PEERCRED,optval,optlen);
+	  break;
 	case TARGET_SO_PEERNAME:
-	/* These don't just return a single integer */
-	goto unimplemented;
+	  if (get_user(len, &optlen))
+return -EFAULT;
+	  if (len < 0)
+return -EINVAL;
+	  ret = get_errno(getsockopt(sockfd, level, opt

[Qemu-devel] QEMU and m68k - Has anyone looked at the Syn68k core in Executor ?

2006-07-13 Thread Armistead, Jason
I came across a product called Executor from a company called Ardi
(www.ardi.com).  Basically it's a Macintosh 68k emulator that uses a 680x0
core called Syn68k.  By the sounds of it, it does a lot of the same dynamic
recompilation as QEMU does.  The Ardi web site suggests that the code is
either going to be sold or maybe released as Open Source.

Has anyone from the QEMU project (especially Fabrice) contacted the Syn68k
authors with a view to helping some of it to "live on" in QEMU ?  I notice
the m68k support in QEMU is only at a "Dev Only" level.  Perhaps some of the
"lessons learnt" with Ardi's Executor and Syn68k would move this along
further.

The reason I came across this is that I've been looking for a HP Apollo
Domain emulator to resurrect some old Apollo systems without needing to
resurrect the hardware they ran on.  The Apollo Domain systems were Motorola
68k family machines.  For the most part, the hardware in these systems is
not that complex.  Probably on a similar footing to the Sparcstation
supported in QEMU.  Support for Apollo hardware was included into Linux 68k
/ NetBSD and OpenBSD.

Cheers

Jason


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] QEMU and m68k - Has anyone looked at the Syn68k core in Executor ?

2006-07-13 Thread Marius Groeger

On Thu, 13 Jul 2006, Armistead, Jason wrote:


Has anyone from the QEMU project (especially Fabrice) contacted the Syn68k
authors with a view to helping some of it to "live on" in QEMU ?  I notice
the m68k support in QEMU is only at a "Dev Only" level.  Perhaps some of the
"lessons learnt" with Ardi's Executor and Syn68k would move this along
further.


There's a good number of 68k emulators in existence; personally, I 
used some of the Amiga emulators 
(http://en.wikipedia.org/wiki/Amiga_emulation [en], 
http://de.wikipedia.org/wiki/Amiga_Emulator [de]). Those are of course 
extremely specific to Amiga HW, and don't emulate all MMU types, but 
nontheless those might be interesting to look at, too.


Regards,
Marius

--
Marius Groeger <[EMAIL PROTECTED]>
SYSGO AG  Embedded and Real-Time Software
Voice: +49 6136 9948 0  FAX: +49 6136 9948 10
www.sysgo.com | www.elinos.com | www.osek.de | www.pikeos.com



___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] QEMU and m68k - Has anyone looked at the Syn68k core in Executor ?

2006-07-13 Thread Fabrice Bellard
IMHO the most interesting part of Executor is the Mac OS API emulation 
layer, but unfortunately it has little relation with QEMU.


Fabrice.

Armistead, Jason wrote:

I came across a product called Executor from a company called Ardi
(www.ardi.com).  Basically it's a Macintosh 68k emulator that uses a 680x0
core called Syn68k.  By the sounds of it, it does a lot of the same dynamic
recompilation as QEMU does.  The Ardi web site suggests that the code is
either going to be sold or maybe released as Open Source.

Has anyone from the QEMU project (especially Fabrice) contacted the Syn68k
authors with a view to helping some of it to "live on" in QEMU ?  I notice
the m68k support in QEMU is only at a "Dev Only" level.  Perhaps some of the
"lessons learnt" with Ardi's Executor and Syn68k would move this along
further.

The reason I came across this is that I've been looking for a HP Apollo
Domain emulator to resurrect some old Apollo systems without needing to
resurrect the hardware they ran on.  The Apollo Domain systems were Motorola
68k family machines.  For the most part, the hardware in these systems is
not that complex.  Probably on a similar footing to the Sparcstation
supported in QEMU.  Support for Apollo hardware was included into Linux 68k
/ NetBSD and OpenBSD.

Cheers

Jason


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel






___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] Fix for accept

2006-07-13 Thread Fabrice Bellard

Hi,

OK for the bug report, but the fix is not correct because the problem is 
generic. [get|put]_user() and the other functions should be used 
everywhere to communicate with the "user" space and to generate the 
-EFAULT error if the address is not correct. For that purpose the host 
signal SIGSEGV can be catched and asm macros can be used to see if it is 
an expected seg fault (in this case [get|put]_user must return an error 
code) or if it is a QEMU bug. Note that exactly the same system is used 
inside the Linux kernel and I don't think it is necessary to invent 
something else.


Regards,

Fabrice.

Pablo Virolainen wrote:

Following code crashes qemu user emulation.

#include 
#include 

int main() {
accept(0,NULL,NULL);
return 0;
}

Pablo Virolainen




Index: linux-user/syscall.c
===
RCS file: /sources/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.75
diff -u -r1.75 syscall.c
--- linux-user/syscall.c27 Jun 2006 21:08:10 -  1.75
+++ linux-user/syscall.c13 Jul 2006 10:18:57 -
@@ -878,9 +878,20 @@
 int sockfd = tgetl(vptr);
 target_ulong target_addr = tgetl(vptr + n);
 target_ulong target_addrlen = tgetl(vptr + 2 * n);
-socklen_t addrlen = tget32(target_addrlen);
-void *addr = alloca(addrlen);
-
+socklen_t addrlen=0;
+   /* Just to get rid of compiler warnings */
+   ulong addrt=0;
+void *addr;
+	
+	get_user(addrlen,&target_addrlen);

+   get_user(addrt,&target_addr);
+	
+	if (addrt!=0) {

+   addr = alloca(addrlen);
+   } else {
+   addr = NULL;
+   }
+	
 ret = get_errno(accept(sockfd, addr, &addrlen));

 if (!is_error(ret)) {
 host_to_target_sockaddr(target_addr, addr, addrlen);




___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel




___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] QEMU and m68k - Has anyone looked at the Syn68k core in Executor ?

2006-07-13 Thread Paul Brook
On Thursday 13 July 2006 21:43, Fabrice Bellard wrote:
> IMHO the most interesting part of Executor is the Mac OS API emulation
> layer, but unfortunately it has little relation with QEMU.

I'd expect it would be possible to hook it up to qemu though.

Paul


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] qemu Makefile.target

2006-07-13 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Fabrice Bellard06/07/13 23:00:26

Modified files:
.  : Makefile.target 

Log message:
use posix timers

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/Makefile.target?cvsroot=qemu&r1=1.118&r2=1.119


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] qemu cpu-all.h

2006-07-13 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Fabrice Bellard06/07/13 23:00:41

Modified files:
.  : cpu-all.h 

Log message:
export cpu_get_real_ticks()

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/cpu-all.h?cvsroot=qemu&r1=1.55&r2=1.56


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] qemu vl.c vl.h hw/pc.c linux-user/main.c

2006-07-13 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Fabrice Bellard06/07/13 23:20:22

Modified files:
.  : vl.c vl.h 
hw : pc.c 
linux-user : main.c 

Log message:
new clock logic: cpu ticks and virtual clocks are no longer 
proportional - added timestamps on the stdio console

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/vl.c?cvsroot=qemu&r1=1.197&r2=1.198
http://cvs.savannah.gnu.org/viewcvs/qemu/vl.h?cvsroot=qemu&r1=1.135&r2=1.136
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/pc.c?cvsroot=qemu&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/qemu/linux-user/main.c?cvsroot=qemu&r1=1.90&r2=1.91


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] qemu/hw pcnet.c

2006-07-13 Thread Fabrice Bellard
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Fabrice Bellard06/07/13 23:25:11

Modified files:
hw : pcnet.c 

Log message:
avoid recursive tx

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/pcnet.c?cvsroot=qemu&r1=1.2&r2=1.3


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] QEMU and variable freq CPUs

2006-07-13 Thread Fabrice Bellard
I just commited a patch which should make QEMU work on PCs with variable 
CPU frequency.


Feel free to send feebacks regarding performance problems or bugs after 
trying it.


Fabrice.


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] fix for qemu-* looping forever on symlinks (patch attached)

2006-07-13 Thread Michael Gilbert

please review the attached patch (to linux-user/path.c), which i
believe fixes the problem of qemu looping forever on symlinks when
using -L.  it is undesirable (i believe) for the -L option to search
all subdirectories.  this is in reference to debian bug #297572
(bugs.debian.org/297572).

mike gilbert
--- source/qemu-0.8.1/linux-user/path.c	2006-05-03 16:32:58.0 -0400
+++ path-me.c	2006-06-22 21:31:19.0 -0400
@@ -100,7 +100,7 @@
 return;
 
 base = new_entry("", NULL, prefix+1);
-base = add_dir_maybe(base);
+//base = add_dir_maybe(base);
 if (base->num_entries == 0) {
 free (base);
 base = NULL;

___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] fix for qemu-* looping forever on symlinks (patch attached)

2006-07-13 Thread Paul Brook
On Friday 14 July 2006 03:31, Michael Gilbert wrote:
> please review the attached patch (to linux-user/path.c), which i
> believe fixes the problem of qemu looping forever on symlinks when
> using -L.  it is undesirable (i believe) for the -L option to search
> all subdirectories.  this is in reference to debian bug #297572 
> (bugs.debian.org/297572).

Have you tried running dynamically linked executables with your patch?

The whole point of the -L option is so that it picks up target shared 
libraries, eg. in lib and usr/lib. By my reading your patch makes the -L 
option do absolutely nothing, which can't be right.

The proper fix is to do the lookups when a file is accesses (possibly with 
caching) not pre-scan the whole tree.

Paul


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel