Commit Graph

366 Commits

Author SHA1 Message Date
scw 2dd1c1657f Add sigcontext/mcontext conversion macros. 2003-01-21 11:28:01 +00:00
scw a57f525335 Define {,UN}LINK_BIG_FRAME() macros for dealing with stackframes
greater than 511 bytes in size.
2003-01-21 11:27:18 +00:00
scw c3be47693c Use 'int' instead of 'u_int32_t' in a couple of places to avoid
depending on sys/types.h.
2003-01-21 11:26:04 +00:00
scw 0767992461 If we don't explicitly recognise the trap type, only panic if it
came from kernel mode. Otherwise, print details of the exception
and send a SIGILL to the process.

The is necessary now that debug exceptions are handled here.
2003-01-20 22:32:26 +00:00
scw def0257e54 Split struct reg into integer and FP parts, to be more like every other port.
As a side benefit, advertise PT_[GS]ETFPREGS.
2003-01-20 20:07:52 +00:00
scw c64b785002 Add sh5 kernel support for SAs.
This gets the Cayman to multi-user with a non-SA aware userland.
2003-01-19 19:49:47 +00:00
scw 8b92aecb3f Use the full 'sh5le-unknown-netbsd-' prefixed toolchain names, and
set optimisation to -O2 now that gcc seems to generate decent sh5 code.
2003-01-19 19:46:57 +00:00
wiz 1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
wiz c6f1277bfa synchronous, not syncronous. 2003-01-06 13:10:25 +00:00
thorpej dca15fc8c2 Use aprint_normal() for cfprint routines. 2003-01-01 02:10:08 +00:00
manu 4a06119a9d Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.
2002-12-21 16:23:56 +00:00
thorpej e8cc3884de Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is. 2002-12-10 17:14:02 +00:00
thorpej 78ea2dd367 Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
2002-12-10 05:14:24 +00:00
scw d4cfbd3754 Implement __cpu_simple_lock{,init,try}() for sh5. 2002-12-07 22:31:33 +00:00
scw 50247a2a3c Fix PRIiPTR. 2002-12-07 21:37:35 +00:00
scw 57c2c2b87f Add a hack at the end of setregs() which works around a bug which can,
under some circumstances, leave turds in the icache following vmspace
teardown.

It's not yet clear if this is a pmap bug or a toolchain problem since
the hack is unecessary when the kernel is compiled with -O0. Of course
that could just be masking the problem due to increased icache pressure...
2002-12-06 10:22:15 +00:00
scw f051850107 Avoid strict-alias warnings. 2002-12-06 10:14:10 +00:00
scw 41085b101b fsina.s, fsrra.s and fcosa.s take single-precision operands, not double. 2002-12-06 10:12:13 +00:00
scw 87897c05fe Qualify ptel and tlbcookie fields with volatile since they are
modified by the TLB miss handler.
2002-12-06 10:10:48 +00:00
lukem 0635de35a3 Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more. 2002-11-26 23:30:07 +00:00
scw 918d34d917 Quell an uninitialised variable warning. 2002-11-24 12:07:52 +00:00
scw 2fcea657de Implemented #2: Improved TLB management 2002-11-23 09:27:03 +00:00
scw a3885e9bdd - Change VM_MIN_KERNEL_ADDRESS to start at KSEG1 instead of KSEG0.
- Overhaul the TLB management code such that we now keep track of
   the exact TLB slot at which a mapping was inserted, both for user-
   space and kernel mappings. This addresses #2 on the TODO list.
2002-11-23 09:25:54 +00:00
scw dbaff62d21 Make this compile again. 2002-11-23 09:14:14 +00:00
manu d584ed9598 Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.
2002-11-15 20:06:00 +00:00
scw bc159224ed Missing newline. 2002-10-31 14:52:54 +00:00
scw 78aeffb90b Add an explicit ULL suffix to a 64-bit constant to appease gcc-current. 2002-10-31 14:52:30 +00:00
scw 3795c4e6f4 Since we keep a list of all mappings for a given physical page (even
unmanaged mappings) so we can deal with cache aliases, make sure to
skip unmanaged/wired mappings (added via pmap_kenter_pa()) when doing
things like pmap_page_protect().
2002-10-31 14:34:17 +00:00
scw 6a3f09110b Catch NMIs when DDB is defined, instead of DEBUG.
Drop the interrupt level to zero when before handling ASTs in the
exit path of h/w interrupts.
2002-10-31 14:24:16 +00:00
scw 8bf915f645 When setting the SP for a process, copy the same value to the
process' FP for the sake of consistency.
2002-10-31 14:20:39 +00:00
jdolecek c82ab2eb79 now that mem_no is emitted by config(8), there is no reason to keep
copy of more or less identical iskmemdev() for every arch; move the function
to spec_vnop.c, and g/c machine-dependant copies
2002-10-26 13:50:17 +00:00
scw b67ad48827 Put bit definitions for the FP control/status register in <sh5/fpu.h> and
use them instead of "magic" numbers in the source.
2002-10-24 13:58:48 +00:00
scw 511275734b Format string fixes. 2002-10-24 13:48:44 +00:00
scw b28965836d Tick off another item. 2002-10-23 13:37:05 +00:00
scw c774ffbae4 MD glue for COMPAT_NETBSD32 on SH-5. 2002-10-23 13:26:35 +00:00
scw 31397fedc3 Make the compile if PMAP_DIAG is not defined. 2002-10-23 13:24:28 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
scw 949919c48e Tick off another item. 2002-10-22 13:11:06 +00:00
scw 2a52019c1e As per TODO item #13, clear the Referenced bit in the PTE after purging
a mapping from the TLB/cache to prevent duplicate purges for pages
which were not touched since the last purge.
2002-10-22 13:10:28 +00:00
scw 8496cdaeb7 - Fix REDUCE16 to ignore the upper 32-bits of the input operand.
- Shift a leading misaligned quad to compensate for the implicit shift
  in the "ldlo.q" instruction. (And remove the "XXX:" comment which correctly
  hinted that this might be necessary).
- Clean up some comments.
2002-10-22 12:22:43 +00:00
scw 6a2132797e - Simplify early initialisation so we do most of it in C.
- Call allocsys() much earlier so we can use uvm_pageboot_alloc() to
  steal KSEG0 pages for system tables.
2002-10-22 09:30:26 +00:00
scw b7d8acc608 In switch_exit(), load the SP and FP from proc0's PCB instead of using
a "null" stack.
Also be sure to clear curproc, and update curpcb.
2002-10-21 15:37:20 +00:00
scw 87df298d3e Unroll the zero/copy page loops to do 128 bytes per loop instead of 32,
paying particular attention to cache-lines and sets.
2002-10-19 13:18:55 +00:00
scw 28cf032416 If the incoming buffer is already quad aligned, skip the initial
alignment code. (There was nothing wrong with the original code path
other than it was slightly slower if the buffer was already aligned).

Also, catch another corner case related to alignment/length of the
last 1-7 bytes.
2002-10-19 13:17:33 +00:00
scw 7feac76e17 Tick off a few more items, and add a new one. 2002-10-19 11:13:11 +00:00
scw 873eee59ff Add fast assembler versions of in_cksum() and in4_cksum().
(Well, as fast as can be expected on a cpu with no carry flag)
2002-10-19 09:01:44 +00:00
scw 80b7fbca17 Ditch the crude and slow bytewise copyin()/copyout()/kcopy() code in favour
of the asm memcpy() in libkern.
2002-10-19 08:56:45 +00:00
scw 1e0542ac19 Fix a spurious looping PC/FP message when we stop due to not finding
the caller's stack frame.
2002-10-19 08:50:30 +00:00
scw c01b319dcc There seem to be some stability problems with the scif serial port driver
at the moment, possibly as a side-effect of some yet-to-be-committed SH5
speed-ups.

Work-around it for now by using com0 as the console.
2002-10-19 08:43:32 +00:00
scw a7be530a95 Add code to support tracing back through a stackframe which was created
using a "movi imm, Rn / sub R15, RN, R15" pair. This is how the compiler
creates frames which are too big to fit in the immediate field of "addi";
something which happens a lot with -O0 ...

