關於linux uboot下的MMU 瞭解

來源:互聯網
上載者:User

在平台標頭檔通常有

#ifdef CONFIG_ENABLE_MMU
#define virt_to_phys(x) virt_to_phy_smdkc110(x)
#else
#define virt_to_phys(x) (x)
#endif

 

這裡居然是虛擬位址轉換成物理地址,沒有物理地址轉換成虛擬位址的東西?

在do_movi 函數裡面有

  if (addr >= 0xc0000000)
   addr = virt_to_phys(addr);

在do_bootm函數也有

 addr = virt_to_phys(addr);

這個定義

#ifdef CONFIG_ENABLE_MMU
#define virt_to_phys(x) virt_to_phy_smdkc110(x)
#else
#define virt_to_phys(x) (x)
#endif

可以解釋,即使我在關掉MMU的情況下,不改預設的啟動環境變數,照樣也能正常啟動核心,因為在上面的兩個關鍵函數裡面都轉換成最終的物理地址了!

#define CONFIG_BOOTCOMMAND "movi read kernel C0008000; movi read rootfs 30A00000 180000; bootm C0008000 30A00000"

看看 virt_to_phy_smdkc110(x)
這個怎麼來的吧。

 

#ifdef CONFIG_ENABLE_MMU#ifdef CONFIG_MCP_SINGLEulong virt_to_phy_smdkc110(ulong addr){if ((0xc0000000 <= addr) && (addr < 0xd0000000))return (addr - 0xc0000000 + 0x20000000);elseprintf("The input address don't need "\"a virtual-to-physical translation : %08lx\n", addr);return addr;}#elseulong virt_to_phy_smdkc110(ulong addr){if ((0xc0000000 <= addr) && (addr < 0xd0000000))return (addr - 0xc0000000 + 0x30000000);else if ((0x30000000 <= addr) && (addr < 0x50000000))return addr;elseprintf("The input address don't need "\"a virtual-to-physical translation : %08lx\n", addr);return addr;}#endif#endif

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.