0.11内核rd_load@ramdisk.c中memcpy函数好像有bug
0.11內核rd_load@ramdisk.c中memcpy函數好像有bug,如:
#define memcpy(dst,src,n) \
?? ?__asm__("cld;rep;movsl"::"D"((long)(dst)),"S"((long)(src)), "c"((long)(n)/4))
//memcpy(cp, bh->b_data, BLOCK_SIZE);
?? ?for (j=0; j<BLOCK_SIZE; j++)
?? ??? ?cp[j] = bh->b_data[j];
?? ?if (block == 256+1) {
?? ??? ?struct d_super_block * s2 = (struct d_super_block *) cp;
?? ??? ?if (s2->s_magic != SUPER_MAGIC) {
?? ??? ??? ?/* No ram disk image present, assume normal floppy boot */
?? ??? ??? ?DBUG("ds=0x%x es=0x%x fs=0x%x pid=%d", get_ds(), get_es(), get_fs(), current->pid);
?? ??? ??? ?DBUG("TEST1 super block failed, s2->s_magic != SUPER_MAGIC");
?? ??? ?}
?? ??? ?s2 = (struct d_super_block *) bh->b_data;
?? ??? ?if (s2->s_magic != SUPER_MAGIC) {
?? ??? ??? ?/* No ram disk image present, assume normal floppy boot */
?? ??? ??? ?DBUG("TEST2 super block failed, s2->s_magic != SUPER_MAGIC");
?? ??? ?}? else {
?? ??? ??? ?DBUG("TEST2 OK");
?? ??? ?}
?? ?}
跟蹤發現:使用memcpy函數復制,內容沒有復制過來.
使用字節拷貝可以正常復制,是gcc-4.4.3 (ubuntu-8.04 server)bug?
objdump -d ramdisk.o
發現:
?25b:?? ?0f 84 8f 01 00 00?? ??? ?je???? 3f0 <rd_load+0x330>
?261:?? ?8b 75 00??????????? ??? ?mov??? 0x0(%ebp),%esi
?264:?? ?b9 00 04 00 00????? ??? ?mov??? $0x400,%ecx
?269:?? ?fc????????????????? ??? ?cld?? ?
?26a:?? ?f3 a4?????????????? ??? ?rep movsb %ds:(%esi),%es:(%edi)
?
?對%edi未設置
轉載于:https://www.cnblogs.com/mull/p/7851854.html
總結
以上是生活随笔為你收集整理的0.11内核rd_load@ramdisk.c中memcpy函数好像有bug的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql -h139.129.205.
- 下一篇: iOS APP日志写入文件(日志收集)