简体   繁体   English

mips uasm代码有什么优势

[英]what is the advantage about mips uasm code

In the kernel's TLB processing part of the mips architecture, there are some uasm code, which is another way to generate assembly instead of using gcc.在mips架构的内核的TLB处理部分,有一些uasm代码,这是另一种生成汇编的方式,而不是使用gcc。

I don't know why not write inline assembly instead of uasm.我不知道为什么不写内联汇编而不是uasm。 Why?为什么? What are the advantages of uasm? uasm有什么优势?

In a TLB miss handler, I think you need total control over exactly what instructions are used.在 TLB 未命中处理程序中,我认为您需要完全控制所使用的指令。 (To make sure you only access memory through known-present TLB entries). (确保您仅通过已知存在的 TLB 条目访问 memory)。 Using inline asm for just a few special instructions, and letting GCC spill local variables to the stack (if compiled without optimization), wouldn't work.仅对一些特殊指令使用内联汇编,并让 GCC 将局部变量溢出到堆栈(如果编译时没有优化),是行不通的。

The TLB-miss handler entry point is also not a function that should return with jr $ra . TLB-miss 处理程序入口点也不是应该返回jr $ra的 function 。

So your best bet is to write the whole handler in pure asm instead of trying to make sure the compiler emits a "safe" implementation.所以你最好的办法是用纯 asm 编写整个处理程序,而不是试图确保编译器发出一个“安全”的实现。

Using an asm("") statement at global scope inside a C source file would work but makes the asm more ugly, and makes it harder for asm to take advantage of the C preprocessor.在 C 源文件中的全局 scope 中使用asm("")语句会起作用,但会使 asm 更难看,并使 asm 更难利用 Z0D61F8370CAD1D412F570B84D143E1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM