Let's see if we can utilize two cores of an x86 processor in plain old DOS. Here's the code.
; nasm -O0 -fbin u.asm -o u.com
org 100h
; copy CPU1 code
mov bx, cs
mov ds, bx
mov si, cpu1
mov bx, 0x9000
mov es, bx
xor di, di
mov cx, 512
rep movsb
jmp protected
cpu1:
mov di, 0xB800
mov es, di
mov di, 2
mov al, '1'
stosb
mov al, 15
stosb
hlt
protected:
cli
mov eax, cs
shl eax, 4
add eax, gdt
mov [gdtinfo+2], eax
mov eax, cs
shl eax, 4
add [start_addr], eax
lgdt [gdtinfo]
mov eax, cr0
or eax, 1
mov cr0, eax
db 0x66
db 0xEA
start_addr:
dd start
dw 8
start:
bits 32
mov ax, 0x10
mov ds, ax
mov es, ax
mov edi, 0xB8000
mov [edi+0], byte '0'
mov [edi+1], byte 15
; start CPU1
mov edi, 0xFEE00300
mov [edi], dword 0x000C4500
mov ecx, 10000000
delay:
times 4 nop
loop delay
mov [edi], dword (0x000C4600 + 0x90000/0x1000)
hlt
gdt:
dd 0, 0
db 0xFF, 0xFF, 0, 0, 0, 10011010b, 11001111b, 0
db 0xFF, 0xFF, 0, 0, 0, 10010010b, 11001111b, 0
gdtinfo:
dw $ - gdt - 1
dd 0
No comments:
Post a Comment