Commit Graph

1018 Commits

Author SHA1 Message Date
jeffs 1bf0f4630f Use a cast to handle syscall() copyin case with 64b clean ctx save/restore. 2000-09-26 18:24:45 +00:00
jeffs d6f992112d No longer save $at on syscall entry. v1 does appear to be used as if
you do not save it and pass it along in rval the system will start
to fail running user programs.  This finishes the suggestion by cgd to
not save some registers on syscall entry.
2000-09-26 18:22:12 +00:00
uch a21df3ae8e fix R3900 FlushCache bug. 2000-09-26 17:47:40 +00:00
jeffs e13c3f735f In trap(), do not lower spl for T_BREAK. This lets ddb always run at
splhigh() so nothing can happen behind it's back.
2000-09-21 20:59:58 +00:00
thorpej b008f5f25a Make PMAP_PAGEIDLEZERO() return a boolean value. FALSE indidcates
that the page being zero'd was not completed and that page zeroing
should be aborted.  This may be used by machine-dependent code doing
slow page access to reduce the latency of running a process that has
become runnable while in the middle of doing a slow page zero.
2000-09-21 17:46:04 +00:00
jeffs f1173a05e0 Add trace/t pid support for mips. 2000-09-19 06:22:51 +00:00
uch 0500ddb633 [R3900/R3920] sync with
| Module Name:	syssrc
 | Committed By:	nisimura
 | Date:		Sat Sep 16 07:20:17 UTC 2000
2000-09-18 18:17:32 +00:00
nisimura 70a97ab16c Introduce new MIPS1 direct mapped cache capacity detection logics. 2000-09-16 07:20:16 +00:00
jeffs 36c4252a17 Re-enable SR IE bit before calling syscall(). Matches Tohru's mips1 change. 2000-09-16 06:57:21 +00:00
nisimura 2982d7707b There is no need to handle processor master interrupt mask SR_INT_IE
in syscall() anymore.  By defition, processor was in SR_INT_IE turn
on prior to have syscall exception.  MIPS1 assembler hook arranges
to enable the bit for its own.  MIPS3 does the same effect by
turning off EXL bit.
2000-09-16 05:07:06 +00:00
nisimura f4b74d3898 - Reimplement MIPS1 cache size dectection logic taking advantage of the
fact the direct mapped cache makes address alias effect.
- Just turn on processor master interrupt mask IEc (SR_INT_IE) bit prior
  to call syscall() kernel entry point.  IEp is always 1 in this case
  by defition.
2000-09-16 04:54:44 +00:00
chuck 9dc2f5ced0 IDT32364's Config register uses a different base for IC/DC (instruction
and data cache sizes).   R4000 uses 2^(12+IC) and 2^(12+DC).  IDT32364
uses 2^(9+IC) and 2^(9+DC).

abstract around the problem by making the base a parameter to the
MIPS3_CONFIG_CACHE_SIZE macro.   we pass the base down from mips_vector_init
to mips3_vector_init and to mips3_ConfigCache (where it is used).

XXX: someone with an MIPS3_4100 should switch to this and get rid
of the ugly ifdefs in cpuregs.h
2000-09-16 00:04:57 +00:00
jeffs bdad8bae5b Handle R4K trap faults in user mode like overflows (deliver SIGFPE). This
prevents a panic running crashme.  Better comment for VCE define.
2000-09-15 06:50:46 +00:00
jeffs efef8a5aa6 Do not save t* registers in syscall stub as suggested by cgd. Saves
a whole 0.01us in lmbench lat_syscall null on our 250Mhz QED system.
$at is still saved just to be safe, although it looks like it does
not need to be.  $v1 is used in syscall(), although I'm not sure why.
2000-09-13 06:48:04 +00:00
nisimura 0ba2036eee Introduce 'segbase' global variable to hold the pointer to current
process's segtab, retiring 'pcb_segtab' field from 'struct pcb'.
This would be another MULTIPROCESSOR unfriendly and the necessity
might be eliminated when the way to hold PTE is redesigned.
2000-09-13 01:53:00 +00:00
chuck 0dcdf1214c kill mips3_write_xcontext_upper 2000-09-13 01:20:41 +00:00
chuck 6f9229b2e6 modify mips3 locore to elminate the abuse of XContext
so that we can run on systems that do not have XContext
(e.g. IDT 32364).
2000-09-13 01:12:47 +00:00
soren 99418ce05f Remove old comment. 2000-09-12 15:40:36 +00:00
jeffs bbcf1beea0 In outofworld, keep $sp for DDB case if it looks like a kernel address
so the stacktrace is ok.
2000-09-08 07:24:42 +00:00
jeffs 8f8a7ca780 Shuichiro URATA pointed out that the R4000 needs 3 nops. Other OSs make
it look at casual inspection like 1 nop is needed but play other tricks.
Still have reduced by 1 nop.  Hopefully this covers the NEC 41[x]1.  Could
not find info for those processors.
2000-09-07 20:31:02 +00:00
jeffs 8f2cc012b5 Remove 3 of the nops between tlbwr and eret in tlb miss handlers. They
were added early when adding the QED support.  RM5231 seems to work fine
w/o the extra nops.  Noticed by Chuck Cranor.
2000-09-06 06:33:42 +00:00
soren c5ce14be0a Back out (most of) previous. I was using an 1.5 asm.h and hadn't
noticed cgd's fix..
2000-09-05 01:24:51 +00:00
soren c3150dc3dc Add nop after PANIC macros. 2000-09-05 00:55:48 +00:00
jeffs f8d9f59ed9 Correct _KERN_MCOUNT restoration of $t9.
From Ethan Solomita (ethan@geocast.com).
2000-08-30 22:31:12 +00:00
thorpej 4db6fc7542 Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity.  Its use in
roundrobin() still needs some work.
2000-08-25 01:04:06 +00:00
uch 2111496e74 Rewrote TX39 series cache routines. 2000-08-24 05:31:59 +00:00
thorpej a86d1f4891 Add a lock around the scheduler, and use it as necessary, including
in the non-MULTIPROCESSOR case (LOCKDEBUG requires it).  Scheduler
lock is held upon entry to mi_switch() and cpu_switch(), and
cpu_switch() releases the lock before returning.

Largely from Bill Sommerfeld, with some minor bug fixes and
machine-dependent code hacking from me.
2000-08-20 21:50:06 +00:00
wdk 1e59559e3e intrcnt[] counters should be handled by the port specific interrupt handlers.
This change facilitates the migration from intrcnt[] to the new evcnt(9)
framework without breaking all of the mips based ports.
2000-08-14 04:36:34 +00:00
jeffs 95ac0dc817 In db_disasm() use fuword() to fetch user addresses. Mainly to avoid
bad EPCs from losing the initial ddb context when panicing, but also
helps with typos.
2000-08-10 22:31:26 +00:00
jeffs 6f9d8d6cd3 Tweak to compile with printf format changes. 2000-08-10 08:01:24 +00:00
jeffs 22bda73efd To be safe when called from interupt, [fs]uswintr need to preserve
cpu_onfault.  By Etan Solomita (ethan@geocast.com).
2000-08-09 23:03:24 +00:00
jeffs 0b5e00636a Fix a bug in how .S routines call _mcount to allocate stack before
use.  By Ethan Solomita (ethan@geocast.com).
2000-08-09 22:52:36 +00:00
tshiozak 51a53de0d5 Preparation for the future introduction of multibyte locale.
- MB_LEN_MAX is increased to 32.
 - To ensure binary compatibility for old executables
   under multibyte locale, versioned setlocale is added.
 - __mb_len_cur definision is added in setlocale.c
   and enable it in stdlib.h .
   It is also important for multibyte locale stuffs,
   but I just forgot.
