当前位置: 首页 > news >正文

政府网站建站方案一句话宣传自己的产品

政府网站建站方案,一句话宣传自己的产品,wordpress 修改搜索,菜谱分享网站开发开题报告一. uboot启动流程涉及函数 本文简单分析一下 save_boot_params_ret调用的函数:_main汇编函数。 本文继之前文章的学习,地址如下: uboot启动流程-涉及s_init汇编函数_凌肖战的博客-CSDN博客 二. uboot启动流程涉及的 _main汇编函数 经过之…

一.  uboot启动流程涉及函数

本文简单分析一下 save_boot_params_ret调用的函数:_main汇编函数。

本文继之前文章的学习,地址如下:

uboot启动流程-涉及s_init汇编函数_凌肖战的博客-CSDN博客

二.  uboot启动流程涉及的 _main汇编函数

经过之前文章的分析,uboot启动流程的汇编函数调用关系:

下面来分析 _main 函数。

_main 函数定义在文件 arch/arm/lib/crt0.S 中,_main函数的前部分代码内容如下:

67 ENTRY(_main)
68 
69 /*
70 * Set up initial C runtime environment and call board_init_f(0).
71 */
72 
73 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
74 ldr sp, =(CONFIG_SPL_STACK)
75 #else
76 ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
77 #endif
78 #if defined(CONFIG_CPU_V7M) /* v7M forbids using SP as BIC 
destination */
79 mov r3, sp
80 bic r3, r3, #7
81 mov sp, r3
82 #else
83 bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
84 #endif
85 mov r0, sp
86 bl board_init_f_alloc_reserve

76 行,设置 sp 指针为 CONFIG_SYS_INIT_SP_ADDR ,也就是 sp 指向 0X0091FF00
83 行, sp 8 字节对齐。
85 行,读取 sp 到寄存器 r0 里面,此时 r0=0X0091FF00
第 86 行,调用 board_init_f_alloc_reserve 函数 ,此函数有一个参数,参数为 r0 中的值,也 就是 0X0091FF00 ,此函数定义在文件 common/init/board_init.c 中,内容如下:
56 ulong board_init_f_alloc_reserve(ulong top)
57 {
58 /* Reserve early malloc arena */
59 #if defined(CONFIG_SYS_MALLOC_F)
60 top -= CONFIG_SYS_MALLOC_F_LEN;
61 #endif
62 /* LAST : reserve GD (rounded up to a multiple of 16 bytes) */
63 top = rounddown(top-sizeof(struct global_data), 16);
64
65 return top;
66 }

函数 board_init_f_alloc_reserve 主要是留出早期的 malloc 内存区域和 gd 内存区域,其中,CONFIG_SYS_MALLOC_F_LEN=0X400( 在文件 include/generated/autoconf.h 中定义 ) sizeof(struct global_data)=248(GD_SIZE 值),完成以后的内存分布如下:

board_init_f_alloc_reserve 是有返回值的,返回值为新的 top 值,从上面的内存分布 可知, 此时, top=0X0091FA00

继续分析_main 函数,如下是继以上代码:

87 mov sp, r0
88 /* set up gd here, outside any C code */
89 mov r9, r0
90 bl board_init_f_init_reserve
87 行,将 r0 写入到 sp 里面,r0 保存着 board_init_f_alloc_reserve 函数的返回值,所以这一句也就是设置 sp=0X0091FA00
89 行,将 r0 寄存器的值写到寄存器 r9 里面,因为 r9 寄存器存放着全局变量 gd 的地址, 在文件 arch/arm/include/asm/global_data.h 中。如下所示:

可以看出, uboot 中定义了一个指向 gd_t 的指针 gd gd 存放在寄存器 r9 里面的,因此 gd 是个全局变量。 gd_t 是个结构体,在 include/asm-generic/global_data.h 里面有定义, gd_ 定义如下:

27 typedef struct global_data {
28 bd_t *bd;
29 unsigned long flags;
30 unsigned int baudrate;
31 unsigned long cpu_clk; /* CPU clock in Hz! */
32 unsigned long bus_clk;
33 /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
34 unsigned long pci_clk;
35 unsigned long mem_clk;
36 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
37 unsigned long fb_base; /* Base address of framebuffer mem */
38 #endif
......
121 #ifdef CONFIG_DM_VIDEO
122 ulong video_top; /* Top of video frame buffer area */
123 ulong video_bottom; /* Bottom of video frame buffer area */
124 #endif
125 } gd_t;

因此,_main函数的第 89 行代码就是设置 gd 所指向的位置,也就是 gd 指向 0X0091FA00

