[Qemu-devel] PATCH: darwin-user syscalls

2007-03-02 Thread Ilya Shar
Handling extra signals in syscall.c/syscalls.h.  Patch
is attached. 

Thanks, 
Ilya 


 

Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

qemu_0.9.0_darwin-user_signal.patch
Description: 2083588519-qemu_0.9.0_darwin-user_signal.patch
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] Page protection and i386 cmpxchg8b

2007-02-26 Thread Ilya Shar
--- Pierre d'Herbemont <[EMAIL PROTECTED]> wrote:

> ...
> cvs diff -u would be easier to read for me. (or diff
> -u). You could  
> send this patch to the qemu-devel, that would be
> cool.
> 

Pierre, 

Please see the diff file attached. 

> ...
> Ouch! I have noticed the same: qemu can trigger bugs
> really easily at  
> the kernel level :( Could you explain how you know
> that cmpxchg8b is  
> the key to our problem? 

Stepping in gdb I saw that cmpxchg8b attempts to write
to a protected page.  Besides, when the system
crashes, here's what I see in the crash log in the
Console app:

...
Exception:  EXC_BAD_ACCESS (0x0001)
Codes:  KERN_PROTECTION_FAILURE (0x0002) at
0x2111faf5

Thread 0 Crashed:
0   qemu-i386   0x0e02254b stq_le_p + 50
(cpu-all.h:344)
1   qemu-i386   0x0e0224d6 helper_cmpxchg8b + 192
(helper.c:1523)
2   <<>>0x0e1361b4 code_gen_buffer +
708980
3   qemu-i386   0x0e000db3 cpu_loop + 23 (main.c:498)
4   qemu-i386   0x0e001f75 main + 2814 (main.c:917)
5   qemu-i386   0x0e000a8e _start + 216
6   qemu-i386   0x0e0009b5 start + 41

...

Any suggestions how to fix this?  

Thanks for your help! 
Ilya 

> Also qemu signal handlers
> might be overridden  
> by some mach calls, that could explain the problem
> you are  
> encountering. We need to work on this.
> 
> Pierre.
> 


 

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367

darwin-user_syscall.c_diff
Description: 2740739241-darwin-user_syscall.c_diff
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] Page protection and i386 cmpxchg8b

2007-02-23 Thread Ilya Shar
--- Pierre d'Herbemont <[EMAIL PROTECTED]> wrote:
Hi Pierre, 

Thanks for your reply - please see comments inserted
below: 

> Hi Ilya!
> 
> On 23 févr. 07, at 21:32, Ilya Shar wrote:
> 
> > I'm running i386-darwin-usrer on i386 and some
> apps
> > (Safari browser) crash because cmpxchg8b attempts
> to
> > wrie to a qemu-allocated page which is readable
> but
> > write-protected.  When I comment out mprotect in
> > exec.c
> 
> Are you sure it does Safari does crash because of
> that call? I have  
> the Apple Bug Reporter which complains about the
> fact that qemu gets  
> a EXC_BAD_ACCESS, but then I get this error:
> qemu: Unsupported mach syscall: -61(0xffc3) (=  
> semaphore_signal_trap)
> or
> qemu: Unsupported mach syscall: -33(0xffdf) (=  
> syscall_thread_switch)
> 
> To fix this we have to implement those syscalls.
> 

Sure.  At first I was hitting unsupported mach
syscalls, so I modified darwin-user/syscall.h
according to
/Developer/SDKs/MacOSX10.3.9.sdk/usr/include/mach/syscall_sw.h
: 

$ diff syscall.c syscall.c.orig 
458,465d457
< case -33:
< DPRINTF("semaphore_signal_trap(0x%x)\n",
arg1);
< ret = semaphore_signal_trap(arg1);
< break;
< case -34:
< DPRINTF("semaphore_signal_all_trap(0x%x)\n",
arg1);
< ret = semaphore_signal_all_trap(arg1);
< break;
471,474d462
< case -37:
< DPRINTF("semaphore_wait_signal_trap(0x%x,
0x%x)\n", arg1, arg2);
< ret = semaphore_wait_signal_trap(arg1,arg2);

< break;

With this Sfari went past the unsupported call -33 and
now stops in call -61 (syscall_thread_switch).  Can I
just modify syscalls.c in a similar way to fix it?  

