summaryrefslogtreecommitdiff
path: root/sys/arch/usermode
AgeCommit message (Collapse)Author
2023-04-03usermode/syscall.c: s/fall trough/FALLTHROUGH/ (KNF)gutteridge
2023-02-09Adjust _all_ cinclude of *.local filesabs
- Ensure always at end - Use tab rather than spaces - Add consistent comment "Pull in optional local configuration - always at end" The only functional change is that a local file which tried to override an existing setting (eg with "no foo") would have failed in some cases before, but now will work
2022-09-18Eliminate use of IFF_OACTIVE.thorpej
2022-05-28fix various typos in comments, mainly origional->original,andvar
extened->extended, incomming->incoming.
2022-05-28fix various typos, mainly in comments.andvar
2022-03-20fix typos in debug/panic messages: isued->issued, initialiased->initialised.andvar
2022-01-01fix typos in comments, mainly basicly -> basically.andvar
2021-08-07Merge thorpej-cfargs2.thorpej
2021-07-24Fix all remaining typos, mainly in comments but also in few definitions and ↵andvar
log messages, reported by me in PR kern/54889. Also fixed some additional typos in comments, found on review of same files or typos.
2021-06-16if_attach and if_initialize cannot fail, don't test return valueriastradh
These were originally made failable back in 2017 when if_initialize allocated a softint in every interface for link state changes, so that it could fail gracefully instead of panicking: https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html However, this spawned many seldom- or never-tested error branches, which are risky to have around. And that softint in every interface has since been replaced by a single global workqueue, because link state changes require thread context but not low latency or high throughput: https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html So there is no longer any reason for if_initialize to fail. (The subroutine if_stats_init can't fail because percpu_alloc can't fail either.) There is a snag: the softint_establish in if_percpuq_create could fail, potentially leading to bad consequences later on trying to use the softint. This change doesn't introduce any new bugs because of the snag -- if_percpuq_attach was already broken. However, the snag can be better addressed without spawning error branches, either by using a single softint or making softints less scarce. (Separate commit will change the signatures of if_attach and if_initialize to return void, scheduled to ride whatever is the next convenient kernel bump.) Patch and testing on amd64 and evbmips64-eb by maya@; commit message soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me.
2021-04-24Merge thorpej-cfargs branch:thorpej
Simplify and make extensible the config_search() / config_found() / config_attach() interfaces: rather than having different variants for which arguments you want pass along, just have a single call that takes a variadic list of tag-value arguments. Adjust all call sites: - Simplify wherever possible; don't pass along arguments that aren't actually needed. - Don't be explicit about what interface attribute is attaching if the device only has one. (More simplification.) - Add a config_probe() function to be used in indirect configuiration situations, making is visibly easier to see when indirect config is in play, and allowing for future change in semantics. (As of now, this is just a wrapper around config_match(), but that is an implementation detail.) Remove unnecessary or redundant interface attributes where they're not needed. There are currently 5 "cfargs" defined: - CFARG_SUBMATCH (submatch function for direct config) - CFARG_SEARCH (search function for indirect config) - CFARG_IATTR (interface attribte) - CFARG_LOCATORS (locators array) - CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles) ...and a sentinel value CFARG_EOL. Add some extra sanity checking to ensure that interface attributes aren't ambiguous. Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark ports to associate those device handles with device_t instance. This will trickle trough to more places over time (need back-end for pre-OFW Sun OBP; any others?).
2021-04-01Whitespace: #define<tab>simonb
2021-01-20remove compat_ossaudio from kernel modulesnia
this is only useful with compat_linux and gets autoloaded when compat_linux is loaded, so there's no reason to bake it into kernels any more.
2020-10-21make process_machdep.c included always since it provides register i/o used bychristos
sys_process_getlwpstatus.c which is always included.
2020-10-20harmonize process_machdep.c inclusion.christos
2020-06-30Make copystr() a MI C function, part of libkern and shared on allmaxv
architectures. Notes: - On alpha and ia64 the function is kept but gets renamed locally to avoid symbol collision. This is because on these two arches, I am not sure whether the ASM callers do not rely on fixed registers, so I prefer to keep the ASM body for now. - On Vax, only the symbol is removed, because the body is used from other functions. - On RISC-V, this change fixes a bug: copystr() was just a wrapper around strlcpy(), but strlcpy() makes the operation less safe (strlen on the source beyond its size). - The kASan, kCSan and kMSan wrappers are removed, because now that copystr() is in C, the compiler transformations are applied to it, without the need for manual wrappers. Could test on amd64 only, but should be fine.
2020-05-29For struct timecounter, use C99 initializers.rin
Compile tested. No functional changes intended.
2020-03-14pmap_remove_all(): Return a boolean value to indicate the behaviour. Ifad
true, all mappings have been removed, the pmap is totally cleared out, and UVM can then avoid doing the work to call pmap_remove() for each map entry. If false, either nothing has been done, or some helpful arch-specific voodoo has taken place.
2020-02-05Adopt <net/if_stat.h>skrll
2019-12-03Use __insn_barrier to enforce ordering in l_ncsw loops.riastradh
(Only need ordering observable by interruption, not by other CPUs.)
2019-12-01Fix false sharing problems with cpu_info. Identified with tprof(8).ad
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-01Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:ad
Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not preempted while using the value of curcpu(). Instead, observe the value of l_ncsw before and after the check to see if we have been preempted. If we have been preempted, then we need to retry the read.
2019-11-29Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE.riastradh
2019-11-29Largely eliminate the MD rwlock.h header file.riastradh
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-29PR port-sparc/54718 (sparc install hangs since recent scheduler changes)ad
- userret() must be called every time we return to user, it's not optional. - If clearing the AST with interrupts off, you must loop over userret().
2019-11-23cpu_need_resched():ad
- 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-21mi_userret(): take care of calling preempt(), set spc_curpriority directly,ad
and remove MD code that does the same.
2019-11-13Switch to the new PTE naming.maxv
2019-09-23Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all archesskrll
to follow arm and (generic) mips. Reviewed by christos.
2019-05-29Even if we don't use MII(4), use the common path of SIOC[GS]IFMEDIA inmsaitoh
sys/net/if_ethersubr.c if we can. - Add ec_ifmedia into struct ethercom. - ec_mii in struct ethercom is kept and used as it is. It might be used in future. Note that some Ethernet drivers which _DOESN'T_ use mii(4) use ec_mii for keeping the if_media. Those should be changed in future.
2019-05-29 KNF. No functional change.msaitoh
2019-05-08Merge isaki-audio2 branch, the overhaul of audio subsystem.isaki
- 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-07Switch all users (except ia64) of custom machine/ansi.h to common_ansi.hkamil
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-04-10Make the usermode kernel compile again.thorpej
2019-04-10 Add missing semicolon.msaitoh
2019-04-06Centralized shared part of child_return() into MI partkamil
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-06Overhaul the API used to fetch and store individual memory cells inthorpej
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-03-09Start replacing the x86 PTE bits.maxv
2019-02-17Set WARN=3 for sing-compare.rin
2018-11-27Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfomaxv
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-09-22- Determine KERN_AS automatically depending on whether OPT_MODULAR isrin
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-16interrupt has two 'r'sskrll
fix another typo while I'm here (flsah)
2018-09-03Rename min/max -> uimin/uimax for better honesty.riastradh
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-08-17Start using the kernel ld script.reinoud
There are still issues with the .init placement and ./build.sh creating bad images.
2018-08-05Advise to explicitly set flags +agm instead of only clearing them when setreinoud
2018-08-05Add KGDB definitions for i386reinoud
2018-08-05To avoid possible collisions between the NetBSD/userland kernel and possiblereinoud
host kernel memory allocation schemes, allocate two dedicated pages for page copying and page zeroing.
2018-08-03Allow for setting kernel breakpoints in our remote kgdbreinoud
2018-08-03Fix physical memory size issue. It will now happily run on more than one gb.reinoud
2018-08-01Revert to working statereinoud