Commit Graph

127 Commits

Author SHA1 Message Date
des
29c5c858fc Dissociate ptrace from procfs.
Until now, the ptrace syscall was implemented as a wrapper that called
various functions in procfs depending on which ptrace operation was
requested.  Most of these functions were themselves wrappers around
procfs_{read,write}_{,db,fp}regs(), with only some extra error checks,
which weren't necessary in the ptrace case anyway.

This commit moves procfs_rwmem() from procfs_mem.c into sys_process.c
(renaming it to proc_rwmem() in the process), and implements ptrace()
directly in terms of procfs_{read,write}_{,db,fp}regs() instead of
having it fake up a struct uio and then call procfs_do{,db,fp}regs().

It also moves the prototypes for procfs_{read,write}_{,db,fp}regs()
and proc_rwmem() from proc.h to ptrace.h, and marks all procfs files
except procfs_machdep.c as "optional procfs" instead of "standard".
2001-10-07 20:08:42 +00:00
jake
6815a9f859 Add contents to struct *reg. 2001-09-30 19:59:07 +00:00
jake
cbc8263434 Optimize bcopy and bzero etc to use 64 bit loads and stores if possible.
Handle overlap in bcopy.
Add routines for copying and zeroing pages using physical addresses
directly.
Remove all the hacks to account for calling the firmware on its own
trap table, we use the kernel trap table.  There is still a problem
with OF_exit().
2001-09-30 19:50:39 +00:00
jake
5e37317159 Use %ver to identify the cpu instead of openfirmware.
Submitted by:	robert
2001-09-30 19:45:34 +00:00
jake
31f25c3f3d Remove some debug code, add traces. 2001-09-30 19:44:19 +00:00
jake
e0d2d2b6d0 Return EIO for procfs_*_dbregs. 2001-09-30 19:43:18 +00:00
jake
9ace52fc69 Add a place holder for PSTATE_SECURE, which detects if user code it
trying to set bad pstate bits.
2001-09-30 19:42:34 +00:00
jake
9f3535edc7 Split the low level trap code into trap, interrupt and syscall, its
easier and hopefully this code is done changing radically.

Don't use the mmu tlb register to address the kernel page table, nor
the 8k pointer register.  The hardware will do some of the page table
lookup by storing the the base address in an internal register and
calculating the address of the tte in the table.  However it is limited
to a 1 meg tsb, which only maps 512 megs.  The kernel page table only
has one level, so its easy to just do it by hand, which has the advantage
of supporting abitrary amounts of kvm and only costs a few more instructions.

Increase kvm to 1 gig now that its easy to do so and so we don't waste
most of a 4 meg page.

Fix some traces.  Fix more proc locking.

Call tsb_stte_promote if we get a soft fault on a mapping in the upper
levels of the tsb.  If there is an invalid or unreferenced mapping
in the primary tsb, it will be replaced.

