예제 #1
0
/* context.lock is held for us, so we don't need any locking. */
static void flush_ldt(void *current_mm)
{
	mm_context_t *pc;

	if (current->active_mm != current_mm)
		return;

	pc = &current->active_mm->context;
	set_ldt(pc->ldt->entries, pc->ldt->size);
}
예제 #2
0
파일: page.c 프로젝트: 304471720/GridOS
/**
	@brief Switch memory context
*/
void km_arch_ctx_switch(struct km * pre_ctx, struct km * next_ctx)
{
	unsigned long cr3_physical;

	/* Get physical base of cr3 */
	cr3_physical = HAL_GET_BASIC_PHYADDRESS(next_ctx->translation_table);
	//TODO: not use this macro

	/* Write to cr3 to switch */
	write_cr3(cr3_physical);

#if 0
	/*load the LDT, if the LDT is different*/
	if(unlikely(pre_ctx->ldt!=new_ctx->ldt))
	{
		//printk("\nnew_ctx->ldt :%h,%d.",new_ctx->ldt,new_ctx->ldt_entries);
		set_ldt(new_ctx->ldt,new_ctx->ldt_entries);
	}
#endif
}