While I'm here, add a simple heuristic to detect infinite loops caused by
tracing back through some non-leaf asm routines which don't set up frames.
2002-10-18 09:16:14 +00:00
scw fd0556a4dc Interrupt handles are now allocated from KSEG0. 2002-10-14 14:22:44 +00:00
scw 89612efe30 Interrupt overhaul:
- Allocate interrupt handles dynamically from a pool(9) to reduce the
   number of TLB misses during interrupt dispatch.
 - Fully support evcnt(9) in all interrupt dispatchers.
2002-10-14 14:19:27 +00:00
scw 041aef4bee Preparation for compat_netbsd32. 2002-10-14 14:13:27 +00:00
scw bd8765b9da Add a couple more items. 2002-10-14 10:52:41 +00:00
scw e52022da42 Mark a couple of items as done. 2002-10-14 09:48:20 +00:00
scw 278e4d7886 Quell an uninitialised variable warning. 2002-10-14 09:46:31 +00:00
scw 48d75c2893 Work around yet another compiler optimisation bug.
I don't even want to think about where else in the kernel
this one could bite...
2002-10-12 12:02:16 +00:00
scw 2991c538da Add support for Restartable Atomic Sequences.
XXX: ptrace(2) does not currently work on SH5, so there are no checks for
tracing through a RAS at this time.
2002-10-12 11:39:53 +00:00
scw 7135f0329f Fixes for LP64. 2002-10-10 09:47:17 +00:00
scw 58c1858c31 More fixes/tweaks:
- Use the PVO_CACHEABLE flag in the pvo as the One True Indicator of
   the cacheable status of a mapping instead of peeking at the PTEH.
 - Don't inline some of the larger routines, in an effort to appease
   the somewhat buggy compiler.
 - Fix some comments.
 - Fix some casts.
 - Add a bunch more debugging instrumentation.
2002-10-10 08:57:52 +00:00
scw bbb7b848b6 Don't try to trace back through proc_trampoline. 2002-10-10 08:53:22 +00:00
scw a3d166c50b - Add kcr0 and kcr1 to db_regs.
- Move usr, sr, pc, and the branch-target registers to the top of
   the listing so that it is no longer necessary to scroll through
   64 integer registers to see them.
2002-10-10 08:52:31 +00:00
scw 4401a03fd4 Tweak the "ffs" code in cpu_switch so we can ditch __HAVE_MD_RUNQUEUE. 2002-10-09 20:27:35 +00:00
scw 1d99b44e36 Adjust the size of intrcnt members to match sizeof(u_long). 2002-10-09 18:52:36 +00:00
scw 16c5b1b5a8 - g/c an accidentally committed debug hack
- use sh5_trunc_page() instead of masking with SH5_PTEH_EPN mask
  where appropriate. The latter is not safe in 64-bit mode.
2002-10-08 16:01:07 +00:00
scw ae8f4bf362 Fix tyop. 2002-10-08 15:59:32 +00:00
scw 71de7dd5e6 - Tweak the kernel's start address for 64-bit kernels.
- Use a local hacked-up-for-sh64 dbsym(8).
2002-10-08 15:59:11 +00:00
scw f30b5f8e54 Cast to caddr_t via intptr_t. 2002-10-08 15:56:13 +00:00
scw 2729bcfb69 - Use intrnames[] instead of rolling our own.
- Update intrcnt[level] in sh5_intr_dispatch().
2002-10-08 15:55:07 +00:00
scw e0248b775a intrnames has moved to board-specific code. 2002-10-08 15:53:04 +00:00
scw a5719508fe Get DB_ELFSIZE for 64-bit kernels. 2002-10-08 15:49:26 +00:00
scw 2657f0ac37 Ensure the temporary mapping for /dev/mem is flagged as unmanaged. 2002-10-07 15:05:58 +00:00
scw 88e1242876 Lots of small changes, some functional, some cosmetic.
The main bug fixes are:
 - pmap_pvo_remove() must calculate the kipt index if the idx param is -1.

 - Don't assume that if a pmap's ASID generation is out of date that we
   can skip purging/invalidating the cache for any of its constituent
   mappings. At this time, the ASID generation just indicates that none
   of its mappings are in the TLB. However, there may still be some valid
   cache entries for them.

