Commit Graph

2544 Commits

Author SHA1 Message Date
msaitoh
74868e2a8b s/recevive/receive/ in comment. 2019-12-27 06:52:43 +00:00
kamil
4d3a90668a Harmonize the namespace of fast TLS base pointer getter functions
Protect __lwp_getprivate_fast() with _RTLD_SOURCE, _LIBC_SOURCE and
__LIBPTHREAD_SOURCE__.

Include in this namespace <sys/tcl.h> and use __BEGIN_DECLS/__END_DECLS
for the sake of consistency.
2019-12-27 00:32:16 +00:00
ad
ddd3a0be1e uvmexp.free -> uvm_free() 2019-12-21 13:00:20 +00:00
ad
57eb66c673 Fix false sharing problems with cpu_info. Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
  the IPI bitmask and ci_want_resched.
2019-12-01 15:34:44 +00:00
riastradh
398a51e047 Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE. 2019-11-29 22:55:33 +00:00
riastradh
63d8b25a63 Nix mb_* on vax. 2019-11-29 20:06:44 +00:00
riastradh
915952b159 Largely eliminate the MD rwlock.h header file.
This was full of definitions that have been obsolete for over a
decade.  The file still remains for __HAVE_RW_STUBS but that's all.
Used only internally in kern_rwlock.c now, not by <sys/rwlock.h>.
2019-11-29 20:04:52 +00:00
ad
115c1bc097 cpu_need_resched():
- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().
2019-11-23 19:40:34 +00:00
ad
8d31b01840 mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.
2019-11-21 19:23:58 +00:00
pgoyette
1d577fe379 Move all non-emulation-specific coredump code into the coredump module,
and remove all #ifdef COREDUMP conditional compilation.  Now, the
coredump module is completely separated from the emulation modules, and
they can all be independently loaded and unloaded.

Welcome to 9.99.18 !
2019-11-20 19:37:51 +00:00
chs
d47bcd296c in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
2019-11-10 21:16:21 +00:00
christos
511f85a37d Rewrite the floppy selection logic, and fix an always false condition. 2019-10-28 21:11:23 +00:00
maya
631bfe425c Avoid duplicate PRIxBUSADDR and follow the likely intention, providing PRIxBSH. 2019-09-24 14:26:32 +00:00
skrll
bf158e33f8 Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
2019-09-23 16:17:54 +00:00
kamil
a8778fd7dc Introduce PTRACE_REG_FP() a helper macro to retrieve the frame pointer
The macro is dummy for ia64 (the FP register is unknown and can change
freely) and sparc/sparc64 (not stored in struct reg).
2019-06-18 21:18:11 +00:00
msaitoh
b4eb82f5ca Fix typo in comment(s/similiar/similar/). 2019-06-03 05:59:01 +00:00
msaitoh
fdd9a79fe9 Add il(4). Commented out. 2019-05-24 08:30:26 +00:00
isaki
e622eac459 Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly.  Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism.  The encoding/channels/frequency
  conversions are completely handled in the upper layer.  So the hard-
  ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
  - Obsoletes query_encoding and add query_format instead.
  - Obsoletes set_params and add set_format instead.
  - Remove drain, setfd, mappage.
  - The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c         -> dev/audio/audio.c (rewritten)
- dev/audiovar.h      -> dev/audio/audiovar.h
- dev/audio_dai.h     -> dev/audio/audio_dai.h
- dev/audio_if.h      -> dev/audio/audio_if.h
- dev/audiobell.c     -> dev/audio/audiobell.c
- dev/audiobellvar.h  -> dev/audio/audiobellvar.h
- dev/mulaw.[ch]      -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
2019-05-08 13:40:13 +00:00
kamil
bca8c3ffc4 Switch all users (except ia64) of custom machine/ansi.h to common_ansi.h
Deduplicate the code among ports and poll definitions of types
directly from a compiler.

This fixes miscompilation of certain programs that instruct compilers
to generate code for different types. This bug has been detected with
-fshort-wchar in EFI firmware.

Proposed and discussed on a mailing list (twice).

Itanium uses custom !ELF fallback switch, temporarily leave it as it is.
2019-05-07 03:49:25 +00:00
sevan
702a353ffb Use veriexec.config to reduce duplication 2019-04-26 22:46:03 +00:00
sevan
75d6e670be Enable BUFQ_PRIOCSCAN, CARP, Veriexec by default in GENERIC kernel configs.
On ports without a GENERIC kernel config enable in individul files, e.g evbmips.
Omit on:
atari, dreamcast, emips, epoc32, evbppc/VIRTEX*, ia64, luna68x, mvme68k,
mvmeppc, playstation2, riscv, sun2, sun3, x68k, zaurus due to resource
constraints or port infancy.
2019-04-26 21:40:28 +00:00
isaki
47655f2d42 Add drvctl to kernel which has audio device.
audiocfg(1) requires drvctl(4).
2019-04-13 08:22:58 +00:00
isaki
b8a46fec78 White space -> TAB, fix indent, and add RCS Id.
No functional changes intended.
2019-04-08 14:48:33 +00:00
kamil
a85c0c1388 Centralized shared part of child_return() into MI part
Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.
2019-04-06 11:54:19 +00:00
thorpej
91bfaeb675 Overhaul the API used to fetch and store individual memory cells in
userspace.  The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms.  The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
2019-04-06 03:06:23 +00:00
christos
021d832a13 centralize setdisklabel(9) 2019-04-03 22:10:49 +00:00
kamil
857b4b62b8 Rework the fork(2)/vfork(2) event signalling under ptrace(2)
Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.
2019-04-03 08:07:59 +00:00
isaki
6291b1348d Use C99 style struct initializer to audio_hw_if. 2019-03-16 12:09:56 +00:00
thorpej
3a6fe30ac0 Use copyin(), not fusword(). 2019-03-14 23:49:38 +00:00
rin
56d037034f Add ure(4) to kernel config files. Also add PHY drivers where necessary. 2019-02-06 11:58:30 +00:00
dholland
810a783361 Systematize handling of removed drivers.
- Every driver that was removed and whose number hasn't already been
   reused is now listed with a commented-out "obsolete" line.
 - The format of these has been systematized. Future format changes can
   probably be safely done with a script.
 - This does not include a few cases of assignments that only lasted a
   couple days, or stuff from before major reorgs. Some of these may
   be included nonetheless, because there was a lot of ground to cover
   and therefore not a lot of time to dig into history in detail.

Note that the obsolete listings do not mean the major numbers can
never be reused; that's up to portmasters and/or core. It does mean
that they won't be reused by accident, however, which in some cases
(depending on the driver, how widely used it was, its family of device
nodes, their default permissions, etc.) can be quite dangerous.

Note that some of the things now explicitly listed as obsolete are
really ancient history. My scan went back as far as when the majors
files were added. (But not before that.)
2019-01-28 02:28:56 +00:00
dholland
480020cd90 Fix wrong scoping of {U,}LLONG_MAX. More cases, not just amd64.
PR 53298 from Roberto E. Vargas Caballero.
2019-01-21 20:28:17 +00:00
jdolecek
072aa173aa move DEV_BSIZE, DEV_BSHIFT out of MD param.h, they are same on all ports
also move BLKDEV_IOSIZE, MAXPHYS, but allow override since some ports
have different value (powerpc uses NBPG for BLKDEV_IOSIZE, sun2/sun3
have lower MAXPHYS)
2019-01-07 22:00:30 +00:00
maxv
08fa964521 Retire compat_ibcs2, as discussed on tech-kern@. FreeBSD did the same
recently.
2018-12-29 11:30:11 +00:00
maxv
33c450cc7a Disable compat_ibcs2, it is being retired. 2018-12-29 09:48:54 +00:00
maxv
d8ce26fe5b Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
2018-11-27 14:09:53 +00:00
rin
e9ac1fc994 - Determine KERN_AS automatically depending on whether OPT_MODULAR is
set or not, in the same way as libcompat.

- Specify OPT_MODULAR in the port Makefile instead of KERN_AS.

Now, KERN_AS=library is used for kernels without module(7) for all ports.

OK christos
2018-09-22 12:24:01 +00:00
riastradh
d1579b2d70 Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)
2018-09-03 16:29:22 +00:00
msaitoh
61e1eb0d0b - Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
  - Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
  use them on all m68k machines.
2018-08-22 01:05:21 +00:00
maxv
f71d13bdf7 Unreference IPF/PF from all the config files, and enable NPF instead when
wanted. This also fixes some inconsistencies I saw in several files (eg
IPF options while IPF was not compiled, IPF+PF enabled by default, etc).
2018-08-01 20:04:09 +00:00
maxv
62c8988166 Remove the kernel PMC code. Sent yesterday on tech-kern@.
This change:

 * Removes "options PERFCTRS", the associated includes, and the associated
   ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
   good.

 * Removes the PMC code of ARM XSCALE.

 * Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

 * Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
   definitions are put in sysarch.h.

 * Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
   and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
   netbsd32 and rump.

 * Removes the pmc_evid_t and pmc_ctr_t types.

 * Removes all the associated man pages. The sets are marked as obsolete.
2018-07-12 10:46:40 +00:00
maya
a50c06709e Remove duplicate ; 2018-06-06 01:49:07 +00:00
ragge
46b98f9cd0 Enable ffsv2 in boot. 2018-05-01 07:03:47 +00:00
ragge
e2e66973ed Kernel linker support for vax. Now modules can be loaded again.
XXX - should keep modules on physical segment instead of in KVM.
2018-04-30 06:46:12 +00:00
ragge
7fbf6189d2 Fix bug causing small constants not to be printed out. 2018-04-29 19:01:15 +00:00
maxv
f8f3c934e0 M_CLUSTER -> M_EXT_CLUSTER 2018-04-27 07:53:07 +00:00
ragge
31c431270b Remove the old unneccessary cksum files. 2018-04-27 06:36:32 +00:00
ragge
1cb48e477a Enable CPU_IN_CKSUM. 2018-04-25 11:12:55 +00:00
ragge
09fcb8c02e Add cpu_in_cksum.S. 2018-04-25 11:08:21 +00:00
ragge
6c80cbc78d VAX version of cpu_in_checksum(). Increases network performance significantly. 2018-04-25 11:06:49 +00:00