Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;==============================================================================
- ;= Digos Operating v 0.0.1 =
- ;= =
- ;= Startup code for AP´s =
- ;= =
- ;= by Rodrigo Fagner =
- ;= =
- ;= Sao Jose do Rio Preto - SP 10/10/2015 08:39 =
- ;==============================================================================
- SECTION .text
- BITS 16
- _entry:
- JMP ap_boot
- ALIGN 4
- GDTPointer dd 0xA1A2A3A4 ; + 1
- IDTPointer dd 0x02020202 ; + 2
- StackPointer dd 0x03030303 ; + 3
- StackTest dd 0xBA000001 ; + 4
- APCPUBooted dd 0xBABBBCBD ; + 5
- ALIGN 4
- ap_boot:
- cli
- cld
- mov ax, cs
- mov ds, ax
- mov es, ax
- mov fs, ax
- mov gs, ax
- mov ss, ax
- mov EAX, StackTest
- mov EBX, [EAX]
- mov ESP, EBX
- MOV EAX, APCPUBooted
- MOV [EAX], DWORD 0xA1B2C3D4
- mov EAX, GDTPointer ; Loaded from smp.c
- lgdt [EAX] ; load GDT into GDTR
- mov EAX, IDTPointer ; Loaded from smp.c
- lidt [EAX] ; load IDT into IDTR
- ;===============================
- ;= Enable PMODE =
- ;===============================
- mov eax, cr0 ; set bit 0 in CR0-go to pmode
- or eax, 1
- mov cr0, eax
- ; Just small delay...
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- ;===============================
- ;= Jump Far =
- ;===============================
- jmp 0x08:.Stage3
- BITS 32
- .Stage3:
- CLI
- CLD
- ;===============================
- ;= Set registers =
- ;===============================
- mov ax, 0x10
- mov ds, ax
- mov es, ax
- mov fs, ax
- mov gs, ax
- mov ss, ax
- mov eax, StackPointer
- call [eax]
- .halt: ; Just to make shure in some case...
- jmp .halt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement