diff options
-rw-r--r-- | debian/patches/clock_boottime0001-yyy-clock_boottime.patch | 190 | ||||
-rw-r--r-- | debian/patches/series | 1 |
2 files changed, 0 insertions, 191 deletions
diff --git a/debian/patches/clock_boottime0001-yyy-clock_boottime.patch b/debian/patches/clock_boottime0001-yyy-clock_boottime.patch deleted file mode 100644 index 5e4e3cf..0000000 --- a/debian/patches/clock_boottime0001-yyy-clock_boottime.patch +++ /dev/null @@ -1,190 +0,0 @@ -From 8f9c75cd7470e1c4ff93f0a60b4a32a207471209 Mon Sep 17 00:00:00 2001 -From: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Sat, 25 Jul 2015 18:23:10 +0200 -Subject: [PATCH gnumach] yyy clock_boottime - ---- - include/mach/time_value.h | 40 ++++++++++++++++++++++++++++++++-------- - kern/mach_clock.c | 36 +++++++++++++++++++++++++++++++++++- - kern/mach_clock.h | 11 ++++++++++- - kern/task.c | 3 ++- - kern/thread.c | 3 ++- - 5 files changed, 81 insertions(+), 12 deletions(-) - -diff --git a/include/mach/time_value.h b/include/mach/time_value.h -index 2a2f091..fdfd2dc 100644 ---- a/include/mach/time_value.h -+++ b/include/mach/time_value.h -@@ -45,22 +45,46 @@ typedef struct time_value time_value_t; - */ - #define TIME_MICROS_MAX (1000000) - -+#define time_value_assert(val) \ -+ assert(0 <= (val)->microseconds && (val)->microseconds < TIME_MICROS_MAX); -+ - #define time_value_add_usec(val, micros) { \ -+ time_value_assert(val); \ - if (((val)->microseconds += (micros)) \ - >= TIME_MICROS_MAX) { \ - (val)->microseconds -= TIME_MICROS_MAX; \ - (val)->seconds++; \ - } \ -+ time_value_assert(val); \ - } - --#define time_value_add(result, addend) { \ -- (result)->microseconds += (addend)->microseconds; \ -- (result)->seconds += (addend)->seconds; \ -- if ((result)->microseconds >= TIME_MICROS_MAX) { \ -- (result)->microseconds -= TIME_MICROS_MAX; \ -- (result)->seconds++; \ -- } \ --} -+/* XXX */ -+#define abs(x) ((x) < 0? -(x): (x)) -+ -+#define time_value_add_sub(val, signum, operand) { \ -+ time_value_assert(val); \ -+ time_value_assert(operand); \ -+ (val)->seconds += (signum) * abs((operand)->seconds); \ -+ (val)->microseconds += (signum) * (operand)->microseconds; \ -+ if ((val)->microseconds >= TIME_MICROS_MAX) { \ -+ (val)->microseconds -= TIME_MICROS_MAX; \ -+ (val)->seconds++; \ -+ } else \ -+ if ((val)->microseconds < 0) { \ -+ (val)->microseconds += TIME_MICROS_MAX; \ -+ (val)->seconds--; \ -+ } \ -+ time_value_assert(val); \ -+ } -+ -+/* XXX */ -+#define sgn(x) ((x) < 0? -1: ((x) > 0? 1: 0)) -+ -+#define time_value_add(result, addend) \ -+ time_value_add_sub(result, sgn((addend)->seconds), addend) -+ -+#define time_value_sub(result, subtrahend) \ -+ time_value_add_sub(result, -1 * sgn((subtrahend)->seconds), subtrahend) - - /* - * Time value available through the mapped-time interface. -diff --git a/kern/mach_clock.c b/kern/mach_clock.c -index b627b89..655adf4 100644 ---- a/kern/mach_clock.c -+++ b/kern/mach_clock.c -@@ -367,9 +367,30 @@ void init_timeout(void) - - elapsed_ticks = 0; - } -+ -+/* -+ * We record timestamps using the boot-time clock. We keep track of -+ * the boot-time clock by storing the difference to the real-time -+ * clock. -+ */ -+struct time_value clock_boottime_offset; -+ -+/* -+ * Update the offset of the boot-time clock from the real-time clock. -+ * This function must be called when the real-time clock is updated. -+ * This function must be called at SPLHIGH. -+ */ -+void -+clock_boottime_update(struct time_value *new_time) -+{ -+ struct time_value delta = time; -+ time_value_sub(&delta, new_time); -+ time_value_add(&clock_boottime_offset, &delta); -+} - - /* -- * Record a timestamp in STAMP. -+ * Record a timestamp in STAMP. Records values in the boot-time clock -+ * frame. - */ - void - record_time_stamp (time_value_t *stamp) -@@ -378,6 +399,18 @@ record_time_stamp (time_value_t *stamp) - stamp->seconds = mtime->seconds; - stamp->microseconds = mtime->microseconds; - } while (stamp->seconds != mtime->check_seconds); -+ time_value_add(stamp, &clock_boottime_offset); -+} -+ -+/* -+ * Read a timestamp in STAMP into RESULT. Returns values in the -+ * real-time clock frame. -+ */ -+void -+read_time_stamp (time_value_t *stamp, time_value_t *result) -+{ -+ *result = *stamp; -+ time_value_sub(result, &clock_boottime_offset); - } - - -@@ -423,6 +456,7 @@ host_set_time(host, new_time) - #endif /* NCPUS > 1 */ - - s = splhigh(); -+ clock_boottime_update(&new_time); - time = new_time; - update_mapped_time(&time); - resettodr(); -diff --git a/kern/mach_clock.h b/kern/mach_clock.h -index 89fd335..1af0cda 100644 ---- a/kern/mach_clock.h -+++ b/kern/mach_clock.h -@@ -86,9 +86,18 @@ extern boolean_t reset_timeout(timer_elt_t telt); - - extern void init_timeout (void); - --/* Read the current time into STAMP. */ -+/* -+ * Record a timestamp in STAMP. Records values in the boot-time clock -+ * frame. -+ */ - extern void record_time_stamp (time_value_t *stamp); - -+/* -+ * Read a timestamp in STAMP into RESULT. Returns values in the -+ * real-time clock frame. -+ */ -+extern void read_time_stamp (time_value_t *stamp, time_value_t *result); -+ - extern kern_return_t host_get_time( - host_t host, - time_value_t *current_time); -diff --git a/kern/task.c b/kern/task.c -index b384347..9a3d848 100644 ---- a/kern/task.c -+++ b/kern/task.c -@@ -783,7 +783,8 @@ kern_return_t task_info( - = task->total_system_time.seconds; - basic_info->system_time.microseconds - = task->total_system_time.microseconds; -- basic_info->creation_time = task->creation_time; -+ read_time_stamp(&task->creation_time, -+ &basic_info->creation_time); - task_unlock(task); - - if (*task_info_count > TASK_BASIC_INFO_COUNT) -diff --git a/kern/thread.c b/kern/thread.c -index 1f47553..865a1cc 100644 ---- a/kern/thread.c -+++ b/kern/thread.c -@@ -1503,7 +1503,8 @@ kern_return_t thread_info( - &basic_info->system_time); - basic_info->base_priority = thread->priority; - basic_info->cur_priority = thread->sched_pri; -- basic_info->creation_time = thread->creation_time; -+ read_time_stamp(&thread->creation_time, -+ &basic_info->creation_time); - - /* - * To calculate cpu_usage, first correct for timer rate, --- -2.1.4 - diff --git a/debian/patches/series b/debian/patches/series index 25d8cf2..029e46a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -13,4 +13,3 @@ sysenter0001-yyy-sysenter-prototype.patch vm-cache-policy0001-VM-cache-policy-change.patch vm-cache-policy0002-vm-keep-track-of-clean-pages.patch vm-cache-policy0003-vm-evict-clean-pages-first.patch -clock_boottime0001-yyy-clock_boottime.patch |