Example #1
0
/* copy data from inside memory to outside memory */
int memory_copy_to_outside(void *dst, void *src, word len)
{
#ifdef __KERNEL__
	return safe_memory_copy(dst, src, len, ADDR_OUTSIDE, ADDR_INSIDE, 0, 0);
#else
	memcpy(dst, src, len);
	return 0;
#endif
}
Example #2
0
/* copy the last exception to inside or outside memory */
int context_get_last_exception(context_t *cont, exception_t *excep)
{
	int ret;

	context_lock(cont);

	if (!cont->last_exception.had_exception) {
		context_unlock(cont);

		ERROR(-ERROR_PARAM);
	}

	ret = safe_memory_copy(excep, &cont->last_exception, sizeof(exception_t), ADDR_UNDEF, ADDR_INSIDE, 0, 0);

	cont->last_exception.had_exception = 0;

	context_unlock(cont);

	return ret;
}