From 4637e1f6a39d81d02705cc0926ff8c427dc60f60 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Sun, 10 Aug 2008 05:23:24 +0000 Subject: [PATCH] splitting kernel into sections git-svn-id: svn://kolibrios.org@851 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/kolibri_pe/boot/boot | Bin 0 -> 7060 bytes kernel/branches/kolibri_pe/boot/boot.asm | 69 ++++++ kernel/branches/kolibri_pe/boot/bootcode.inc | 4 +- kernel/branches/kolibri_pe/boot/init.asm | 135 +++++++++++ kernel/branches/kolibri_pe/const.inc | 1 + kernel/branches/kolibri_pe/data16.inc | 2 +- kernel/branches/kolibri_pe/data32.inc | 6 +- kernel/branches/kolibri_pe/fs/parse_fn.inc | 2 +- kernel/branches/kolibri_pe/kernel.asm | 225 +++---------------- kernel/branches/kolibri_pe/ld.x | 9 +- kernel/branches/kolibri_pe/makefile | 85 +++---- 11 files changed, 293 insertions(+), 245 deletions(-) create mode 100644 kernel/branches/kolibri_pe/boot/boot create mode 100644 kernel/branches/kolibri_pe/boot/boot.asm create mode 100644 kernel/branches/kolibri_pe/boot/init.asm diff --git a/kernel/branches/kolibri_pe/boot/boot b/kernel/branches/kolibri_pe/boot/boot new file mode 100644 index 0000000000000000000000000000000000000000..5ee998df2201cb4fb2814d7c6d7e1987d1167922 GIT binary patch literal 7060 zcmb_B3shTGw&z~LO`1}|v{h>z!*NFM@2~egXO>`jYK1)`fR|t;gMvSd za+Ygw7k5`w6rb1ptn0gX=AxvB_Z98kW!j53Y{qzhp{Zo=zGAG`J)kq_^jI3R)U(v+ zOwZpx@aEh{aN6RfxTmMXE1&(3n!R3p!+ZRHbisM2|A7O0r5MN)jS&6thIQF1H)Z4O z^;y%vYcApGb9)@To5%3q`odyMp_zoph22hkBIvC5^o4jw(?w?pyIqZZqw8B-#|I1C zA=h!;#6{r}wVwK*$L@AIabL416m*50*n!XS$D5pZ)rOo$vmeRQZP~hILf{6g_v61m z2d1C!K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-{s>uQZrVI=HFYPN2|mCQ9hn+VXZ@Xgs((y^tGBAXuj9d zpwYfvKEBa%FEm$cAa7~F6ki>%4ymg_kHjtH$z-}ZKpqu?&xmlR!%vE&nQvpo{iv3C zmV%Y8Wu7A|Q_DP0RqGB=gBjBO&P9A1>7=1%{HsUL0-h_vgg&8~$5n;gV*ZiZ<2$Ej*YZH^-5Va7doq`~8 z_c6br;b~Q}bofha*H1cTBl4nUj6aD>R7UD#znMN6u1Y)|uh2W*kB3wv(OVZ0=0}KM zS4FsjF2|Rx6xyzkH%175vH2$B0m}~pe}yy*FSj-EiDz!*ay|hd8I%N8=RgzD z2=84HYNhi%SA;`Xp&kCzM)6jPbtKyiT}QfDyUJGWw~ov)tE?ll&2eq?hMuI#bMTI* zIjo6T$7Wk@ZHf1O7Po1rg1JpaYj z%$=IX7gsB~1cfz7RTwW(=9$ZvR~Vn6;98>ClpIzAZwqQ92%Da0QIsg6A6lxfYT*0S zEO^&1hwoF|cjTp6g*@{SBEQh(-(|5M1kx8R_?80WX80rDyU1?=nQ}K!+=string mov al, 186 - call putchar + call word putchar mov al, ' ' - call putchar + call word putchar printplain: ; in: si->string diff --git a/kernel/branches/kolibri_pe/boot/init.asm b/kernel/branches/kolibri_pe/boot/init.asm new file mode 100644 index 0000000000..81d6e358d9 --- /dev/null +++ b/kernel/branches/kolibri_pe/boot/init.asm @@ -0,0 +1,135 @@ + +format MS COFF + +include '../macros.inc' + +$Revision: 849 $ + +include "../const.inc" + +public __start + +extrn _high_code +extrn __os_stack +extrn _boot_mbi +extrn _sys_pdbr + +extrn _gdts +extrn __edata + +section '.init' code readable align 16 + +use32 + +align 4 + +mboot: + dd 0x1BADB002 + dd 0x00010003 + dd -(0x1BADB002 + 0x00010003) + dd mboot + dd 0x100000 + dd __edata; - OS_BASE + dd LAST_PAGE + dd __start + +align 16 +__start: + cld + + mov esp, __os_stack +(0x100000000-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+(0x100000000-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)+(0x100000000-OS_BASE) + mov eax, PG_LARGE+PG_SW +@@: + stosd + add eax, 4*1024*1024 + loop @B + + mov dword [_sys_pdbr+(0x100000000-OS_BASE)], PG_LARGE+PG_SW + mov dword [_sys_pdbr+(0x100000000-OS_BASE)+4], PG_LARGE+PG_SW+4*1024*1024 + mov dword [_sys_pdbr+(0x100000000-OS_BASE)+(page_tabs shr 20)], _sys_pdbr+PG_SW+(0x100000000-OS_BASE) + + mov ebx, cr4 + or ebx, CR4_PSE + and ebx, not CR4_PAE + mov cr4, ebx + + mov eax, _sys_pdbr+(0x100000000-OS_BASE) + mov ebx, cr0 + or ebx,CR0_PG+CR0_WP + + mov cr3, eax + mov cr0, ebx + + mov ebx, [_boot_mbi+(0x100000000-OS_BASE)] + + 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+(0x100000000-OS_BASE)] + jmp pword 0x08:_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 diff --git a/kernel/branches/kolibri_pe/const.inc b/kernel/branches/kolibri_pe/const.inc index 3d20d5e62b..d50d5c9e06 100644 --- a/kernel/branches/kolibri_pe/const.inc +++ b/kernel/branches/kolibri_pe/const.inc @@ -198,6 +198,7 @@ OS_TEMP equ 0xDFC00000 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 diff --git a/kernel/branches/kolibri_pe/data16.inc b/kernel/branches/kolibri_pe/data16.inc index 974119f4c8..7dc22ec955 100644 --- a/kernel/branches/kolibri_pe/data16.inc +++ b/kernel/branches/kolibri_pe/data16.inc @@ -12,7 +12,7 @@ flm db 0 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 diff --git a/kernel/branches/kolibri_pe/data32.inc b/kernel/branches/kolibri_pe/data32.inc index 5d675a5e6b..578b1ee57f 100644 --- a/kernel/branches/kolibri_pe/data32.inc +++ b/kernel/branches/kolibri_pe/data32.inc @@ -171,10 +171,10 @@ end if IncludeIGlobals align 16 -gdts: +_gdts: - dw gdte-$-1 - dd gdts + dw 0x67; gdte-$-1 + dd _gdts dw 0 ; Attention! Do not change the order of the first four selectors. They are used in Fast System Call diff --git a/kernel/branches/kolibri_pe/fs/parse_fn.inc b/kernel/branches/kolibri_pe/fs/parse_fn.inc index 142f687304..1e0f5196f4 100644 --- a/kernel/branches/kolibri_pe/fs/parse_fn.inc +++ b/kernel/branches/kolibri_pe/fs/parse_fn.inc @@ -40,7 +40,7 @@ proc Parser_params locals buff db 4 dup(?) ; for test cd endl - mov eax,[bx_from_load+OS_BASE+LOAD_BASE] + mov eax,[_bx_from_load+OS_BASE+BOOT_BASE] mov ecx,sysdir_path mov [ecx-64],dword 'sys' cmp al,'r' ; if ram disk diff --git a/kernel/branches/kolibri_pe/kernel.asm b/kernel/branches/kolibri_pe/kernel.asm index 5c4e6d4b14..897bace85f 100644 --- a/kernel/branches/kolibri_pe/kernel.asm +++ b/kernel/branches/kolibri_pe/kernel.asm @@ -74,14 +74,14 @@ max_processes equ 255 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,178 +107,29 @@ pci_data_sel equ (pci_data_32-gdts) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +public __os_stack +public _boot_mbi +public _sys_pdbr +public _gdts +public _high_code + +public __setvars + +extrn _enter_bootscreen +extrn _leave_bootscreen + +extrn _bx_from_load + section '.flat' code readable align 16 -public __start - -extrn __edata - use32 -org 0x001001E0 + +org 0xE0102000 + align 4 -mboot: - dd 0x1BADB002 - dd 0x00010003 - dd -(0x1BADB002 + 0x00010003) - dd mboot - dd 0x100000 - dd __edata; ;__edata - OS_BASE - dd LAST_PAGE - dd __start - -align 16 -__start: - cld - - 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 @@ -341,8 +192,6 @@ __DEBUG__ fix 1 __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 @@ -453,7 +302,7 @@ proc test_cpu endp align 4 -high_code: +_high_code: mov ax,os_stack mov dx,app_data mov ss,ax @@ -464,10 +313,9 @@ high_code: 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 @@ -478,10 +326,6 @@ high_code: ; 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 @@ -528,13 +372,14 @@ high_code: call _init_mm mov [pg_data.pg_mutex], 0 - mov esi, 0x100000 - mov ecx, (_leave_bootscreen-0x100000)/4 - mov edi, 0x10000 + mov esi, _enter_bootscreen + mov ecx, _leave_bootscreen + shr ecx, 2 + mov edi, BOOT_BASE cld rep movsd - jmp far 0x60:_enter_bootscreen; + jmp far 0x60:0x00000; align 4 __setvars: @@ -589,7 +434,7 @@ __setvars: 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 @@ -804,6 +649,8 @@ __setvars: include 'detect/disks.inc' ;!!!!!!!!!!!!!!!!!!!!!!!!!! + xchg bx, bx + call Parser_params ; READ RAMDISK IMAGE FROM HD diff --git a/kernel/branches/kolibri_pe/ld.x b/kernel/branches/kolibri_pe/ld.x index 18a92d377f..ce23e74e06 100644 --- a/kernel/branches/kolibri_pe/ld.x +++ b/kernel/branches/kolibri_pe/ld.x @@ -9,7 +9,14 @@ SECTIONS . = SIZEOF_HEADERS; . = ALIGN(32); - .flat . + __image_base__ : + .boot . + __image_base__ : + { + *(.boot) + *(.init) + . = ALIGN(4096); + } + + .flat : { *(.flat) } diff --git a/kernel/branches/kolibri_pe/makefile b/kernel/branches/kolibri_pe/makefile index e5f89bc4ae..5fb77e8dd6 100644 --- a/kernel/branches/kolibri_pe/makefile +++ b/kernel/branches/kolibri_pe/makefile @@ -1,48 +1,37 @@ -FASM=fasm -FLAGS=-m 65536 -languages=en|ru|ge|et -drivers_src=sound sis infinity ensoniq ps2mouse uart ati2d vmode -skins_src=default - -.PHONY: all kernel drivers skins clean - -all: kernel drivers skins - -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 - -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 - -clean: - rm -rf bin - rm -f lang.inc + +CC = gcc +FASM = fasm.exe + +INCLUDE = include + +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_SRC:= \ + kernel.asm \ + boot/boot.asm \ + boot/init.asm + + +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