Commit Graph

986 Commits

Author SHA1 Message Date
uwe
7233c378a1 Comment proc_trampoline properly. 2007-03-16 02:27:16 +00:00
uwe
c67ce65c70 L_MD_PCB and L_MD_UPTE are small enough to be used as immediate values. 2007-03-16 01:30:56 +00:00
uwe
1edd00232c Comment sh3_vector_tlbmiss. Same object code is generated. 2007-03-15 23:13:59 +00:00
uwe
eae42fb475 Arrange for data blocks to start on 32B cache line boundary. 2007-03-15 01:54:18 +00:00
uwe
b602f9a09b Use .L* for local labels. Misc cosmetic.
Same object code is generated.
2007-03-15 00:00:38 +00:00
uwe
67862e14f4 s/TAB/space/ to separate instruction operands. There are quite a few
cpp macros and long src operands anyway that destroy any intended
"neatly lined up" effect that TAB was supposed to achieve.

White space change only, same object code is generated, but it is much
easier on the eyes now.
2007-03-14 22:38:00 +00:00
uwe
2d73ff48ec More nano-optimizations to mutex stubs: rely on _lock_cas to preserve
things for us to shave off a few cycles.
2007-03-14 06:42:46 +00:00
uwe
ecde82d887 Tweak to shave off a few cycles. 2007-03-14 05:38:28 +00:00
uwe
07a908343d Convert _lock_cas to RAS. Check for restart in ast() on return from interrupt. 2007-03-14 05:03:52 +00:00
uwe
7b073b8364 Oops. Don't define stubs if LOCKDEBUG. 2007-03-14 02:01:19 +00:00
uwe
beab1d398c LINTSTUB: include <sys/mutex.h> to make the lint stub lintable. 2007-03-14 01:20:20 +00:00
uwe
8e5c3b9886 Implement fast-path mutex_enter and mutex_exit stubs. 2007-03-14 01:14:25 +00:00
ad
59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
uwe
11957bf405 Note in that TAS.B in inline asm clobbers "cc".
Use MOVT instead of clear+rotate with carry in __cpu_simple_lock_try.
2007-03-12 01:33:50 +00:00
uwe
d96c2a32bc Use simple mutexes. This file is effectively a copy of arm's one now. 2007-03-12 00:57:13 +00:00
uwe
7983f30ad7 Do cpu_exit with proper locking.
Rename assembly cpu_exit to cpu_do_exit and make a C version of
cpu_exit() to do proper locking.  While here, g/c switch_exit entry
point and don't call lwp_exit2 from cpu_exit.
From ad@

Completes PR port-sh3/35971 - my Jornada now boots to multiuser with a
LOCKDEBUG kernel.
2007-03-12 00:32:56 +00:00
uwe
f3c67932b4 Cosmetic. Group function declarations and variable definitions. 2007-03-12 00:12:29 +00:00
uwe
c24277d5f4 Factor out code to save processor state to pcb->pcb_sf switchframe
into a macro.  While here, clarify l->l_md.md_pcb->pcb_sf
vs. l->l_md.md_pcb confusion with proper naming and some comments.
Idea from OpenBSD.
2007-03-11 23:54:03 +00:00
ad
7a902dfca5 PR port-sh3/35971: Mutex error on SH3 DIAGNOSTIC kernels 2007-03-11 20:09:03 +00:00
he
8a3ceb1726 Cast to char* before doing pointer arithmetic. 2007-03-06 23:38:37 +00:00
tsutsui
1032472464 Call uvm_pageidlezero() only if uvm.page_idle_zero is true. 2007-03-04 10:41:59 +00:00
christos
53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
uwe
3cdc20a9de Brute force _lock_cas() by disabling interrupts.
Need to redo it with RAS later.
2007-02-23 03:24:47 +00:00
uwe
b2fe1ffc55 Sprinkle static so that gcc can eliminate simple helper functions that
get inlined.
2007-02-23 03:14:32 +00:00
uwe
b0513c4b84 Catch up with bool rototill. 2007-02-23 02:57:43 +00:00
uwe
7856f87f0d Add lock_stubs.S with fake _lock_cas - just to make the kernel compile
for now.
2007-02-22 22:53:26 +00:00
uwe
b8be26359e Provide an empty cpu_lwp_free2(). 2007-02-22 22:37:52 +00:00
uwe
cb750a7039 Undef __HAVE_MUTEX_STUBS, there are no mutex stubs yet. 2007-02-22 22:29:10 +00:00
thorpej
f6d76ae22a TRUE -> true, FALSE -> false 2007-02-22 16:45:48 +00:00
thorpej
712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
ad
3363855a4a Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
2007-02-16 02:53:43 +00:00
ad
def3fb26c7 Add MUTEX_CLEAR_WAITERS(). 2007-02-15 22:52:42 +00:00
ad
b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
hubertf
142c2a33ba Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
2007-01-24 13:08:11 +00:00
elad
504c71d9fe Make machdep scope architecture-agnostic by removing all arch-specific
requests and centralizing them all. The result is that some of these
are not used on some architectures, but the documentation was updated
to reflect that.
2006-12-26 10:43:43 +00:00
elad
3d11477c94 Add requests indicating access to unmanaged memory for arm, pc532, powerpc,
sh3, sh5, and vax, and use them instead of KAUTH_GENERIC_ISSUSER.

