Skip to contentSkip to conversation

MIPS CP0 not usable in kernel mode?

PATCH In review Stefan Weil 2 participants 4 messages Mar 23, 2006 – Aug 21, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS CP0 not usable in kernel mode?

Hello,

according to MIPS32 4KE User's Manual, coprocessor CP0 is always usable when the processor is running in kernel mode.

So in kernel mode, exception "CP0 is not usable" should not happen.

I think the boolean expression which checks for the exception condition has to be inverted - see my patch for translate.c.

Kind regards,
Stefan

RCS file: /sources/qemu/qemu/target-mips/translate.c,v retrieving revision 1.11

translate.c 23 Mar 2006 19:25:53 -0000 renamed from translate.c 5 Dec 2005 19:59:36 -0000 1.11 +1 -1
diff -u -r1.11 translate.c
@@ -1180,7 +1180,7 @@
    const unsigned char *opn = "unk";
 
    if (!(ctx->CP0_Status & (1 << CP0St_CU0)) &&
-        !(ctx->hflags & MIPS_HFLAG_UM) &&
+        (ctx->hflags & MIPS_HFLAG_UM) &&
        !(ctx->hflags & MIPS_HFLAG_ERL) &&
        !(ctx->hflags & MIPS_HFLAG_EXL)) {
        if (loglevel & CPU_LOG_TB_IN_ASM) {

//

#1 lore raw
Quoted 11 lines · Stefan Weil

Hello,

according to MIPS32 4KE User's Manual, coprocessor CP0 is always usable when the processor is running in kernel mode.

So in kernel mode, exception "CP0 is not usable" should not happen.

I think the boolean expression which checks for the exception condition has to be inverted - see my patch for translate.c.

This is correct (otherwise it wouldn't be possible to ever enable CP0). The Linux kernel (plus qemu startup) happens to avoid this particular case, which might explain it wasn't caught earlier.

Thiemo

#2 lore raw

PATCH 1/1 Fix some minor warnings from qemu-doc.texi

Hi,

texi2html prints several warnings when it processes qemu-doc.texi. Some of these warnings are fixed with my patch.

Merci
Stefan

qemu-doc.texi 29 Mar 2006 12:04:36 -0000 renamed from qemu-doc.texi 20 Feb 2006 00:35:00 -0000 1.81 +0 -0
diff -u -b -B -u -r1.81 qemu-doc.texi
@@ -903,7 +903,7 @@

@example

Quoted 1 line

./qemu.sh

Connected to host network interface: tun0
-Linux version 2.4.21 ([email protected]) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003 +Linux version 2.4.21 (bellard@@voyager.localdomain) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003 BIOS-provided physical RAM map:
BIOS-e801: 0000000000000000 - 000000000009f000 (usable)
BIOS-e801: 0000000000100000 - 0000000002000000 (usable)
@@ -940,7 +940,7 @@
pty: 256 Unix98 ptys configured
Serial driver version 5.05c (2001-07-08) with no serial options enabled
ttyS00 at 0x03f8 (irq = 4) is a 16450
-ne.c:v1.10 9/23/94 Donald Becker ([email protected])
+ne.c:v1.10 9/23/94 Donald Becker (becker@@scyld.com)
Last modified Nov 1, 2000 by Paul Gortmaker
NE*000 ethercard probe at 0x300: 52 54 00 12 34 56
eth0: NE2000 found at 0x300, using IRQ 9.
@@ -963,7 +963,7 @@
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 64k freed

-Linux version 2.4.21 ([email protected]) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003 +Linux version 2.4.21 (bellard@@voyager.localdomain) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003

QEMU Linux test distribution (based on Redhat 9)

#3 lore raw

PATCH 1/1 Small fix for qemu-doc.texi

Hi,

this patch fixes 4 minor issues in qemu-doc.texi.

Kind regards,
Stefan

qemu-doc.texi 21 Aug 2006 16:34:23 -0000 renamed from qemu-doc.texi 19 Aug 2006 16:56:18 -0000 1.105 +3 -3
@@ -559,8 +559,8 @@
 The TCP Net Console has two modes of operation.  It can send the serial
 I/O to a location or wait for a connection from a location.  By default
 the TCP Net Console is sent to @var{host} at the @var{port}.  If you use
-the @var{,server} option QEMU will wait for a client socket application
-to connect to the port before continuing, unless the @code{,nowait}
+the @var{server} option QEMU will wait for a client socket application
+to connect to the port before continuing, unless the @code{nowait}
 option was specified. If @var{host} is omitted, 0.0.0.0 is assumed. Only
 one TCP connection at a time is accepted. You can use @code{telnet} to
 connect to the corresponding character device.
@@ -1011,7 +1011,7 @@
 it. For example, use @file{/dev/cdrom} to access to the CDROM or
 @file{/dev/fd0} for the floppy.
 
-@table
+@table @code
 @item CD
 You can specify a CDROM device even if no CDROM is loaded. QEMU has
 specific code to detect CDROM insertion or removal. CDROM ejection by
@@ -1198,7 +1198,7 @@
 QEMU emulates a PCI UHCI USB controller. You can virtually plug
 virtual USB devices or real host USB devices (experimental, works only
 on Linux hosts).  Qemu will automatically create and connect virtual

USB hubs
-as neccessary to connect multiple USB devices.
+as necessary to connect multiple USB devices.

@menu
* usb_devices::