I confirm it stills not working. The latest source code is:
Code: Select all
/********************************************************************************/
/* */
/* FIREBIRD OS */
/* */
/* This is a simple asm bootloader for Firebird OS */
/* */
/********************************************************************************/
#################################
# Main code... #
#################################
.code16
.text
.globl _start
.include "kernel/kernel.inc"
_start:
/* Initialize segment registers... */
ljmp $0x0000, $0x7C05
xorw %ax, %ax
movw %ax, %ds
movw %ax, %ss
movw $0x7c00, %sp
/* Clear screen... */
call clear_screen
/* BIOS will copy kernel to es:bx ... */
pushw $KERNEL_POS_ES # KERNEL_POS_ES:KERNEL_POS_BX...
popw %es
movw $KERNEL_POS_BX, %bx
/* Copy function settings... */
movb $0x2, %ah # Copy function...
movb $KERNEL_SECT, %al # Sectors to read...
movb $0x0, %ch # Cylinder 0...
movb $0x2, %cl # Sector 2...
movb $0x0, %dh # Head 0...
movb $0x0, %dl # Device 0...
/* Read... */
int $0x13
jnc read_done
/* Error reading... */
call reset_floppy
jnc _start # Read again...
/* Error reseting floppy... */
jmp error # Die...
read_done:
/* Enable A20 gate... */
cli # Clear interrupts...
inb $0x92, %al # Open al to port 0x92...
or $0x2, %al # Send value 0x2 to al...
outb %al, $0x92 # Close al port 0x92...
sti # Re-enable interrupts...
/* Move the GDT and load it... */
movw $GDT_ADDR>>4, %ax
movw %ax, %es
movw $gdt, %si
xorw %di, %di
movw $GDT_SIZE>>2, %cx
rep movsl
lgdt gdtr
/* Go protected mode... */
cli
movl %cr0, %eax
or $1, %eax
movl %eax, %cr0
ljmp $CODE_SEL, $protected_mode
.code32
protected_mode:
/* Jump to kernel... */
ljmp $CODE_SEL, $((KERNEL_POS_ES<<4)+KERNEL_POS_BX)
.code16
/* If we reach here something went wrong... */
error:
movw $error_str, %si
call print_string
/* Halt execution if we reach here... */
halt:
hlt
jmp halt
#################################
# Functions... #
#################################
reset_floppy:
push %ax # We use ax and dx so save the values...
push %dx
movw $0x0, %ax
movb $0x0, %dl # Drive to reset...
stc # Activate cartage flag...
int $0x13
pop %dx # Restore ax and dx...
pop %ax
ret
print_string:
pusha
movb $0xe, %ah # Teletype function...
.repeat:
lodsb # Get char from str...
cmpb $0, %al # End of string?
je .done
int $0x10 # Exec function...
jmp .repeat # Next char...
.done:
popa
ret
clear_screen:
push %ax
push %cx
push %bx
push %dx
movw $0x6, %ax # Clear screen function...
movw $0x0, %cx # Clear from 0, 0...
movw $0x174f, %dx # To 23, 79...
movb $0x0, %bh # Black background...
int $0x10
pop %dx
pop %cx
pop %bx
pop %ax
ret
#################################
# Data... #
#################################
error_str:
.ascii "[!] Error booting Firebird OS...\0"
#################################
# GDT descriptor... #
#################################
gdtr:
gdtsize: .word gdt_end-gdt-1
gdtbase: .long GDT_ADDR
gdt:
/* Null descriptor... */
.quad 0x0000000000000000
/* Code segment with 4GB flat memory model... */
.quad 0x00cf9a000000ffff
/* Data segment with 4GB flat memory model... */
.quad 0x00cf92000000ffff
/* For future use... */
.quad 0x0000000000000000
.quad 0x0000000000000000
gdt_end:
#################################
# Boot signature... #
#################################
.org 0x1fe
.word 0xaa55
Code: Select all
/********************************************************************************/
/* */
/* FIREBIRD OS */
/* */
/* Here I specify a set of constants (memory addresses...) that my operative */
/* system will use in it's kernel. */
/* */
/********************************************************************************/
.set CODE_SEL, 0x8 # Code segment selector in kernel mode...
.set DATA_SEL, 0x10 # Data segment selector in kernel mode...
.set IDT_ADDR, 0x80000 # TODO: For future use...
.set IDT_SIZE, (256*8) # TODO: For future use...
.set GDT_ADDR, (IDT_ADDR+IDT_SIZE) # GDT starts after IDT...
.set GDT_ENTRIES, 5 # Our GDT has 5 descritors...
.set GDT_SIZE, (8*GDT_ENTRIES) # GDT length...
.set KERNEL_SECT, 0x1 # Kernel size in sectors...
.set KERNEL_POS_ES, 0x1000 # Initial kernel position (ES:BX)...
.set KERNEL_POS_BX, 0x0
.set STACK_BOT, 0xa0000 # Stack starts at 640K and grows downside...
Code: Select all
/********************************************************************************/
/* */
/* FIREBIRD OS */
/* */
/* This is a simple asm testing kernel for Firebird OS */
/* */
/********************************************************************************/
.text
.globl _start
.include "kernel/kernel.inc"
.org 0
_start:
movw $DATA_SEL, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
movw %ax, %ss
#movl $STACK_BOT, %esp
movw $0x2046, 0xb8000
movw $0x2069, 0xb8002
movw $0x2072, 0xb8004
movw $0x2065, 0xb8006
movw $0x2062, 0xb8008
movw $0x2069, 0xb800a
movw $0x2072, 0xb800c
movw $0x2064, 0xb800e
movw $0x2020, 0xb8010
movw $0x204f, 0xb8012
movw $0x2053, 0xb8014
halt:
hlt
jmp halt