Commit Graph

750 Commits

Author SHA1 Message Date
scw e07faf8a74 Replace the myriad copies of bounds_check_with_label() with a single MI
version.

Add disk_blocksize(9) so that disk drivers can record the physical
block size of a disk if it is different to DEV_BSIZE. Right now this
simply initialises dk_blkshift and dk_byteshift according to the
supplied block size. This information is used in the MI version of
bounds_check_with_label().
2006-11-25 11:59:55 +00:00
riz 11f6dc7a44 Don't worry about the ELF32_MACHDEP_ENDIANNESS macro when compiling
a host tool - it's never used there.
2006-11-25 07:32:53 +00:00
tsutsui 7cb169d2dd Disable sosend_loan() in sys/kern/uipc_socket.c temporarily on CPUs
which have virtual address indexed cache and whose pmaps don't always
allow normal shared mappings even for read only pages.

In future, these pmaps should be rewritten to handle such read only
shared mappings properly like ARM pmap, but currently we just disable
sosend_loan() to avoid unnecessary uncached mappings and cache flushes
on MIPS3 CPUs, or map/unmap thrashing on SH4.

Discussed with thorpej a while ago.
2006-11-18 14:25:39 +00:00
uwe 20e7821e8a Enforce correct userspace bounds in copy{in,out}str().
From Miod Vallat <miod@openbsd.org>.
2006-11-16 23:12:23 +00:00
uwe ba0408a7f5 Lift extern shb_cd declaration to the top level.
Make all routines static.
2006-10-29 02:10:12 +00:00
uwe 523122cd3e Nuke GPROF cargo-cult I've been cut-n-pasting around in my drivers. 2006-10-27 00:08:32 +00:00
uwe 2909b42808 Fix __mcount to use bsrf to call _mcount. We know it's in the same
module (in the same file even), so we know the offset at link time and
don't need a reloc.  This kills the last text relocation in the sh3
libc.so.

While here, tweak the code slightly to put delay slots into use.
2006-10-26 23:54:28 +00:00
uwe 07dcd59f52 __pmap_kpte_lookup: verify that ptp is not NULL. 2006-10-24 01:56:33 +00:00
uwe d8092bae40 Kill get_ascii and its alternative format, it's not very useful. We'd
better use it for something else later.  I'm also thinking of g/c'ing
the temp buffer and emit disassembly with db_printf direcly, and
get_ascii gets in the way.
2006-10-23 21:13:00 +00:00
uwe 9287c88e77 Const-poision. While here, rename the argument s/code/pc/. 2006-10-23 19:28:07 +00:00
uwe 351eae3599 Be careful when fetching instruction to disassemble. Check for
unalinged address, refuse to disassemble P4 area (on-chip i/o regs),
use fusword/kcopy to fetch the instruction.
2006-10-23 18:33:56 +00:00
uwe a34468ef57 fu* function should read bytes/shorts as unsigned, so s/exts/extu/ 2006-10-23 16:28:51 +00:00
uwe f8b92ef629 Instead of referring *code repeatedly, fetch it once into a local variable.
Identical object code for f_* is produced with -O.
2006-10-22 03:58:36 +00:00
uwe d62bc05de1 Whitespace cosmetics in declarations of local variables. 2006-10-22 03:50:10 +00:00
uwe e10806aaa8 Rename get_opcode argument for consistency. 2006-10-22 03:37:04 +00:00
uwe a619033d94 SH_RCR2_BITS for bitmask_snprintf. 2006-10-19 03:26:10 +00:00
uwe 5e3c689570 Oops, don't stop rtc when enabling rtc oscillator - we would stall it
until rtc(4) attaches and starts the clock (that caused my Jornada to
lose about 12 secs during boot).
2006-10-19 00:25:18 +00:00
uwe 92dc06bfcf Don't include <machine/intr.h> in asm sources. 2006-10-15 02:11:21 +00:00
he 8bcd5596e1 Forward-declare "struct lwp" before using it in an argument declaration.
Gets rid of a recurring lint warning whenever this file is included.
2006-10-11 16:16:48 +00:00
uwe ba3cb45cce Oops, fix bug in previous. On SH4 (two-issue) sh_clock.cpuclock is
the spin count divided by two, so introduce a variable to hold the
original number that we later use to compute pclock.
2006-10-11 03:20:01 +00:00
uwe 61a805fc2c Do calculations to estimate cpu and pclock using 64-bit and doing all
the multiplications first.  Round to nearest, instead of down.

When estimating pclock don't compute sh_clock.cpucycle_1us * 1000000
sh_clock.cpuclock is exactly that (but without rounding errors).

This improves timekeeping on my Jornada.
2006-10-11 02:31:19 +00:00
uwe f6a0f2334c Lift extern cpu_cd declaration to the top-level.
Make match/attach routines static.
Whitespace cosmetics.
2006-10-11 01:08:48 +00:00
uwe bc9906d21b Don't call spl*() in setsoft(), as softintr_schedule() already calls
setsoft() inside _cpu_intr_suspend().
2006-10-10 00:40:47 +00:00
uwe d9338e1f50 general_exception() is called with all interrupts masked in SR
(effectively we were running syscalls with interrupts disabled).
splx back to previous interrupt level from tf->tf_ssr.