2000-08-08 22:31:13 +00:00
shin f0803f8192 protect doubleword register from interrupt. 2000-08-06 12:30:36 +00:00
jeffs 8d300a3b14 setregs() cache sync turns out not to be needed with kern_exec 1.104
(which was 2 weeks after our internal trees full sync).
2000-08-02 06:46:47 +00:00
jeffs e1cf55c8a8 Make mips3_FlushICache() convert a0 into a KSEG0 + virtual index like
the _2way and mips3_FlushDCache(). This lets all mips3 cache ops accept
user virtual addresss w/o a tlb miss.  Since this is now done in both
ICache flush routines, no need to do it in pmap.c.  Fixed R4400
stability problems with setregs() cache flushing.
2000-08-01 23:38:26 +00:00
jeffs e6bdec31fd Fix vmapbuf() to call uvm_km_valloc_perfer_wait() call, but trunc_page()
to the prefer arg so we free the correct page.
2000-08-01 22:45:05 +00:00
cgd b63ed164a1 convert PRID handling to use macros on an int, not bit-fields.
there's no reason to use bit-fields, and they just complexity to
the header.
2000-07-27 17:29:05 +00:00
jeffs 3eae1609f1 Fix to actually compile MIPS1 only. 2000-07-27 08:28:36 +00:00
jeffs e4a0934c13 Do not attempt mips3 style cache flush on mips1 in setregs() as it
is illegal to flush on user addresses.  In theory the race exists
on MIPS1, but it is rather unlikely in common use.  I have
seen it with regress/sys/kern/sigtramp on a QED 5231 system.
2000-07-27 06:28:06 +00:00
cgd 4adc7b9704 add nops after jals in PANIC and PRINTF. (these macros are often used in
code which has noreorder set, and they're not used with nops afterwards,
as is appropriate in that case, so put the nops in the macros.)
2000-07-27 05:01:06 +00:00
jeffs ca2a49c4cf Back-out vmapbuf() change for now as locally it has been found to sleep
in some circumstances that don't sleep when not using pmap_prefer().
2000-07-26 16:24:38 +00:00
jeffs 71538e8894 Fix mips3 outofworld to panic cleanly even if shutdown path misses K2.
Previously we jal to panic which never cleared the tlb fault, so if
on the course of shutdown (like a doshutdownhooks() callback) missed
K2, it would panic again.  Fix by setting EPC to panic() and eret.
2000-07-25 18:06:49 +00:00
jeffs 3a90817270 Add option to apply additional mask to the SR at run-time for MIPS3 platforms.
By default this is off, and only slightly changes the code to load SR when
a temp register is available.  This can be used by the platform code to
handle slow to clear interrupts (our case) or to mask off any interrupt
any interrupt at run-time.  This can be very useful for embedded platforms
that have less than desirable interrupt properties.
2000-07-25 17:56:05 +00:00
jeffs 7dad7ceb84 Use new uvm_km_valloc_prefer_wait() in vmapbuf(). This lets the K2
mapping of b_data have the same virtual index, so the mapping does
not degenerate into uncached in pmap_enter().
2000-07-24 20:16:29 +00:00
jeffs 2ebdfcd251 Make pmap_prefer() use a global setting based on cache size
instead of assuming 64KB.   This allows best fit and will
support bigger caches.
2000-07-20 18:33:40 +00:00
jeffs c8b819c2ed Include kgdb hooks in trap.c. Include bits of DDB code for kgdb also. Remove
some local prototypes that are in headers now.
2000-07-20 18:14:46 +00:00
jeffs d8d3c52075 Move masked status and instr into jal cpu_intr delay slot. 2000-07-20 00:43:07 +00:00
jeffs 5938072101 In FPU excepton code, send SIGILL if no one claims the instruction.
SIGFPE is still delivered where appropriate.
2000-07-19 22:05:02 +00:00
jeffs 64d555c075 Improve outofworld: to include the vaddr. Removed unused mips3_Set64bit
and an #if 1.
2000-07-19 20:46:00 +00:00
jeffs 32ee71ac65 Fix stacktrace() to have an 8 byte aligned stack. On our platform previously
it would hang-up.  logstacktrace() actually was the same as stacktrace() so
just make it an XLEAF() for now.  Include some DDB code for KGDB compilation.
2000-07-19 18:56:36 +00:00
jeffs 8b8bf4501b At the start of the kernel, keep the MIPS3_SR_DIAG_BEV setting
on mips3 systems, until the kernel actually hooks the vectors.
This makes it easier to debug early problems if the firmware
has provides an exception handler.
2000-07-19 18:38:41 +00:00
jeffs f7dacc7a8e Use spl*_noprof routines to raise and lower spl for kernel profiling.
This keeps the SR management more contained in locore, and should
be roughly the same performance as the .text size is less.  Talked
to simonb and he was ok with this change.
2000-07-18 06:25:32 +00:00
jeffs 8e5b35a55a Fix FP exception handling that was recently broken and would not
run src/regress cleanly.  Need to save and restore the frame pointer
for fpemul_sig*().
2000-07-18 00:41:18 +00:00
jeffs 5961b67774 if MIPS3_ENABLE_CLOCK_INTR is defined, set MIPS3_[HARD_]INT_MASK
appropriately.  This supports ports that use the internal clock.
Add 2 diag register defines that are specific to QED processors.
2000-07-17 23:35:13 +00:00
jeffs 0e0c4d24e8 Move platform db_trap callback from arch/mips into ddb as suggested by
jhawk.  This callback is used by platform code to manage things like
watchdogs that should be disabled while in ddb.  Done as a callback
for processors such as mips that support lots of different systems.
2000-07-17 19:57:49 +00:00
jeffs efabca31b5 Make memcpy() the favored interface an swizzle the args for ovbcopy. Also
move bcopy XLEAF here from locore.S.  For 64b clean compilation add a
ld/sd section to the block copy.
2000-07-17 07:37:50 +00:00
jeffs 2fd0d88f44 Use <uvm/uvm_extern.h> instead of vm/vm.h 2000-07-17 07:06:13 +00:00
jeffs 116a6f8233 Pull in geocast mips ddb improvements and start bringing in kgdb support.
Add ddb support for QED opcodes, fill in enough routines so "next" usually
works, kdbpoke support for any size.  Add callback that ports can hook when
entering and leaving ddb.  This can be used for things like turning
off watchdogs while in ddb.
2000-07-17 07:04:19 +00:00
jeffs ef9531850e Add comment that overriding the sysctl defines in machine/cpu.h
breaks userland binary compatiabiltiy between mips ports.  Move
check down so common values are always defined here.
2000-07-13 07:37:11 +00:00
jeffs f6812b853b Only define machdep sysctls if CPU_MAXID is not defined by machine/cpu.h.
This lets mips ports have additional machdep sysctl.  Define CPUISMIPS3
for MIPS1+MIPS2 as cpu_arch >= 3 to support mips4.  Add cpu_intr()
prototype so this is defined in one place.
2000-07-11 06:34:57 +00:00
jeffs 6b28794054 Add support for 3 QED special2 opcodes. 2000-07-11 06:27:58 +00:00
jeffs 54a85cb3af For 64b clean 32b compilation, do not bother setting SX And KX.
The current code does not maintain these in SR, and they are not
needed by 32b kernel code for mips3/4 instructions.
2000-07-11 06:26:08 +00:00
soren 77e30d85bf Oops. 2000-07-11 01:15:47 +00:00
jeffs dcbf69bf94 Update mips3_locore_vec cache functions for mips3_L1TwoWayCache. Add cast
for clean compilation with _MIPS_BSD_API_LP32_64CLEAN set.
2000-07-10 23:21:16 +00:00
jeffs 010c198b37 In setregs() flush sigreturn trampoline code from the d (MIPS3) and i cache.
Tested on geocast RM5231 platform.  This fixes a race in
regress/sys/kern/sigtramp.  Some other ports do the same thing.
2000-07-10 21:12:13 +00:00
uch e8ebb2a377 use mips3 cache op.
invalidate -> write-back invalidate
(although NetBSD/hpcmips run on write-through mode.)
suggested by cgd.
2000-07-10 16:23:18 +00:00
cgd a5c13f9ad4 Kwality control:
* put #includes of opt headers and headers to get protos used by
  net/netisr_dispatch.h in net/netisr.h (if !defined(_LOCORE)) (rather than
  in netisr_dispatch.h itself, and potentially nowhere, respectively).
