/* 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 = ¤t->active_mm->context; set_ldt(pc->ldt->entries, pc->ldt->size); }
/** @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 }