php 大小端转换函数,求问:QEMU模拟器大小端格式报错的解决办法

使用大端格式运行MIPS程序,报错如下:

root@t-vm:/home/t/Desktop/_dir605L_FW_113.bin.extracted/squashfs-root-0# qemu-mips -L . bin/ls

bin/ls: Invalid ELF image for this architecture

使用小端格式运行MIPSEL程序,正常运行:

root@t-vm:/home/t/Desktop/_TEW-654TR_A1_FW100B19.bin.extracted/squashfs-root# qemu-mipsel -L . bin/ls

bin         lib         mnt         sbin        var

dev         linuxrc     proc        tmp         www

etc         lost+found  root        usr

采用网上方法(http://www.devttys0.com/2011/12/qemu-vs-sstrip/),修改elfload.c文件,发现并无所注释行:

/* Verify the portions of EHDR outside of E_IDENT for the target.

This has to wait until after bswapping the header.  */

static bool elf_check_ehdr(struct elfhdr *ehdr)

{

return (elf_check_arch(ehdr->e_machine)

&& ehdr->e_ehsize == sizeof(struct elfhdr)

&& ehdr->e_phentsize == sizeof(struct elf_phdr)

&& (ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN));

}

使用复制模拟指令程序方式运行报错

root@t-vm:/home/t/Desktop/_TEW-654TR_A1_FW100B19.bin.extracted/squashfs-root# cp $(which qemu-mipsel) ./

root@t-vm:/home/t/Desktop/_TEW-654TR_A1_FW100B19.bin.extracted/squashfs-root# ./qemu-mipsel bin/ls

bin/ls: can't load library 'libsutil.so'(这个动态链接库求好心人分享)

root@t-vm:/home/t/Desktop/_TEW-654TR_A1_FW100B19.bin.extracted/squashfs-root# chroot . ./qemu-mipsel bin/ls

chroot: failed to run command ‘./qemu-mipsel’: No such file or directory(是不是我这个命令用错了。。。求解)

求大家帮帮忙 至少能让我这个大端MIPS程序跑起来 最好是能用复制模拟指令程序方式运行 以便IDA远程调试用

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值