* require netisr.h to be included before netisr_dispatch.h.
* minor additional cleanup of both netisr.h and netisr_dispatch.h.
* clean up uses to remove now-unnecessary header file inclusions, and
  local prototypes of the fns.
* convert netisr dispatch implementations which didn't use
  netisr_dispatch.h (pc532) to use it.
2000-07-02 04:40:33 +00:00
mrg 28d898391b remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h> 2000-06-29 08:10:45 +00:00
cgd 7e975cacbe un-__P, clean up spacing a little bit, put fwd struct decl(s) near top
rather than embedded.  no functional changes.
2000-06-29 06:00:43 +00:00
kleink bb2ed0f487 G/c _BSD_INTPTR_T_ and _BSD_UINTPTR_T_. 2000-06-27 05:53:22 +00:00
kleink 47b5c5e3b1 Resolve some formatting nits; add __intptr_t and __uintptr_t. 2000-06-27 04:58:51 +00:00
kleink e695f72a2e Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
2000-06-26 15:42:16 +00:00
mrg 4c698e84f6 <vm/vm_param.h> -> <uvm/uvm_param.h> 2000-06-26 14:58:58 +00:00
mrg 2f159a1bac remove/move more mach vm header files:
<vm/pglist.h> -> <uvm/uvm_pglist.h>
	<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
	<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
	<vm/vm_object.h> -> nothing
	<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
2000-06-26 14:20:25 +00:00
simonb 889c658b5b Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes.  Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
2000-06-26 04:55:19 +00:00
nisimura 472221aa39 Abandon {mips1,mips3}_TBRPL() which have little gain than TLBUpdate(). 2000-06-26 03:05:04 +00:00
nisimura 074a952030 Abandon {mips1,mips3}_TBRPL()s which have little gain. They were
expected to be better than MachTLBUpdate(). After all, TLBUpdate()
is rather harmful and should be replaced with TBIS().
2000-06-26 02:55:45 +00:00
kleink 133ea38323 Add a WEAK_ALIAS() macro. 2000-06-23 12:18:45 +00:00
soren e7d8e5164a Remove extraneous mips1_TBRPL() prototype. 2000-06-22 05:00:48 +00:00
soren 78c90ae276 Fix pasto. 2000-06-21 19:39:32 +00:00
soda 76baab0725 3rd argument of TBRPL() is not paddr_t but PTE.
XXX - mips3_TBRPL seems to be never called.
2000-06-20 05:54:03 +00:00
soren d78ff1cd5b Add mips3_write_config(). 2000-06-20 02:57:17 +00:00
cgd 942546fe30 cod: any of various bottom-dwelling fishes (family Gadidae, the cod
family) that usually occur in cold marine waters and often have barbels
  and three dorsal fins.
code: a set of instructions for a computer.

The latter is more appropriate in the comment corrected here.
2000-06-17 06:38:25 +00:00
cgd 79d0534b05 put cache op #defines up at the top of the file, so all cache ops can
use them.  Rename them to match the names in See Mips Run; they're not
as orthogonal as values or'd together might make you think...  Finally,
actually use them for every bloody cache op.
2000-06-17 01:35:28 +00:00
cgd 433fe9077e when printing the cpu_id (because it's unknown or not supported),
print the whole PRID value.  Also, print the PRID value in addition to
the name, when the CPU is known (for data collection purposes).
2000-06-15 23:39:14 +00:00
shin 5ded3d8a81 backout previous change.
cache operation in cpu_fork() is necessary for CPU's which
detect virtual alias by hardware (ex. R4000 with secondary cache).
2000-06-15 13:04:05 +00:00
soren a8b7b64af8 Remove unnecessary HitFlushCache from cpu_fork(). From Toru Nishimura. 2000-06-14 22:17:59 +00:00
castor 751cd4ffb0 Profiling fixes from Ethan Solomita <ethan@geocast.com>.
Merge Kernel MCOUNT and user MCOUNT.

The earlier code which was inserted to call _mcount in profiling
assembler routines is busted badly.  This gets it working with PIC
code and should work with any arbitrary assembler routine.
2000-06-12 23:42:10 +00:00
soren 9f0da0dd16 Post a SIGFPE rather than SIGILL on floating point exceptions. 2000-06-10 02:43:49 +00:00
soda 1c2aa78d6b rename
vad_to_pfn() -> mips_paddr_to_tlbpfn()
	pfn_to_vad() -> mips_tlbpfn_to_paddr()
as suggested by thorpej on port-mips Mar 27.
2000-06-09 06:30:35 +00:00
soda 2047c95e49 Decrease MIPS3_TLB_WIRED_ENTRIES from 8 to 2,
and rename it to MIPS3_TLB_WIRED_UPAGES.
The value of wired register becomes variable on arc port,
and arc is the only mips3 port which uses the wired TLB entries 2..7.
2000-06-09 06:06:57 +00:00
soda 26c2cf79c0 rename
vad_to_pfn() -> mips_paddr_to_tlbpfn()
	pfn_to_vad() -> mips_tlbpfn_to_paddr()
as suggested by thorpej on port-mips Mar 27.
2000-06-09 05:51:42 +00:00
soda b1438dd751 make paddr_t 64bit on arc port by introducing _MIPS_PADDR_T_64BIT. 2000-06-09 04:36:43 +00:00
soda f587c1c5bf typo in comment 2000-06-09 04:28:17 +00:00
soda 44769378c9 this header don't have to include <machine/locore.h>,
include <mips/locore.h> instead.
2000-06-09 04:24:22 +00:00
soda 9fee25ddfa USRIOSIZE had to be changed from 32 to 128,
when MAXBSIZE was changed from 16KB to 64KB(MAXPHYS)
on <sys/param.h> revision 1.28.
2000-06-09 04:18:19 +00:00
mhitch afce867d15 Fix loadfpregs(): the register used to access the floating point registers
was not getting loaded, and the floating point registers were being loaded
from the proc structure rather than the FP registers in the pcb.
2000-06-08 04:47:13 +00:00
soren a9aa2abf94 defopt SYSCALL_DEBUG. 2000-06-06 18:52:30 +00:00
soren a2bda06df5 Typo. 2000-06-06 17:41:58 +00:00
soren 5e4ca4defb Rename RM5200 cache ops to mips3_*_2way in anticipation of using them
for other CPUs with 2-way set associative L1 caches as well.
2000-06-06 17:41:07 +00:00
soren 113f160717 R12K has 64 TLBs too. 2000-06-06 17:36:12 +00:00
soren d8e5d1fa7d Add rnd(4) glue for the MIPS3 cycle counter. 2000-06-06 02:24:00 +00:00
jhawk c063b64a2b Do not clear msgbufenabled in dumpsys(). Dump messages will now go to
the message buffer. This can be invaluable in debugging if the dump
fails (assuming a persistant message buffer)
2000-06-05 23:44:55 +00:00
shin 4a71a2a50f delete unnecessary 'extern ...' line. 2000-06-03 13:16:02 +00:00
shin 5d883bf68e make it compile with 'options SOFTFLOAT'. 2000-06-02 12:57:22 +00:00
thorpej 8c2d00aaeb Add a comment about needing to initialize p_cpu when multiple
processors are supported.
2000-05-31 05:09:14 +00:00
nisimura 48ef457a5f Leave fpcurproc NULL for Vr4100/TX3900. It's solely for delayed lazy
FPA.  fp.S is free from fpcurproc references for SOFTFLOAT case.
2000-05-31 01:11:58 +00:00
nisimura 788c728dbd Replace fpcurproc->p_addr-> references with curpcb->. 2000-05-31 00:59:27 +00:00
uch 6764e5fc91 if defined SOFTFLOAT, set fpcurproc before call MachFPInterrupt() 2000-05-30 18:12:47 +00:00
nisimura 58d84e19a6 savefpregs() and loadfpregs() are defined in mips_machdep.c 2000-05-30 02:05:36 +00:00
nisimura 3d826a5c7e Add a missing closing parenthesis. 2000-05-30 01:42:43 +00:00
nisimura b67b90d7f9 FPA ownership is now guarded by MDP_FPUSED flag and there is no necessity
to have #if ... around savefpregs() calls.
2000-05-30 01:29:59 +00:00
nisimura 0e501989cd - Have savefpregs() and loadfpregs() in C codes with lengthy inlined
asm statements, obsoluting asm routines in locore.S.  They are
  designed to work in symmetry as names suggests.  savefpregs()
  does not clear a global variable fpcurproc.  Both would be noops when
  NOFPU global symbol is defined.
- MDP_FPUSED flag is not turned on for FPA-less processors like Vr4100
  and TX3900 even when processes execute FP insns.
2000-05-30 01:23:53 +00:00
simonb 4857b33794 A few more white-space bogons. 2000-05-29 23:40:03 +00:00
simonb 6c87680cbf A TAB after the define keyword instead of spaces. 2000-05-29 23:30:06 +00:00
nisimura a7c050472e Nuke #include directives found unnecessary. 2000-05-29 11:46:52 +00:00
nisimura f7c88c8f18 Make sure to load FPA contents next time an FP insn is executed when
process_write_fpregs() changes pcb_fpregs[].
2000-05-29 11:19:46 +00:00
nisimura 76f0ee4e32 Put an additional check to see curproc was an FPA owner process. 2000-05-29 09:47:19 +00:00
nisimura 87cd634474 Put addtional checks to see the curproc is an FPA owner process. 2000-05-29 09:43:33 +00:00
nisimura 8e19d02f25 Cleanup take two
- Nuke external function reference of savefpregs() which is already defined
  in mips/cpu.h.
- Adjust the comment tells "let user processes change CP0 status register
  freely might be dangerous."
2000-05-29 09:37:00 +00:00
nisimura 3f8e9c25b6 Make claried MDP_FPUSED usage.
- MDP_FPUSED flag indicates the process has executed at least one
  FP insn during its life time.
- pcb_fpregs storage is guaranteed zero initialzed.  If the process is FPA
  owner, savefpregs() must be called to synchronize it with FPA contents.
- No necessity to save FPA contents into pcb_fpregs prior to the whole
  storage is overwritten by process_write_fpregs().
2000-05-29 09:16:36 +00:00
thorpej e03e9e8086 Rather than starting init and creating kthreads by forking and then
doing a cpu_set_kpc(), just pass the entry point and argument all
the way down the fork path starting with fork1().  In order to
avoid special-casing the normal fork in every cpu_fork(), MI code
passes down child_return() and the child process pointer explicitly.

This fixes a race condition on multiprocessor systems; a CPU could
grab the newly created processes (which has been placed on a run queue)
before cpu_set_kpc() would be performed.
2000-05-28 05:48:59 +00:00
enami 2e535006c1 No longer need to include sys/types.h. 2000-05-27 02:18:12 +00:00
soren 630f6535cd Match a comment with the MIPS3 version. 2000-05-27 02:13:46 +00:00
soren dc83d17889 Include <sys/param.h> to make the new cpu.h happy. 2000-05-27 02:13:12 +00:00
sommerfeld 40339b39f9 Reduce use of curproc in several places:
- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

 - Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

 - Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

 - ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

 - move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

 - simplify interface to ktrwrite()
2000-05-27 00:40:29 +00:00
thorpej a7d0570e67 First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

	- Global state: sched_qs (run queues), sched_whichqs (bitmap
	  of non-empty run queues), sched_slpque (sleep queues).
	  NOTE: These may collectively move into a struct schedstate
	  at some point in the future.

	- Per-CPU state, struct schedstate_percpu: spc_runtime
	  (time process on this CPU started running), spc_flags
	  (replaces struct proc's p_schedflags), and
	  spc_curpriority (usrpri of processes on this CPU).

	- Every platform must now supply a struct cpu_info and
	  a curcpu() macro.  Simplify existing cpu_info declarations
	  where appropriate.

	- All references to per-CPU scheduler state now made through
	  curcpu().  NOTE: this will likely be adjusted in the future
	  after further changes to struct proc are made.

Tested on i386 and Alpha.  Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
2000-05-26 21:19:19 +00:00
mhitch 5228efa47e Fix typo (stray " where it shouldn't be). 2000-05-26 20:59:00 +00:00
jhawk 8e44b27348 Rename the machine-specific stack trace printing functions
from db_stack_trace_cmd() to db_stack_trace_print(),
and add an additional argument, a function pointer for an
output routine (i.e. printf() or db_printf()).

Add db_stack_trace_cmd() in db_command.[ch], calling
db_stack_trace_print() with db_printf() as the printer.

Move count==-1 special handling from db_stack_trace_print() [nee
db_stack_trace_cmd()] to db_stack_trace_cmd() [nascent here].

Again, I'm unable to test compilation on all affected platforms,
so advance apologies for potential brokenness.
2000-05-26 03:34:24 +00:00
thorpej 8964c35eca Introduce a new process state distinct from SRUN called SONPROC
which indicates that the process is actually running on a
processor.  Test against SONPROC as appropriate rather than
combinations of SRUN and curproc.  Update all context switch code
to properly set SONPROC when the process becomes the current
process on the CPU.
2000-05-26 00:36:42 +00:00
simonb 52e7cddaa7 Fix kernel profiling so that it actually works:
- Add 16 bytes to the stack on entry to _mcount so we don't
   overflow it.
 - Use inline interrupt {dis,en}abling instead of calling
   profiled function in locore.
2000-05-25 03:07:10 +00:00
soren a20a3b38fd Appease gcc. 2000-05-24 18:42:03 +00:00
thorpej 1140468205 Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).
2000-05-24 16:48:33 +00:00
soren a255740671 MachForceCacheUpdate and cacheflush_bug have never been used in NetBSD,
so remove references them, and do a little other cleanup.
2000-05-23 04:21:39 +00:00
uch fb077d8092 change TX3922 D-cache mode to write-through. 2000-05-21 11:53:00 +00:00
soren f598aece87 MIPS 'mach halt' does nothing MD, so nuke it. 2000-05-21 05:41:25 +00:00
soren 6aba4259b6 R10K has 64 TLBs. 2000-05-21 04:25:57 +00:00
soren abbe53961a Add R12K PRID. 2000-05-21 04:03:34 +00:00
soren 81fa4aa07f Populate the cputype defopt (not enabled yet). 2000-05-21 03:31:35 +00:00
soren 2779a53005 Include opt_cputype.h. 2000-05-21 03:23:15 +00:00
soren 7ea4a2b744 Fix RCS ID line. 2000-05-21 02:51:58 +00:00
soren b70819c71a Also share BE ldscripts. 2000-05-21 02:50:10 +00:00
soren 135a70e5a6 Make cache printing a little more consistent. 2000-05-17 23:35:44 +00:00
soren 740759113f mips5200_FlushCache(): flush L2 cache too. 2000-05-17 12:44:48 +00:00
nisimura 66ecdc15d3 Remove unused PSL_USERCLR defines for processor status register. 2000-05-15 08:36:32 +00:00
nisimura 8a71a7a50f Backout the previous change which was done mistakenly. 2000-05-15 06:45:44 +00:00
nisimura c7c815f46b Remove #include <machine/psl.h> which is not used. 2000-05-15 06:39:14 +00:00
castor 42ccab0d49 Add fp emulation for sqrt_s and sqrt_d instructions
from Jeff Smith <jeffs@geocast.com>.  These are needed to support
-mips2 compilation.  With this change, on a QED 5231 we now pass the
paranoia tests, and are successfully using userlands built with -mips2.
2000-05-14 06:19:32 +00:00
nisimura df234d8698 Take a straight way for pagemove() PTE manipulation, abandoning to
use MIPS_TBRPL().  When PTEs are modified, both src and dst TLBs
are invalidated.  MIPS3 single TLB entry has paired double PTE
and pagemove() likely walks through multiple pages.  The positive
effect of of MachTLBUpdate() or TBRPL() is unclear.
2000-05-10 08:55:22 +00:00