Update documentation and example secmodel code.
2006-12-22 11:13:21 +00:00
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
uwe
943edbd0d8 Nuke va-sh.h. stdarg.h and varargs.h now use __builtin_va_*. 2006-05-21 23:14:13 +00:00
uwe
9458b164a6 New stdarg.h and varargs.h based on arm and i386 versions.
Use __builtin_va_* instead of hand written code in va-sh.h that uses
LHS casts.  Slightly worse code is generated by gcc 3.3.3, but LHS
casts are outlawed in gcc 3.3.6 and gcc 4.

Build-tested on hpcsh (le) and mmeye (be), run-tested on hpcsh.
2006-05-21 22:39:04 +00:00
uwe
d5b4b78d10 Change _BSD_VA_LIST_ from "void *" to "__builtin_va_list" for newer
gcc versions and "char *" otherwise.  This is what most other arches
use, modulo different __GNUC_PREREQ__.

This is in preparation for replacing stdarg.h and varargs.h with
versions based on __builtin_* instead of handwritten code that gcc
3.3.6 and up refuse to compile b/c of lhs casts.

Identical binary code produced.
2006-05-15 08:57:59 +00:00
elad
8ccb6c9341 integrate kauth. 2006-05-14 21:55:09 +00:00
skrll
a9f4c28a3d Fix a bunch of cast lvalues. 2006-05-10 06:24:02 +00:00
uwe
03ee8a12f3 Fix typo in comment in previous. 2006-04-11 23:45:13 +00:00
uwe
1860560960 Cosmetic. Same object code generated. 2006-04-11 19:07:54 +00:00
uwe
c73fd1d833 Shave off few instructions by replacing mov src, dst; swap.w dst, dst;
with swap.w src, dst in REDUCE.
2006-04-11 18:42:09 +00:00
uwe
412106574d Shave off few instructions by replacing mov #imm, reg; sub reg, dst
with add #-imm, dst
2006-04-11 18:34:39 +00:00
uwe
ae727708e1 Decorate pmap_remove_all() with /* ARGSUSED */ 2006-04-10 23:12:11 +00:00
cherry
93447d7ac4 closes: PR kern/32359
modifies machine/db_machdep.h: BKPT_SET(inst) to BKPT_SET(inst, addr) for all archs ie; passess the
breakpoint address as well.

Patch from cherry@mahiti.org
2006-04-01 15:45:00 +00:00
uebayasi
8572d2c144 Stop using linker scripts on all sh3 ports.
The only information to be compensated is text section start address.
The default value is set arch-wise as DEFTEXTADDR.  Each kernel config
can override the default value by setting TEXTADDR.

