Commit Graph

283 Commits

Author SHA1 Message Date
Jake Burkholder
90a801d702 Use cpufunc macros instead of using inline asm directly. 2002-01-08 05:10:58 +00:00
Jake Burkholder
79dba4cb34 Set the normal global pcb register when context switching. 2002-01-08 05:10:07 +00:00
Jake Burkholder
01cad5de12 Add a macro for getting the tlbs (itlb and/or dtlb) which the given
tte may be mapped by.
2002-01-08 05:07:58 +00:00
Jake Burkholder
70f550ae58 Prototype pmap_map_tsb(). 2002-01-08 05:06:39 +00:00
Jake Burkholder
dff34dde25 Remove PANIC_STACK_PAGES which is no longer used.
Redefine the compile time assertion macro to take one parameter.
2002-01-08 05:05:42 +00:00
Jake Burkholder
d2746ddb32 Add declarations needed by last commit. 2002-01-08 05:03:36 +00:00
Jake Burkholder
c0be70d7e2 Update comments about _start, the kernel entry point, to reflect new
parameters needed for smp support.
If we are not the boot processor, jump to the smp startup code instead.
Implement a per-cpu panic stack, which is used for bootstrapping both
primary and secondary processors and during faults on the kernel stack.
Arrange the per-cpu page like the pcb, with the struct pcpu at the end
of the page and the panic stack before it.
Use the boot processor's panic stack for calling sparc64_init.
Split the code to set preloaded global registers and to map the kernel
tsb out into functions, which non-boot processors can call.
Allocate the kstack for thread0 dynamically in pmap_bootstrap, and give
it a guard page too.
2002-01-08 05:02:13 +00:00
Jake Burkholder
77a240d5da Fix qsort callouts used for sorting memory regions during boot. vm_offset_t
is unsigned, so we can't use signed arithmetic.

Tripped over by:	jhb
2002-01-08 04:43:04 +00:00
Jake Burkholder
338f7e3e47 Add a md field to pcpu for the upa module id.
Remove the alt_stack field.
Use the defines for the register variables declared in C, so that they
don't get out of sync with the assembler.
2002-01-08 04:40:13 +00:00
Jake Burkholder
f25af321eb Define CKLF_PC in terms of TRAPF_PC. 2002-01-08 04:36:53 +00:00
Jake Burkholder
c0e12e9356 Add a mov() macro, which is used in conjunction with the register defines
for setting reserved global registers from c.
2002-01-08 04:36:01 +00:00
Jake Burkholder
2a32c6cea1 Update comments and defines to reflect that normal and alternate g6 point
to the current pcb.
Remove interrupt global defines; they use PCPU_REG now.
Move ATOMIC_INC_INT here from exception.s, add ATOMIC_DEC_INT.
Add a KASSERT macro for use in assembler.
2002-01-08 04:34:20 +00:00
Jake Burkholder
3a3b7ddc5a Add asis for the upa config reg, which contains the hardware cpu id, and
for the interrupt send register, which is used for dispatching ipis.
2002-01-08 04:29:50 +00:00
Peter Wemm
ead8168ac0 Convert a bunch of 1 << PCPU_GET(cpuid) to PCPU_GET(cpumask). 2002-01-05 09:41:37 +00:00
Thomas Moestl
62ec4add59 1. Implement an optimization for pmap_remove() and pmap_protect(): if a
substantial fraction of the number of entries of tte's in the tsb
   would need to be looked up, traverse the tsb instead. This is crucial
   in some places, e.g. when swapping out a process, where a certain
   pmap_remove() call would take very long time to complete without this.
2. Implement pmap_qenter_flags(), which will become used later
3. Reactivate the instruction cache flush done when mapping as executable.
   This is required e.g. when executing files via NFS, but is known to
   cause problems on UltraSPARC-IIe CPU's. If you have such a CPU, you
   will need to comment this call out for now.

Submitted by:	jake (3)
2002-01-02 18:49:20 +00:00
Thomas Moestl
ca8712b098 Correct the defintion of struct ofw_upa_regs, and use it instead of
struct ofw_nexus_reg. Implement UPA device memory management in the
nexus driver.
Adapt the psycho driver to these changes, and do some minor cleanup work
while being there.
2002-01-02 18:27:13 +00:00
Thomas Moestl
477609fb13 Close a window of time during early boot in which an interrupt would
cause a panic.

Reported and tested (in another version) by: Jamey Wood <Jamey.Wood@Sun.COM>
2002-01-02 18:21:16 +00:00
Jake Burkholder
48cff2ea0b Correctly identify the cpu in certain ultra 1s.
Noticed by:	Jamey Wood <Jamey.Wood@Sun.COM>
Submitted by:	tmm
2002-01-01 21:26:57 +00:00
Jake Burkholder
2f3a74c449 Define __ASM__ so that libc will know not to define C things. 2002-01-01 21:21:05 +00:00
Jake Burkholder
947f30e25e Add a define for the fp restore soft trap type.
Only declare C things if __ASM__ is not defined.
2002-01-01 21:19:46 +00:00
Jake Burkholder
9b9706d39d Add constants needed by user trap code. 2002-01-01 21:17:14 +00:00
Jake Burkholder
fa60dcbea4 Enable virtual caching for kernel pages. When we enabled virtual caching
for certain user pages, stores to kernel pages would not update the
affected cache lines, which would sometimes cause the wrong data to be
returned for loads from kernel pages.  This was especially fatal when
the addresses affected held the kernel stack pointer, and a random
value was loaded into it.
Fix a harmless off by one error in a dcache_inval_phys call.
2002-01-01 21:14:58 +00:00
Jake Burkholder
52d966e949 Add some more info to traces.
Fix a potential race in setting up the per-cpu pointer if the special
restore fails on return to user mode fails and we need to trap back
into the kernel to fault in more stack.
Remove debug code.
2002-01-01 21:04:27 +00:00
Jake Burkholder
d89dbeb9e4 Ensure that the syscall trap vector is properly aligned. 2002-01-01 21:00:29 +00:00
Jake Burkholder
1ca0488670 Implement sysarch(SPARC_UTRAP_INSTALL).
Forgot this file in last commit.
2002-01-01 20:57:51 +00:00
Jake Burkholder
cbe522d307 Implement user trap delivery as specified by the sparc abi. This provides
an efficient way for the kernel to bounce certain mundane traps back to
userland for handling there.  A user trap handler returns directly to the
trapping user code, rather than going through the kernel again.  Only a
handful of instructions are actually executed in kernel mode.
Implement sysarch(SPARC_UTRAP_INSTALL).
Add code to handle sharing of the user trap table across forks and unsharing
at exec.

This can be used to implement efficient tracking of floating point register
usage in userland, fe by a thread library, and to handle alignment fault
fixups and instruction emulation in userland, for which the code may need
to be different for 32bit and 64bit binaries.
2002-01-01 20:56:28 +00:00
Jake Burkholder
d79083a390 Add a panic stack, which is used as a known good stack when there is
something wrong with the kernel stack.
Add code to check the kernel stack pointer in various important places
and try hard not to go down in flames if its wrong.
2002-01-01 20:26:46 +00:00
Jake Burkholder
cee5e561b6 Add a soft trap for restoring the fpu registers from the pcb. 2002-01-01 20:15:39 +00:00
Jake Burkholder
f264c6fbf8 Fix long lines in the trap table due to the abi specificied trap types
having overly long names.
2002-01-01 20:10:51 +00:00
Thomas Moestl
db8a25bd07 Do not include pcib.h, which only existed in my development tree, and do
not use struct pcib_softc when struct apb_softc would be correct.

Spotted by:	jake
Pointy hat to:	tmm
2001-12-30 16:14:33 +00:00
Thomas Moestl
9c5781cdd0 Add bus_common.h, which contains some definiton that apply to both PCI
and SBus.

Obtained from:	NetBSD
2001-12-30 16:13:05 +00:00
Jake Burkholder
92ebc34a9c Make these compile. 2001-12-29 09:55:37 +00:00
Jake Burkholder
40454f863d Remove local change that crept in. 2001-12-29 09:55:10 +00:00
Jake Burkholder
18f2fb66c6 Add a header for user trap types required by the sparc abi.
For simplicity the corresponding kernel types use the same
numerical values.
2001-12-29 08:59:33 +00:00
Jake Burkholder
9030565569 Adapt for used by upcoming fp emulation code.
Comment.