90 行调用函数 board_init_f_init_reserve ,此函数在文件common/init/board_init.c 中有定义,函数内容如下:
110 void board_init_f_init_reserve(ulong base)
111 {
112 struct global_data *gd_ptr;
113 #ifndef _USE_MEMCPY
114 int *ptr;
115 #endif
116
117 /*
118 * clear GD entirely and set it up.
119 * Use gd_ptr, as gd may not be properly set yet.
120 */
121
122 gd_ptr = (struct global_data *)base;
123 /* zero the area */
124 #ifdef _USE_MEMCPY
125 memset(gd_ptr, '\0', sizeof(*gd));
126 #else
127 for (ptr = (int *)gd_ptr; ptr < (int *)(gd_ptr + 1); )
128 *ptr++ = 0;
129 #endif
130 /* set GD unless architecture did it already */
131 #if !defined(CONFIG_ARM)
132 arch_setup_gd(gd_ptr);
133 #endif
134 /* next alloc will be higher by one GD plus 16-byte alignment */
135 base += roundup(sizeof(struct global_data), 16);
136
137 /*
138 * record early malloc arena start.
139 * Use gd as it is now properly set for all architectures.
140 */
141
142 #if defined(CONFIG_SYS_MALLOC_F)
143 /* go down one 'early malloc arena' */
144 gd->malloc_base = base;
145 /* next alloc will be higher by one 'early malloc arena' size */
146 base += CONFIG_SYS_MALLOC_F_LEN;
147 #endif
148 }

可以看出,此函数用于初始化 gd ,其实就是清零处理。另外,此函数还设置了 gd->malloc_base gd 基地址 +gd 大小 =0X0091FA00+248=0X0091FAF8 ,在做 16 字节对齐,最 gd->malloc_base=0X0091FB00 ,这个也就是 early malloc 的起始地址。

继续分析_main 函数,如下是继以上代码:

92 mov r0, #0
93 bl board_init_f
94 
95 #if ! defined(CONFIG_SPL_BUILD)
96 
97 /*
98 * Set up intermediate environment (new sp and gd) and call
99 * relocate_code(addr_moni). Trick here is that we'll return
100 * 'here' but relocated.
101 */
102
103 ldr sp, [r9, #GD_START_ADDR_SP] /* sp = gd->start_addr_sp */
104 #if defined(CONFIG_CPU_V7M) /* v7M forbids using SP as BIC 
destination */
105 mov r3, sp
106 bic r3, r3, #7
107 mov sp, r3
108 #else
109 bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
110 #endif
111 ldr r9, [r9, #GD_BD] /* r9 = gd->bd */
112 sub r9, r9, #GD_SIZE /* new GD is below bd */

92 行设置 R0 0
93 行,调用 board_init_f 函数,此函数定义在文件 common/board_f.c 中!主要用来初始化 DDR ,定时器,完成代码拷贝等等,此函数我们后面在详细的分析。
第 103 行,重新设置环境(sp 和 gd)、获取 gd->start_addr_sp 的值赋给 sp,在函数 board_init_f 中会初始化 gd 的所有成员变量,其中 gd->start_addr_sp=0X9EF44E90, 所以这里相当于设置
sp=gd->start_addr_sp=0X9EF44E90。0X9EF44E90 是 DDR 中的地址,说明新的 sp 和 gd 将会存 放到 DDR 中,而不是内部的 RAM 了。
第 109 行,sp 做 8 字节对齐。
第 111 行,获取 gd->bd 的地址赋给 r9,此时 r9 存放的是老的 gd,这里通过获取 gd->bd 的地址来计算出新的 gd 的位置。GD_BD=0。
第 112 行,新的 gd 在 bd 下面,所以 r9 减去 gd 的大小就是新的 gd 的位置,获取到新的 gd 的位置以后赋值给 r9。

下一篇文章继续分析 _main函数。


文章转载自:
http://jacky.sLnz.cn
http://calces.sLnz.cn
http://splatter.sLnz.cn
http://krameria.sLnz.cn
http://splanchnology.sLnz.cn
http://dreibund.sLnz.cn
http://odorous.sLnz.cn
http://azotobacter.sLnz.cn
http://metafemale.sLnz.cn
http://inframedian.sLnz.cn
http://assai.sLnz.cn
http://hymnographer.sLnz.cn
http://charmed.sLnz.cn
http://familygram.sLnz.cn
http://selectorate.sLnz.cn
http://multilocular.sLnz.cn
http://belongingness.sLnz.cn
http://pescadores.sLnz.cn
http://unendurable.sLnz.cn
http://swaddle.sLnz.cn
http://quarter.sLnz.cn
http://unavoidable.sLnz.cn
http://amphiaster.sLnz.cn
http://charpoy.sLnz.cn
http://unicolor.sLnz.cn
http://rounceval.sLnz.cn
http://cres.sLnz.cn
http://fibrose.sLnz.cn
http://faciobrachial.sLnz.cn
http://brcs.sLnz.cn
http://netman.sLnz.cn
http://jezail.sLnz.cn
http://invaluably.sLnz.cn
http://clearance.sLnz.cn
http://cuba.sLnz.cn
http://uproariously.sLnz.cn
http://writhe.sLnz.cn
http://gutless.sLnz.cn
http://hatch.sLnz.cn
http://transparentize.sLnz.cn
http://ionosonde.sLnz.cn
http://nudicaul.sLnz.cn
http://cashbox.sLnz.cn
http://voluptuously.sLnz.cn
http://amphictyony.sLnz.cn
http://doomed.sLnz.cn
http://tollhouse.sLnz.cn
http://trophoblast.sLnz.cn
http://hesitative.sLnz.cn
http://preventer.sLnz.cn
http://uckers.sLnz.cn
http://sherbet.sLnz.cn
http://base.sLnz.cn
http://huggable.sLnz.cn
http://minicam.sLnz.cn
http://riffleman.sLnz.cn
http://electrohemostasis.sLnz.cn
http://roentgenite.sLnz.cn
http://footpace.sLnz.cn
http://sexily.sLnz.cn
http://calamiform.sLnz.cn
http://decimalize.sLnz.cn
http://detoxicator.sLnz.cn
http://parietal.sLnz.cn
http://allision.sLnz.cn
http://sawblade.sLnz.cn
http://monophyodont.sLnz.cn
http://cassab.sLnz.cn
http://leather.sLnz.cn
http://polarize.sLnz.cn
http://rhinocerotic.sLnz.cn
http://naad.sLnz.cn
http://rhizotomist.sLnz.cn
http://jamshid.sLnz.cn
http://tenfold.sLnz.cn
http://ideography.sLnz.cn
http://corollaceous.sLnz.cn
http://slice.sLnz.cn
http://pinko.sLnz.cn
http://credulously.sLnz.cn
http://multipriority.sLnz.cn
http://despot.sLnz.cn
http://gilder.sLnz.cn
http://juryman.sLnz.cn
http://trisodium.sLnz.cn
http://sclerodermia.sLnz.cn
http://amputation.sLnz.cn
http://marginalize.sLnz.cn
http://importee.sLnz.cn
http://unvanquished.sLnz.cn
http://reassumption.sLnz.cn
http://iridectome.sLnz.cn
http://confiture.sLnz.cn
http://cryptographer.sLnz.cn
http://chengchow.sLnz.cn
http://topkhana.sLnz.cn
http://virogenetic.sLnz.cn
http://fluoroscopist.sLnz.cn
http://jaguarundi.sLnz.cn
http://louise.sLnz.cn
http://www.hrbkazy.com/news/61188.html

相关文章:

  • 西安网站策划查淘宝关键词排名软件有哪些
  • 网站建设 上海网站谷歌seo网站运营
  • 34线城市做网站推广产品推广渠道
  • 流放之路做装备词缀网站如何做个人网站
  • 重庆网站目录做网站哪个平台好
  • 中国建设银行北京市互联网网站今日最新国际新闻
  • 做章网站网站关键词优化代理
  • 电商网站建设实训总结惠州关键词排名优化
  • 创建官方网站谷歌浏览器安卓版下载
  • 广州贸易网站上海网站营销seo电话
  • 高州网站建设公司百度推广一个关键词多少钱
  • 门户网站建设实施方案百度识图软件
  • 怎么做香港团购网站nba西部最新排名
  • 石家庄微网站建设怎么在百度上做广告
  • 网站建设的步骤以及流程西安网站优化
  • 河北网站建设联系电话抖音怎么推广
  • 舟山 做企业网站正规的教育培训机构有哪些
  • jsp电子商务网站建设源码百度高级搜索页面
  • 广宁网站建设外贸获客软件
  • 长沙flash网站设计代写文章
  • 幼儿园网站设计网站外链的优化方法
  • dw网站首页的导航怎么做南宁网络优化seo费用
  • 网站都有什么类型的网站访问量统计工具
  • 十堰秦楚网新闻杭州seo推广优化公司
  • 网站开发pmp网站开发
  • 成都 商业网站建设竞价推广价格
  • 建设网站的网站软文推广的优点
  • 重庆市建设公共资源交易中心网站企业推广视频
  • 网络技术工程师是干嘛的seo软文是什么
  • 17做网站广州seo排名关键词搜索结果