Finally, the subtle NFS and buffer cache corruption problems disappear.
2002-10-07 15:02:07 +00:00
scw 199e165526 Add a cacheop for purging/invalidating the whole operand/insn caches.
This is currently not used (actually, it was used locally for a short time
while tracking down a pmap bug), but is here in case it's needed later.
2002-10-07 14:48:14 +00:00
scw 9bbc15e3a1 Add a SH5_PTEL_CACHEABLE() macro which evaulates TRUE if the specified
PTEL describes a cacheable mapping.
2002-10-07 14:42:31 +00:00
scw 1b3c8f3be0 Flesh out cpu_reboot(). 2002-10-05 11:01:13 +00:00
scw 0bd5c145b4 Pick up sh3's disksubr.c instead of maintaining an identical copy locally.
This allows the two architectures to share disklabels.
2002-10-05 09:51:17 +00:00
scw cf68c75f4a Simplify the test for KSEG0 addresses in pmap_extract() so that it
works for _all_ KSEG0 addresses, not just managed VAs.
2002-10-05 08:23:32 +00:00
elric d19d268a95 assign majors for raw and cooked cgd's. 2002-10-04 18:28:24 +00:00
scw 4c6f867793 s/COPTS/DEFCOPTS/ 2002-10-04 10:24:05 +00:00
scw 26ebb442bf - Hook the PCI arbiter and error interrupts, and print something
useful should one occur.
- Manually poke some config values into the sh5pci host bridge's
  config registers since it doesn't appear in config. space.
- Reserve the first 256 bytes of i/o space to avoid assigning i/o
  address 0 to any cards.
- Slight tweak to the initialisation code after consultation with
  SuperH and the linux driver.
2002-10-04 10:22:24 +00:00
scw a520b3b2c8 Convert to new devsw world order. 2002-10-04 10:16:56 +00:00
scw f7f3db86ff When loading a DMA map, make sure the BUS_DMA_COHERENT flag in the
map accurately tracks the same flag in the segments belonging to it.
The map's copy can be set only if all the segments are coherent.

This finally gets NFS writes fully working on my PCI ex(4) card.
2002-10-04 09:20:20 +00:00
scw 99fec1b346 Minor pmap rototil:
- Track unmanaged mappings of RAM more closely by allocating a pvo
   for them. This allows us to check more accurately for multiple
   cache-mode-incompatible mappings.

 - As part of the above, implement pmap_steal_memory(). This has the
   beneficial side-effect of moving a fair chunk of kernel data
   structures into KSEG0.
2002-10-04 09:17:57 +00:00
scw c859106ab8 Gee, this file is showing its origins... cpu_swapout() may invoke
panic() on MIPS, but really shouldn't do the same on SH5.
2002-10-02 16:19:59 +00:00
thorpej 89bf5a8f8e Add trailing ; to CFATTACH_DECL. 2002-10-02 15:52:22 +00:00
scw b13817324e Fix the initial cacheline alignment case. This gets my PCI ex(4) card
pretty much working, at least for non-NFS use.

With NFS, it fails under pressure probably due to operand cache aliases
between KSEG0 and regular 4KB mappings elsewhere. Sigh.
2002-10-02 14:40:27 +00:00
scw 9e1133a710 In pmap_page_is_cacheable(), add an explicit check for KSEG0 addresses.
They don't show up in the page tables, so the default "not cacheable"
status is wrong.

This finally gets my ex(4) working on the Cayman's PCIbus.
2002-10-02 12:19:38 +00:00
scw 4c12ca2bdc Don't clear the original contents of r0 in sigreturn(). We're returning
to the interrupted context, not the sigreturn syscall stub.
2002-10-02 08:13:09 +00:00
scw 240029a2aa NetBSD/sh5 post-dates the old "signal trampoline" delivery mechanism,
so don't bother even pretending it exists.
2002-10-02 08:10:34 +00:00
scw c4efa0ddba Change IPL_SOFTNET to 3. 2002-10-01 21:07:31 +00:00
scw 0e3aa70138 Count all soft interrupt events per level, rather than just
the first one per call to softintr_dispatch().
2002-10-01 21:04:59 +00:00
scw 92c80efadc Fix a soft interrupt botch which prevented softints being dispatched
on exit from regular h/w interrupts.
2002-10-01 20:41:52 +00:00
thorpej 3b6eef8108 Use CFATTACH_DECL(). 2002-10-01 19:24:47 +00:00
scw 2ce95435ad One of the last pieces of the SH5 pmap jigsaw; detect and deal with
operand cache synonyms and paradoxes for shared mappings:

 - Writable mappings are cache-inhibited if the underlying physical
   page is mapped at two or more *different* VAs.

   This means that read-only mappings at different VAs are still
   cacheable. While this could lead to operand cache synonyms, it
   won't cause data loss. At worst, we'd have the same read-only
   data in several cache-lines.

 - If a new cache-inhibited mapping is added for a page which has
   existing cacheable mappings, all the existing mappings must be
   made cache-inhibited.

 - Conversely, if a new cacheable mapping is added for a page which
   has existing cache-inhibited mappings, the new mapping must also
   be made cache-ibhibited.

 - When a mapping is removed, see if we can upgrade any of the
   underlying physical page's remaining mappings to cacheable.

TODO: Deal with operand cache aliases (if necessary).
2002-10-01 15:01:48 +00:00
scw 1e4acb4d20 Another temporary fix until I write a bootloader: run the kernel
through dbsym(8).
2002-10-01 07:56:45 +00:00
scw 5a512e6285 Flesh out bus_dmamap_sync(). 2002-10-01 07:55:17 +00:00
scw 02301c13c5 Add a #define for the SH5's cacheline size. 2002-10-01 07:50:36 +00:00
scw a5ea619bef In pmap_extract() deal with KVAs in KSEG0 (which can be passed by the
bus_dma(9) code) instead of panicing.
2002-10-01 07:49:46 +00:00
scw 7a61cafd1e After the kernel is built, run it through objcopy to change the LMA
of the loadable sections to correspond to the physical address of
RAM in the Cayman. This is so sh5gdb uploads the image to the correct
place. (Should've done this ages ago instead of manually running a
script...)

This can be removed when I get a native bootloader written.
2002-09-28 18:35:38 +00:00
thorpej 8f6cdec6af Make _C_LABEL() pay attention to __NO_LEADING_UNDERSCORES__. 2002-09-28 15:50:37 +00:00
scw d26f394149 Add audio(4). 2002-09-28 13:13:23 +00:00
scw a7be636d26 Rename the SH5 PCI attachment to "sh5pci" instead of abusing the "pcibus"
config definition. The new config world order is more picky about such things.
2002-09-28 13:08:22 +00:00
scw 3e955d2331 PCI is pretty much done. 2002-09-28 13:06:49 +00:00
scw 94b4198ec9 Bump the scif console priority to CN_REMOTE for now. 2002-09-28 13:03:22 +00:00
scw 1c9cfe70b6 Const'ify the cfattach structure. 2002-09-28 11:18:01 +00:00
scw 251ba05b3f Support for the SH5 on-chip PCI bridge, and support for its deployment
in the Cayman board.
2002-09-28 11:16:36 +00:00
scw 171b08b4b9 Set the new process' FPSCR.DN bit so that denormalised FP numbers are
quietly flushed to zero before they're used.

While this isn't perfect, it seems to mimic the behaviour on i386 at least.
2002-09-28 11:11:01 +00:00
scw 3d776f64cf These hackish changes have been sitting around for a while. Commit
them so they don't get lost. This driver will be overhauled later
on anyway to make it shareable between sh[3-5].
2002-09-28 11:08:13 +00:00
scw 02787a17bc Wrap some expensive sanity checks in "ifdef PORTMASTER". 2002-09-28 11:04:26 +00:00
scw 4d809d551d The FP status register is 32-bits wide, so don't use register_t in
the various state frames.
2002-09-28 11:03:08 +00:00
scw 58931592a1 Honour BUS_DMA_COHERENT flag in bus_dmamem_map(), and g/c some dead code.
XXX: Still need to flesh out bus_dmamap_sync().
2002-09-28 10:57:44 +00:00
scw 05e55efada - Add pmap_page_is_cacheable() to allow the bus_dma code to query the
cacheable attribute of a mapping.
- Honour PMAP_NC in pmap_enter() using NOCACHE, instead of DEVICE.
- No longer need to re-fetch the ptel in pmap_pa_unmap_kva() as
  syncing the cache no longer risks causing a TLB miss.
