Merge of Wu's GSOC 09 branch (src.20090525.r4372.wu)
Main changes: - COW optimization for safecopy. - safemap, a grant-based interface for sharing memory regions between processes. - Integration with safemap and complete rework of DS, supporting new data types natively (labels, memory ranges, memory mapped ranges). - For further information: http://wiki.minix3.org/en/SummerOfCode2009/MemoryGrants Additional changes not included in the original Wu's branch: - Fixed unhandled case in VM when using COW optimization for safecopy in case of a block that has already been shared as SMAP. - Better interface and naming scheme for sys_saferevmap and ds_retrieve_map calls. - Better input checking in syslib: check for page alignment when creating memory mapping grants. - DS notifies subscribers when an entry is deleted. - Documented the behavior of indirect grants in case of memory mapping. - Test suite in /usr/src/test/safeperf|safecopy|safemap|ds/* reworked and extended. - Minor fixes and general cleanup. - TO-DO: Grant ids should be generated and managed the way endpoints are to make sure grant slots are never misreused.
This commit is contained in:
@@ -18,7 +18,7 @@ libsys_FILES=" \
|
||||
env_panic.c \
|
||||
env_prefix.c \
|
||||
fkey_ctl.c \
|
||||
micro_delay.c \
|
||||
tsc_util.c \
|
||||
report.c \
|
||||
taskcall.c \
|
||||
read_tsc.s \
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
#define CALIBRATE \
|
||||
if(!calibrated) { \
|
||||
int r; \
|
||||
if((r=micro_delay_calibrate()) != OK) \
|
||||
panic(__FILE__, "micro_delay: calibrate failed\n", r); \
|
||||
if((r=tsc_calibrate()) != OK) \
|
||||
panic(__FILE__, "calibrate failed\n", r); \
|
||||
}
|
||||
|
||||
static u32_t calib_tsc, Hz = 0;
|
||||
static int calibrated = 0;
|
||||
|
||||
int
|
||||
micro_delay_calibrate(void)
|
||||
tsc_calibrate(void)
|
||||
{
|
||||
u64_t start, end, diff;
|
||||
struct tms tms;
|
||||
@@ -50,11 +50,11 @@ micro_delay_calibrate(void)
|
||||
diff = sub64(end, start);
|
||||
if(ex64hi(diff) != 0)
|
||||
panic(__FILE__,
|
||||
"micro_delay_calibrate: CALIBRATE_TICKS too high "
|
||||
"tsc_calibrate: CALIBRATE_TICKS too high "
|
||||
"for TSC frequency\n", NO_NUM);
|
||||
calib_tsc = ex64lo(diff);
|
||||
#if 0
|
||||
printf("micro_delay_calibrate: "
|
||||
printf("tsc_calibrate: "
|
||||
"%lu cycles/%d ticks of %d Hz; %lu cycles/s\n",
|
||||
calib_tsc, CALIBRATE_TICKS(Hz), Hz,
|
||||
div64u(mul64u(calib_tsc, Hz), CALIBRATE_TICKS(Hz)));
|
||||
@@ -94,3 +94,23 @@ micro_delay(u32_t micros)
|
||||
return OK;
|
||||
}
|
||||
|
||||
u32_t tsc_64_to_micros(u64_t tsc)
|
||||
{
|
||||
return tsc_to_micros(ex64lo(tsc), ex64hi(tsc));
|
||||
}
|
||||
|
||||
u32_t tsc_to_micros(u32_t low, u32_t high)
|
||||
{
|
||||
u32_t micros;
|
||||
|
||||
if(high) {
|
||||
return 0;
|
||||
}
|
||||
CALIBRATE;
|
||||
|
||||
micros = (div64u(mul64u(low, MICROHZ * CALIBRATE_TICKS(Hz)),
|
||||
calib_tsc)/Hz);
|
||||
|
||||
return micros;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user