[Qemu-devel] [ARM] add with PC in argument

2008-02-24 Thread claude vittoria

Hello,

I got a problem in an IRQ handler of mutek OS 
(https://www-asim.lip6.fr/trac/mutekh), target ARM Integrator/CM 
922T-XA10. I try to port it on Qemu. A porting has been done for Skyeyes


So in qemu I don't get the same comportement. The add of lr = pc + 4 
gives lr = pc + 8 into qemu.

I think that s->pc += 4 at start of disas_arm_insn alters the result.
Could you confirm ?

0x7caddlr, pc, #4
0x80ldrpc, =SystemInterrupt

0x84ldrr3, [sp, #PSR_OFF]  <= never executed in Qemu
0x88msrspsr_cxsf, r3@ put cpsr in SPSR
0x8cldmiasp, {r0-r15}^@ restore Context

B.R.
Claude




[Qemu-devel] qemu/target-sparc exec.h op.c op_helper.c op_me...

2008-02-24 Thread Blue Swirl
CVSROOT:/cvsroot/qemu
Module name:qemu
Changes by: Blue Swirl   08/02/24 14:10:06

Modified files:
target-sparc   : exec.h op.c op_helper.c op_mem.h translate.c 
Added files:
target-sparc   : helper.h 
Removed files:
target-sparc   : op_template.h 

Log message:
 Modify Sparc32/64 to use TCG

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/target-sparc/exec.h?cvsroot=qemu&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/qemu/target-sparc/op.c?cvsroot=qemu&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/qemu/target-sparc/op_helper.c?cvsroot=qemu&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/qemu/target-sparc/op_mem.h?cvsroot=qemu&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/qemu/target-sparc/translate.c?cvsroot=qemu&r1=1.88&r2=1.89
http://cvs.savannah.gnu.org/viewcvs/qemu/target-sparc/helper.h?cvsroot=qemu&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/target-sparc/op_template.h?cvsroot=qemu&r1=1.2&r2=0




[Qemu-devel] [PATCH] TFTP: fix search of ':' in BootFile

2008-02-24 Thread Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <[EMAIL PROTECTED]>

diff --git a/net/tftp.c b/net/tftp.c
index 3dd2b06..ea8fea2 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -474,7 +474,7 @@ TftpStart (void)
printf ("*** Warning: no boot file name; using '%s'\n",
tftp_filename);
} else {
-   char *p = strchr (p, ':');
+   char *p = strchr (BootFile, ':');
 
if (p == NULL) {
strncpy(tftp_filename, BootFile, MAX_LEN);
-- 
1.5.3.7





[Qemu-devel] [PATCH] CFI: Fix AMD erase support

2008-02-24 Thread Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <[EMAIL PROTECTED]>

diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c
index b3a8a8e..c360179 100644
--- a/hw/pflash_cfi01.c
+++ b/hw/pflash_cfi01.c
@@ -275,7 +275,7 @@ static void pflash_write (pflash_t *pfl, target_ulong 
offset, uint32_t value,
 if (cmd == 0xd0) { /* confirm */
 pfl->wcycle = 1;
 pfl->status |= 0x80;
-} if (cmd == 0xff) { /* read array mode */
+} else if (cmd == 0xff) { /* read array mode */
 goto reset_flash;
 } else
 goto error_flash;
-- 
1.5.4





[Qemu-devel] [PATCH] Let ESP SCSI adapter to be usable outside sun4m

2008-02-24 Thread Hervé Poussineau

Hi,

At the moment, ESP SCSI adapter can only be used inside sun4m machines.
Attached patch moves the declaration outside sun4m.h, so other machines 
can also use it.
I've moved the declaration to devices.h because I found no better place 
to put it. If you know a better place, please tell me :)


Hervé
Index: Makefile.target
===
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.245
diff -u -r1.245 Makefile.target
--- Makefile.target 10 Feb 2008 16:33:12 -  1.245
+++ Makefile.target 24 Feb 2008 20:43:50 -
@@ -511,7 +511,7 @@
 endif
 
 # SCSI layer
-OBJS+= lsi53c895a.o
+OBJS+= lsi53c895a.o esp.o
 
 # USB layer
 OBJS+= usb-ohci.o
@@ -573,7 +573,7 @@
 OBJS+= cirrus_vga.o parallel.o ptimer.o
 else
 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
-OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
+OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o sparc32_dma.o
 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
 endif
 endif
Index: hw/devices.h
===
RCS file: /sources/qemu/qemu/hw/devices.h,v
retrieving revision 1.2
diff -u -r1.2 devices.h
--- hw/devices.h18 Nov 2007 14:36:08 -  1.2
+++ hw/devices.h24 Feb 2008 20:57:22 -
@@ -16,6 +16,16 @@
 void ads7846_write(void *opaque, uint32_t value);
 struct ads7846_state_s *ads7846_init(qemu_irq penirq);
 
+/* esp.c */
+#ifdef CPU_DEFS_H
+#define ESP_MAX_DEVS 7
+void esp_scsi_attach(void *opaque, BlockDriverState *bd, int id);
+void *esp_init(target_phys_addr_t espaddr,
+   void *dma_opaque, qemu_irq irq, qemu_irq *reset);
+void espdma_memory_read(void *opaque, uint8_t *buf, int len);
+void espdma_memory_write(void *opaque, uint8_t *buf, int len);
+#endif
+
 /* stellaris_input.c */
 void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode);
 
Index: hw/esp.c
===
RCS file: /sources/qemu/qemu/hw/esp.c,v
retrieving revision 1.33
diff -u -r1.33 esp.c
--- hw/esp.c1 Jan 2008 17:06:38 -   1.33
+++ hw/esp.c24 Feb 2008 20:50:30 -
@@ -24,9 +24,7 @@
 #include "hw.h"
 #include "block.h"
 #include "scsi-disk.h"
-#include "sun4m.h"
-/* FIXME: Only needed for MAX_DISKS, which is probably wrong.  */
-#include "sysemu.h"
+#include "devices.h"
 
 /* debug ESP card */
 //#define DEBUG_ESP
Index: hw/sun4m.c
===
RCS file: /sources/qemu/qemu/hw/sun4m.c,v
retrieving revision 1.84
diff -u -r1.84 sun4m.c
--- hw/sun4m.c  11 Feb 2008 20:01:36 -  1.84
+++ hw/sun4m.c  24 Feb 2008 20:46:24 -
@@ -31,6 +31,7 @@
 #include "net.h"
 #include "boards.h"
 #include "firmware_abi.h"
+#include "devices.h"
 
 //#define DEBUG_IRQ
 
Index: hw/sun4m.h
===
RCS file: /sources/qemu/qemu/hw/sun4m.h,v
retrieving revision 1.10
diff -u -r1.10 sun4m.h
--- hw/sun4m.h  27 Jan 2008 09:49:28 -  1.10
+++ hw/sun4m.h  24 Feb 2008 20:45:42 -
@@ -59,12 +59,6 @@
CPUState *env);
 void slavio_set_power_fail(void *opaque, int power_failing);
 
-/* esp.c */
-#define ESP_MAX_DEVS 7
-void esp_scsi_attach(void *opaque, BlockDriverState *bd, int id);
-void *esp_init(target_phys_addr_t espaddr,
-   void *dma_opaque, qemu_irq irq, qemu_irq *reset);
-
 /* cs4231.c */
 void cs_init(target_phys_addr_t base, int irq, void *intctl);
 



[Qemu-devel] [PATCH] Add KBD_CMD_SCANCODE command

2008-02-24 Thread Hervé Poussineau

Hi,

PS/2 controller emulation lacks the KBD_CMD_SCANCODE command, which 
gets/sets the scancode set (1, 2 or 3).

Scancode sets 1 and 2 are still not supported.

Hervé
Index: hw/ps2.c
===
RCS file: /sources/qemu/qemu/hw/ps2.c,v
retrieving revision 1.10
diff -u -r1.10 ps2.c
--- hw/ps2.c16 Dec 2007 23:41:11 -  1.10
+++ hw/ps2.c23 Feb 2008 21:05:05 -
@@ -34,6 +34,7 @@
 /* Keyboard Commands */
 #define KBD_CMD_SET_LEDS   0xED/* Set keyboard leds */
 #define KBD_CMD_ECHO   0xEE
+#define KBD_CMD_SCANCODE   0xF0/* Get/set scancode set */
 #define KBD_CMD_GET_ID 0xF2/* get keyboard ID */
 #define KBD_CMD_SET_RATE   0xF3/* Set typematic rate */
 #define KBD_CMD_ENABLE 0xF4/* Enable scanning */
@@ -89,6 +90,7 @@
conversions we do the translation (if any) in the PS/2 emulation
not the keyboard controller.  */
 int translate;
+int scancode_set;
 } PS2KbdState;
 
 typedef struct {
@@ -134,7 +136,9 @@
 static void ps2_put_keycode(void *opaque, int keycode)
 {
 PS2KbdState *s = opaque;
-if (!s->translate && keycode < 0xe0)
+
+/* XXX: add support for scancode sets 1 and 2 */
+if (!s->translate && keycode < 0xe0 && s->scancode_set == 3)
   {
 if (keycode & 0x80)
 ps2_queue(&s->common, 0xf0);
@@ -202,6 +206,7 @@
 s->scan_enabled = 1;
 ps2_queue(&s->common, KBD_REPLY_ACK);
 break;
+case KBD_CMD_SCANCODE:
 case KBD_CMD_SET_LEDS:
 case KBD_CMD_SET_RATE:
 s->common.write_cmd = val;
@@ -227,6 +232,22 @@
 break;
 }
 break;
+case KBD_CMD_SCANCODE:
+if (val == 0) {
+if (s->scancode_set == 1)
+ps2_queue(&s->common, 0x43);
+else if (s->scancode_set == 2)
+ps2_queue(&s->common, 0x41);
+else if (s->scancode_set == 3)
+ps2_queue(&s->common, 0x3f);
+else
+ps2_queue(&s->common, KBD_REPLY_ACK);
+} else {
+s->scancode_set = val;
+ps2_queue(&s->common, KBD_REPLY_ACK);
+}
+s->common.write_cmd = -1;
+break;
 case KBD_CMD_SET_LEDS:
 ps2_queue(&s->common, KBD_REPLY_ACK);
 s->common.write_cmd = -1;
@@ -493,6 +514,7 @@
 ps2_common_save (f, &s->common);
 qemu_put_be32(f, s->scan_enabled);
 qemu_put_be32(f, s->translate);
+qemu_put_be32(f, s->scancode_set);
 }
 
 static void ps2_mouse_save(QEMUFile* f, void* opaque)
@@ -516,12 +538,16 @@
 {
 PS2KbdState *s = (PS2KbdState*)opaque;
 
-if (version_id != 2)
+if (version_id != 2 && version_id != 3)
 return -EINVAL;
 
 ps2_common_load (f, &s->common);
 s->scan_enabled=qemu_get_be32(f);
 s->translate=qemu_get_be32(f);
+if (version_id == 3)
+s->scancode_set=qemu_get_be32(f);
+else
+s->scancode_set=3;
 return 0;
 }
 
@@ -552,8 +578,9 @@
 
 s->common.update_irq = update_irq;
 s->common.update_arg = update_arg;
+s->scancode_set = 3;
 ps2_reset(&s->common);
-register_savevm("ps2kbd", 0, 2, ps2_kbd_save, ps2_kbd_load, s);
+register_savevm("ps2kbd", 0, 3, ps2_kbd_save, ps2_kbd_load, s);
 qemu_add_kbd_event_handler(ps2_put_keycode, s);
 qemu_register_reset(ps2_reset, &s->common);
 return s;


Re: [Qemu-devel] [PATCH 4/9] AppleSMC device

2008-02-24 Thread Rob Landley
On Tuesday 08 January 2008 09:22:49 Alexander Graf wrote:
> Apples hardware dongle sits withing the fan control. To get Mac OS X up
> and running, this control device needs to be emulated and given the
> correct dongle key. This key has to be given via the command line.

How is the key obtained?  I have access to a couple of macintoshes, but I 
don't know what code to run on them to snapshot the key?

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.




Re: [Qemu-devel] [PATCH 4/9] AppleSMC device

2008-02-24 Thread Alexander Graf


On Feb 25, 2008, at 6:57 AM, Rob Landley wrote:


On Tuesday 08 January 2008 09:22:49 Alexander Graf wrote:
Apples hardware dongle sits withing the fan control. To get Mac OS  
X up

and running, this control device needs to be emulated and given the
correct dongle key. This key has to be given via the command line.


How is the key obtained?  I have access to a couple of macintoshes,  
but I

don't know what code to run on them to snapshot the key?


You need to read the keys OSK0 and OSK1 from your own SMC device using  
the applesmc driver on Linux. You can find a piece of code that does  
this on OSX on Amit Singh's website.


If you are on Linux, I wrote a script that does this for you: 
http://alex.csgraf.de/qemu/getkey

Remember that you have to be on an Intel Mac, as the PPC Macs lack  
this chip.


Alex