But a really alarming thing happens before it gets
there.  If my ethernet cable is not plugged in,
cmpxchg8b write to a nonwritable page brings my system
down.  I suppose it happens in somewhere in the
drivers. 

...

> 
> I think the idea behind the mprotect is to make sure
> that any changes  
> to this pages gets monitored, and that the tb can be
> invalidated if  
> the code was modified (self modify-ing code).

That makes sense.  Still I am not sure why cmpxchg8b
causes problems. 

Thanks! 
Ilya 

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



 

Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/


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


[Qemu-devel] Page protection and i386 cmpxchg8b

2007-02-23 Thread Ilya Shar
Hi, 

I'm running i386-darwin-usrer on i386 and some apps
(Safari browser) crash because cmpxchg8b attempts to
wrie to a qemu-allocated page which is readable but
write-protected.  When I comment out mprotect in
exec.c 

//mprotect(g2h(page_addr),
qemu_host_page_size,
// (prot & PAGE_BITS) & ~PAGE_WRITE);

I can proceed further.  I would guess mprotect is
there for a reason so it doesn't seem like a good
solution, besides the runs get substantially slower
without mprotect.  Is there a solution to this problem
or a way to better understand what is going on? 

Thanks, 
Ilya 



 

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367


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


[Qemu-devel] Please help fix an illegal instruction / SSE problem

2007-02-15 Thread Ilya Shar
Every Cocoa application I try to run under
i386-darwin-user/qemu-i386 exits on an illegal
instruction: 

Starting
/Applications/Calculator.app/Contents/MacOS/Calculator
with qemu

queue_signal: sig=4
qemu: uncaught target signal 4 (Illegal instruction) -
exiting

The last block always executes SSE instructions: 

IN: 
0x0ab7:  movdqa 0xfffa(%esi,%edx,1),%xmm0
0x0abd:  movdqa 0xa(%esi,%edx,1),%xmm1
0x0ac3:  movdqa 0x1a(%esi,%edx,1),%xmm2
0x0ac9:  movdqa 0x2a(%esi,%edx,1),%xmm3
0x0acf:  movdqa 0x3a(%esi,%edx,1),%xmm4
0x0ad5:  movdqa %xmm0,%xmm5
0x0ad9:  movdqa %xmm4,%xmm0
0x0add:  data16
0x0ade:  (bad)  

Non-graphics applications run fine.  

Could it be a configuration/compilation problem
(although some SEE instructions seem to be handled
fine)?  If not, is there a way to better diagnose the
problem?  I on Mac OS Intel with QEMU 0.9.0. 

Thank you for your help! 
Ilya 



 

8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news


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


[Qemu-devel] Help with gdb on Mac OS

2007-02-11 Thread Ilya Shar
I am trying to step through i386-darwin-user/qemu-i386
in gdb but I am getting a KERN_PROTECTION_FAILURE
fairly early in the run: 

(gdb) run /bin/ls
Starting program:
/Users/ilya/tmp/feb11/qemu-0.9.0/i386-darwin-user/qemu-i386
/bin/ls
Reading symbols for shared libraries . done
Starting /bin/ls with qemu


Program received signal EXC_BAD_ACCESS, Could not
access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x2115eaf5
helper_cmpxchg8b () at ../cpu-all.h:344
344 ((uint32_t *)ptr)[0] = x.p[0];
(gdb) 

The offending value of ptr is misalligned, can this
indicate a problem?  Reducing optimization or setting
-g3 doesn't change this behavior.  Strangely, the same
example runs fine without gdb. 

Is there any way to correct the gdb problem?  I am
using gdb 6.3 on Mac OS Intel with QEMU 0.9.0 and
patches for gcc4/Mac posted by Mike Kronenberg.  

Thanks for your help, 
Ilya 



 

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121


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


[Qemu-devel] Signal handling for i386-darwin-user on Mac Intel

2007-02-04 Thread Ilya Shar
Thanks to pointers/patches from Mike and Pierre, I can
build i386-darwin-user binary.  There is a glitch
though with signal-handling.  The following fragment
in cpu_signal_handler() in cpu-exec.c 

pc = uc->uc_mcontext.gregs[REG_EIP];
trapno = uc->uc_mcontext.gregs[REG_TRAPNO];

