code provided by Mike Smith. While I'm here, convert this file to use
macros from <machine/asm.h> rather than making assumptions about how
C labels are handled.
sane in general. Since we can uniquely identify each SPU type
(except for 318/319/330, because there _are_ no differences, really),
require that the appropriate SPU option be configured into the kernel.
in new hp300spu.h file. This includes the code that associates
model number with cpu/mmu/cache combinations.
- Define "mmuid" constants for several models, derived from code
provided by Mike Smith.
systems with a Frodo Utility Chip. This is essientially an 8250 with
3 bytes of padding between each register. From mike smith
<miff@spam.frisbee.net.au>.
- place all interrupt-related macros, prototypes, etc. into <machine/intr.h>,
like other ports.
- rename isrlink/isrunlink/isrinit, etc. intr_establish/intr_disestablish/
intr_init, etc., and move to intr.c for naming consistency.
- don't call intr_init() twice.
- While servicing an rx, tx, or modem status interrupt: if we have a
NULL struct tty * or if the tty isn't open, just return.
- Skip the self test if we are the console; it manages to do funny
things to autoconfig messages. (XXX - this should be fixed)
code. In practice, no one traces NetBSD programs with HP-UX debuggers,
and the evil required to make it work should not be discussed in the
presence of small children.
- /dev/kmem: disallow access to devices
This is designed to protect device registers from being corrupted
accidentally by "innocent" mem/kmem grovellers.
- Supply an `fputype' global. Since all hp300's have an FPU, default
it to FPU_68881, setting it to FPU_68040 if we detect a 68040 CPU.
- Use `fputype' at run-time rathern than FPCOPROC at compile-time.
- Re-arrange locore slightly; move startup code to the beginning, right
after the vector table.
Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.
For the detailed change history, look at the commit log entries for
the is-newarp branch.
it fails spectacularly and doesn't clean up. Also, don't depend genassym.c
(since it no longer exists), and remove dependencies for genassym.o (since it
no longer exists).
compute the number of iterations through the copy loop based
on file size; the miniroot image may be compressed. Instead,
ignore short reads in the NFS case, and handle them like EOF.
- Fix typo in a printf format.
new ipl is higher than the ipl currently set in SR. (Thanks to
scottr@netbsd.org for implementing it while I was busy with other stuff!)
- Define spl{bio,net,tty,imp} in terms of _splraise().
- Move definition of splhil() here, and define splkbd() as an alias for it.
- Synch the "clean" rule with the i386 port's.
- Add a commented-out rule for generating assym.h w/ the new genassym.sh.
Some slight changes need to be made to genassym.h to make it work with
m68k, so we can't use it just yet.
The boot blocks do a primitive form of autoconfiguration. Duplicate some
of the old config strcutures for the benefit of the boot blocks; they
don't need something as flexible as the kernel does.
- Always ensure that RAW_PART ("c") can be opened.
- Disallow unused or non-existent partitions from being opened.
- Don't do bounds checking or partition translation on RAW_PART.
This is consistent with other disk drivers in the NetBSD source tree,
and fixes a condition where the user could not fix a corrupted disklabel
due to a bogus offset for partition "c".
- Always allow RAW_PART to be opened, regardless of the partition table.
- Never do partition translation on RAW_PART; it's always offset 0.
- Always make sure the disklabel is read from RAW_PART.
- Make *strategy() return values consistent.
This fixes a condition where a bogus partition table could be written
to the disk from SYS_INST, and the user had no way to rewrite with
a correct partition table, since RAW_PART would be invalid.
We're about 75% there. SCSI and HP-IB are not yet supported in a new
config kernel; some autoconfiguration hackery has to be done there, yet.
These changes are enough to network boot a diskless kernel.
New config glue is enabled with the "NEWCONFIG" kernel option. If that
option is not present, an old config kernel will be built. Any kernel
configured with config(8) will automatically pick up the NEWCONFIG
option from std.hp300.
dmacomputeipl(), which is called by drivers which use DMA once they've
hooked up their interrupts. This new function computes the appropriate
ipl to use for the DMA controller and (re-)establishes it's interrupt.
on indirect-config busses a (permanent) softc that they could share
between 'match' and 'attach' routines:
Define __BROKEN_INDIRECT_CONFIG so that old autoconfiguration
interfaces are used, until drivers are converted to use the new
interfaces (actually, converted back to use the _older_ interfaces)
which prohibit indirect configuration devices from receiving a softc
in their match routine that they can share with their attach routine.
Lets users over-ride with makeoptions COPTS="..." in kernel config files.
Leave `mandatory' flags (like -msoft-float which on m68k enforces no
FP in kernel) in CFLAGS.
VM_PROT_READ|VM_PROT_EXECUTE. The previous default (VM_PROT_ALL)
would cause the following scenario:
- someone attempts to write kernel text (my test was writing
to an offset of /dev/kmem which was known to be in the text
segment, while in single-user mode).
- enter trap() with MMU fault (because of RO pte).
- trap() calls vm_fault(), which looks up vm_map_entry for
fauling address.
- vm_fault interprets write fault and VM_PROT_WRITE (in VM_PROT_ALL)
as COW; new page allocated, data copied to new page, new page
mapped in at trunc_page(<faulting va>).
- wow, look at the fireworks!
Fixes two potential symptoms:
- kernacc() returns TRUE when checking for permission to write
an offset in kernel text, which is bogus, since the text has
been mapped RO by pmap_bootstrap().
- Handling of a stray pointer that attempted to scribble into
kernel text would not be executed properly.
don't do this, kernacc() will bogusly return TRUE for page 0, causing a
NULL pointer dereference in uiomove() when reading /dev/kmem.
Thanks to Scott Reynolds for noticing the problem.
- Fix up usage of MBD_ISPID().
- Ensure that we never deal with a NULL proc, and if our proc has
no pcb, punt. Suggested by Gordon Ross.
- Eliminate some redundant NULL pointer checks in the T_MMUFLT cases;
proc0.p_addr is now initialized early, and we make a single test
for sanity at the top of trap() now.
- Initialize proc0.p_addr just after setting up the kernel stack, to avoid
getting NULL pointers in trap(). Change suggested by Gordon Ross.
- Panic if main() returns.
- Tidy up a couple of comments.
(remaps page read/write/cache-inhibit, does write, restores previous
mapping). Kernel text no longer needs to be read/write with DDB/KGDB
is in the kernel.
Based on a similar module written for the Sun3 port by Gordon Ross,
and modified somewhat by me.
- Offset kernel text one page. Stash the PA of this offset page for
use later.
- Add a few comments.
- Free up some registers earlier in the initialization process.
- Use a `prototc' to set the Translation Control register, rather
than relying on a2 pointing just past the MMU trampoline in the
high page. (Suggested by Charles Hannum.)
- Set VBR to the kernel vector table just before turning on the MMU.
- Just before rebooting, set VBR to 0, which is what the BOOTROM expects
it to be.
kernel setroot(). The device type for network boot is set like any
other device now. Also, call the punit entry point for device drivers
to properly set `bootdev'.
The "options GENERIC" entry in kernel config files is not longer necessary
for "swap generic" kernels. Uses new config constructs which work with
some glue in an old config environment. This code will support new config
with minimal changes.
an unrecognized keyboard produced garbage on keypresses in the kernel,
but worked in the boot program (which has this default). The bug is
that the keymap pointers are unitialized.
- Only pass user trace traps and breakpoints on to trap().
Gets rid of some hair in the trace/breakpoint trap cases.
- Before entering the debugger, switch to a temporary
stack so that the debugger can alter the stack pointer.
- Add glue for KGDB (still not complete).
Some other minor cleanup:
- Protect against some bad pointer derefs.
- Be more a little more verbose when a fatal trap
occurs to aid debugging.
- Only pass user trace traps and breakpoints on to trap().
- Before entering the debugger, switch to a temporary
stack so that the debugger can alter the stack pointer.
- Add glue for KGDB (still not complete).
Clearly mark the MMU enable trampoline code.
the keyboard to work. Fixes a bug where booting with `-d' worked
only on systems using a serial console.
While I'm here, eliminate some redundancy in the ite console intialization
code.
This fixes a critical bug where a clock interrupt would happen sometime
between the call to hp300_calibrate_delay() and when proc0 is initialized.
This ends up dereferencing a bad pointer in itimerdecr(), which scribbles
over the first page of kernel text, specifically vectors 46 and 47 (decimal).
To complicate matters, the way the bug manifested itself was different
depending on whether or not DDB was configured into the kernel. When
DDB is in the kernel, kernel text is mapped read/write. When DDB is not
in the kernel, kernel text is mapped read-only. Note that the kernel
scribble happens early, typically before the console is initialized.
In the non-DDB case, the kernel will hang as soon as it's loaded because
the access causes a fault (before the console is initialized, so you
don't see the trap).
In the DDB case, the access does _not_ cause a fault. However, the
mechanism used to enter the kernel debugger is to issue a "trap #15".
Conveniently, this is one of the corrupted vectors (47), thus rendering
DDB useless (it actually caused a recursive panic/trap loop).
This _WILL_ be in the first 1.2 official patch.