We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
问题已解决,原因为刷TLB时,使用m约束传递vaddr,这会导致invlpg指令实际上刷的是vaddr变量在栈上存储的地址,并非把vaddr本身当做地址去刷TLB,需要修改内联汇编。
具体原理请见:https://stackoverflow.com/questions/79251944/why-this-wont-cause-page-fault/79256771#79256771
static void page_table_pte_remove(uint32_t vaddr) { uint32_t* pte = pte_ptr(vaddr); *pte &= ~PG_P_1; //asm volatile("invlpg %0" : : "m"(vaddr) : "memory");//这种并未真正刷TLB,不会产生page fault //asm volatile("invlpg %0" : : "m"(*(char *)vaddr) : "memory");//解决方法1,修改后不要忘了将thread_exit中释放pid放到释放PCB之前,否则会出现PAGE FAULT asm volatile("invlpg (%0)" : : "r"(vaddr) : "memory");//解决方法2,修改后不要忘了将thread_exit中释放pid放到释放PCB之前,否则会出现PAGE FAULT }
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: