娇小w搡bbbb搡bbb,《第一次の人妻》,中国成熟妇女毛茸茸,边啃奶头边躁狠狠躁视频免费观看

歷史上的今天

今天是:2024年11月24日(星期日)

正在發(fā)生

2021年11月24日 | Linux ARMv7中斷向量表搬移(2)

發(fā)布者:神光騎士 來源: eefocus關(guān)鍵字:Linux  ARMv7  中斷向量表 手機看文章 掃描二維碼
隨時隨地手機看文章

一. Linux ARMv7啟動階段對中斷向量表的搬移

1、中斷向量表和中斷處理部分代碼的搬移

經(jīng)歷過kernel的匯編階段,進入C語言start_kernel后對中斷向量表的位置進行搬移,搬移函數(shù)是early_trap_init。


early_trap_init函數(shù)的調(diào)用流程為:

 start_kernel(init/main.c)--->setup_arch(arch/arm/kernel/setup.c)--->paging_init(arch/arm/mm/mmu.c)--->devicemaps_init(arch/arm/mm/mmu.c)--->early_trap_init(arch/arm/kernel/traps.c)


/*

* Set up the device mappings. Since we clear out the page tables for all

* mappings above VMALLOC_START, except early fixmap, we might remove debug

* device mappings. This means earlycon can be used to debug this function

* Any other function or debugging method which may touch any device _will_

* crash the kernel.

*/

static void __init devicemaps_init(const struct machine_desc *mdesc)

{

        struct map_desc map;

        unsigned long addr;

        void *vectors;

        /*

         * Allocate the vector page early.

         *分配兩個頁的內(nèi)存空間,arm中每個頁的大小為4K,這兩個頁的內(nèi)存空間,一個是為保存中斷向量

         *表,一個是為了保存中斷的處理部分代碼,這兩部分代碼的排布可以在

         *(arch/arm/kernel/vmlinux.lds和arch/arm/kernel/entry-armv.S)中可以具體分析出來

         */

        vectors = early_alloc(PAGE_SIZE * 2);

        early_trap_init(vectors);

 

         /*

          * Clear page table except top pmd used by early fixmaps

          */

         for (addr = VMALLOC_START; addr < (FIXADDR_TOP & PMD_MASK); addr += PMD_SIZE)

                pmd_clear(pmd_off_k(addr));

 

         /*

          * Map the kernel if it is XIP.

          * It is always first in the modulearea.

          */

#ifdef CONFIG_XIP_KERNEL  //此宏未定義

        map.pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & SECTION_MASK);

        map.virtual = MODULES_VADDR;

        map.length = ((unsigned long)_etext - map.virtual + ~SECTION_MASK) & SECTION_MASK;

        map.type = MT_ROM;

        create_mapping(&map);

#endif

 

 

        /*

         * Map the cache flushing regions.

         */

#ifdef FLUSH_BASE  //此宏未定義

        map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS);

        map.virtual = FLUSH_BASE;

        map.length = SZ_1M;

        map.type = MT_CACHECLEAN;

        create_mapping(&map);

#endif

#ifdef FLUSH_BASE_MINICACHE  //此宏未定義

        map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS + SZ_1M);

        map.virtual = FLUSH_BASE_MINICACHE;

        map.length = SZ_1M;

        map.type = MT_MINICLEAN;

        create_mapping(&map);

#endif

 

 

        /*

         * Create a mapping for the machine vectors at the high-vectors

         * location (0xffff0000). If we aren't using high-vectors, also

         * create a mapping at the low-vectors virtual address.

         */

        /*

         *創(chuàng)建一個頁的內(nèi)存地址映射,虛擬地址為0xffff0000,此地址為中斷向量表的高端地址

         *設(shè)置中斷向量表的高端地址在匯編的v7_setup中,使用的v7_crval設(shè)置了cp15的c1寄存器

         *v7_crval定義在arch/arm/mm/proc-v7-2level.S。

         */

        map.pfn = __phys_to_pfn(virt_to_phys(vectors));

        map.virtual = 0xffff0000;

        map.length = PAGE_SIZE;

#ifdef CONFIG_KUSER_HELPERS  //此宏有定義

        map.type = MT_HIGH_VECTORS;

#else

        map.type = MT_LOW_VECTORS;

#endif

        create_mapping(&map);

        /*

         *判斷中斷向量表的位置是否設(shè)置在高端地址,如果中斷向量表沒有設(shè)置在高端地址,

         *在映射低端中斷向量表地址。

         */

        if (!vectors_high()) {

                map.virtual = 0;

                map.length = PAGE_SIZE * 2;

                map.type = MT_LOW_VECTORS;

            create_mapping(&map);

        }

 

        /* Now create a kernel read-only mapping */

        map.pfn += 1;

        map.virtual = 0xffff0000 + PAGE_SIZE;

        map.length = PAGE_SIZE;

        map.type = MT_LOW_VECTORS;

        create_mapping(&map);

 

        /*

         * Ask the machine support to map in the statically mapped devices.

         */

        if (mdesc->map_io)

                mdesc->map_io();

        else

                debug_ll_io_init();

                fill_pmd_gaps();

 

        /* Reserve fixed i/o space in VMALLOC region */

        pci_reserve_io();

 

         /*

          * Finally flush the caches and tlb to ensure that we're in a

          * consistent state wrt the writebuffer. This also ensures that

          * any write-allocated cache lines in the vector page are written

          * back. After this point, we can start to touch devices again.

          */

        local_flush_tlb_all();

        flush_cache_all();

 

        /* Enable asynchronous aborts */

        early_abt_enable();

        /*   AT

         *  TFR   EV X F   I D LR    S

         * .EEE ..EE PUI. .T.T 4RVI ZWRS BLDP WCAM

         * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced

         *   01    0 110       0011 1100 .111 1101 < we want

         */

        .align  2

        .type   v7_crval, #object

v7_crval:

        crval   clear=0x2120c302, mmuset=0x10c03c7d, ucset=0x00c01c7c

early_trap_init函數(shù)的分析


void __init early_trap_init(void *vectors_base)

{

#ifndef CONFIG_CPU_V7M

        unsigned long vectors = (unsigned long)vectors_base;

        extern char __stubs_start[], __stubs_end[];

        extern char __vectors_start[], __vectors_end[];

        unsigned i;

 

        vectors_page = vectors_base;

    

        /*

         * Poison the vectors page with an undefined instruction.  This

         * rly_trap_init instruction is chosen to be undefined for both ARM and Thumb

         * ISAs.  The Thumb version is an undefined instruction with a

         * branch back to the undefined instruction.

         * 將申請的4K先設(shè)置為未定義指令,防止在發(fā)生其他中斷時,沒有處理導(dǎo)致cpu錯誤

         */

        for (i = 0; i < PAGE_SIZE / sizeof(u32); i++)

                ((u32 *)vectors_base)[i] = 0xe7fddef1;/*

         * Copy the vectors, stubs and kuser helpers (in entry-armv.S)

         * into the vector page, mapped at 0xffff0000, and ensure these

         * are visible to the instruction stream.

         */

        /*

         *將中斷向量表和中斷處理的代碼搬移到申請的兩頁地址空間內(nèi)

         */

        memcpy((void *)vectors, __vectors_start, __vectors_end - __vectors_start);

        memcpy((void *)vectors + 0x1000, __stubs_start, __stubs_end - __stubs_start);

 

        kuser_init(vectors_base);

 

        flush_icache_range(vectors, vectors + PAGE_SIZE * 2);

#else /* ifndef CONFIG_CPU_V7M */

        /*

         * on V7-M there is no need to copy the vector table to a dedicated

         * memory area. The address is configurable and so a table in the kernel

         * image can be used.

         */

#endif

}

