Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 851 → Rev 850

/kernel/branches/kolibri_pe/data32.inc
171,10 → 171,10
IncludeIGlobals
 
align 16
_gdts:
gdts:
 
dw 0x67; gdte-$-1
dd _gdts
dw gdte-$-1
dd gdts
dw 0
 
; Attention! Do not change the order of the first four selectors. They are used in Fast System Call
/kernel/branches/kolibri_pe/kernel.asm
74,14 → 74,14
tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
 
 
os_stack equ (os_data_l-_gdts) ; GDTs
os_code equ (os_code_l-_gdts)
graph_data equ (3+graph_data_l-_gdts)
tss0 equ (tss0_l-_gdts)
app_code equ (3+app_code_l-_gdts)
app_data equ (3+app_data_l-_gdts)
pci_code_sel equ (pci_code_32-_gdts)
pci_data_sel equ (pci_data_32-_gdts)
os_stack equ (os_data_l-gdts) ; GDTs
os_code equ (os_code_l-gdts)
graph_data equ (3+graph_data_l-gdts)
tss0 equ (tss0_l-gdts)
app_code equ (3+app_code_l-gdts)
app_data equ (3+app_data_l-gdts)
pci_code_sel equ (pci_code_32-gdts)
pci_data_sel equ (pci_data_32-gdts)
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
107,29 → 107,178
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
section '.flat' code readable align 16
 
public __os_stack
public _boot_mbi
public _sys_pdbr
public _gdts
public _high_code
public __start
 
public __setvars
extrn __edata
 
extrn _enter_bootscreen
extrn _leave_bootscreen
use32
org 0x001001E0
 
extrn _bx_from_load
align 4
 
section '.flat' code readable align 16
mboot:
dd 0x1BADB002
dd 0x00010003
dd -(0x1BADB002 + 0x00010003)
dd mboot
dd 0x100000
dd __edata; ;__edata - OS_BASE
dd LAST_PAGE
dd __start
 
use32
align 16
__start:
cld
 
org 0xE0102000
mov esp, __os_stack-OS_BASE
push 0
popf
 
cmp eax, 0x2BADB002
mov ecx, sz_invboot
jne .fault
 
bt dword [ebx], 3
mov ecx, sz_nomods
jnc .fault
 
bt dword [ebx], 6
mov ecx, sz_nommap
jnc .fault
 
mov [_boot_mbi-OS_BASE], ebx
 
xor eax, eax
cpuid
cmp eax, 0
mov ecx, sz_nopse
jbe .fault
 
mov eax, 1
cpuid
bt edx, 3
mov ecx, sz_nopse
jnc .fault
 
; ENABLE PAGING
 
mov ecx, 32
mov edi, _sys_pdbr+(OS_BASE shr 20)-OS_BASE
mov eax, PG_LARGE+PG_SW
@@:
stosd
add eax, 4*1024*1024
loop @B
 
mov dword [_sys_pdbr-OS_BASE], PG_LARGE+PG_SW
mov dword [_sys_pdbr-OS_BASE+4], PG_LARGE+PG_SW+4*1024*1024
mov dword [_sys_pdbr-OS_BASE+(page_tabs shr 20)], _sys_pdbr+PG_SW-OS_BASE
 
mov ebx, cr4
or ebx, CR4_PSE
and ebx, not CR4_PAE
mov cr4, ebx
 
mov eax, _sys_pdbr-OS_BASE
mov ebx, cr0
or ebx,CR0_PG+CR0_WP
 
mov cr3, eax
mov cr0, ebx
 
mov ebx, [_boot_mbi]
 
mov edx, [ebx+20]
mov esi, [ebx+24]
mov ecx, LAST_PAGE
test edx, edx
jz .no_mods
.scan_mod:
mov ecx, [esi+4]
add esi, 16
dec edx
jnz .scan_mod
 
.no_mods:
add ecx, 4095
and ecx, not 4095
 
lgdt [gdts]
jmp pword os_code:high_code
 
 
.fault:
; push ecx
; call _lcls
; call __bprintf
_hlt:
hlt
jmp _hlt
 
sz_invboot db 'Invalid multiboot loader magic value',0x0A
db 'Halted',0
 
sz_nomods db 'No modules loaded',0x0A
db 'Halted',0
 
