uboot的jumptable_init函数分析

一、函数说明

函数功能:安装系统函数指针

函数位置:common/exports.c

二、函数分析

 1 void jumptable_init (void)
 2 {
 3     int i;
 4 
 5     gd->jt = (void **) malloc (XF_MAX * sizeof (void *)); //在堆中开辟指针空间
 6     for (i = 0; i < XF_MAX; i++)
 7         gd->jt[i] = (void *) dummy;                       //指针空间都初始化成指向空函数
 8     //依次安装函数指针
 9     gd->jt[XF_get_version] = (void *) get_version;
10     gd->jt[XF_malloc] = (void *) malloc;
11     gd->jt[XF_free] = (void *) free;
12     gd->jt[XF_getenv] = (void *) getenv;
13     gd->jt[XF_setenv] = (void *) setenv;
14     gd->jt[XF_get_timer] = (void *) get_timer;
15     gd->jt[XF_simple_strtoul] = (void *) simple_strtoul;
16     gd->jt[XF_udelay] = (void *) udelay;
17 #if defined(CONFIG_I386) || defined(CONFIG_PPC)
18     gd->jt[XF_install_hdlr] = (void *) irq_install_handler;
19     gd->jt[XF_free_hdlr] = (void *) irq_free_handler;
20 #endif    /* I386 || PPC */
21 #if (CONFIG_COMMANDS & CFG_CMD_I2C)
22     gd->jt[XF_i2c_write] = (void *) i2c_write;
23     gd->jt[XF_i2c_read] = (void *) i2c_read;
24 #endif    /* CFG_CMD_I2C */
25 }

  

 

你可能感兴趣的:(uboot的jumptable_init函数分析)