devicemaps_init的参数为machine_desc结构体。以s3c6410为例,在arch/arm/mach-s3c64xx/mach-smdk6410.c中使用上述宏声明machine_desc结构体

MACHINE_START(SMDK6410, "SMDK6410")
/* Maintainer: Ben Dooks <ben-linux@fluff.org> */
//.phys_io = S3C_PA_UART & 0xfff00000,
//.io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
.boot_params = S3C64XX_PA_SDRAM + 0x100, .init_irq = s3c6410_init_irq,
.map_io = smdk6410_map_io,
.init_machine = smdk6410_machine_init,
.timer = &s3c24xx_timer,
MACHINE_END

devicemaps_init的作用:

1.为中断向量分配内存,为中断向量虚拟地址映射的页表分配内存,建立虚拟地址到物理地址的映射。

具体参考create_mapping(&map)函数。

linux中ARM处理器使用的是高端中断向量地址0xffff_0000.

这一点可以在进入start_kernel之前的汇编函数__v6_setup中看到,该函数的返回值r0中保存的是要写入CP15 C1中的值。

/*
* __v6_setup
*
* Initialise TLB, Caches, and MMU state ready to switch the MMU
* on. Return in r0 the new CP15 C1 control register setting.
*
* We automatically detect if we have a Harvard cache, and use the
* Harvard cache control instructions insead of the unified cache
* control instructions.
*
* This should be able to cover all ARMv6 cores.
*
* It is assumed that:
* - cache type register is implemented
*/
__v6_setup:
#ifdef CONFIG_SMP
mrc p15, , r0, c1, c0, @ Enable SMP/nAMP mode
orr r0, r0, #0x20
mcr p15, , r0, c1, c0,
#endif mov r0, #
mcr p15, , r0, c7, c14, @ clean+invalidate D cache
mcr p15, , r0, c7, c5, @ invalidate I cache
mcr p15, , r0, c7, c15, @ clean+invalidate cache
mcr p15, , r0, c7, c10, @ drain write buffer
#ifdef CONFIG_MMU
mcr p15, , r0, c8, c7, @ invalidate I + D TLBs
mcr p15, , r0, c2, c0, @ TTB control register
orr r4, r4, #TTB_FLAGS
mcr p15, , r4, c2, c0, @ load TTB1
#endif /* CONFIG_MMU */
adr r5, v6_crval
ldmia r5, {r5, r6}
mrc p15, , r0, c1, c0, @ read control register
bic r0, r0, r5 @ clear bits them
orr r0, r0, r6 @ set them
mov pc, lr @ return to head.S:__ret

v6_crval宏的定义如下:

    .macro    crval, clear, mmuset, ucset
#ifdef CONFIG_MMU
.word \clear
.word \mmuset
#else
.word \clear
.word \ucset
#endif
.endm .type v6_crval, #object
v6_crval:
crval clear=0x01e0fb7f, mmuset=0x00c0387d, ucset=0x00c0187c

r0 = r0 & (~clear) | (mmuset)

可以看到,最终V是被设置为1了,所以是高端地址中断。

2.调用mdesc->map_io()进行SOC相关的初始化。

以S3C6410为例调用的是smdk6410_map_io(),这个函数的具体实现以后再详细分析。

devicemaps_init(mdesc)的更多相关文章

  1. Linux---从start_kernel到init进程启动

    “平安的祝福 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 ” ini ...

  2. Uboot与Linux之间的参数传递

    U-boot会给Linux Kernel传递很多参数,如:串口,RAM,videofb等.而Linux kernel也会读取和处理这些参数.两者之间通过struct tag来传递参数. U-boot把 ...

  3. 内存管理 初始化(二)bootmem位图分配器建立 及 使用

    本地的笔记有点长,先把bootmem位图分配器的建立 及  使用过程做下梳理. 都是代码,上面做了标注.开始的汇编部分省略了(涉及的内容不多,除了swapper_pg_dir的分配). 该记录不会再添 ...

  4. imx6的kernel3.4.15启动流程

    //最开始的定义为 DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad/DualLite (Device Tree)") .smp = sm ...

  5. init_machine 在Kernel中被调用的过程

    以tiny4412为例: arch/arm/mach-exynos/mach-tiny4412.c MACHINE_START(TINY4412, "TINY4412") /* M ...

  6. ARM Linux内核源码剖析索引

    start_kernel -->asm-offset.h 生成 -->proc_info_list   -->machine_desc -->__vet_atags --> ...

  7. S3C6410串口平台设备注册流程分析

    1.mdesc->map_io() start_kernel -->setup_arch(&command_line); -->paging_init(mdesc); --& ...

  8. 移植 Linux 内核

    目录 更新记录 1.Linux 版本及特点 2.打补丁.编译.烧写.启动内核 3.内核源码文件结构 4.内核架构分析 4.1 内核配置 4.2 Makefile架构分析 4.3 Kconfig 架构文 ...

  9. Linux 链接脚本分析

    作者:答疑助手lizuobin 原文: https://blog.csdn.net/lizuobin2/article/details/51779064 在前面学习的过程中,看代码时遇到 arch_i ...

随机推荐

  1. 《从0到1学习Flink》—— Flink 项目如何运行?

    前言 之前写了不少 Flink 文章了,也有不少 demo,但是文章写的时候都是在本地直接运行 Main 类的 main 方法,其实 Flink 是支持在 UI 上上传 Flink Job 的 jar ...

  2. 解决apache启动错误 AH00558: httpd: Could not reliably determine...

    [root@localhost httpd-2.4.7]# /usr/local/httpd/bin/apachectl start AH00558: httpd: Could not reliabl ...

  3. mac-httpd

    mac 的httpd mac 自带了apache2, 但是不推荐使用, 因为它的目录在/Library/WebServer/Documents/下 使用brew install apache-http ...

  4. android 开发-ListView与ScrollView事件冲突处理(事件分发机制处理)

    ListView和ScrollView都存在滚动的效果,所以一般不建议listView和scrollView进行嵌套使用,但有些需求则需要用到两者嵌套.在android的学习中学了一种事件分发处理机制 ...

  5. 判断dataset表中是否存在 某列

    DataSet ds ; ds.Tables[0].Columns.Contains("a") 同样适用于 datarow dr ; dr.Table.Columns.Contai ...

  6. i++ ++i i=i+1 和i+=1

    这几个运算符的差别总是过一段时间就爱搞混,每次需要百度,还是自己记录一下方便查阅. int i=0; System.out.println(i++); 输出:0 int i=0; System.out ...

  7. Employees Earning More Than Their Managers

    The Employee table holds all employees including their managers. Every employee has an Id, and there ...

  8. bootstrap Table 服务端处理分页 后台是.net

    要考虑函数可被可重复使用(调用),需要将可变化的变为参数封装起来 function HQCreatTables(ob) { var option = { method: 'get', dataType ...

  9. Struct2标签的传值方式(转载)

    "#request.userList"> "center"> "id"/> : "username"/ ...

  10. JavaScript_HTML DEMO_3_节点

    创建新的HTML元素 删除已有的HTML元素 <body> <div id="div1"> <p id="p1">这是一个段 ...