sz_nommap db 'No memory table', 0x0A
db 'Halted',0
 
sz_nopse db 'Page size extensions not supported',0x0A
db 'Halted',0
 
org $-0x100000
 
align 4
 
_enter_bootscreen:
 
use16
mov eax, cr0
and eax, not 0x80000001
mov cr0, eax
jmp far 0x1000:start_of_code
 
version db 'Kolibri OS version 0.7.1.0 ',13,10,13,10,0
 
include "boot/bootstr.inc" ; language-independent boot messages
include "boot/preboot.inc"
 
if lang eq en
include "boot/booteng.inc" ; english system boot messages
else if lang eq ru
include "boot/bootru.inc" ; russian system boot messages
include "boot/ru.inc" ; Russian font
else if lang eq et
include "boot/bootet.inc" ; estonian system boot messages
include "boot/et.inc" ; Estonian font
else
include "boot/bootge.inc" ; german system boot messages
end if
 
include "data16.inc"
 
include "boot/bootcode.inc" ; 16 bit system boot code
include "bus/pci/pci16.inc"
include "detect/biosdisk.inc"
 
;include "boot/shutdown.inc" ; shutdown or restart
 
cli
 
mov eax, cr0
or eax, 0x80000001
mov cr0, eax
 
jmp pword os_code:__setvars
 
org $+0x100000
 
align 4
_leave_bootscreen:
 
use32
 
 
192,6 → 341,8
__DEBUG_LEVEL__ fix 1
 
 
org OS_BASE+$
 
MEM_WB equ 6 ;write-back memory
MEM_WC equ 1 ;write combined memory
MEM_UC equ 0 ;uncached memory
302,7 → 453,7
endp
 
align 4
_high_code:
high_code:
mov ax,os_stack
mov dx,app_data
mov ss,ax
313,9 → 464,10
mov fs, dx
mov gs, dx
 
; push ecx
; push ebx
push ecx
push ebx
 
; mov dword [sys_pgdir-OS_BASE+(page_tabs shr 20)], sys_pgdir+PG_SW-OS_BASE
 
; bt [cpu_caps], CAPS_PGE
; jnc @F
326,6 → 478,10
; or ebx, CR4_PGE
; mov cr4, ebx
@@:
; xor eax, eax
; mov dword [sys_pgdir], eax
; mov dword [sys_pgdir+4], eax
 
; mov eax, cr3
; mov cr3, eax ; flush TLB
 
372,14 → 528,13
call _init_mm
mov [pg_data.pg_mutex], 0
 
mov esi, _enter_bootscreen
mov ecx, _leave_bootscreen
shr ecx, 2
mov edi, BOOT_BASE
mov esi, 0x100000
mov ecx, (_leave_bootscreen-0x100000)/4
mov edi, 0x10000
cld
rep movsd
 
jmp far 0x60:0x00000;
jmp far 0x60:_enter_bootscreen;
 
align 4
__setvars:
434,7 → 589,7
mov [dword apm_data_16 + 4], dl
 
mov dword[apm_entry], ebx
mov word [apm_entry + 4], apm_code_32 - _gdts
mov word [apm_entry + 4], apm_code_32 - gdts
 
mov eax, [BOOT_VAR + 0x9044] ; version & flags
mov [apm_vf], eax
649,8 → 804,6
include 'detect/disks.inc'
;!!!!!!!!!!!!!!!!!!!!!!!!!!
 
xchg bx, bx
 
call Parser_params
 
; READ RAMDISK IMAGE FROM HD
/kernel/branches/kolibri_pe/ld.x
9,15 → 9,8
. = SIZEOF_HEADERS;
. = ALIGN(32);
 
.boot . + __image_base__ :
.flat . + __image_base__ :
{
*(.boot)
*(.init)
. = ALIGN(4096);
}
 
.flat :
{
*(.flat)
}
__edata = .;
/kernel/branches/kolibri_pe/boot/boot.asm
File deleted
/kernel/branches/kolibri_pe/boot/init.asm
File deleted
/kernel/branches/kolibri_pe/boot/boot
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/kernel/branches/kolibri_pe/boot/bootcode.inc
32,9 → 32,9
print:
; in: si->string
mov al, 186
call word putchar
call putchar
mov al, ' '
call word putchar
call putchar
 
