summaryrefslogtreecommitdiffstats
path: root/sys/arch/sh/include
AgeCommit message (Collapse)AuthorFilesLines
2021-02-23remove some unused includesjsg1-163/+0
2020-09-25landisk has legacy global variable want_resched, rather than post-MPderaadt1-10/+5
ci->ci_want_resched. convert to the modern style.
2020-07-09another excess filederaadt1-23/+0
2020-07-06Add support for timeconting in userland.pirofti1-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@
2020-06-30Remove obsolete <machine/stdarg.h> header. Nowadays the varargvisa1-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@
2020-05-31introduce "cpu_rnd_messybits" for use instead of nanotime in dev/rnd.c.dlg1-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.
2020-05-27Retire <machine/varargs.h>.visa1-57/+0
Nothing uses the header anymore. OK deraadt@ mpi@
2019-11-07db_addr_t -> vaddr_tmpi1-2/+2
2019-11-07Substitute boolean_t/TRUE/FALSE by int/1/0.mpi1-4/+4
2019-03-24Add intr_{disable,restore}() for sh.visa1-1/+13
Reminded by deraadt@
2019-02-17sprinle some casts to quiet compiler; ok millertderaadt1-3/+3
2018-11-11Add END() macro to set symbol size like every other archguenther1-1/+3
ok deraadt@
2018-10-05Provide an MD 64-bit byteswapping function build on 32-bit swapsnaddy1-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@
2018-10-02Unify the MD byteswapping code as much as possible across architectures.naddy1-20/+25
Use inline functions instead of GNU C statement expressions, and make them available to userland. With clues from guenther@. ok guenther@ kettenis@
2018-09-14Unify and bump some of the NMBCLUSTERS defines. Some archs had it set toclaudio1-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@
2018-03-05#define _MAX_PAGE_SHIFT in MD _types.h as the maximum pagesize an archderaadt1-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
2018-02-11Move landisk to MI mutex.mpi1-61/+2
ok dlg@
2017-09-05Move mutex, condvar, and thread-specific data routes, pthread_once, andguenther1-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@
2017-06-29kill RCSID macros; discussed with millertderaadt1-4/+1
2017-06-23Unbreak profiling assembly functions in userland by defining thempi1-2/+2
correct prologue if compiled with -DPROF. ok deraadt@
2017-05-18Fix kernel build on armv7 and sh.visa1-2/+2
Pointed out by deraadt@
2017-04-20Hook up mutex(9) to witness(4).visa1-3/+4
2017-04-13Provide mips64 with kernel-facing TCB_{GET,SET} macros that store itguenther1-3/+1
in struct mdproc. With that, all archs have those and the __HAVE_MD_TCB macro can be unifdef'ed as always defined. ok kettenis@ visa@ jsing@
2017-02-08In exec_elf.c: expand ELFNAME(), ELFNAME2(), and ELFNAMEEND() exceptguenther1-3/+1
leaving out the size, so that ELFNAME2(exec,makecmds) becomes exec_elf_makecmds instead of exec_elf{32,64}_makecmds and then delete the ELFNAME2() and ELFNAMEEND() macros. Move the prototypes for functions local to exec_elf.c to there from exec_elf.h. Simplify the SMALL_KERNEL conditionals around the ELF coredump code. Change exec_conf.c to use the size-generic names and macros Remove exec_elf{32,64}.c and just build exec_elf.c; delete the _KERN_DO_ELF and _KERN_DO_ELF64 #defines. ok jca@, encouragement from deraadt@ and tom@
2016-09-03Increase the number of mbufs on most architectures. This is basedbluhm1-2/+2
on a guess how much memory a typical machine has. If the value is too high, users may run out of kernel memory. Then we will have to adjust this again. OK claudio@ deraadt@
2016-05-27Remove the non ELF macrosderaadt2-32/+3
ok millert
2016-05-18Save and restore 'gbr' register when enter/leaving the kernel, and useguenther4-5/+25
it for the TCB pointer. Eliminate __cerror. "looks good" kettenis@, testing and ok deraadt@
2016-05-10SROP mitigation. sendsig() stores a (per-process ^ &sigcontext) cookiederaadt1-3/+3
inside the sigcontext. sigreturn(2) checks syscall entry was from the exact PC addr in the (per-process ASLR) sigtramp, verifies the cookie, and clears it to prevent sigcontext reuse. not yet tested on landisk, sparc, *88k, socppc. ok kettenis
2016-04-27G/C DDB_REGS.mpi1-2/+1
2016-02-27Rename kdb_trap() into db_ktrap().mpi1-2/+2
The goal is to include it in the list of functions that must not be instrumented. All ddb(8) functions should be in this list and have their names start with 'db_'. ok visa@, deraadt@
2016-01-15intr_barrier for sh/landisk; tobiasu noticed the need as wellderaadt1-1/+3
2015-09-30Use #ifndef _MACHINE_DISKLABEL_H_ everywhere. Replace _ARM_DISKLABEL_H_krw1-4/+4
and _SH_DISKLABEL_H_ with _MACHINE_DISKLABEL_H_. Add the guard to loongson and octeon. The #defines are not used anywhere else in the tree so no functional change.
2015-09-30Use consistant whitespace/comments for #define'ing LABELSECTOR,krw1-4/+4
LABELOFFSET and MAXPARTITIONS. Easier on the eye when scanning through all these files. No functional change.
2015-09-26lint is dead and C99 may be old enough to drive a car: delete LONGLONGguenther1-3/+1
comments ok millert@
2015-08-29_NLIST_DO_ELF is no longer needed: it's the only optionguenther1-2/+1
ok deraadt@
2015-05-05emul_native is only used for kernel threads which can't dump core, soguenther1-4/+1
delete coredump_trad(), uvm_coredump(), cpu_coredump(), struct md_coredump, and various #includes that are superfluous. This leaves compat_linux processes without a coredump callback. If that ability is desired, someone should update it to use coredump_elf32() and verify the results... ok kettenis@
2015-04-30Remove SIZE_MAX from limits.h. It was added years ago before wemillert1-4/+1
had a proper stdint.h. No ports fallout. OK guenther@ miod@
2015-02-15Change pmap_remove_holes() to take a vmspace instead of a map as its argument.miod1-2/+2
Use this on vax to correctly pick the end of the stack area now that the stackgap adjustment code will no longer guarantee it is a fixed location.
2015-02-11no md code wants lockmgr locks, so no md code needs to include sys/lock.hdlg1-2/+1
with and ok miod@
2014-11-17split the int and long implementations to avoid compiler warnings.dlg1-13/+70
tested by and ok jsg@
2014-09-24jmatthew@ found another case of me getting the number of args wrongdlg1-2/+2
to an atomic_swap_ptr.
2014-09-24implement atomic_{cas,swap}_{uint,long,ptr) and atomic_{add,sub}_{int,long}dlg1-9/+122
fixes from and ok miod@
2014-07-12Tackle the endian.h mess. Make it so that:guenther1-4/+6
* you can #include <sys/endian.h> instead of <machine/endian.h>, and ditto <endian.h> (fixes code that pulls in <sys/endian.h> first) * those will always export the symbols that POSIX specified for <endian.h>, including the new {be,le}{16,32,64}toh() set. c.f. http://austingroupbugs.net/view.php?id=162 if __BSD_VISIBLE then you also get the symbols that our <machine/endian.h> currently exports (ntohs, NTOHS, dlg's bemtoh*, etc) * when doing POSIX compiles (not __BSD_VISIBLE), then <netinet/in.h> and <arpa/inet.h> will *stop* exporting the extra symbols like BYTE_ORDER and betoh* ok deraadt@
2014-07-11CPU_BUSY_CYCLE(): A new MI statement for busy loop power reductionuebayasi1-1/+3
The new CPU_BUSY_CYCLE() may be put in a busy loop body so that CPU can reduce power consumption, as Linux's cpu_relax() and FreeBSD's cpu_spinwait(). To start minimally, use PAUSE on i386/amd64 and empty on others. The name is chosen following the existing cpu_idle_*() functions. Naming and API may be polished later. OK kettenis@
2014-03-29It's been a quarter century: we can assume volatile is present with that name.guenther1-9/+9
ok dlg@ mpi@ deraadt@
2014-03-19It's safe to assumed 'signed' existsguenther1-2/+2
2014-03-16DDB supports ELF symbols are all archs, and it's always the same as theguenther1-8/+1
native size, so eliminate the #defines. ok miod@
2014-01-30Move declaration of struct vm_page_md from <machine/vmparam.h> tomiod2-20/+21
<machine/pmap.h> where it belongs, and compensate in <uvm/uvm_extern.h> by including <uvm/uvm_pmap.h> before <uvm/uvm_page.h>. Tested on all MACHINE_ARCH but amd64 and i386 (and hppa64).
2014-01-23unifdef -D__HAVE_VM_PAGE_MD - no functional change.miod1-2/+1
2013-12-18Provide MI symbol _STACKALIGNBYTESderaadt1-3/+4