appears to be Linux-specific and gives compilation
errors on a Mac:

/Users/ilya/tmp/feb4/qemu_cvs_user/qemu/cpu-exec.c: In
function 'cpu_x86_signal_handler':
/Users/ilya/tmp/feb4/qemu_cvs_user/qemu/cpu-exec.c:1307:
error: request for member 'gregs' in something not a
structure or union
/Users/ilya/tmp/feb4/qemu_cvs_user/qemu/cpu-exec.c:1307:
error: 'EIP' undeclared (first use in this function)
... 

When I dummy-out cpu_signal_handler() the binary
compiles, but I cannot run anything because the
signals are not handled. 

Is there a patch/solution to this?  

Thanks again for your help! 
Ilya 




 

Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/


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


Re: [Qemu-devel] Please help build qemu/darwin-user on Mac Intel

2007-02-03 Thread Ilya Shar
Hi Mike, 

Thanks a lot for the patches.  I applied them
(together with qemu-0.7.0-gcc4.patch, which appears to
be necessary although it's not in the archive you
created) but in the middle of the build dyngen rejects
op.o: 

../dyngen -c -o opc.h op.o
dyngen: Unable to replace ret with jmp in
op_bsfl_T0_cc
make[1]: *** [opc.h] Error 1

Did I mess up somewhere or there is something wrong
with the patches?  

Thanks again for your help! 
Ilya 


--- Mike Kronenberg <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> we have decided to wait for the next qemu release
> until we update the  
> patches for kju, as qemu dev has picked up speed,
> which is good.
> Never the less, you can grab the patches for qemu
> cvs (OS X Intel) here:
> 
> http://www.kberg.ch/qemu/cvspatches20070202.zip
> 
> Best Regards
> Mike
> 
> On 03.02.2007, at 08:47, Pierre d'Herbemont wrote:
> 
> > Hi,
> >
> > On 3 févr. 07, at 02:37, Ilya Shar wrote:
> >
> >> I am trying to build i386-darwin-user to run it
> on an
> >> x86 Mac.  I'm on Mac OS 10.4 Intel with gcc 3.3
> and
> >> I'm getting compiler errors right away:
> >>
> >> $ cvs
> >>
>
-d:pserver:[EMAIL PROTECTED]:/cvsroot/darwine
> >
> > Ilya, qemu's CVS has the most up-to-date version
> of darwin-user  
> > now, so you should use it intead of the version
> which is in the  
> > darwine's cvs. Moreover to compile qemu on intel
> you'll need a few  
> > patche. The team behind Q.app has collected them
> for you [1]. Also  
> > I am not sure that gcc 3.3 can build Mac Intel
> binaries that are  
> > compliant with the current Mac OS X x86 ABI. So
> you may also need  
> > the gcc 4.0 patches that you should find in [1].
> >
> > Pierre.
> >
> > [1]
> http://www.kju-app.org/proj/browser/trunk/patches
> >
> >
> > ___
> > 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
> 




 

Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091


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


[Qemu-devel] Please help build qemu/darwin-user on Mac Intel

2007-02-02 Thread Ilya Shar
Hi, 

I am trying to build i386-darwin-user to run it on an
x86 Mac.  I'm on Mac OS 10.4 Intel with gcc 3.3 and
I'm getting compiler errors right away: 

$ cvs
-d:pserver:[EMAIL PROTECTED]:/cvsroot/darwine
co qemu
$ cd qemu/
$ ./configure --target-list=i386-darwin-user
--cc=/opt/gcc3/bin/gcc
$ make
/opt/gcc3/bin/gcc -Wall -O2 -g -fno-strict-aliasing 
-mdynamic-no-pic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -o dyngen dyngen.c
dyngen.c: In function `gen_code':
dyngen.c:1700: error: structure has no member named
`r_offset'
dyngen.c:1701: error: structure has no member named
`r_offset'
dyngen.c:1713: error: structure has no member named
`r_offset'
dyngen.c:1718: error: structure has no member named
`r_offset'
dyngen.c:1761:2: #error unsupport object format
dyngen.c:1697: warning: unused variable `type'
make: *** [dyngen] Error 1

Please let me know if there's a config trick or if
there's a patch to apply (or please point me to a more
appropriate forum/resource for such questions). 

Thanks! 
Ilya 



 

Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL


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