Re: [Qemu-devel][PATCH] Tap and VLAN socket support for win32

2006-02-02 Thread Kazu

Thursday, February 02, 2006 8:10 AM Fabrice Bellard wrote:


Hi,

I merged your patches and I made important changes to simplify them. I
did not do any tests so tell me if you see problems.



-net socket,connect doesn't work. On Windows host, connect returns with err
= WSAEWOULDBLOCK and second time err = WSAEINVAL. I think changing the place
of EWOULDBLOCK would be good. On Linux host, EWOULDBLOCK is the same as
EAGAIN but a patch works on both Linux and Windows.

For -net socket,mcast, bind have to be done by sin_addr.s_addr = INADDR_ANY.
It seems that it works on Linux host.

Regards,
Kazu

Index: vl.c
===
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.160
diff -u -r1.160 vl.c
--- vl.c 1 Feb 2006 23:06:55 - 1.160
+++ vl.c 2 Feb 2006 09:28:19 -
@@ -2335,7 +2335,13 @@
 goto fail;
}

-ret = bind(fd, (struct sockaddr *)mcastaddr, sizeof(*mcastaddr));
+struct sockaddr_in addr;
+memset(addr, 0, sizeof(addr));
+addr.sin_family = AF_INET;
+addr.sin_port = mcastaddr-sin_port;
+addr.sin_addr.s_addr = INADDR_ANY;
+
+ret = bind(fd, (struct sockaddr *)addr, sizeof(addr));
if (ret  0) {
perror(bind);
goto fail;
@@ -2561,8 +2567,8 @@
ret = connect(fd, (struct sockaddr *)saddr, sizeof(saddr));
if (ret  0) {
err = socket_error();
-if (err == EINTR || err == EWOULDBLOCK) {
-} else if (err == EINPROGRESS) {
+if (err == EINTR) {
+} else if (err == EINPROGRESS || err == EWOULDBLOCK) {
break;
} else {
perror(connect);


qemu-20060202-vlan.patch
Description: Binary data
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] [PATCH 2/3] ide lba48 support

2006-02-02 Thread Jens Axboe
On Wed, Feb 01 2006, Fabrice Bellard wrote:
 Jens Axboe wrote:
 Subject: [PATCH] Add lba48 support to ide
 From: Jens Axboe [EMAIL PROTECTED]
 Date: 1136376117 +0100
 
 Add lba48 support for the ide code. Read back of hob registers isn't
 there yet, though.
 
 Do you have a more recent patch ? In your latest patch, the lba48 field 
 is never reset and the nsector may be broken.

The lba48 setting did look a little odd, should be corrected now. I
guess that is what would affect the nsector stuff, it looks correct to
me know.

From nobody Mon Sep 17 00:00:00 2001
From: Jens Axboe [EMAIL PROTECTED]
Date: Thu Feb 2 10:51:20 2006 +0100
Subject: [PATCH] Add lba48 support to ide

Enables qemu to support ide disk images  2^28 * 512 bytes.

---

 hw/ide.c |  157 ++
 1 files changed, 137 insertions(+), 20 deletions(-)

b67eb122b5646ddcfd13d45563bbe6aa5309e9c0
diff --git a/hw/ide.c b/hw/ide.c
index 50b8e63..01b10e1 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -307,14 +307,24 @@ typedef struct IDEState {
 /* ide regs */
 uint8_t feature;
 uint8_t error;
-uint16_t nsector; /* 0 is 256 to ease computations */
+uint32_t nsector;
 uint8_t sector;
 uint8_t lcyl;
 uint8_t hcyl;
+/* other part of tf for lba48 support */
+uint8_t hob_feature;
+uint8_t hob_nsector;
+uint8_t hob_sector;
+uint8_t hob_lcyl;
+uint8_t hob_hcyl;
+
 uint8_t select;
 uint8_t status;
+
 /* 0x3f6 command, only meaningful for drive 0 */
 uint8_t cmd;
+/* set for lba48 access */
+uint8_t lba48;
 /* depends on bit 4 in select, only meaningful for drive 0 */
 struct IDEState *cur_drive; 
 BlockDriverState *bs;
@@ -462,13 +472,19 @@ static void ide_identify(IDEState *s)
 put_le16(p + 80, 0xf0); /* ata3 - ata6 supported */
 put_le16(p + 81, 0x16); /* conforms to ata5 */
 put_le16(p + 82, (1  14));
-put_le16(p + 83, (1  14));
+/* 13=flush_cache_ext,12=flush_cache,10=lba48 */
+put_le16(p + 83, (1  14) | (1  13) | (1 12) | (1  10));
 put_le16(p + 84, (1  14));
 put_le16(p + 85, (1  14));
-put_le16(p + 86, 0);
+/* 13=flush_cache_ext,12=flush_cache,10=lba48 */
+put_le16(p + 86, (1  14) | (1  13) | (1 12) | (1  10));
 put_le16(p + 87, (1  14));
 put_le16(p + 88, 0x3f | (1  13)); /* udma5 set and supported */
 put_le16(p + 93, 1 | (1  14) | 0x2000);
+put_le16(p + 100, s-nb_sectors);
+put_le16(p + 101, s-nb_sectors  16);
+put_le16(p + 102, s-nb_sectors  32);
+put_le16(p + 103, s-nb_sectors  48);
 
 memcpy(s-identify_data, p, sizeof(s-identify_data));
 s-identify_set = 1;
@@ -572,12 +588,19 @@ static int64_t ide_get_sector(IDEState *
 int64_t sector_num;
 if (s-select  0x40) {
 /* lba */
-sector_num = ((s-select  0x0f)  24) | (s-hcyl  16) | 
-(s-lcyl  8) | s-sector;
+   if (!s-lba48) {
+   sector_num = ((s-select  0x0f)  24) | (s-hcyl  16) |
+   (s-lcyl  8) | s-sector;
+   } else {
+   sector_num = ((int64_t)s-hob_hcyl  40) |
+   ((int64_t) s-hob_lcyl  32) |
+   ((int64_t) s-hob_sector  24) |
+   ((int64_t) s-hcyl  16) |
+   ((int64_t) s-lcyl  8) | s-sector;
+   }
 } else {
 sector_num = ((s-hcyl  8) | s-lcyl) * s-heads * s-sectors +
-(s-select  0x0f) * s-sectors + 
-(s-sector - 1);
+(s-select  0x0f) * s-sectors + (s-sector - 1);
 }
 return sector_num;
 }
@@ -586,10 +609,19 @@ static void ide_set_sector(IDEState *s, 
 {
 unsigned int cyl, r;
 if (s-select  0x40) {
-s-select = (s-select  0xf0) | (sector_num  24);
-s-hcyl = (sector_num  16);
-s-lcyl = (sector_num  8);
-s-sector = (sector_num);
+   if (!s-lba48) {
+s-select = (s-select  0xf0) | (sector_num  24);
+s-hcyl = (sector_num  16);
+s-lcyl = (sector_num  8);
+s-sector = (sector_num);
+   } else {
+   s-sector = sector_num;
+   s-lcyl = sector_num  8;
+   s-hcyl = sector_num  16;
+   s-hob_sector = sector_num  24;
+   s-hob_lcyl = sector_num  32;
+   s-hob_hcyl = sector_num  40;
+   }
 } else {
 cyl = sector_num / (s-heads * s-sectors);
 r = sector_num % (s-heads * s-sectors);
@@ -1475,43 +1507,89 @@ static void cdrom_change_cb(void *opaque
 s-nb_sectors = nb_sectors;
 }
 
+static void ide_cmd_lba48_transform(IDEState *s, int lba48)
+{
+s-lba48 = lba48;
+
+/* handle the 'magic' 0 nsector count conversion here. to avoid
+ * fiddling with the rest of the read logic, we just store the
+ * full sector count in -nsector and ignore -hob_nsector from now
+ */
+if (!s-lba48) {
+   if (!s-nsector)
+   s-nsector = 256;
+} else {
+   if (!s-nsector  !s-hob_nsector)
+   s-nsector = 65536;
+   else {
+  

Re: [Qemu-devel] VMDK block device as a kernel module ?

2006-02-02 Thread Paul Brook
On Wednesday 01 February 2006 11:54, Bogdan Harjoc wrote:
 Hello,

 I haven't been watching qemu development too closely but AFAIK (and
 a quick search through the list archives says the same thing) there
 haven't been any efforts in building the vmware block driver as a kernel
 (block device) driver.

Probably because that's got nothing to do with qemu.

I expect you could probably use the kernel DM or loopback layers.

Paul


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


[Qemu-devel] [patch] Arm BKPT instruction

2006-02-02 Thread Paul Brook
The attached patch implements the Arm bkpt instruction.

In full system emulation it causes a prefect abort (as defined by the 
architecture). For usermode emulation we capture it the same as SWI.

Paul
Index: linux-user/main.c
===
RCS file: /sources/qemu/qemu/linux-user/main.c,v
retrieving revision 1.76
diff -u -p -r1.76 main.c
--- linux-user/main.c	5 Dec 2005 21:04:24 -	1.76
+++ linux-user/main.c	2 Feb 2006 20:41:06 -
@@ -358,14 +358,27 @@ void cpu_loop(CPUARMState *env)
 }
 break;
 case EXCP_SWI:
+case EXCP_BKPT:
 {
 /* system call */
-if (env-thumb) {
-insn = lduw((void *)(env-regs[15] - 2));
-n = insn  0xff;
+if (trapnr == EXCP_BKPT) {
+if (env-thumb) {
+insn = lduw((void *)(env-regs[15]));
+n = insn  0xff;
+env-regs[15] += 2;
+} else {
+insn = ldl((void *)(env-regs[15]));
+n = (insn  0xf) | ((insn  4)  0xff0);
+env-regs[15] += 4;
+}
 } else {
-insn = ldl((void *)(env-regs[15] - 4));
-n = insn  0xff;
+if (env-thumb) {
+insn = lduw((void *)(env-regs[15] - 2));
+n = insn  0xff;
+} else {
+insn = ldl((void *)(env-regs[15] - 4));
+n = insn  0xff;
+}
 }
 
 if (n == ARM_NR_cacheflush) {
Index: target-arm/cpu.h
===
RCS file: /sources/qemu/qemu/target-arm/cpu.h,v
retrieving revision 1.13
diff -u -p -r1.13 cpu.h
--- target-arm/cpu.h	26 Nov 2005 10:46:39 -	1.13
+++ target-arm/cpu.h	2 Feb 2006 20:41:06 -
@@ -34,6 +34,7 @@
 #define EXCP_DATA_ABORT  4
 #define EXCP_IRQ 5
 #define EXCP_FIQ 6
+#define EXCP_BKPT7
 
 /* We currently assume float and double are IEEE single and double
precision respectively.
Index: target-arm/helper.c
===
RCS file: /sources/qemu/qemu/target-arm/helper.c,v
retrieving revision 1.2
diff -u -p -r1.2 helper.c
--- target-arm/helper.c	18 Dec 2005 16:54:08 -	1.2
+++ target-arm/helper.c	2 Feb 2006 20:41:06 -
@@ -127,6 +127,7 @@ void do_interrupt(CPUARMState *env)
 offset = 0;
 break;
 case EXCP_PREFETCH_ABORT:
+case EXCP_BKPT:
 new_mode = ARM_CPU_MODE_ABT;
 addr = 0x0c;
 mask = CPSR_A | CPSR_I;
Index: target-arm/op.c
===
RCS file: /sources/qemu/qemu/target-arm/op.c,v
retrieving revision 1.17
diff -u -p -r1.17 op.c
--- target-arm/op.c	26 Nov 2005 10:46:39 -	1.17
+++ target-arm/op.c	2 Feb 2006 20:41:06 -
@@ -885,6 +885,12 @@ void OPPROTO op_wfi(void)
 cpu_loop_exit();
 }
 
+void OPPROTO op_bkpt(void)
+{
+env-exception_index = EXCP_BKPT;
+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: target-arm/translate.c
===
RCS file: /sources/qemu/qemu/target-arm/translate.c,v
retrieving revision 1.35
diff -u -p -r1.35 translate.c
--- target-arm/translate.c	18 Dec 2005 16:55:25 -	1.35
+++ target-arm/translate.c	2 Feb 2006 20:41:07 -
@@ -1217,6 +1217,12 @@ static void disas_arm_insn(CPUState * en
 gen_op_addl_T0_T1_saturate();
 gen_movl_reg_T0(s, rd);
 break;
+case 7: /* bkpt */
+gen_op_movl_T0_im((long)s-pc - 4);
+gen_op_movl_reg_TN[0][15]();
+gen_op_bkpt();
+s-is_jmp = DISAS_JUMP;
+break;
 case 0x8: /* signed multiply */
 case 0xa:
 case 0xc:
@@ -2183,6 +2197,13 @@ static void disas_thumb_insn(DisasContex
 gen_bx(s);
 break;
 
+case 0xe: /* bkpt */
+gen_op_movl_T0_im((long)s-pc - 2);
+gen_op_movl_reg_TN[0][15]();
+gen_op_bkpt();
+s-is_jmp = DISAS_JUMP;
+break;
+
 default:
 goto undef;
 }
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] [PATCH] -win2k-hack performance+DMA support

2006-02-02 Thread Leonardo E. Reiter
Attached is a patch which greatly speeds up disk writes when using 
-win2k-hack to install Windows 2000.  It only delays every 16th 
interrupt, which after rigorous testing is still enough to overcome the 
Windows 2000 disk full bug.  If you are really adventurous you can try 
it every 32nd time, but for me that caused problems during some 
installations, so I thought it was too aggressive.


This patch also adds -win2k-hack functionality to DMA writes, since DMA 
now works in the latest CVS QEMU.


Enjoy,

Leo Reiter

--
Leonardo E. Reiter
Vice President of Product Development, CTO

Win4Lin, Inc.
Virtual Computing from Desktop to Data Center
Main: +1 512 339 7979
Fax: +1 512 532 6501
http://www.win4lin.com
Index: hw/ide.c
===
RCS file: /cvsroot/qemu/qemu/hw/ide.c,v
retrieving revision 1.39
diff -a -u -r1.39 ide.c
--- hw/ide.c	1 Feb 2006 22:20:12 -	1.39
+++ hw/ide.c	2 Feb 2006 01:48:25 -
@@ -336,6 +336,7 @@
 uint8_t *data_end;
 uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4];
 QEMUTimer *sector_write_timer; /* only used for win2k instal hack */
+uint32_t irq_count; /* counts IRQs when using win2k install hack */
 } IDEState;
 
 #define BM_STATUS_DMAING 0x01
@@ -712,7 +713,7 @@
 ide_set_sector(s, sector_num + n);
 
 #ifdef TARGET_I386
-if (win2k_install_hack) {
+if (win2k_install_hack  ((++s-irq_count % 16) == 0)) {
 /* It seems there is a bug in the Windows 2000 installer HDD
IDE driver which fills the disk with empty logs when the
IDE write IRQ comes too early. This hack tries to correct
@@ -750,7 +751,19 @@
 if (n == 0) {
 /* end of transfer */
 s-status = READY_STAT | SEEK_STAT;
-ide_set_irq(s);
+#ifdef TARGET_I386
+if (win2k_install_hack  ((++s-irq_count % 16) == 0)) {
+/* It seems there is a bug in the Windows 2000 installer 
+   HDD IDE driver which fills the disk with empty logs 
+   when the IDE write IRQ comes too early. This hack tries 
+   to correct that at the expense of slower write 
+   performances. Use this option _only_ to install Windows 
+   2000. You must disable it for normal use. */
+qemu_mod_timer(s-sector_write_timer, 
+qemu_get_clock(vm_clock) + (ticks_per_sec / 1000));
+} else 
+#endif
+ide_set_irq(s);
 return 0;
 }
 if (n  MAX_MULT_SECTORS)
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] [PATCH] partial fix for cirrus_vga mode switch corruption...

2006-02-02 Thread Leonardo E. Reiter
The attached patch corrects display mode switch corruption in Windows 
2000 and XP guests when using cirrus_vga.  I'm not sure it's correct and 
it's certainly a hack, but apparently win2k/xp are expecting the video 
RAM to be reset to all 1's after mode switches.  After lots of trial and 
error, I discovered that setting the vram to all 1's should only be done 
on mode switches to 8bpp or higher depth.


The only drawback to applying this patch as is, is that when switching 
back from the monitor, the Windows guest's screen will be reset to solid 
white.  Using the monitor in graphics mode is not a priority for me, but 
it should be easy to put a check in the code to avoid the memset() if 
the user is switching back from the monitor rather than Windows itself 
doing a mode switch.


I've found that on rare occasion, even with this patch, mode switches 
still cause display corruption.  For the most part however, the attached 
hack does the job.


Regards,

Leo Reiter


--
Leonardo E. Reiter
Vice President of Product Development, CTO

Win4Lin, Inc.
Virtual Computing from Desktop to Data Center
Main: +1 512 339 7979
Fax: +1 512 532 6501
http://www.win4lin.com
Index: hw/vga.c
===
RCS file: /cvsroot/qemu/qemu/hw/vga.c,v
retrieving revision 1.41
diff -a -u -r1.41 vga.c
--- hw/vga.c	3 Jul 2005 14:00:51 -	1.41
+++ hw/vga.c	27 Jan 2006 20:42:31 -
@@ -1364,6 +1364,8 @@
 
 if (disp_width != s-last_width ||
 height != s-last_height) {
+if (cirrus_vga_enabled  s-get_bpp(s) = 8)
+memset(s-vram_ptr, 0xff, s-vram_size);
 dpy_resize(s-ds, disp_width, height);
 s-last_scr_width = disp_width;
 s-last_scr_height = height;
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel