pmon-loongson3\Targets\LS2K\ls2k\start.S
jr initmips
pmon-loongson3\zloader\initmips.c realinitmips //说明initmips.c 是编译之后生成的
jalr initmips的地址
pmon-loongson3\Targets\LS2K\ls2k\tgt_machdep.c initmips
tgt_fpuenable //开启fpu
tgt_cpufreq //计算cpu频率
CPU_ConfigCache
dbginit
pmon-loongson3\pmon\common\main.c dbginit
__init //所有构造初始化,即_P 修饰的函数。主要是各类命令等
envinit //环境变量初始化,环境变量存在spi flash 中
md_cacheon
tgt_devinit
pmon-loongson3\Targets\LS2K\ls2k\tgt_machdep.c tgt_devinit
_pci_businit
pmon-loongson3\sys\dev\pci\pciconf.c _pci_businit
_pci_scan_dev //扫描pci设备
_setup_pcibuses
check_str //电源管理acpi,从s3 恢复
pmon-loongson3\Targets\LS2K\ls2k\tgt_machdep.c check_str
init_pcidev
_pci_devinit
_pci_setup_devices
vga_bios_init
ls_pcie_config_set
init_net
pmon-loongson3\sys\kern\init_main.c init_net
paraminit
vminit
kmeminit
startrtclock
mbinit
tgt_devconfig
pmon-loongson3\Targets\LS2K\ls2k\tgt_machdep.c tgt_devconfig
init_pcidev
config_init
configure
ifinit
domaininit
splx
init_proc
ifconfig
tgt_logo //显示pmon logo
print_cpu_info //打印cpu info
print_mem_freq //打印mem
tgt_memprint
tgt_smpstartup //开启smp
DevicesInit
ls2k_nand_init //ls2k nandflash 初始化
verify_dtb //校验dtb
main //自动引导 或pmon命令模式
pmon-loongson3\pmon\common\main.c main
load_menu_list
do_cmd('bl')
pmon-loongson3\pmon\common\cmdparser.c do_cmd
CmdTable[i].func) (ac, av);
autoload
do_cmd('g')
循环执行,即处理命令输入
get_line
do_cmd //执行用户输入的命令
console_state
bl
加载boot.cfg
文件并绘制菜单栏pmon-loongson3\pmon\cmds\menulist2f.c
[cmds]
bl -- > cmd_menu_list
pmon-loongson3\pmon\cmds\menulist2f.c cmd_menu_list
__console_init
show_main
load_list_menu
pmon-loongson3\pmon\cmds\boot_cfg.c load_list_menu
OpenLoadConfig //打开boot.cfg文件
menu_list_read //分析boot.cfg文件
draw_main //绘制引导菜单
循环执行,等待用户选择启动,
getch //等用户输入,enter 执行, c 进入pmon 命令行
draw_mid_main //绘制选中项,执行上下选择键时会执行此函数
do_cmd_boot_load
pmon-loongson3\pmon\cmds\boot_cfg.c do_cmd_boot_load
boot_load
boot_load_from_menu
load_kernel_from_menu
boot_kernel
pmon-loongson3\pmon\common\bootkernel.c boot_kernel
dl_initialise
getExec("bin")
exec
pmon-loongson3\pmon\loaders\exec.c exec
loader //这里是执行一个回调函数,每种类型有注册一个回调函数,这里是以bin格式加载
pmon-loongson3\pmon\loaders\exec_bin.c load_bin //加载至内存中 0 处
load_initrd_from_menu
boot_initrd
pmon-loongson3\pmon\common\bootkernel.c boot_initrd
dl_initialise
getExec("bin")
exec
pmon-loongson3\pmon\loaders\exec.c exec
loader //这里是执行一个回调函数,每种类型有注册一个回调函数,这里是以bin格式加载
pmon-loongson3\pmon\loaders\exec_bin.c load_bin //加载至内存中 dl_loffset(0x84000000) 处
boot_run_from_menu
do_cmd('g ') //执行命令g,参数为boot.cfg中的args 的值
load
将文件加载内存pmon-loongson3\pmon\cmds\load.c
[cmds]
load --> cmd_nload
dl_initialise
getExec("bin")
exec
exec
pmon-loongson3\pmon\loaders\exec.c exec
loader //这里是执行一个回调函数,每种类型有注册一个回调函数,这里是以bin格式加载
pmon-loongson3\pmon\loaders\exec_bin.c load_bin //加载至内存中 dl_loffset(0) 处
go
运行内核pmon-loongson3\pmon\cmds\cmd_go.c
[cmds]
g --> cmd_go
pmon-loongson3\pmon\cmds\cmd_go.c cmd_go
initrd_execed
initstack
md_registers
clrhndlrs
closelst
md_setsr
ls_pcie_config_set
console_state
cfg_coherent
_go
console_state
fload
更新固件,即将文件写入0xbfc000000
处pmon-loongson3\pmon\cmds\menulist2f.c
[cmds]
fload --> cmd_load_flush
首先通过grep
函数名, 如果这样还不能找到的话。 则可以通过反汇编时带的符号来找
编译带符号表的pmon
,然后再反汇编,命令如下:
cd zloader.ls2k
make cfg all tgt=rom DEBUG=-g
cd ../Targets/LS2K/compile/ls2k
mipsel-linux-objdump -S pmon.gdb > pmon.S