Submitted by:	tmm
2001-12-29 08:55:56 +00:00
Jake Burkholder
a536612abe Print the correct v9 opcodes.
Submitted by:	tmm
2001-12-29 08:52:50 +00:00
Jake Burkholder
decce32cc3 Update to new constants. 2001-12-29 08:37:58 +00:00
Jake Burkholder
1a0840deca Make cont in ddb work. 2001-12-29 08:37:35 +00:00
Jake Burkholder
3be7dfb8b4 Prototype dcache_inval_phys.
Submitted by:	tmm
2001-12-29 08:35:49 +00:00
Jake Burkholder
1e903121eb Add comments as to why VM_MAXUSER_ADDRESS is magic (abitrary).
Define the KVA_RANGE in terms of ttes, not sttes.
Remove UPT_MIN_ADDRESS.  We no longer use a hard coded address for
the user tsb.
2001-12-29 08:25:43 +00:00
Jake Burkholder
5ff798a5e0 Make tte bit constants explicitly unsigned and long.
Add a wierd soft bit.
Remove struct stte.
2001-12-29 08:24:02 +00:00
Jake Burkholder
a4e1e6e5de Add definitions for dcache color bits, which may move to cache.h.
Add fields to md_page for tracking virtual page color, and pv entry
lists.
Fix pmap_track_modified to work for non-kernel pmaps.  This is due to
kernel virtual addresses potentially overlapping with userland addresses.
2001-12-29 08:19:24 +00:00
Jake Burkholder
e3d6851148 Implement pv entries as separate structures from the ttes, like other
architectures do.
2001-12-29 08:17:16 +00:00
Jake Burkholder
624eb79821 Remove support for multi level tsbs, making this code much simpler and
much less magic, fragile, broken.  Use ttes rather than sttes.
We still use the replacement scheme used by the original code, which
is pretty cool.

Many crucial bug fixes from:	tmm
2001-12-29 08:15:43 +00:00
Jake Burkholder
b45b19a44e Implement pv entries as separate structures from the ttes, as other
architectures do.

Many crucial bug fixes from:	tmm
2001-12-29 08:12:22 +00:00
Jake Burkholder
6e5f166d2c Great pmap rewrite to use a much simpler one level tsb of ttes, instead
of sttes.  Also removes many differences between this and the other pmaps.
Reserve the kva space used by the openfirmware translations.
Use physical addresses directly in pmap_zero_page and pmap_copy_page, now
that we have the cache line shooting support.
Add code to track the virtual cachability of mapped pages.  The dmmu
requires that multiple mappings of the same phsyical address have the
save virtual address bits up to a colour boundary.  Violating this
requires all mappings to be mapped uncacheable.  We do not yet handle
the case of a badly aliased mapping becoming cachable again.

Many crucial bug fixes from:	tmm
2001-12-29 08:11:02 +00:00
Jake Burkholder
bab1ab0654 Use fprs to track floating register usage. Clear it once we've saved
the registers so we don't uselessly save them over and over again for
each context switch until another floating point instruction is executed.
Use a non-specific tlb slot for the tsb, which needs to have a locked
entry.
Remove overly verbose traces.
2001-12-29 08:03:15 +00:00
Jake Burkholder
26a7438b6f Add .register directives for gcc3.
Add macros to atomically increment an integer variable in the data
section and to atomically set a bit in a tte.  Note that the latter
does not return the new value.
Rewrite RESUME_SPILLFILL_MAGIC to use more sensical calculations, and
to preserve all alternate globals religiously.  Must now be called on
alternate globals.
Defer switching to the kernel stack until inside the syscall, trap,
interrupt wrappers.  Splitting the windows is all that's really urgent.
Adapt to new trap types.
Add %xcc where appropriate in order to not use v8 opcodes inadvertantly
(which work fine).
Modify the low level tlb fault handlers to operate on a tsb made up of
ttes, not sttes.  This effectively makes the tsb twice as large.
After atomically updating tte bits in memory, also set the bit in the
register that holds the data which will be loaded into the tlb.  The
macro returns the old value.
Use the preloaded mmu global which holds the address of the current
user tsb.
Add back a low level protection fault handler instead of just punting
into the vm system.  This effectively saves a soft fault per COW fault.
Add a trace to intr_enqueue.
Pass arguments to the trap, interrupt, syscall wrappers in the out
registers instead of some on the stack, some in registers.
Use the preloaded alternate global pcb register.
2001-12-29 07:59:04 +00:00
Jake Burkholder
1b217abc65 Add needed include of fsr.h.
Use fprs to track floating point usage.
Remove misguided comment.
Clear fprs in a child process's new trapframe.
2001-12-29 07:47:33 +00:00
Jake Burkholder
fac346769a 1. Adapt to new trap types.
2. Make trap_pfault more like it is on other architectures.
3. Fix a bug in syscall() which caused system calls with more than
   six arguments that are called through the wild card syscall to
   have their arguments scrambled.  This affected mmap due to the
   (bogus) wrapper in libc.

Submitted by:	tmm (3)
2001-12-29 07:45:49 +00:00