summaryrefslogtreecommitdiffstats
path: root/sys/arch/powerpc/include
AgeCommit message (Collapse)AuthorFilesLines
2021-03-11spellingjsg1-3/+3
2020-11-28Add retguard to macppc kernel locore.S, ofwreal.S, setjmp.Sgkoehler1-11/+20
This changes RETGUARD_SETUP(ffs) to RETGUARD_SETUP(ffs, %r11, %r12) and RETGUARD_CHECK(ffs) to RETGUARD_CHECK(ffs, %r11, %r12) to show that r11 and r12 are in use between setup and check, and to pick registers other than r11 and r12 in some kernel functions. ok mortimer@ deraadt@
2020-10-26Retguard asm macros for powerpc libc, ld.sogkoehler1-1/+42
Add retguard to some, but not all, asm functions in libc. Edit SYS.h in libc to remove the PREFIX macros and add SYSENTRY (more like aarch64 and powerpc64), so we can insert RETGUARD_SETUP after SYSENTRY. Some .S files in this commit don't get retguard, but do stop using the old prefix macros. Tested by deraadt@, who put this diff in a macppc snap.
2020-07-09do not need this one eitherderaadt1-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-51/+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-06-05Implement cpu_rnd_messybits() as a read of the cycle counter register.naddy1-2/+10
ok dlg@, powerpc/sparc64 ok kettenis@, sparc64/alpha tested by deraadt@
2020-05-31introduce "cpu_rnd_messybits" for use instead of nanotime in dev/rnd.c.dlg1-1/+3
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@
2020-04-15Switch powerpc to MI mplock implementation.mpi1-9/+11
Reduce differences with others architectures and make it possible to use WITNESS on it. Rename & keep the current recursive lock implementation as it is used by the pmap. Tested by Peter J. Philipp, otto@ and cwen@. ok kettenis@
2020-03-17Fix inline assembly in ppc_mftb(); using %L0 instead of %0+1 makes this workkettenis1-2/+2
for both gcc and clang. From NetBSD. Thanks to some serious detective work by ghoehler@. ok deraadt@, gkeohler@
2019-07-11Use "i" constrain instead of "n" constrain in inline assembly. Makes clangkettenis1-3/+3
happy. ok visa@, mpi@
2019-07-02Drop % from register name used for register variable since it makes clangkettenis1-2/+2
unhappy. ok deraadt@, visa@
2019-03-23Use the debugger mutex for `ddb_mp_mutex'. This should prevent a racevisa1-3/+1
that could leave `ddb_mp_mutex' locked if one CPU incremented `db_active' while another CPU was in the critical section. When the race hit, the debugger was unable to resume execution or switch between CPUs. Race analyzed by patrick@ OK mpi@ patrick@
2019-03-23Add intr_{disable,restore}() for powerpc.visa1-1/+13
OK mpi@ patrick@
2018-12-05Include srp.h where struct cpu_info uses srp to avoid erroring out whenjsg1-1/+2
including cpu.h machine/intr.h etc without first including param.h when MULTIPROCESSOR is defined. ok visa@
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-08-20Remove unused spllock().visa1-2/+1
OK deraadt@ mpi@
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-01-25Move common mutex implementations to a MI place.mpi1-84/+2
Archs not yet converted can to the jump by defining __USE_MI_MUTEX. ok visa@
2018-01-22Include <sys/mutex.h> rather than <machine/mutex.h>mpi1-2/+2
Required by upcoming MI mutex change.
2018-01-13Define and use IPL_MPFLOOR in our common mutex implementation.mpi2-3/+4
ok kettenis@, visa@
2018-01-12Unify <machine/mutex.h> a bit further.mpi1-7/+8
`mtx_owner' becomes the first field of 'struct mutex' on i386/amd64/arm64. ok visa@
2017-12-04Change __mp_lock_held() to work with an arbitrary CPU info structure andmpi1-2/+2
extend ddb(4) "ps /o" output to print which CPU is currently holding the KERNEL_LOCK(). Tested by dhill@, ok visa@
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-07-25Remove leftovers of a past softintr mechanism.visa1-5/+1
OK mpi@, kettenis@
2017-06-29kill RCSID macros; discussed with millertderaadt1-5/+1
2017-06-23Unbreak profiling assembly functions in userland by defining thempi1-2/+2
correct prologue if compiled with -DPROF. ok deraadt@
2017-05-29Kill SPINLOCK_SPIN_HOOK, use CPU_BUSY_CYCLE() instead.mpi1-3/+1
ok visa@, kettenis@
2017-05-12Make atomic.h ready to be included in userland.mpi1-3/+4
- keep setbits/clearbits inside _KERNEL ok dlg@, kettenis@
2017-04-20Hook up mutex(9) to witness(4).visa1-3/+15
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-4/+2
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-04Telling gcc the TCB pointer is in %r2 via the 'register asm' extensionguenther1-35/+2
tests out on powerpc and generates slightly better code
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-10SROP mitigation. sendsig() stores a (per-process ^ &sigcontext) cookiederaadt1-2/+2
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-05-07Flush page (through the direct map) before mapping it into AGP. Fixeskettenis1-1/+17
artifacts seen in X on some G5 machines. Unfortunately not enough to fix G4 machines. With help from Marcus Glocker. ok mpi@
2016-05-07Use a Thread Information Block in both single and multi-threaded programs.guenther1-1/+4
This stores errno, the cancelation flags, and related bits for each thread and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable! Make libpthread dlopen'able by moving the cancelation wrappers into libc and doing locking and fork/errno handling via callbacks that libpthread registers when it first initializes. 'errno' *must* be declared via <errno.h> now! Clean up libpthread's symbol exports like libc. On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec. Testing by various, particularly sthen@ and patrick@ ok kettenis@
2016-04-27G/C DDB_REGS.mpi1-2/+1
2016-03-05One ddb interface is enough for ppc.mpi1-1/+6
2016-03-05Define db_reg_t like the other archs by typedef'ing "struct trapframe".mpi1-9/+6
This will allow us to use some of the DDB macros on trapframe which are not DDB_REGS.
2015-11-24The only network driver needing <net/if_types.h> is upl(4) for IFT_OTHER.mpi1-2/+1
2015-10-08Add a per-page flag to indicate that all mappings of that page should bekettenis1-4/+5
uncached. To be used in the drm code. ok mpi@
2015-09-26lint is dead and C99 may be old enough to drive a car: delete LONGLONGguenther1-3/+1
comments ok millert@
2015-09-13intr_barrier(9) for macppc and socppc.kettenis1-2/+3
2015-09-11Make the powerpc pmap (more) mpsafe by protecting both the pmap itself and thekettenis1-1/+5
pv lists with a mutex. This should make pmap_enter(9), pmap_remove(9) and pmap_page_protect(9) safe to use without holding the kernel lock. ok visa@, mpi@, deraadt@
2015-08-30Provide remaining arch with END() macro for setting calculated size onguenther1-1/+2
symbols in ASM ok deraadt@ mpi@
2015-08-29_NLIST_DO_ELF is no longer needed: it's the only optionguenther1-4/+2
ok deraadt@
2015-08-23Add support for the Secure-PLT ABI variant. This will give us better W^Xkettenis1-2/+7
support on powerpc as it uses a non-executable GOT and PLT. "start slamming stuff in" deraadt@
2015-08-14replace the asm mutexes with a c implementation.dlg2-6/+8
there's no real functional advantage to this, except that it will make it easier to add deadlock detection to the code. this is modelled on the c mutex implementation thats on alpha, mips64, and hppa. ok mpi@ kettenis@