Tested on COMPUTEXEVB (evbsh3).

Reviewed By:	uwe
2006-03-17 16:06:51 +00:00
he
450ce68a74 Transform to new signature for uvm_fault() by dropping the third arg.
Discussed with drochner.
2006-03-16 15:10:06 +00:00
uebayasi
f059840dbd * Don't define SET/CLR/ISSET locally.
* Avoid shadow in a pointer-to-function declaration.
2006-03-07 10:53:29 +00:00
thorpej
61dd49d3bc Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.
2006-03-07 07:21:50 +00:00
thorpej
be8b235384 Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
  trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
  about KTRACE and SYSTRACE, but do no more.
2006-03-07 03:32:04 +00:00
he
fddbc48a67 Remove yet another instance of the SET/CLR/ISSET macro triplet, now
that they are in <sys/types.h>.
2006-03-06 15:01:45 +00:00
christos
beea4fc3fa Add a proc_is_traced_p() macro and use it, instead of copying the same code
in many places. Idea from thorpej.
2006-03-05 19:08:38 +00:00
christos
a4495f4cec implement PT_SYSCALL 2006-03-05 07:21:37 +00:00
uwe
970e24ee46 s/u_intN_t/uintN_t/ 2006-03-04 01:55:03 +00:00
uwe
3499d9e849 s/u_intN_t/uintN_t/ 2006-03-04 01:13:35 +00:00
uwe
7ebf92ccc4 Use 4- or 2-bytes aligned accesses if possible.
Makes it possible to examine hw registers that require 4- or 2-byte accesses.
2006-02-24 00:57:19 +00:00
thorpej
3ddf26777f Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.
2006-02-20 16:50:36 +00:00
uwe
01bb68c06b Make _BASE visible regardless of #ifdef SHx.
Add defines for SMR bits in IrDA mode in 7709.
2006-02-18 00:41:32 +00:00
skrll
221fe583b6 Match comment against #endif with #ifdef 2006-02-17 08:23:26 +00:00
perry
fbae48b901 Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
2006-02-16 20:17:12 +00:00
uwe
c842fab210 Fix file comment to include the expansion for 'F' in "SCIF". 2006-02-14 00:02:03 +00:00
uwe
533115eb12 Define scif register base(s) and offsets.
Express old defines in terms of base + offset.
Use uintN_t.
2006-02-14 00:00:34 +00:00
uwe
7dea0a81b8 Move/merge common defintions out of ifdef. 2006-02-13 23:26:31 +00:00
uwe
2e71b70d1f While here, use uintN_t. 2006-02-12 02:30:55 +00:00
uwe
c6474efc78 Revert changes made in 1.10. They should not be necessary (we are
doing a single word store).  I've been running my Jornada without them
for a very long time, but got no word from dreamcast folks.  Thanks to
Nick Hudson for testing it on dreamcast finally.
2006-02-12 02:23:03 +00:00
uwe
3c5e28322e pmap_extract: handle P1 and P2 (MMU bypass) addresses specially.
PMAP_MAP_POOLPAGE maps pa -> P1 va, so we must handle this case here.
PR port-sh3/26569 by Nick Hudson.
2006-02-09 10:08:32 +00:00
uwe
175260c2de sh3_vector_tlbmiss: don't waste perfectly good delay slots. 2006-02-08 02:19:57 +00:00
uwe
33c4e018e2 While here, shave off few bytes and few cycles off of the sh3_vector_tlbmiss.
Since the registers we use are at the very end of address space, we
can load their addresses as small immediate negative constants instead
of loading them from memory.
2006-02-08 00:32:06 +00:00
uwe
9621f44368 Pass untruncated va=TEA to tlb_exception(), not its VPN. 2006-02-07 23:56:20 +00:00
skrll
c36e4cf586 Fix the multiple inclusion protection. hi dsl. 2006-02-02 06:39:05 +00:00
dsl
37875b24f4 Need to install byte_swap.h and bswap.h needs to include sh3/byte_swap.h. 2006-02-01 20:56:18 +00:00
dsl
28cb02c94f Make the sh3 bswap headers look like all the other ports 2006-01-31 07:58:56 +00:00
dsl
67d47e0290 Change sys/arch/xxx/include/bswap.h to #include machine/byte_swap.h then
sys/bswap.h in order to pick up the MD inline routines and the constant
folding definitions in the right order.
Code can include either sys/bswap.h or machine/bswap.h with the same effect.
2006-01-31 07:49:18 +00:00
dsl
6f0f9f8763 Make almost everything #include <sys/bswap.h> instead of <machine/bswap.h>
The bswap.h and endian.h files are all rather incestuous, but I want to
get the constant folding stuff into one place - sys/bswap.h
2006-01-29 21:42:40 +00:00
uwe
86e8b6d9d0 Wrap sh3 and sh4 parts into respective ifdefs.
Declare local functions static.
ANSI'ify functions without arguments.
2006-01-25 00:02:57 +00:00
uwe
4baa2e17dd EVTCODE_TO_MAP_INDEX - tweak to help gcc produce better code. 2006-01-24 23:51:42 +00:00
uwe
25196f3ee3 Consistently apply ifdef logic so that in SH3-only or SH4-only kernel
all references to CPU cpecific functions are direct, and unused hooks
are not defined.
2006-01-24 00:01:22 +00:00
uwe
aec45d5629 Pacify -Wuninitialized for SH3 && SH4 case. 2006-01-23 23:25:45 +00:00
uwe
6b850c4367 Delclare __sh_PTEH for SH3 && SH4 case. 2006-01-23 23:17:49 +00:00
uwe
8cfe9e15ba Pacify -Wuninitialized for SH3 && SH4 case. 2006-01-23 23:07:19 +00:00
uwe
406de23722 Don't waste rts delay slots in sh3_switch_resume and savectx.
longjmp needs to arrange for a call to setjmp to return 1.
2006-01-23 22:52:09 +00:00
uwe
a22aa45682 Use cpp-safe labels. 2006-01-23 22:32:50 +00:00
uwe
5db834dbd4 LINTSTUB: include <sh3/locore.h> - to check *_switch_resume prototypes. 2006-01-23 22:14:59 +00:00
uwe
3e38547c6e Provide sh3_switch_resume/sh4_switch_resume with own copies of L_MD_UPTE.
Move SET_ENTRY_SIZE(sh4_switch_resume) under ifdef SH4.
2006-01-23 22:06:44 +00:00
uwe
8025d17cda Fix sh_tlb_update signature for SH3 && SH4 case. 2006-01-23 22:04:04 +00:00
uwe
4dfa629043 Wrap sh3_switch_setup/sh4_switch_setup into the same ifdefs that are
used in vm_machdep.c at their invocation sites.
2006-01-23 21:45:02 +00:00
uwe
f8e74829d9 Fix the sense of #else/#endif comments. 2006-01-23 21:39:15 +00:00
uwe
9167514771 In onfault handlers of copyinstr and copyoutstr move EFAULT to the
correct register.  This code worked correctly only because the right
register already contained EFAULT.
2006-01-23 03:17:17 +00:00
uwe
e1b83e081d LINTSTUBs. Provide .size (except for the switch maze of jumps). 2006-01-23 01:33:53 +00:00
uwe
622ea6b6fb Fix few labels with dots in the middle that I've missed in previous. 2006-01-23 00:36:04 +00:00
uwe
c4d52dce59 Use cpp-safe labels. 2006-01-23 00:31:54 +00:00
uwe
43f9c9c93e Use bsr instead of mova+jsr. 2006-01-22 06:25:25 +00:00
uwe
c4ef153e79 LINTSTUBs. 2006-01-22 06:08:51 +00:00
uwe
c5b4a6c241 Use macros from <machine/asm.h>. Provide .size
Provide LINTSTUBs.
2006-01-22 05:56:58 +00:00
uwe
722d3e38c8 CONSTCOND. 2006-01-21 22:10:59 +00:00
uwe
530e77af35 Use foo &= ~(type)mask; instead of foo &= (type)~mask; to make lint happy.
While here, convert to uintN_t.
2006-01-21 04:57:07 +00:00
uwe
ffc34314e2 Add lint comments. Hide computed goto in cpu_reset() from lint.
Remove infinite loop from cpu_reset(), gcc accepts computed goto as
the sign that function never returns.
2006-01-21 04:26:56 +00:00
uwe
a1695713e9 Declare cpu_reset as __attribute__((__noreturn__)). 2006-01-21 04:24:12 +00:00
uwe
2f21a084a1 ANSI'fy. 2006-01-21 04:12:22 +00:00
uwe
d0928cda19 Lintable no-ops for LOCKDEBUG macros. 2006-01-21 03:57:48 +00:00
uwe
e4f6d0eca3 Hide RUN_P2 and RUN_P1 from lint.
Drop CONSTCOND as lint doesn't see that code now.
While here, tweak them a bit to use less casts.
2006-01-21 03:52:42 +00:00
uwe
c4888894b9 Use uint32_t. 2006-01-21 03:42:29 +00:00
uwe
92dfa6358c Tweak the way we compute displacement for bra/bsr.
Makes lint happy, makes code shorter too.
2006-01-21 02:09:06 +00:00
uwe
a5480590a9 "if (foo) return;" in one line is bad style. 2006-01-21 01:51:47 +00:00
uwe
f57593cc31 Use space in "static\tvoid". 2006-01-21 01:48:36 +00:00
uwe
696dfdc2f6 Use uint16_t instead of u_short for instructions.
There's no reason for buf argument to be unsigned char.
0x7f is not a printing character.
2006-01-21 01:45:34 +00:00
uwe
6167325eb6 Add NOTREACHED after calls to panic(). 2006-01-21 00:56:05 +00:00
uwe
de6525a736 There's no need to duplicate cpu type ifdef dance here. cputypes.h
already defines CPU_IS_SH[34] as constants for kernels that support
only single cpu type.
2006-01-21 00:46:36 +00:00
uwe
88d4d97511 Add CONSTCOND to make lint happy. 2006-01-21 00:40:36 +00:00
christos
3ffa241fcd Add a STRONG_ALIAS macro 2006-01-20 22:02:40 +00:00
uwe
24ce06fd0d Provide PIC_EPILOGUE_SLOT that is safe to use in delay slot. 2006-01-06 22:27:53 +00:00
uwe
25d6b3ac57 Introduce PIC_PROLOGUE_NOSAVE for functions that do non-local jumps
and don't need to save/restore r12.  Shaves off two instructions.
2006-01-05 19:18:40 +00:00
uwe
d4e9884c9c mova can only have r0 as destination, so PIC_PROLOGUE can not specify
an arbitrary temp register.
2006-01-05 02:45:19 +00:00
uwe
2a12f0da53 Macros for .size directive. 2006-01-05 02:02:56 +00:00
uwe
5b2d014092 Provide defines for offsets into the jump buffer. 2006-01-05 00:50:23 +00:00
uwe
ba99e8a02c Nuke __P. 2006-01-03 01:29:46 +00:00
uwe
5804629139 KNF: space after the keyword, blank line between function declarations
and variable definitions.
2006-01-02 23:37:34 +00:00
uwe
6ee797fb71 Prepend "cpu0: " to autoconfiguration messages.
While here move separator space to the beginning of optional messages.
Tweak write-through/back message so that is parses as expected.

