日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > linux >内容正文

linux

linux kernel中cache代码解读

發(fā)布時(shí)間:2025/3/21 linux 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux kernel中cache代码解读 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1、 在kernel中調(diào)用__dma_flush_range,底層是如何操作的呢?

/* remove any dirty cache lines on the kernel alias */__dma_flush_range(ptr, ptr + size); /** __dma_flush_range(start, end)* - start - virtual start address of region* - end - virtual end address of region*/ ENTRY(__dma_flush_range)dcache_line_size x2, x3 //獲取cache line size, 保存在x2中sub x3, x2, #1 //x3=x2-1,用于對(duì)其的Maskbic x0, x0, x3 //地址對(duì)齊,x0就是__dma_flush_range(ptr, ptr + size)中的ptr虛擬地址 1: dc civac, x0 // invalid一行cache line,下面這一段是一個(gè)循環(huán)add x0, x0, x2 //x0 = x0 + cache line sizecmp x0, x1 //比較x0和__dma_flush_range(ptr, ptr + size)中的ptr+sizeb.lo 1bdsb syret ENDPIPROC(__dma_flush_range) /** dcache_line_size - get the minimum D-cache line size from the CTR register.*/.macro dcache_line_size, reg, tmpmrs \tmp, ctr_el0 // read CTRubfm \tmp, \tmp, #16, #19 // cache line size encodingmov \reg, #4 // bytes per wordlsl \reg, \reg, \tmp // actual cache line size

附上civac的寄存器和指令:

最后總結(jié)一下,__dma_flush_range(ptr, ptr+size)其實(shí)就是 invalid cache這一段虛擬地址

總結(jié)

以上是生活随笔為你收集整理的linux kernel中cache代码解读的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。