11.4Sandvar$NetBSD: TODO.hp300,v 1.4 2023/09/08 19:04:28 andvar Exp $
21.2Scgd
31.1Smycroft1. Create and use an interrupt stack.
41.1Smycroft   Well actually, use the master SP for kernel stacks instead of
51.1Smycroft   the interrupt SP.  Right now we use the interrupt stack for
61.1Smycroft   everything.  Allows for more accurate accounting of systime.
71.1Smycroft   In theory, could also allow for smaller kernel stacks but we
81.1Smycroft   only use one page anyway.
91.1Smycroft
101.1Smycroft2. Copy/clear primitives could be tuned.
111.1Smycroft   What is best is highly CPU and cache dependent.  One thing to look
121.1Smycroft   at are the copyin/copyout primitives.  Rather than looping using
131.1Smycroft   MOVS instructions, you could map an entire page at a time and use
141.1Smycroft   bcopy, MOVE16, or whatever.  This would lose big on the VAC models
151.1Smycroft   however.
161.1Smycroft
171.1Smycroft3. Sendsig/sigreturn are pretty bogus.
181.4Sandvar   Currently we can call a signal handler even if an exception
191.1Smycroft   occurs in the middle of an instruction.  This causes the handler
201.1Smycroft   to return right back to the middle of the offending instruction
211.1Smycroft   which will most likely lead to another exception/signal.
221.1Smycroft   Technically, I feel this is the correct behavior but it requires
231.1Smycroft   saving a lot of state on the user's stack, state that we don't
241.1Smycroft   really want the user messing with.  Other 68k implementations
251.1Smycroft   (e.g. Sun) will delay signals or abort execution of the current
261.1Smycroft   instruction to reduce saved state.  Even if we stick with the
271.1Smycroft   current philosophy, the code could be cleaned up.
281.1Smycroft
291.1Smycroft4. Ditto for AST and software interrupt emulation.
301.1Smycroft   Both are possibly over-elaborate and inefficiently implemented.
311.1Smycroft   We could possibly handle them by using an appropriately planted
321.1Smycroft   PS trace bit.
331.1Smycroft
341.1Smycroft5. Make use of transparent translation registers on 030/040 MMU.
351.1Smycroft   With a little rearranging of the KVA space we could use one to
361.1Smycroft   map the entire external IO space [ 600000 - 20000000 ).  Since
371.1Smycroft   the translation must be 1-1, this would limit the kernel to 6mb
381.1Smycroft   (some would say that is hardly a limit) or divide it into two
391.1Smycroft   pieces.  Another promising use would be to map physical memory
401.1Smycroft   within the kernel.  This allows a much simpler and more efficient
411.1Smycroft   implementation of /dev/mem, pmap_zero_page, pmap_copy_page and
421.1Smycroft   possible even kernel-user cross address space copies.  However,
431.1Smycroft   it does eat up a significant piece of kernel address space.
441.1Smycroft
451.1Smycroft6. Create a 32-bit timer.
461.4Sandvar   Timers 2 and 3 on the MC6840 clock chip can be concatenated together to
471.1Smycroft   get a 32-bit countdown timer.  There are at least three uses for this:
481.1Smycroft   1. Monitoring the interval timer ("clock") to detect lost "ticks".
491.1Smycroft      (Idea from Scott Marovich)
501.1Smycroft   2. Implement the DELAY macro properly instead of approximating with
511.1Smycroft      the current "while (--count);" loop.  Because of caches, the current
521.1Smycroft      method is potentially way off.
531.1Smycroft   3. Export as a user-mappable timer for high-precision (4us) timing.
541.1Smycroft   Note that by doing this we can no longer use timer 3 as a separate
551.1Smycroft   statistics/profiling timer.  Should be able to compile-time (runtime?)
561.1Smycroft   select between the two.
571.1Smycroft
581.3Sandvar7. Conditional MMU code should be restructured.
591.1Smycroft   Right now it reflects the evolutionary path of the code: 320/350 MMU
601.1Smycroft   was supported and PMMU support was glued on.  The latter can be ifdef'ed
611.1Smycroft   out when not needed, but not all of the former (e.g. ``mmutype'' tests).
621.1Smycroft   Also, PMMU is made to look like the HP MMU somewhat ham-stringing it.
631.1Smycroft   Since HP MMU models are dead, the excess baggage should be there (though
641.1Smycroft   it could be argued that they benefit more from the minor performance
651.1Smycroft   impact).  MMU code should probably not be ifdef'ed on model type, but
661.1Smycroft   rather on more relevant tags (e.g. MMU_HP, MMU_MOTO).
671.1Smycroft
681.1Smycroft8. Redo cache handling.
691.1Smycroft   There are way too many routines which are specific to particular
701.1Smycroft   cache types.  We should be able to come up with a more coherent
711.1Smycroft   scheme (though HP 68k boxes have just about every caching scheme
721.1Smycroft   imaginable: internal/external, physical/virtual, writeback/writethrough)
731.1Smycroft   See, for example, Wheeler and Bershad in ASPLOS 92.
741.1Smycroft
751.1Smycroft9. Sort the free page list.
761.1Smycroft   The DMA hardware on the 300 cannot do scatter/gather IO.  For example,
771.1Smycroft   if an 8k system buffer consists of two non-contiguous physical pages
781.1Smycroft   it will require two DMA transfers (and hence two interrupts) to do the
791.1Smycroft   operation.  It would take only one transfer if they were physically
801.1Smycroft   contiguous.  By keeping the free list ordered we could potentially
811.1Smycroft   allocate contiguous pages and reduce the number of interrupts.  We can
821.1Smycroft   consider doing this since pages in the free list are not reclaimed and
831.1Smycroft   thus we don't have to worry about distorting any LRU behavior.
841.1Smycroft----
851.1SmycroftMike Hibler
861.1SmycroftUniversity of Utah CSS group
871.1Smycroftmike@cs.utah.edu
88