Date: Tue, 8 Jun 2004 00:52:04 -1000 From: juli mallett <jmallett@FreeBSD.org> To: freebsd-mips@FreeBSD.org Subject: Some MIPS status goodies. Message-ID: <20040608105204.GA58638@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
Heyo folks, I had a quantity of free time dumped on me late last week, and I've gotten back up to speed on MIPS stuff. I've done basic interrupting working (clock interrupts), and I'm working out detailf of threads. Namely I have to figure out how to keep the status register consistent. I also only tonight *got* the difference between the different parts of a context switch... The kernel thread, and the userland thread. For me, the former is associated with a PCB, the latter with a trapframe. This may not be correct, but it's a convenient enough way of looking at it to make some progress. Some strange stuff with callouts, perhaps. I've seen many context switches happen now, it's kind of neat. What's really helped me make progress is the excellent mips64emul emulator. It's pretty cool, and in very early stages of development. But it's enough to cut some of the overhead of rebooting a real Indigo2, etc. It's also representative of someone who took the time to understand the hardware interfaces enough to implement something to pretend to be them, and this can be very nice to read and look at to understand how stuff works, if you just can't wrap your brain around why someone used 1-space indents and seeems to have rot13'd all the function names as to make it wholly impossible to make sense of... And I won't even talk about the Sprite-derived code! I made a port of mips64emul, ports/emulators/mips64emul. I didn't do x11 support because I didn't want to get into too much of the messy parts of ports, but patches are welcome, and I'll probably get around to it some day. Here's a um, textshot of a MIPS kernel booting in mips64emul... Note that in testing without setting to use 128 megs of ram, spooky stuff happened, so all I can vouch for is that. That's the -M 128... The -q turns off some of the very heavy debugging output (it means quiet), and the -G 22 means to emulate an SGI, more specifically, an IP-22. Other interesting options are -C <blah> to emulate a specific CPU, -N to watch instruction interpretation speed/progress, and -s to get a nice summary of instruction use at the end of execution. %%% (juli@oingo:~)3% mips64emul -M 128 -qG 22 mips.build/sgimips/usr/people/juli/p4/mips/sys/INDY/kernel IOC rev 1, machine Indy (Guiness), board rev 3 [ sgi_ip22: unimplemented write to address 0x20, data=0x00 ] [ sgi_ip22: unimplemented write to address 0x4, data=0x00 ] [ sgi_ip22: unimplemented write to address 0xc, data=0x00 ] [ sgi_ip22: unimplemented write to address 0x14, data=0x00 ] [ sgi_ip22: unimplemented write to address 0x18, data=0x00 ] Timer calibration, got 40000 cycles (40000, 40000, 40000) CPU clock speed = 8.00Mhz SGI-IP22 (IP22), subtype 18, board rev. 3 at 3MHz ARCS MEM 0x1000000 -> 0x8000000 Kernel page table maps 28672 4K pages and is 224K Copyright (c) 1992-2004 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 5.2-CURRENT #63: Mon Jun 7 23:56:06 HST 2004 juli@oingo:/usr/people/juli/mips.build/sgimips/usr/people/juli/p4/mips/sys/INDY WARNING: WITNESS option enabled, expect reduced performance. elf_cpu_load_file unimplemented at /usr/people/juli/p4/mips/sys/mips/mips/elf_machdep.c:37, returning error. MIPS R4000 CPU (0x400) Rev. 0.0 with MIPS R4010 FPC Rev. 0.0 cpu0: 32KB/32B direct-mapped L1 Instruction cache, 48 TLB entries cpu0: 32KB/32B direct-mapped write-back L1 Data cache machine: SGI-IP22 ARCS memory = 0 (0 KB) Loaded program memory = 0 (0 KB) avail memory = 117440512 (112 MB) real memory = 117440512 (112 MB) null: <null device, zero device> random: <entropy source, Software, Yarrow> imc0 imc0: revision 3, EISA present [ sgi_ip22_memctl: unimplemented write to address 0xec, data=0x00000000 ] [ sgi_ip22_memctl: unimplemented write to address 0xfc, data=0x00000000 ] [ sgi_ip22_memctl: unimplemented read from address 0xc, data=0x00000000 ] [ sgi_ip22_memctl: unimplemented write to address 0xc, data=0x00000000 ] [ sgi_ip22_memctl: unimplemented read from address 0x84, data=0x00000000 ] [ sgi_ip22_memctl: unimplemented write to address 0x84, data=0x00000000 ] procfs registered Timecounter "SGI IP22" frequency 8000000 Hz quality 1000 Timecounters tick every 10.000 msec warning: cpu0 exception while EXL is set, not setting EPC! Fatal trap type 13 in kernel mode: (Tr) Trap program counter = 0xc000000002221658 return address = 0xc000000002221658 bad virtual address = 0 cause = 0x34 status = 0x20008083 current thread = 0xffffffffa8216638 current process = 0 (swapper) Stopped at 0xc000000002221658: invalid address. db> ps pid proc uarea uid ppid pgrp flag stat wmesg wchan cmd 17 ffffffffa796d2d0 c000000005cab000 0 0 0 0000204 [IWAIT] swi6:+ 16 ffffffffa796d5a0 c000000005cac000 0 0 0 0000204 [IWAIT] swi7: task queue 15 ffffffffa796d870 c000000005cbf000 0 0 0 0000204 [IWAIT] swi5:+ 5 ffffffffa796db40 c000000005cc0000 0 0 0 0000204 [SLPQ - 0xffffffffa1055200][SLP] taskqueue 14 ffffffffa7955000 c000000005cc1000 0 0 0 0000204 [SLPQ - 0xffffffffa823ba80][SLP] yarrow 4 ffffffffa79552d0 c000000005cc2000 0 0 0 0000204 [SLPQ - 0xffffffffa8215940][SLP] g_down 3 ffffffffa79555a0 c000000005cc3000 0 0 0 0000204 [SLPQ - 0xffffffffa8215938][SLP] g_up 2 ffffffffa7965000 c000000005c81000 0 0 0 0000204 [SLPQ - 0xffffffffa8215928][SLP] g_event 13 ffffffffa79652d0 c000000005ca6000 0 0 0 0000204 [IWAIT] swi4: vm 12 ffffffffa79655a0 c000000005ca7000 0 0 0 000020c [LOCK Giant ffffffffa1054200] swi8: clock 11 ffffffffa7965870 c000000005ca8000 0 0 0 0000204 [IWAIT] swi1: net 10 ffffffffa7965b40 c000000005ca9000 0 0 0 000020c [Can run] idle 1 ffffffffa796d000 c000000005caa000 0 0 0 0000200 [INACTIVE] swapper 0 ffffffffa8216368 ffffffffa82348c8 0 0 0 0000200 [CPU 0] swapper db> %%% My goal is to fix whatever's breaking now, and implement bus resource stuff and more interrupt stuff, then once I have some interesting devices working, I'll move on with making all the threading and VM stuff just right. Or, y'know, I might get distracted by a shiny thing and start working on something random! As always, questions, no matter how dumb you may think they are (such as asking why the formatting of addresses is the ps output sucks so hard) are encouraged. Thanx, juli. PS: I haven't forgotten about setting up a SUP server or something... But I'm not sure if I should actually make it a prioritity to set up, as it's going to mean using my home bandwidth, etc... How much interest is there actually? If you're interested in having access to the source, toss me an email. FreeBSD developers, I'll walk you through getting P4 going. -- juli mallett. jmallett@freebsd.org. adrift in the pacific.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040608105204.GA58638>