这段程序是从龚俊S3C44BO_BIOS中的一个小段程序,实在是看不懂,那位能分析下???
if((prog_begin==0)&&overwrite0) { unsigned int ins; ins = *(unsigned int *)data_begin; if((ins>>24)==0xea) // instruction: b xxxx, now just support b instruction!!! bios_load_addr = ((ins&0xffffff)<<2)+8; else bios_load_addr = 4; // other instruction, jump to 4 bios_load_addr = (bios_load_addr-BIOS_LOAD-8)/4; bios_load_addr = (bios_load_addr&0xffffff)|0xea000000; *(unsigned int *)data_begin = 0xea000000+(BIOS_BASE-8)/4; modify_a0 = 1; } cache_cfg = rNCACHBE0; rNCACHBE0 = 0x20000000; SectorProg(prog_begin, (unsigned short *)data_begin, size);
if(modify_a0) { size = FlashSector(size-1)+SECTOR_SIZE; FlashRead(FlashSector(BIOS_LOAD), (unsigned short *)(DFT_DOWNLOAD_ADDR+size), SECTOR_SIZE); *(unsigned int *)(DFT_DOWNLOAD_ADDR+size+SECTOR_SIZE-4) = bios_load_addr; SectorProg(FlashSector(BIOS_LOAD), (unsigned short *)(DFT_DOWNLOAD_ADDR+size), SECTOR_SIZE); } rNCACHBE0 = cache_cfg; } 对if(modify_a0) { size = FlashSector(size-1)+SECTOR_SIZE; FlashRead(FlashSector(BIOS_LOAD), (unsigned short *)(DFT_DOWNLOAD_ADDR+size), SECTOR_SIZE); *(unsigned int *)(DFT_DOWNLOAD_ADDR+size+SECTOR_SIZE-4) = bios_load_addr; SectorProg(FlashSector(BIOS_LOAD), (unsigned short *)(DFT_DOWNLOAD_ADDR+size), SECTOR_SIZE); } 这一段实在是不明白. *(unsigned int *)(DFT_DOWNLOAD_ADDR+size+SECTOR_SIZE-4) = bios_load_addr; 放一条跳转指令.跳去那里? BIOS_LOAD这个地址是怎样来的?? 各位解释下,实在是看不懂. |