PR: port-sh3/31315
2006-01-02 23:32:11 +00:00
uwe
e968ab9426 Prepend "cpu0: " to autoconfiguration messages.
While here re-wrap some lines to be more readable.

PR: port-sh3/31315
2006-01-02 23:30:33 +00:00
uwe
3099c2f7de Add space between cpu speed and "MHz" in the attachment message. 2006-01-02 23:16:20 +00:00
uwe
9d461d0045 First cut at PIC macros. 2005-12-31 05:06:33 +00:00
perry
2d542ba1f8 inline -> __inline 2005-12-28 19:09:29 +00:00
perry
50a256a3a0 __asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
2005-12-24 23:23:59 +00:00
uwe
12ffdb00a2 Implement WARN_REFERENCES. 2005-12-24 22:57:26 +00:00
perry
2d65de2479 bare asm -> __asm 2005-12-24 22:45:33 +00:00
uwe
552b373ffa Prettify. 2005-12-24 21:10:28 +00:00
perry
5f1c88d70d Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:06:46 +00:00
uwe
105ff7167f Declare ddb_regs extern in db_machdep.h and provide the defintion in
db_interface.c.
2005-12-18 22:41:50 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
nonaka
2f7c0c1f96 fix EMODE instruction cache range index op. 2005-10-22 15:13:38 +00:00
uwe
04b13834d6 Drop obsolete bus_space_* compat defs. 2005-09-15 18:34:03 +00:00
kleink
aece7a90fd Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges.  Noted by David Holland in PR kern/31126.
2005-09-06 21:40:37 +00:00
drochner
44bf0a7ee2 s/locdesc_t/int/g 2005-08-26 13:19:34 +00:00
nonaka
02d0ebb277 Added SH7751{,R} integrated PCI controller support. 2005-08-16 11:32:26 +00:00
uwe
51d0cd96db Implement syscall_intern for sh3. 2005-07-10 22:27:20 +00:00
uwe
b044b5b620 Cosmetic: drop leading underscores from the volatile keyword. 2005-07-10 16:24:29 +00:00
uwe
496eb1f350 Cosmetic: use uintN_t, drop leading underscores from the volatile
keyword, use extern in function declarations.
2005-07-10 16:21:01 +00:00
nonaka
ba180bf75f Added EMODE cache operation. 2005-07-07 16:56:50 +00:00
uwe
70d5ff6a8a Make this file suitable for use in asm sources. 2005-07-03 22:18:32 +00:00
uwe
a761e60e47 Add SH_INTEVT_WDT_ITI in intc_intr_priority. 2005-07-03 17:59:10 +00:00
nonaka
654f6d544d fix timer prescaler definition. 2005-07-03 12:38:38 +00:00
christos
6d30dcee75 PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.
2005-07-01 18:01:44 +00:00
drochner
996c273eda adaptions to config_search() change, and minor autoconf fixes, mostly from Havard Eidnes 2005-06-30 17:03:51 +00:00
nonaka
f3987f5dbb remove EMODE support code.
- EMODE support doesn't work fine yet.
- This code is broken for dreamcast.
  dramcast call sh4_icache_sync_all() before sh4_cache_config().
  (at locore.S)
2005-06-30 15:14:46 +00:00
christos
d3f92bb5dc additions from nonaka's landisk port. 2005-06-29 16:56:58 +00:00
christos
63fcf30b44 more additions from nonaka's landisk port. 2005-06-29 16:51:20 +00:00
christos
104d75eb91 more info for sh4 from nonaka's landisk port. 2005-06-29 16:31:51 +00:00
christos
5caa083144 more register definitions, from nonaka's landisk port. 2005-06-29 16:25:58 +00:00
christos
1c0b7f1f92 Need 2ms delay (from nonaka's landisk port). 2005-06-29 16:23:45 +00:00
dyoung
a37289db57 Make disklabel(8) and fdisk(8) into "host tools " last step: build
and install ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-disklabel,
${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk by "reaching over" to
the sources in ${NETBSDSRCDIR}/sbin/{disklabel fdisk}/.

To avoid clashes with a build-host's header files, especially on
*BSD, the host-tools versions of fdisk and disklabel search for
#includes such as disklabel.h, disklabel_acorn.h, disklabel_gpt.h,
and bootinfo.h in a new #includes namespace, nbinclude/.  That is,
they #include <nbinclude/sys/disklabel.h>, <nbinclude/machine/disklabel.h>,
<nbinclude/sparc64/disklabel.h>, instead of <sys/disklabel.h> and
such.  I have also updated the system headers to #include from
nbinclude/-space when HAVE_NBTOOL_CONFIG_H is #defined.
2005-06-12 19:46:15 +00:00
matt
e1245a3c46 Rework the coredump code to have no explicit knownledge of how coredump
i/o is done.  Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o.  This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.
2005-06-10 05:10:12 +00:00
uwe
9bb93565ec Catch up with constification. 2005-06-04 22:38:24 +00:00
tsutsui
65ae0ba36c Adapt to ddb constification. 2005-06-03 15:01:44 +00:00
scw
8f4aee207b Declare the second arg of process_write_{fp,}regs() to be const.
This permits sh5 to continue to re-use those functions in cpu_setmcontext()
with the recent change to Makefile.kern.inc (revision 1.62).
2005-06-01 13:01:35 +00:00
scw
a0d939e06d Fix const fallout. 2005-06-01 11:59:13 +00:00
uwe
c93f856fa9 Fix shadowing. 2005-05-31 23:12:18 +00:00
uwe
49d5bf28d9 Rename s/newlwp/nlwp/ parameter to cpu_switch_prepare() to avoid
shadowing a function of the same name.  Rename oldlwp to match.
2005-05-31 22:06:51 +00:00
uwe
639d538d14 Constify as -Wcast-qual seyeth. 2005-05-31 22:01:24 +00:00
christos
f6b4c20f18 s/GENASSYM/GENASSYM_CONF/ so we can use "GENASSYM" as the program name. 2005-05-31 04:03:08 +00:00
chs
6cefe93bda adapt to const changes. 2005-05-31 00:40:17 +00:00
kleink
4a6a03b162 Include <sys/cdefs.h> for __signed; related to lib/30072. 2005-05-25 20:58:00 +00:00
lukem
3fd1802e62 Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.
2005-04-25 15:02:02 +00:00
uwe
5c1237f42d Teach db_stack_trace_print() to step through trap frames so that
backtraces on kernel exceptions are actually useful.  Stop tracing at
traps from user mode for now.
2005-04-20 01:56:17 +00:00
uwe
5eaebcb703 Fix pasto in comment. 2005-04-19 22:26:21 +00:00
kleink
b2cb7fcd8a Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.

IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
2005-04-15 22:39:10 +00:00
uwe
89f37124c6 Revert previous. It causes df(1) to reset my Jornada 680 sometimes.
And df(1) that is called during /etc/daily run resets it almost always.
2005-04-04 23:15:08 +00:00
yamt
6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
matt
63c819e89c Add missing stream methods (for wdc_pcmcia.c) 2005-03-11 16:16:06 +00:00
matt
124866f5f5 Don't compare scalars against NULL, use 0. 2005-03-11 07:08:33 +00:00
uwe
1fc105ea83 db_stackcheck_cmd: catch up with proc => lwp changes.
This is just a quick fix to make KSTACK_DEBUG kernels compilable.
Formatting needs improvment (group lwps from one process together, etc).
PR port-sh3/29621
2005-03-08 22:04:22 +00:00
uwe
b6c480ab6a KNF: use "continue" as explicit empty loop body. 2005-03-08 21:05:47 +00:00
uwe
933cf58cd8 Use uint<N>_t instead of u_int<N>_t. 2005-03-08 20:54:58 +00:00
chs
348f7d206d sh3 no longer abuses cf_unit. 2005-01-18 07:30:49 +00:00
tsutsui
e34a3b7f08 Small optimization in vmapbuf()/vunmapbuf().
BTW, should we also pass 'VM_PROT_READ|VM_PROT_WRITE' to flags
with PMAP_WIRED for pmap_enter() in vmapbuf()?
2005-01-09 17:41:34 +00:00
uwe
b667c1f82d Fix lint stub for va_start so that lint is actually happy about it. 2005-01-05 23:39:51 +00:00
tsutsui
23bf17808a Protect accesses to PTE/TLB registers with
_cpu_exception_suspend()/_cpu_exception_resume() pair.

Should fix spontaneous reboot problem on heavy load reported by
Christian Groessler on port-dreamcast.
2004-12-30 09:48:30 +00:00
chs
0ded74691b for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
2004-12-13 02:14:13 +00:00
uwe
e9f575c48c First step towards bus_space - wrap register accesses into macros.
Same object code is generated.
2004-10-19 02:12:21 +00:00
uwe
4866d0ee50 KNF cosmetic. Same object code is generated.
Use continue for explicit empty loop body.
Use for (;;) instead of while (1).
Fix an indentation glitch.
2004-10-19 00:10:33 +00:00
yamt
857913deac include sys/cpu_data.h only if defined(_KERNEL) 2004-09-25 22:08:48 +00:00
yamt
d2fe4b34bb move some per-cpu data definitions to MI place so that they can be modified
without touching all ports.  discussed on tech-kern@.
2004-09-22 11:32:02 +00:00
skrll
f7155e40f6 There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
2004-09-17 14:11:20 +00:00
thorpej
6c08646cb8 Garbage-collect pagemove(); nothing use it anymore (YAY!!!) 2004-08-28 22:12:40 +00:00
yamt
3998262d5e defparam HZ. 2004-07-01 12:44:26 +00:00
thorpej
e33c2bb5d5 Add the %MAKEOPTIONSAPPEND token at the end of the file, after the
common Makefile.kern.inc has been included.
2004-06-04 04:45:49 +00:00
drochner
19f047f8d0 SIGTRAMP_VALID() should not pollute the user namespace 2004-05-10 21:51:49 +00:00
kleink
7b3b647647 Factor out W{CHAR,INT}_{MAX,MIN} into their own header file. 2004-05-08 21:51:47 +00:00
uwe
c22f771297 Register definitions for sh3 integrated DMA controller. 2004-04-08 21:02:57 +00:00
drochner
c83eb997b8 nothing cares about __HAVE_SIGINFO anymore, so nuke it 2004-03-26 21:39:57 +00:00
drochner
ae94c80224 fix references to the syscall formerly known as SYS___sigreturn14 2004-03-26 19:05:33 +00:00
uwe
44498073bf intc_intr_priority: map DMAC and IRDA interrupts. 2004-03-25 01:25:08 +00:00
uwe
1cfab0e2a0 INTEVT2 values for DMAC interrupts. 2004-03-25 01:02:30 +00:00
wiz
f0d2889eb5 Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.
2004-03-24 15:38:41 +00:00
cl
ea5ec0212d add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
  * VP id
  * lock on VP data
  * LWP on VP
  * recently blocked LWP on VP
  * queue of LWPs woken which ran on this VP before sleep
  * faultaddr
  * LWP cache for upcalls
  * upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP
2004-03-14 01:08:47 +00:00
uwe
590efeca88 Wrap "unknown instruction in prologue" in TRACE_DEBUG. gcc3 reorders
instructions so that prologue code and function code get mixed, and
you get a lot of noice from this printf, making traceback very hard to
read if not useless.
2004-02-23 01:06:53 +00:00
uwe
8939f2bdbd Implement proper switch_exit in assembler. Since cpu_switch is
reduced to just a call to switch_exit, g/c the C version and add a one
instruction assembler version that just falls through to switch_exit.

Addresses PR#24007 by Jaromir Dolecek <jdolecek@netbsd> and makes sh3
kernels work again after his elimination of the reaper.  Tested on hpcsh.
2004-01-18 18:54:17 +00:00
martin
da4e67accc Do not export __HAVE_RAS to userland. Applications are supposed to try
rasctl() and detect failure with EOPNOTSUPP.
2004-01-18 18:23:19 +00:00
uwe
a6ced7eb12 G/c symbols related to structs proc and mdproc. 2004-01-18 05:29:45 +00:00