summaryrefslogtreecommitdiffstats
path: root/sys/arch/sh (follow)
Commit message (Collapse)AuthorAgeFilesLines
* spellingjsg2021-03-112-9/+9
|
* remove some unused includesjsg2021-02-231-163/+0
|
* Remove useless redundant call of ttyopen().jan2021-01-011-5/+1
| | | | | | Also remove dead DIALOUT macro. ok mpi@
* In case of failure, call sigexit() from trapsignal instead of sensig().mpi2020-11-081-10/+6
| | | | | | | Simplify MD code and reduce the amount of recursion into the signal code which helps when dealing with locks. ok cheloha@, deraadt@
* The condition around uvm_grow() can be simplified, as the error resultderaadt2020-10-211-7/+3
| | | | | adjustment is effectively a dead store ok kettenis
* uvm_grow() now does the vm_maxsaddr check (before locking), so callers don'tderaadt2020-10-211-3/+2
| | | | | need to do it ok kettenis
* alpha, loongson, sh, sparc64: recompute tick, tick_nsec when hz(9) is resetcheloha2020-10-201-1/+2
| | | | | | | | | | | | | | Normally we set hz(9) at compile-time in sys/conf/param.c to the value of HZ. HZ is one of the fundamental compilation options(4). However, sometimes we need to reset hz(9) at runtime. Whenever we reset hz(9) we need to recompute tick and tick_nsec. Otherwise a variety of "time stuff" in the kernel will not work correctly. For example, most timeouts will expire "too slow" or "too fast". There are a bunch of other places we use tick and tick_nsec that will exhibit similar problems. Test-compiled by deraadt@.
* use access_type as the PROT_* variable for uvm_fault() consistantlyderaadt2020-10-081-7/+7
| | | | ok kettenis
* Include <sys/systm.h> directly instead of relying on hidden UVM includes.mpi2020-10-071-1/+2
| | | | The header is being pulled via uvm_extern.h -> uvm_map.h
* landisk has legacy global variable want_resched, rather than post-MPderaadt2020-09-251-10/+5
| | | | ci->ci_want_resched. convert to the modern style.
* landisk has legacy global variable want_resched, rather than post-MPderaadt2020-09-253-5/+15
| | | | ci->ci_want_resched. convert to the modern style.
* Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults.deraadt2020-09-241-10/+9
| | | | | | | | This should be sufficient for identifying pivoted ROP. Doing so for other traps is at best opportunistic for finding a straight-running ROP chain, but the added (and rare) sleeping point has proven to be dangerous. Discussed at length with kettenis and mortimer. ok mortimer kettenis mpi
* On sh architecture, general_exception() handles regular traps as well asderaadt2020-09-221-5/+7
| | | | | syscalls. The MI syscall code will perform uvm_map_inentry() against PROC_STACK. So avoid doing it twice.
* Ensure the SH_(TRA)) register is read before a potential sleep in trap()deraadt2020-09-141-4/+2
| | | | for same reasons as as recent bug diagnosed in amd64, i386, hppa, powerpc64...
* another excess filederaadt2020-07-091-23/+0
|
* Add support for timeconting in userland.pirofti2020-07-061-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
* Remove obsolete <machine/stdarg.h> header. Nowadays the varargvisa2020-06-301-56/+0
| | | | | | | | functionality is provided by <sys/stdarg.h> using compiler builtins. Tested in a ports bulk build on amd64 by naddy@ OK naddy@ mpi@
* introduce "cpu_rnd_messybits" for use instead of nanotime in dev/rnd.c.dlg2020-05-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | rnd.c uses nanotime to get access to some bits that change quickly between events that it can mix into the entropy pool. it doesn't use nanotime to get a monotonically increasing set or ordered and accurate timestamps, it just wants something with bits that change. there's been discussions for years about letting rnd use a clock that's super fast to read, but not necessarily accurate, but it wasn't until recently that i figured out it wasn't interested in time at all, so things like keeping a fast clock coherent between cpu cores or correct according to ntp is unecessary. this means we can just let rnd read the cycle counters on cpus and things will be fine. cpus with cycle counters that vary in their speed and arent kept consistent between cores may even be desirable in this context. so this is the first step in converting rnd.c to reading cycle counter. it copies the nanotime backend to each arch, and they can replace it with something MD as a second step later on. djm@ suggested rnd_messybytes, but we landed on cpu_rnd_messybits. thanks to visa for his eyes. ok deraadt@ visa@ deraadt@ says he will help handle any MD fallout that occurs.
* Retire <machine/varargs.h>.visa2020-05-271-57/+0
| | | | | | Nothing uses the header anymore. OK deraadt@ mpi@
* Make inittodr() and resettodr() MI.kettenis2020-05-161-94/+1
| | | | | ok deraadt@, mpi@, visa@ ok cheloha@ as well (would have preferred in new file for this code)
* Use the same inittodr()/resettodr() implementation as onkettenis2020-05-112-68/+122
| | | | | | | | amd64/arm64/armv7/hppa/i386/macppc/mips64/sparc64 and move it to the end of sh_machdep.c. Wrap the existing sh_clock.rtc hooks into something that can be used as a todr_handle. ok mpi@
* db_addr_t -> vaddr_tmpi2019-11-074-125/+125
|
* Substitute boolean_t/TRUE/FALSE by int/1/0.mpi2019-11-074-16/+16
|
* If uvm_map_inentry returns false then a signal has been delivered, andderaadt2019-09-061-2/+2
| | | | | | userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
* I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, andderaadt2019-07-091-2/+3
| | | | | | | | then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
* print the cpu model in the correct place (only)deraadt2019-07-072-6/+7
|
* landisk/sh didn't have the code for checking if sp is on MAP_STACKderaadt2019-06-281-1/+4
| | | | | memory, so let's add that where it seems to work gap noticed by miod
* Remove unused scheduler related definitions.mpi2019-06-111-3/+1
| | | | ok visa@
* Add movstrSI12_i4 for linking -Os/-Oz kernels. Sadly however itderaadt2019-04-251-2/+2
| | | | fails and locks early in boot.
* Add intr_{disable,restore}() for sh.visa2019-03-241-1/+13
| | | | Reminded by deraadt@
* sprinle some casts to quiet compiler; ok millertderaadt2019-02-171-3/+3
|
* Add END() macro to set symbol size like every other archguenther2018-11-111-1/+3
| | | | ok deraadt@
* Provide an MD 64-bit byteswapping function build on 32-bit swapsnaddy2018-10-051-2/+11
| | | | | | | | | | | | | as we do on arm and i386. Copied from arm. If there are no MD byteswapping functions, MI macros are used. These are wrapped by static inline functions to prevent multiple evaluation of their argument. If there are MD functions, they are used directly and therefore we must implicitly guarantee that they are safe from multiple evaluation. Defining an MD function to an MI macro breaks this promise. ok deraadt@
* Unify the MD byteswapping code as much as possible across architectures.naddy2018-10-021-21/+26
| | | | | | | Use inline functions instead of GNU C statement expressions, and make them available to userland. With clues from guenther@. ok guenther@ kettenis@
* Unify and bump some of the NMBCLUSTERS defines. Some archs had it set toclaudio2018-09-141-2/+2
| | | | | | | | | 4MB which is far too low especially when the platform is able to run MP. New limits are, amd64 = 256M; arm64, mips64, sparc64 = 64M; alpha, arm, hppa, i386, powerpc = 32M; m88k, sh = 8M Still rather conservative numbers but much better than before. At least some hangs of arm64 build boxes was caused by this. OK kettenis@, visa@
* Move from sendsig() to its callers the initsiginfo() calls andguenther2018-07-101-4/+3
| | | | | | | | instead of passing sendsig() the code+type+val, pass a siginfo_t* to copy from. Eliminate the indirection through struct emul for sendsig(); we no longer have a SunOS4-compat version of sendsig() ok deraadt@
* Implement MAP_STACK option for mmap(). Synchronous faults (pagefault andderaadt2018-04-121-3/+3
| | | | | | | | | | | | | | syscall) confirm the stack register points at MAP_STACK memory, otherwise SIGSEGV is delivered. sigaltstack() and pthread_attr_setstack() are modified to create a MAP_STACK sub-region which satisfies alignment requirements. Observe that MAP_STACK can only be set/cleared by mmap(), which zeroes the contents of the region -- there is no mprotect() equivalent operation, so there is no MAP_STACK-adding gadget. This opportunistic software-emulation of a stack protection bit makes stack-pivot operations during ROPchain fragile (kind of like removing a tool from the toolbox). original discussion with tedu, uvm work by stefan, testing by mortimer ok kettenis
* Do not panic from ddb(4) when a lock requirement isn't fulfilled.mpi2018-03-201-3/+1
| | | | | | | | | | | Extend the logic already present for panic() to any DDB-related operation such that if ddb(4) is entered because of a fault or other trap it is still possible to call 'boot reboot'. While here stop printing splassert() messages as well, to not fill the buffer. ok visa@, deraadt@
* #define _MAX_PAGE_SHIFT in MD _types.h as the maximum pagesize an archderaadt2018-03-051-1/+2
| | | | | | | | | | needs (looking at you sgi, but others required this before). This is for the circumstances we need pagesize known at compile time, not getpagesize() runtime. Use it for malloc storage sizes, for shm, and to set pthread stack default sizes. The stack sizes were a mess, and pushing them towards page-aligned is healthy move (which will also be needed by the coming stack register checker) ok guenther kettenis, discussion with stefan
* Remove almost unused `flags' argument of suser().mpi2018-02-192-5/+5
| | | | | | | The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
* Move landisk to MI mutex.mpi2018-02-113-150/+3
| | | | ok dlg@
* Delete unnecessary <sys/file.h> includesguenther2017-12-301-2/+1
| | | | ok millert@ krw@
* fcntl(F_SETFL) invokes the FIONBIO and FIOASYNC ioctls internally, soguenther2017-12-141-1/+9
| | | | | | | the memory devices (/dev/null, /dev/zero, etc) need to permit them. problem noted, tweak, and testing by jeremy@ ok deraadt@
* use %lx to print the frame address if resolving of the symbol name failsjasper2017-11-031-2/+6
| | | | as discussed with and ok mpi@
* Move mutex, condvar, and thread-specific data routes, pthread_once, andguenther2017-09-051-5/+1
| | | | | | | | pthread_exit from libpthread to libc, along with low-level bits to support them. Major bump to both libc and libpthread. Requested by libressl team. Ports testing by naddy@ ok kettenis@
* Fix typo in comments: s/return/returns/ in "a function that never return."tom2017-08-171-2/+2
|
* kill RCSID macros; discussed with millertderaadt2017-06-291-4/+1
|
* Unbreak profiling assembly functions in userland by defining thempi2017-06-231-2/+2
| | | | | | correct prologue if compiled with -DPROF. ok deraadt@
* Fix the remaining ';;'s in sys/tom2017-06-221-2/+2
|
* Kill db_sym_t.mpi2017-05-302-4/+4
| | | | ok deraadt@, kettenis@, jasper@