2002-09-28 10:53:57 +00:00
scw 902d684338 - Add BUS_SPACE_MAP_PREFETCHABLE
- Re-define bus_size_t and bus_addr_t to be u_int32_t.
  While this may well lose for future silicon with NEFFBITS > 32, the
  original u_long was a waste on current designs (especially for _LP64).
2002-09-28 10:49:10 +00:00
scw e168d3e25c SH5's on-chip PCI bridge is attached as "pcibus", not "pchb". 2002-09-28 10:44:40 +00:00
scw 9c10dff0fb Print the intevt code in hex. 2002-09-28 10:43:36 +00:00
scw e578ac6fc3 Slight tweak to the linker emulation name now that I'm using ld(1)
from binutils-current.

Bump compiler optimisation to -O1.
2002-09-28 10:42:54 +00:00
thorpej 543bc9a286 The native compiler defines __NO_LEADING_UNDERSCORES__, so key off
that to determine if __LEADING_UNDERSCORE is necessary.
2002-09-28 02:27:03 +00:00
thorpej f818766afe Declare all cfattach structures const. 2002-09-27 20:31:45 +00:00
thorpej 6c88de3b53 Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller.  Use it
rather than invoking cfattach->ca_match directly.
2002-09-27 03:17:40 +00:00
scw 9393fbe941 Belated commit of code to calculate the delay constant used by delay(). 2002-09-22 20:57:23 +00:00
scw f9c02a8bd0 An initial NetBSD/sh5 TODO list. 2002-09-22 20:54:33 +00:00
scw 84b2ccee63 Add sh5_nmi_clear(), a board-specific hook for clearing the NMI one-shot. 2002-09-22 20:48:09 +00:00
scw aab9041eea In validate_kipt(), cacheable TLB entries are now legal. 2002-09-22 20:46:32 +00:00
scw badd3d5d65 Performance tweak to the copy_page/zero_page asm code.
Allocate/Prefetch one cache-line ahead of the one we're about to deal with.

This reduces the chances of the cpu stalling while waiting for the cache
to flush a dirty line in order to satisfy the Allocate/Prefetch request.
2002-09-22 20:45:31 +00:00
scw 5a529aa332 - Add a /e option to db_stack_trace_print() which dumps the saved
registers in any trap/interrupt exception frame found.

- Slight tweak to more accurately detect the correct call-site when
  looking for a function's prologue.
2002-09-22 20:31:18 +00:00
simonb 63096043b3 Use "#define\t" instead of "#define ". 2002-09-22 08:30:56 +00:00
chs c081614ea2 it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not.  doh.
2002-09-22 07:53:39 +00:00
chs 55e1f79335 add pmap_remove_all() hook (empty on most platforms so far). 2002-09-22 07:17:08 +00:00
gmcgarry dca80f08fd Add __HAVE_MD_RUNQUEUE flag for MD code to override MI run queue primitives. 2002-09-22 04:11:32 +00:00
scw e5b9e76f43 Start the search for a function's prologue by using the current PC - 4.
This ensures we start from the actual call site, not the return address.
The latter may actually be in the next consecutive function if the current
function has the __noreturn__ attribute and the alignment is Just Right.
2002-09-19 15:47:33 +00:00
scw c87975f571 - Tweak the output format slightly to show the frame address first.
- When dealing with an exception frame, we might as well print some
   useful details while we're passing through.
2002-09-19 13:04:02 +00:00
scw 87048d2661 Don't check the callers expected stack base against the saved frame
pointer, in case the caller grew its stack dynamically.

Also beef up the checks to catch cases where the call stack passes
through the exception handling code in locore. In this case, the
frame pointer and program counter are in the trapframe/intrframe.
2002-09-19 11:25:13 +00:00
scw 910c7664b3 Finally add full stack trace support by grovelling function prologues to
determine the call stack. (I was sick of doing this manually)
2002-09-19 10:05:25 +00:00
scw 47e178df57 Move opcode_t typedef into db_machdep.h. 2002-09-19 10:03:11 +00:00
scw a9c1bc6c83 Add code to deal with the "Cache Purge/Invalidate can cause TLB Miss"
problem, such that a TLB miss no longer occurs.

With the above, it is now safe to enable write-back caching for userland
mappings.

TODO: Deal with cache issues for shared mappings with different VAs.
2002-09-12 12:44:13 +00:00
scw 7e0aa6fcfc sh5_setasid() now returns the original ASID value. 2002-09-12 12:39:34 +00:00
scw a73ea332f6 Adapt to new cacheops requirements. 2002-09-12 12:38:42 +00:00
scw 22569e09ed The cacheops functions now need the physical address of the region
to be purged/invalidated.
2002-09-12 12:37:49 +00:00
scw b0ecf76dd4 sh5_setasid() now returns the value of the previous ASID. 2002-09-12 12:35:00 +00:00
scw 08dfbb4305 - Be more consistent about using ptel_t where it matters.
- Add event counters for some key pmap events (similar to mpc6xx pmap).

 - Use the cache-friendly, optimised copy/zero page functions.

 - Add the necessary cache management code to enable WriteBack caching
   of KSEG1 mappings. Seems to work fine so far.
2002-09-11 11:08:45 +00:00
scw ecb4124668 - Add cache-friendly, optimised copypage/zeropage functions for use by
the pmap module.

- Add {,e}intrnames and {,e}intrcnt to keep kernel-symbol grovelling
  tools like vmstat(8) happy.
2002-09-11 11:03:08 +00:00
scw b08dae4d46 Tweak the interrupt names to properly match reality. 2002-09-11 10:57:50 +00:00
scw e47c955f01 Get the correct evcnt structure and ipl number when initialising softints. 2002-09-11 10:56:43 +00:00
scw 2b0c53084c Slight tweak to save one instruction in the pteg TLB miss case. 2002-09-11 10:55:05 +00:00
scw bd0dd2e2e1 Add "machine fpr" command. This dumps the FPU registers for the current,
or a specified, process.
2002-09-10 12:44:38 +00:00
scw fe2f8acf65 Another big round of pmap fixes/cleanup:
- Use the PMAP_ASID_* constants from pmap.h

 - Track pmap_pvo_{enter,remove}() depth in the same way as mpc6xx's pmap
   (on which this pmap was originally based).

 - Some misc. tidying up and added commentary.

 - Use the VA/KVA to select whether to use the IPT or PTEG instead of
   checking which pmap is being operated on.

 - Add a handy DDB-callable function which will scan the kernel IPT
   looking for inconsitencies.

 - Finally, when unmapping a pool page, purge the data cache for the
   page. This permits write-back caching to be enabled for kernel
   text/data.
2002-09-10 12:42:03 +00:00
scw bcf9491257 Always save/restore the FPSCR into/from the sigcontext. 2002-09-10 12:33:44 +00:00
scw 1a8208566d - Remove the RESVEC vector table (panic/debug traps). It's now in
machine-specific code.

 - Re-work the code which detects a nested critical section event.
   We can now determine who is the owner of the critical section, and
   what event occurred while it was owned.

 - Work-around a silicon bug which can cause a nested critical event.
   In the _EXCEPTION_ENTRY() macro (which sets up the critical section),
   if there is a pending hardware interrupt which has a higher priority
   than the current IMASK, then the "putcon" which supposedly clears SR.BL
   and sets SR.IMASK to 0xf is not atomic. The pending hardware interrupt
   will be taken, causing a nested critical section event. The work-around
   is to update SR.BL and SR.IMASK separately using two "putcon" insns.
2002-09-10 12:27:21 +00:00
scw cd4797ccfa - Give a process a SIGFPE if it gets an FPU exception.
- Make it possible to at least *try* to resume execution if we
   get an NMI.
 - Major clean-up of the panic/critical section trap handlers.
   The dumped state is now much more accurate.
2002-09-10 12:15:39 +00:00