printplain:
; in: si->string
/kernel/branches/kolibri_pe/const.inc
198,7 → 198,6
kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) ;0xFDE00000
master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000
 
BOOT_BASE equ 0x00010000
LOAD_BASE equ 0x00100000
OS_BASE equ 0xE0000000
 
/kernel/branches/kolibri_pe/data16.inc
12,7 → 12,7
preboot_lfb db 0
preboot_bootlog db 0
boot_drive db 0
_bx_from_load: dw 'r1' ; ñòðóêòóðà äëÿ õðàíåíèÿ ïàðàìåòðîâ- îòêóäà ãàøðóçèëèñü, áåðåòñÿ íèæå èç bx ; {SPraid}[13.03.2007]
bx_from_load: dw 'r1' ; ñòðóêòóðà äëÿ õðàíåíèÿ ïàðàìåòðîâ- îòêóäà ãàøðóçèëèñü, áåðåòñÿ íèæå èç bx ; {SPraid}[13.03.2007]
; a,b,c,d - âèí÷åñòåðû, r - ðàì äèñê
; # äèñêà... ñèìâîë, à íå áàéò. '1', à íå 1
 
/kernel/branches/kolibri_pe/fs/parse_fn.inc
40,7 → 40,7
locals
buff db 4 dup(?) ; for test cd
endl
mov eax,[_bx_from_load+OS_BASE+BOOT_BASE]
mov eax,[bx_from_load+OS_BASE+LOAD_BASE]
mov ecx,sysdir_path
mov [ecx-64],dword 'sys'
cmp al,'r' ; if ram disk
/kernel/branches/kolibri_pe/makefile
1,37 → 1,48
FASM=fasm
FLAGS=-m 65536
languages=en|ru|ge|et
drivers_src=sound sis infinity ensoniq ps2mouse uart ati2d vmode
skins_src=default
 
CC = gcc
FASM = fasm.exe
.PHONY: all kernel drivers skins clean
 
INCLUDE = include
all: kernel drivers skins
 
CFLAGS = -c -O2 -I $(INCLUDE) -fomit-frame-pointer -fno-builtin-printf -masm=intel
LDFLAGS = -shared -s -Map kernel.map --image-base 0x100000 --file-alignment 32
kernel: check_lang
@echo "*** building kernel with language '$(lang)' ..."
@mkdir -p bin
@echo "lang fix $(lang)" > lang.inc
@echo "--- building 'bin/kernel.mnt' ..."
@$(FASM) $(FLAGS) kernel.asm bin/kernel.mnt
@rm -f lang.inc
 
drivers:
@echo "*** building drivers ..."
@mkdir -p bin/drivers
@cd drivers; for f in $(drivers_src); do \
echo "--- building 'bin/drivers/$${f}.obj' ..."; \
$(FASM) $(FLAGS) $${f}.asm ../bin/drivers/$${f}.obj; \
done
@mv bin/drivers/vmode.obj bin/drivers/vmode.mdr
 
KERNEL_SRC:= \
kernel.asm \
boot/boot.asm \
boot/init.asm
skins:
@echo "*** building skins ..."
@mkdir -p bin/skins
@cd skin; for f in $(skins_src); do \
echo "--- building 'bin/skins/$${f}.skn' ..."; \
$(FASM) $(FLAGS) $${f}.asm ../bin/skins/$${f}.skn; \
done
check_lang:
@case "$(lang)" in \
$(languages)) \
;; \
*) \
echo "*** error: language is incorrect or not specified"; \
exit 1; \
;; \
esac
 
KERNEL_OBJS = $(patsubst %.s, bin/%.obj, $(patsubst %.asm, bin/%.obj,\
$(patsubst %.c, bin/%.obj, $(KERNEL_SRC))))
 
 
all: kernel.gz
 
kernel.gz :kernel.mnt
7z a -tgzip kernel.gz kernel.mnt
 
kernel.mnt: $(KERNEL_OBJS) Makefile ld.x
ld $(LDFLAGS) -T ld.x -o $@ $(KERNEL_OBJS)
bin/%.obj: %.asm
$(FASM) $< $@
 
bin/%.obj : core/%.c
$(CC) $(CFLAGS) -o $@ -c $<
 
all: $(SUBDIRS)
 
.PHONY: all
clean:
rm -rf bin
rm -f lang.inc