Immediately fail for faults occuring in {f,s}uswintr.
2001-09-30 19:41:20 +00:00
jake
8b63e53025 Implement sysarch(). 2001-09-30 19:06:45 +00:00
jake
fdfc3c2c60 Fix some traces. td->p_comm doesn't exist. 2001-09-30 19:05:30 +00:00
jake
d495dd131c Move the kernel to end of the first 4 gigabytes of address space, so that
one 4 meg page can map both the kernel and the openfirmware mappings.
Add the openfirmware mappings to the kernel tsb so we can call the firmware
on the kernel trap table and access kernel memory normally.
Implement pmap_swapout_proc, pmap_swapin_proc, pmap_swapout_thread,
pmap_swapin_thread, pmap_activate, pmap_page_exists, and pmap_phys_address.
2001-09-30 19:03:22 +00:00
jake
ac0e71fb28 Add a macro to get the context from a tte tag, not necesarily a whole
tte.  Remove the old inline.
2001-09-30 18:55:05 +00:00
jake
c552424869 Include <machine/setjmp.h> instead of <setjmp.h>. 2001-09-30 18:52:56 +00:00
jake
f6a5e3f810 Don't use types that require other headers. 2001-09-30 18:52:17 +00:00
jake
539ccfaeb2 Wrap hardware trap types in ifdef _kernel. 2001-09-30 18:51:18 +00:00
jake
0faa0047f4 Move the pcb the to the top of the kernel stack.
Add a guard page at the bottom of the kernel stack.  Its unclear how easy
it will be to detect these faults and do something useful.
Setup the registers on exec how the c runtime expects.
Implement various {fill,set}_*regs.
Fix proc locking.
2001-09-30 18:48:37 +00:00
jake
de1928a0bc Don't overflow the ktr buffer <gulp>. 2001-09-30 18:42:56 +00:00
jake
327570ce60 Implement PCPU_ADDR. Align functions on 16 bytes boundaries. 2001-09-30 18:41:57 +00:00
obrien
94003d0787 + Fix misplacement of `txp'
+ Document our -CURRENT debugging bits
2001-09-24 03:23:48 +00:00
jake
297dc90746 Add kernbase symbol and use it instead of magic numbers in the
linker script.
2001-09-21 05:43:38 +00:00
jhb
0fc343f1d8 - If we ever do the per-cpu KTR stuff, the index won't be volatile as it
will be private to each CPU.
- Re-style(9) the globaldata structures.  There really needs to be a MI
  struct pcpu that has a MD struct mdpcpu member at some point.
2001-09-18 21:46:26 +00:00
peter
d7a9ef4aa1 Set thread0->td_pcb, this is probably why jake was getting a null deref. 2001-09-14 09:41:26 +00:00
julian
5596676e6c KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
peter
96b9a12bd2 Rip some well duplicated code out of cpu_wait() and cpu_exit() and move
it to the MI area.  KSE touched cpu_wait() which had the same change
replicated five ways for each platform.  Now it can just do it once.
The only MD parts seemed to be dealing with fpu state cleanup and things
like vm86 cleanup on x86.  The rest was identical.

XXX: ia64 and powerpc did not have cpu_throw(), so I've put a functional
stub in place.

Reviewed by:	jake, tmm, dillon
2001-09-10 04:28:58 +00:00
obrien
5f2415a1e9 style(9) the structure definitions. 2001-09-05 16:20:30 +00:00
obrien
0e8186d4dc style(9) the structure definitions. 2001-09-05 05:18:35 +00:00
obrien
70210b8344 style(9) the structure names 2001-09-04 09:23:23 +00:00
peter
16c92cf0c3 Zap #if 0'ed map init code that got moved to the MI area.
Convert the powerpc tree to use the common code.
2001-09-04 08:42:35 +00:00
jake
19f993b903 Make this compile. 2001-09-04 01:17:39 +00:00
jake
7cffb02347 Remove some stale definitions and update for new assembler code. 2001-09-03 23:19:18 +00:00
jake
63fd66633f Add ktr traces to copy{in,out} and cpu_switch.
Context switch the cwp value.  The register usage in cpu_switch will
be updated shortly to better reflect the fact that the current window
may change.
2001-09-03 23:18:02 +00:00
jake
653a513c7f Add comments following what other architectures have.
Fiddle the register values in the trapframe so children returning from
fork() return 0 (and success).
2001-09-03 23:15:54 +00:00
jake
f9d393e059 Change tf_arg to uintptr_t from void * to reflect the fact that
non-pointer values may be passed in it.  Add appropriate casts.

The interrupt type is now passed in tf_arg instead tf_type.
2001-09-03 23:13:42 +00:00
jake
e317d982f6 Implement a slightly different window spill/fill algorithm for dealing
with user windows in kernel mode.  We split the windows using %otherwin,
but instead of spilling user window directly to the pcb, we attempt to
spill to user space.  If this fails because a stack page is not resident
(or the stack is smashed), the fault handler at tl 2 will detect the
situation and resume at tl 1 again where recovery code can spill to the
pcb.  Any windows that have been saved to the pcb will be copied out to
the user stack on return from kernel mode.

Add a first stab at 32 bit window handling.  This uses much of the same
recovery code as above because the alignment of the stack pointer is used
to detect 32 bit code.  Attempting to spill a 32 bit window to a 64 bit
stack, or vice versa, will cause an alignment fault.  The recovery code
then changes the window state to vector to a 32 bit spill/fill handler
and retries the faulting instruction.

Add ktr traces in useful places during trap processing.

Adjust comments to reflect new code and add many more.
2001-09-03 23:10:45 +00:00
jake
c0bffaa6e1 Move the alternate global register stack to struct globaldata. 2001-09-03 22:58:05 +00:00
jake
e6fc6fd6cd Add ktr traces. 2001-09-03 22:57:21 +00:00
jake
6ef2965afd Implement pv_bit_count which is used by pmap_ts_referenced.
Remove the modified tte bit and add a softwrite bit.  Mappings are only
writeable if they have been written to, thus in general modify just
duplicates the write bit.  The softwrite bit makes it easier to distinguish
mappings which should be writeable but are not yet modified.

Move the exec bit down one, it was being sign extended when used as an
immediate operand.

Use the lock bit to mean tsb page and remove the tsb bit.  These are the
only form of locked (tsb) entries we support and we need to conserve bits
where possible.

Implement pmap_copy_page and pmap_is_modified and friends.

Detect mappings that are being being upgraded from read-only to read-write
due to copy-on-write and update the write bit appropriately.

Make trap_mmu_fault do the right thing for protection faults, which is
necessary to implement copy on write correctly.  Also handle a bunch
more userland trap types and add ktr traces.
2001-09-03 22:55:12 +00:00
jake
2be2cb095b Implement signals. 2001-09-03 22:41:40 +00:00
jake
fa2bcfc98d Move %ver definitions from pstate.h to ver.h. Add definitions for normal
kernel pstate values, which include a memory store order override.
2001-09-03 22:36:11 +00:00
jake
9f19dd2781 Add simple macros for tracing in assembler files. There are quite
a few places where we cannot even call a function, and these have
proven to be very useful debugging tools for such situations.
2001-09-03 22:32:49 +00:00
jake
908b8f329b Use the correct copyrights. Note where most of this came from.
Requested by:	obrien
2001-09-03 22:27:23 +00:00
jake
60654f358c Bump UPAGES to 4. The pcb can be rather large. 2001-09-03 22:19:36 +00:00
jake
64bd7a7631 mtx_savecrit is a pil level, not a pstate value, thus mtx_intr_enable
was not doing its thing.
2001-09-03 22:19:04 +00:00
jake
511df0c9cd Add a flushw() macro. 2001-09-03 22:13:53 +00:00
jake
733bc35923 Add atomic_load and store functions without membars, fwiw. 2001-09-03 22:03:25 +00:00
jake
e9a17647c3 The definition for ASI_IMMU_TAG_TARGET_REG was wrong. Sort. 2001-09-03 22:02:15 +00:00
obrien
3c7a869929 + Blah, there was nothing wrong in rev 1.1 talking about the i386/NOTES.
I should have diff'ed the header with the Alpha GENERIC.
+ fix style nit
+ turn on NO_MODULES for now.
2001-09-02 23:48:37 +00:00
obrien
057bc9ceba Match the style of very other platform we have. 2001-09-02 23:37:45 +00:00
peter
89089e22c4 Converge with i386/alpha/etc pmap.c for pmap_new_proc/pmap_dispose_proc(). 2001-08-31 06:30:27 +00:00
dillon
08e732a88b Remove the MPSAFE keyword from the parser for syscalls.master.
Instead introduce the [M] prefix to existing keywords.  e.g.
MSTD is the MP SAFE version of STD.  This is prepatory for a
massive Giant lock pushdown.  The old MPSAFE keyword made
syscalls.master too messy.

Begin comments MP-Safe procedures with the comment:
/*
 * MPSAFE
 */
This comments means that the procedure may be called without
Giant held (The procedure itself may still need to obtain
Giant temporarily to do its thing).

sv_prepsyscall() is now MP SAFE and assumed to be MP SAFE
sv_transtrap() is now MP SAFE and assumed to be MP SAFE

ktrsyscall() and ktrsysret() are now MP SAFE (Giant Pushdown)
trapsignal() is now MP SAFE (Giant Pushdown)

Places which used to do the if (mtx_owned(&Giant)) mtx_unlock(&Giant)
test in syscall[2]() in */*/trap.c now do not.  Instead they
explicitly unlock Giant if they previously obtained it, and then
assert that it is no longer held to catch broken system calls.

Rebuild syscall tables.
2001-08-30 18:50:57 +00:00