XXX: tlb_exception() still has that problem.
2006-10-08 18:20:42 +00:00
tnozaki 44eb8f042e fix gcc -Werror -Wmissing-braces problem
mbstate_t(this is opaque object)'s initializer should be ``{ 0 }'',
so changed 1st field of union from character array to integer.
2006-10-04 13:51:59 +00:00
elad 65792a0340 More from Matt Fleming:
Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.
2006-10-01 20:31:49 +00:00
elad e8373398dc Adapt MD code to KAUTH_DEVICE_TTY_OPEN. Patch from Matt Fleming, thanks! 2006-10-01 18:56:21 +00:00
tsutsui 430cb190a2 Allow shared PV mappings in pmap_enter(9) even on SH4 if VAs of shared pages
have the same virtual cache indexes (i.e. they won't cause virtual cache
aliases). Also prepare PMAP_PREFER(9) for SH4 to avoid some possible virtual
cache aliases.
More stuff should be added in pmap_enter(9), but at least this changes
should fix some existing problems. See discussion on port-sh3 ML for details.

OK'ed by uwe and chs, and closes PR port-sh3/34243.
2006-09-24 00:43:44 +00:00
tsutsui 84b4bcfd71 Add timecounter support for SH3 ports. From gdamore on port-sh3,
with several minor fixes by me.

Previously sh3 ports use two timers (TMU1 and TMU2) as oneshot timer
to cause real hardware interrupts by softintr(9), but now softintr(9)
uses only TMU1 and TMU2 is configured as freerunning counter for
timecounter(9).

Tested on my dreamcast.
2006-09-24 00:34:23 +00:00
uwe 7e62a1bf65 Don't truncate TEA when we call tlb_exception from sh_vector_generic. 2006-09-21 20:40:16 +00:00
uwe 57675076eb Switch the rest of sh3 ports to todr(9)
Split code to handle on-chip rtc into a separate driver
Eliminate all todr code from clock.c
Move __HAVE_GENERIC_TODR to sh3/include/types.h
2006-09-20 00:41:11 +00:00
uwe 6cfe10b75a __db_print_symbol: don't try to be too smart with db_print_loc_and_inst.
We can have in a register an address that points to/into some variable
in the data segment, but db_print_loc_and_inst only looks for
functions, so it will misprint it as something unrelated from libkern
+ huge offset.  E.g. instead of netbsd:cpu_info_store it would print
netbsd:prop_string_create_cstring+0xdeadbeef

Worse, if the address happens to be odd (char field in a struct, an
element of char array), attempt at printing the "instruction" at that
address will cause a fault and will abort "mach frame".

Disassemly is not really that useful in "mach frame" listing anyway
and more often just clutters things by overflowing 80 columns.
2006-09-06 00:11:49 +00:00
uwe f6bf0450b3 Cosmetics - space auxiliary defines so that they are not visually
hidden in surrounding code.
2006-09-05 22:48:40 +00:00
uwe 2a48f4de87 Switch dreamcast to MI todr(9).
Dreamcast does not use SuperH on-chip RTC, so do it seprately from
other sh3 ports.  Convert dreamcast rtc code into a real device
instead of searching/attaching it manually.

Tested by Nick Hudson.
2006-09-05 11:09:36 +00:00
uwe 6ee025d984 general_exception: g/c infinite loop after the call to panic. 2006-09-04 23:57:52 +00:00
uwe fc43c0c3f5 s/0/NULL/ for pointers. 2006-09-04 22:10:50 +00:00
uwe 8089b6b536 Add comments to RCR1 and RCR2 bits. 2006-09-03 12:38:34 +00:00
uwe ded7a4b611 There's no reason to use -Wno-parentheses. 2006-09-02 22:37:33 +00:00
matt d2fa9e5329 Make cpu_coredump dependent on COREDUMP 2006-08-31 16:49:21 +00:00
yamt e527ebac6f - remove unused bdbtofsb.
- move the following macros from MD headers to sys/param.h.
	ctod
	dtoc
	ctob
	btoc
	dbtob
	btodb
2006-08-28 13:43:35 +00:00
uwe 131b06fbff Make columns align with the header when dumping sh4 tlb.
Ifdef out dump of data array 2, it causes weird effects on landisk.
Minor whitespace cosmetic.
2006-08-23 00:09:01 +00:00
uwe ee4e3d86b3 Follow up to revision 1.16 (that only dealt with sh3).
Pass untruncated va=TEA to tlb_exception() from sh4_vector_tlbmiss too.
2006-08-22 21:47:57 +00:00
tsutsui 5011ef47f2 uvm_pagealloc(9) can fail, so handle that case in pmap_enter(9). 2006-08-07 23:19:36 +00:00
drochner 84f50d1b92 don't install <machine/db_machdep.h>, this is kernel only 2006-07-26 19:54:56 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
uwe 68272cc770 tlb_exception: Move and indent TLB_ASSERT to reduce visual clutter.
Fix function name in the panic message.  Print expevt on panic.
Split panic message so that the dumped numbers are on a separate line.
2006-07-22 22:43:43 +00:00
uwe 3ed02eac7c exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated.  Declare it publicly.  While here,
constify the array itself too.
2006-07-22 21:58:29 +00:00
uwe acfbe0b252 Report traps from user break controller as ksi_code = TRAP_TRACE 2006-07-22 03:22:15 +00:00
uwe 2e7b010133 Minor cosmetics. 2006-07-22 03:06:56 +00:00
ad 2b79369c7e - Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.
2006-07-19 21:11:37 +00:00