📄 mutiboot.dmp
字号:
../../Output/Kernel/Init/Init.ld: file format pei-i386
Disassembly of section .text:
00100400 <_mutiboot_main>:
static unsigned short* v = (unsigned short*)0xb8000;
static int pos=0;
int mutiboot_main(unsigned long magic, unsigned long addr)
{
100400: 55 push %ebp
100401: 89 e5 mov %esp,%ebp
100403: 83 ec 48 sub $0x48,%esp
v = (unsigned short*)0xb8000;
100406: c7 05 00 10 10 00 00 movl $0xb8000,0x101000
10040d: 80 0b 00
pos = 0;
100410: c7 05 00 30 10 00 00 movl $0x0,0x103000
100417: 00 00 00
play();
10041a: e8 ef 00 00 00 call 10050e <_play>
memcpy( (char*)0x10000, (char*)0x110000, szImageSize );
10041f: a1 00 20 10 00 mov 0x102000,%eax
100424: 89 44 24 08 mov %eax,0x8(%esp)
100428: c7 44 24 04 00 00 11 movl $0x110000,0x4(%esp)
10042f: 00
100430: c7 04 24 00 00 01 00 movl $0x10000,(%esp)
100437: e8 50 01 00 00 call 10058c <_memcpy>
play();
10043c: e8 cd 00 00 00 call 10050e <_play>
/*
* 1.设置一个16位GDT
* 2.跳转去0x10000执行
*/
char ptr[6];
DescPtr pGdt;
pGdt.addr=pGdt.limit=0;
100441: 66 c7 45 d8 00 00 movw $0x0,0xffffffd8(%ebp)
100447: c7 45 da 00 00 00 00 movl $0x0,0xffffffda(%ebp)
asm volatile ( "sgdt %0" : "=m"( ptr ) ) ;
10044e: 0f 01 45 e8 sgdtl 0xffffffe8(%ebp)
memcpy((char*)&pGdt, ptr, 6);
100452: c7 44 24 08 06 00 00 movl $0x6,0x8(%esp)
100459: 00
10045a: 8d 45 e8 lea 0xffffffe8(%ebp),%eax
10045d: 89 44 24 04 mov %eax,0x4(%esp)
100461: 8d 45 d8 lea 0xffffffd8(%ebp),%eax
100464: 89 04 24 mov %eax,(%esp)
100467: e8 20 01 00 00 call 10058c <_memcpy>
pGdt.limit = sizeof(SegDesc)*256;
10046c: 66 c7 45 d8 00 08 movw $0x800,0xffffffd8(%ebp)
// 内嵌汇编载入 gdt 表描述符
asm volatile ( "lgdt %0" : "=m"( pGdt ) ) ; //载入GDT表
100472: 0f 01 55 d8 lgdtl 0xffffffd8(%ebp)
PSegDesc gdt = (PSegDesc)pGdt.addr;
100476: 8b 45 da mov 0xffffffda(%ebp),%eax
100479: 89 45 d4 mov %eax,0xffffffd4(%ebp)
play();
10047c: e8 8d 00 00 00 call 10050e <_play>
int i;
for( i=3; i<256; i++ )
100481: c7 45 d0 03 00 00 00 movl $0x3,0xffffffd0(%ebp)
100488: 81 7d d0 ff 00 00 00 cmpl $0xff,0xffffffd0(%ebp)
10048f: 7f 1d jg 1004ae <_mutiboot_main+0xae>
if( gdt[i].attr1 == 0 )
100491: 8b 45 d0 mov 0xffffffd0(%ebp),%eax
100494: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
10049b: 8b 45 d4 mov 0xffffffd4(%ebp),%eax
10049e: 80 7c 02 05 00 cmpb $0x0,0x5(%edx,%eax,1)
1004a3: 75 02 jne 1004a7 <_mutiboot_main+0xa7>
break;
1004a5: eb 07 jmp 1004ae <_mutiboot_main+0xae>
1004a7: 8d 45 d0 lea 0xffffffd0(%ebp),%eax
1004aa: ff 00 incl (%eax)
1004ac: eb da jmp 100488 <_mutiboot_main+0x88>
if(i<256 )
1004ae: 81 7d d0 ff 00 00 00 cmpl $0xff,0xffffffd0(%ebp)
1004b5: 7f 55 jg 10050c <_mutiboot_main+0x10c>
{
play();
1004b7: e8 52 00 00 00 call 10050e <_play>
SetGDT( &gdt[i], 0x10000, 0xFFFFF, DA_CR | DA_LIMIT_4K ); // 16位代码段 段限0xFFFFF 1MB
1004bc: c7 44 24 0c 9a 80 00 movl $0x809a,0xc(%esp)
1004c3: 00
1004c4: c7 44 24 08 ff ff 0f movl $0xfffff,0x8(%esp)
1004cb: 00
1004cc: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
1004d3: 00
1004d4: 8b 45 d0 mov 0xffffffd0(%ebp),%eax
1004d7: c1 e0 03 shl $0x3,%eax
1004da: 03 45 d4 add 0xffffffd4(%ebp),%eax
1004dd: 89 04 24 mov %eax,(%esp)
1004e0: e8 47 00 00 00 call 10052c <_SetGDT>
play();
1004e5: e8 24 00 00 00 call 10050e <_play>
play();
1004ea: e8 1f 00 00 00 call 10050e <_play>
play();
1004ef: e8 1a 00 00 00 call 10050e <_play>
play();
1004f4: e8 15 00 00 00 call 10050e <_play>
play();
1004f9: e8 10 00 00 00 call 10050e <_play>
extern JumpTo10000(int seg);
JumpTo10000(i<<3);
1004fe: 8b 45 d0 mov 0xffffffd0(%ebp),%eax
100501: c1 e0 03 shl $0x3,%eax
100504: 89 04 24 mov %eax,(%esp)
100507: e8 a4 00 00 00 call 1005b0 <_JumpTo10000>
}
}
10050c: c9 leave
10050d: c3 ret
0010050e <_play>:
void play()
{
10050e: 55 push %ebp
10050f: 89 e5 mov %esp,%ebp
v[pos++]=0x1f1f;
100511: a1 00 30 10 00 mov 0x103000,%eax
100516: 8d 14 00 lea (%eax,%eax,1),%edx
100519: a1 00 10 10 00 mov 0x101000,%eax
10051e: 66 c7 04 02 1f 1f movw $0x1f1f,(%edx,%eax,1)
100524: ff 05 00 30 10 00 incl 0x103000
}
10052a: 5d pop %ebp
10052b: c3 ret
0010052c <_SetGDT>:
void SetGDT(PSegDesc pDesc, unsigned int base, unsigned int limit, unsigned short attribute)
{
10052c: 55 push %ebp
10052d: 89 e5 mov %esp,%ebp
10052f: 83 ec 04 sub $0x4,%esp
100532: 8b 45 14 mov 0x14(%ebp),%eax
100535: 66 89 45 fe mov %ax,0xfffffffe(%ebp)
pDesc->limit_low = limit & 0x0FFFF; // 段界限 1 (2 字节)
100539: 8b 55 08 mov 0x8(%ebp),%edx
10053c: 8b 45 10 mov 0x10(%ebp),%eax
10053f: 66 89 02 mov %ax,(%edx)
pDesc->base_low = base & 0x0FFFF; // 段基址 1 (2 字节)
100542: 8b 55 08 mov 0x8(%ebp),%edx
100545: 8b 45 0c mov 0xc(%ebp),%eax
100548: 66 89 42 02 mov %ax,0x2(%edx)
pDesc->base_mid = (base >> 16) & 0x0FF; // 段基址 2 (1 字节)
10054c: 8b 55 08 mov 0x8(%ebp),%edx
10054f: 8b 45 0c mov 0xc(%ebp),%eax
100552: c1 e8 10 shr $0x10,%eax
100555: 88 42 04 mov %al,0x4(%edx)
pDesc->attr1 = attribute & 0xFF; // 属性 1
100558: 8b 55 08 mov 0x8(%ebp),%edx
10055b: 0f b7 45 fe movzwl 0xfffffffe(%ebp),%eax
10055f: 88 42 05 mov %al,0x5(%edx)
pDesc->limit_high_attr2 = ((limit >> 16) & 0x0F) | ((attribute >> 8) & 0xF0); // 段界限 2 + 属性 2
100562: 8b 4d 08 mov 0x8(%ebp),%ecx
100565: 8b 45 10 mov 0x10(%ebp),%eax
100568: c1 e8 10 shr $0x10,%eax
10056b: 88 c2 mov %al,%dl
10056d: 80 e2 0f and $0xf,%dl
100570: 0f b7 45 fe movzwl 0xfffffffe(%ebp),%eax
100574: c1 e8 08 shr $0x8,%eax
100577: 24 f0 and $0xf0,%al
100579: 08 d0 or %dl,%al
10057b: 88 41 06 mov %al,0x6(%ecx)
pDesc->base_high = (base >> 24) & 0x0FF; // 段基址 3 (1 字节)
10057e: 8b 55 08 mov 0x8(%ebp),%edx
100581: 8b 45 0c mov 0xc(%ebp),%eax
100584: c1 e8 18 shr $0x18,%eax
100587: 88 42 07 mov %al,0x7(%edx)
}
10058a: c9 leave
10058b: c3 ret
0010058c <_memcpy>:
char* memcpy( char* dest, const char* src, int count )
{
10058c: 55 push %ebp
10058d: 89 e5 mov %esp,%ebp
10058f: 57 push %edi
100590: 56 push %esi
__asm__("cld\n\t"
100591: 8b 4d 10 mov 0x10(%ebp),%ecx
100594: 8b 75 0c mov 0xc(%ebp),%esi
100597: 8b 7d 08 mov 0x8(%ebp),%edi
10059a: fc cld
10059b: f3 a4 repz movsb %ds:(%esi),%es:(%edi)
"rep\n\t"
"movsb"
::"c" (count),"S" (src),"D" (dest));
}
10059d: 5e pop %esi
10059e: 5f pop %edi
10059f: 5d pop %ebp
1005a0: c3 ret
1005a1: 90 nop
1005a2: 90 nop
1005a3: 90 nop
1005a4: 90 nop
1005a5: 90 nop
1005a6: 90 nop
1005a7: 90 nop
1005a8: 90 nop
1005a9: 90 nop
1005aa: 90 nop
1005ab: 90 nop
1005ac: 90 nop
1005ad: 90 nop
1005ae: 90 nop
1005af: 90 nop
001005b0 <_JumpTo10000>:
1005b0: 89 e5 mov %esp,%ebp
1005b2: 8b 45 04 mov 0x4(%ebp),%eax
1005b5: 66 a3 c0 05 10 00 mov %ax,0x1005c0
1005bb: ea 00 00 00 00 00 00 ljmp $0x0,$0x0
001005c0 <_JumpTo10000.seg>:
...
001005c2 <__CTOR_LIST__>:
1005c2: ff (bad)
1005c3: ff (bad)
1005c4: ff (bad)
1005c5: ff 00 incl (%eax)
1005c7: 00 00 add %al,(%eax)
...
001005ca <__DTOR_LIST__>:
1005ca: ff (bad)
1005cb: ff (bad)
1005cc: ff (bad)
1005cd: ff 00 incl (%eax)
1005cf: 00 00 add %al,(%eax)
...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -