qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] [PATCH] 3C90X Emulation


From: Anthony Liguori
Subject: Re: [Qemu-devel] [RFC] [PATCH] 3C90X Emulation
Date: Sat, 11 Jul 2009 09:10:46 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090320)

Matthew Iselin wrote:
This patch adds a basic 3C90X emulation to QEMU.

I have tested this with Linux kernels 2.4 and 2.6 (DSL and Ubuntu), and
Pedigree.

This has been ported from the PearPC 3C90X emulation, with significant
modifications to enable it to work on 2.6 kernels.

Signed-off-by: Matthew Iselin <address@hidden>
---
 Makefile.target |    1 +
 hw/3c90x.c      | 2421 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/pci.c        |    2 +
 hw/pci_ids.h    |    3 +
 4 files changed, 2427 insertions(+), 0 deletions(-)
 create mode 100644 hw/3c90x.c

diff --git a/Makefile.target b/Makefile.target
index 1a71f3a..9f3dd58 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -556,6 +556,7 @@ obj-y += eepro100.o
 obj-y += ne2000.o
 obj-y += pcnet.o
 obj-y += rtl8139.o
+obj-y += 3c90x.o
 obj-y += e1000.o
# Generic watchdog support and some watchdog devices
diff --git a/hw/3c90x.c b/hw/3c90x.c
new file mode 100644
index 0000000..dc242dc
--- /dev/null
+++ b/hw/3c90x.c
@@ -0,0 +1,2421 @@
+/**
+ * QEMU 3C90X Emulation
+ *
+ * Copyright (c) 2009 Matthew Iselin (QEMU VERSION)
+ * Copyright (C) 2004 John Kelley (address@hidden) (PEARPC VERSION)
+ * Copyright (C) 2003 Stefan Weyergraf (PEARPC VERSION)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+
+ * Modifications:
+ *  (none)
+ */
+
+/**
+ * TODO:
+ *  - Still a lot of unimplemented functionality
+ *  - savevm functions
+ * TESTED ON:
+ *  - Damn Small Linux (4.4.10) - Linux 2.4
+ *  - Damn Small Linux N - Linux 2.6
+ *  - Ubuntu (8.10, 5.10)
+ *  - Pedigree
+ */
+
+#include "hw.h"
+#include "pci.h"
+#include "pc.h"
+#include "qemu-timer.h"
+#include "net.h"
+
+// Should we inspect incoming frames and print extra debugging information 
about them?
+//#define DEBUG_3C90X_ANALYSE_FRAMES          0
+
+#ifdef DEBUG_3C90X_ANALYSE_FRAMES
+#define __FAVOR_BSD
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+#endif
+
+#define PACKED      __attribute__((packed));
+#define ALIGNED     __attribute__((aligned));
+#define PACKED8     __attribute__((aligned(8)));
+#define PACKED16    __attribute__((aligned(16)));
+#define PACKED32    __attribute__((aligned(32)));
+
Besides being poorly formatted, the PACKED structures is a good indicator that this file is not endian safe and it doesn't appear to be.

It needs some refactoring to make it work for qemu I think.

Regards,

Anthony Liguori




reply via email to

[Prev in Thread] Current Thread [Next in Thread]