diff options
author | Paul Irofti <pirofti@cvs.openbsd.org> | 2020-07-06 13:33:10 +0000 |
---|---|---|
committer | Paul Irofti <pirofti@cvs.openbsd.org> | 2020-07-06 13:33:10 +0000 |
commit | b7e506b86a1d9691ff26019343ff523bfd30b393 (patch) | |
tree | 8a57536b8a2a17951281291a4bd58752705f500f /sys/arch/i386/pci | |
parent | cce3edda7285834fa934f9d3e3316d3da5a4f28a (diff) |
Add support for timeconting in userland.
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@
Diffstat (limited to 'sys/arch/i386/pci')
-rw-r--r-- | sys/arch/i386/pci/geodesc.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/pci/gscpm.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/pci/ichpcib.c | 6 |
3 files changed, 12 insertions, 6 deletions
diff --git a/sys/arch/i386/pci/geodesc.c b/sys/arch/i386/pci/geodesc.c index 9d9f061eef9..3e804e05a93 100644 --- a/sys/arch/i386/pci/geodesc.c +++ b/sys/arch/i386/pci/geodesc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: geodesc.c,v 1.14 2020/01/05 01:07:58 jsg Exp $ */ +/* $OpenBSD: geodesc.c,v 1.15 2020/07/06 13:33:07 pirofti Exp $ */ /* * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> @@ -65,7 +65,9 @@ struct timecounter geodesc_timecounter = { 0xffffffff, /* counter_mask */ 27000000, /* frequency */ "GEOTSC", /* name */ - 2000 /* quality */ + 2000, /* quality */ + NULL, /* private bits */ + 0 /* expose to user */ }; int diff --git a/sys/arch/i386/pci/gscpm.c b/sys/arch/i386/pci/gscpm.c index 8b8aa4ac430..84c67c64764 100644 --- a/sys/arch/i386/pci/gscpm.c +++ b/sys/arch/i386/pci/gscpm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gscpm.c,v 1.9 2012/08/16 18:42:04 tedu Exp $ */ +/* $OpenBSD: gscpm.c,v 1.10 2020/07/06 13:33:07 pirofti Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> * @@ -55,7 +55,9 @@ struct timecounter gscpm_timecounter = { 0xffffff, /* counter_mask */ 3579545, /* frequency */ "GSCPM", /* name */ - 1000 /* quality */ + 1000, /* quality */ + NULL, /* private bits */ + 0 /* expose to user */ }; struct cfattach gscpm_ca = { diff --git a/sys/arch/i386/pci/ichpcib.c b/sys/arch/i386/pci/ichpcib.c index 6abf1627de2..3ece43ecc56 100644 --- a/sys/arch/i386/pci/ichpcib.c +++ b/sys/arch/i386/pci/ichpcib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ichpcib.c,v 1.28 2014/09/14 14:17:23 jsg Exp $ */ +/* $OpenBSD: ichpcib.c,v 1.29 2020/07/06 13:33:07 pirofti Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> * @@ -63,7 +63,9 @@ struct timecounter ichpcib_timecounter = { 0xffffff, /* counter_mask */ 3579545, /* frequency */ "ICHPM", /* name */ - 1000 /* quality */ + 1000, /* quality */ + NULL, /* private bits */ + 0 /* expose to user */ }; struct cfattach ichpcib_ca = { |