關(guān)鍵字:Linux  ARMv7  中斷向量表 引用地址:Linux ARMv7中斷向量表搬移(2)

上一篇:I2C協(xié)議->裸機程序->adapter驅(qū)動程序分析
下一篇:linux arm mmu基礎(chǔ)

推薦閱讀

機器人Geek+(極智嘉)宣布B輪融資全部完成交割,融資總額已達到1.5億美元, 成為全球物流機器人領(lǐng)域B輪融資額最高的公司。華平投資在本輪融資中的投資總額超過1億美元,同時原有股東火山石資本、祥峰投資繼續(xù)跟投。隨著本輪融資的完成,Geek+成為了第一家從物流領(lǐng)域發(fā)展出來的AI機器人獨角獸公司,并正在迅速往更廣泛的AI機器人領(lǐng)域發(fā)展。 機器人大講...
(文章來源:中科羅伯特機器人學(xué)院) 傳統(tǒng)工業(yè)機器人只能在固定的環(huán)境下,依賴精確的重復(fù)定位能力從事重復(fù)性的工作,還不能適應(yīng)動態(tài)復(fù)雜的環(huán)境,或者跟人類合作完成同一項工作。但是我們現(xiàn)在的生產(chǎn)環(huán)節(jié)需要能適應(yīng)更多應(yīng)用場景的智能化工業(yè)機器人。這就需要拓寬工業(yè)機器人的應(yīng)用領(lǐng)域和行業(yè),積極挖掘中小企業(yè)的應(yīng)用潛能。工業(yè)機器人是實現(xiàn)智能制造的關(guān)鍵...
美國半導(dǎo)體行業(yè)協(xié)會(SIA)董事會今(24)日宣布推選Qorvo 公司總裁、CEO 兼董事 Bob Bruggeworth 擔任 2021 年輪值主席,并同時推選高通公司 CEO 兼董事 Steve Mollenkopf 擔任 2021 年輪值副主席。據(jù)悉,美國半導(dǎo)體行業(yè)協(xié)會的會員的收入占美國半導(dǎo)體行業(yè)的 98%,且擁有近三分之二的非美國芯片公司。SIA 總裁兼 CEO John Neuffer表示...
Diodes Incorporated 推出符合汽車規(guī)格的 500mA LDO,在高功率密度尺寸中提供卓越的 PSRR【2021 年 11 月 24 日美國德州普拉諾訊】Diodes 公司 針對要求嚴格的噪聲敏感型電源相關(guān)汽車產(chǎn)品應(yīng)用項目,推出高度優(yōu)化的 AP7347DQ 低壓差 (LDO) 穩(wěn)壓器。這款符合汽車規(guī)格的高輸出精度 LDO 獲得了 AEC-Q100 一級認證,在 IATF 16949 認證...

史海拾趣

小廣播
設(shè)計資源 培訓(xùn) 開發(fā)板 精華推薦

最新單片機文章

 
EEWorld訂閱號

 
EEWorld服務(wù)號

 
汽車開發(fā)圈

 
機器人開發(fā)圈

電子工程世界版權(quán)所有 京ICP證060456號 京ICP備10001474號-1 電信業(yè)務(wù)審批[2006]字第258號函 京公網(wǎng)安備 11010802033920號 Copyright ? 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
主站蜘蛛池模板: 民乐县| 弥渡县| 文水县| 淳化县| 会同县| 宜宾市| 福鼎市| 泾阳县| 荃湾区| 宝清县| 德昌县| 高陵县| 佛教| 枣庄市| 隆子县| 阿勒泰市| 内黄县| 永州市| 庆城县| 双江| 集安市| 清流县| 监利县| 荔波县| 勐海县| 夏河县| 观塘区| 武威市| 高州市| 大埔县| 大田县| 铅山县| 集安市| 达尔| 临西县| 台南县| 韶关市| 大渡口区| 旺苍县| 商城县| 卓资县|