1 Su Main的主要代码startup.com的入口代码 2[bits 16] 3[section .text] 4org 0 5Start: 6 jmp RealStart ;地址为0x20000 7 8 times 512-($-$$) db 0 9 10RealStart: 11 mov ax,cs 12 mov ss,ax 13 mov ds,ax 14 15 xor eax,eax 16 xor ecx,ecx 17 xor edx,edx 18 xor ebx,ebx 19 xor esi,esi 20 xor edi,edi 21 xor ebp,ebp 22 mov esp,SuStack 23 call SuMain 24SuMain: 25 push bp 26 mov bp,sp 27 28 call ConstructMemoryDescriptors ;建立和物理内存的描述符 29 call EnableA20 ;开启A20 80286处于实模式下时,防止用户程序访问到100000h~10FFEFh之间的内存(高端内存) 如果读写0x10ffef实际上是0x0ffef 30 call Relocatex86Structures ;重定位GDT和IDT(最感兴趣的全局描述符表和中断描述符表) 31 32 push word 0 33 call EnableProtectPaging ;开启保护模式,但是不开启分页机制。经常搞得禁用cr0 34 add sp,2 35 push dword BootRecord.OsLoaderEnd 36 push dword BootRecord.OsLoaderStart 37 call RelocateLoaderSections ;加载osloader到0x00400000 38 add sp,8 39 40 push eax 41 call TransferToLoader ;把系统控制权转给osloader 42 add sp,4 43 44 mov sp,bp 45 pop bp 46 retn
startup.com主要代码
Easter79
2021-10-12
1024 1 0
点赞
收藏
评论区
加载中...