From 06eb2f3614deb425a703b4161c3abfc7b4351a91 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Wed, 20 Aug 2008 18:37:48 +0000 Subject: [PATCH] compact static kernel memory git-svn-id: svn://kolibrios.org@855 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/kolibri_pe/boot/boot.asm | 39 ++++++++++++-- kernel/branches/kolibri_pe/bus/pci/pci32.inc | 6 +-- kernel/branches/kolibri_pe/const.inc | 51 ++++++++++--------- kernel/branches/kolibri_pe/core/v86.inc | 4 +- .../branches/kolibri_pe/drivers/infinity.asm | 2 +- .../kolibri_pe/drivers/sb16/CONFIG.INC | 6 +-- kernel/branches/kolibri_pe/fs/parse_fn.inc | 2 +- kernel/branches/kolibri_pe/kernel.asm | 18 ++++--- kernel/branches/kolibri_pe/ld.x | 1 + 9 files changed, 83 insertions(+), 46 deletions(-) diff --git a/kernel/branches/kolibri_pe/boot/boot.asm b/kernel/branches/kolibri_pe/boot/boot.asm index e2e11b2871..64fe73eb36 100644 --- a/kernel/branches/kolibri_pe/boot/boot.asm +++ b/kernel/branches/kolibri_pe/boot/boot.asm @@ -16,9 +16,10 @@ CR0_PE equ 0x00000001 ;protected mode CR0_WP equ 0x00010000 ;write protect CR0_PG equ 0x80000000 ;paging +public _16bit_start +public _16bit_end public _enter_bootscreen -public _leave_bootscreen public _bx_from_load @@ -26,12 +27,14 @@ extrn __setvars section '.boot' code readable align 16 - -_enter_bootscreen: +_16bit_start: org 0 use16 + +_enter_bootscreen: + mov eax, cr0 and eax, not 0x80000001 mov cr0, eax @@ -71,4 +74,32 @@ include "../detect/biosdisk.inc" jmp pword 0x08:__setvars align 4 -_leave_bootscreen: +_enter_16bit: + mov eax, cr0 + and eax, not 0x80000001 + mov cr0, eax + jmp far 0x1000:@F + +align 4 +_leave_16bit: + + cli + mov eax, cr0 + or eax, CR0_PG+CR0_WP+CR0_PE + mov cr0, eax + hlt + +align 4 +@@: + mov eax, 0x3000 + mov ss, ax + mov esp, 0xEC00 + + mov ebx, 0x1000 + mov ds, bx + mov es, bx + cli + hlt + +align 4 +_16bit_end: diff --git a/kernel/branches/kolibri_pe/bus/pci/pci32.inc b/kernel/branches/kolibri_pe/bus/pci/pci32.inc index e9752b2d10..113c38782d 100644 --- a/kernel/branches/kolibri_pe/bus/pci/pci32.inc +++ b/kernel/branches/kolibri_pe/bus/pci/pci32.inc @@ -398,9 +398,9 @@ sys_pcibios: cmp ebp, 1 ; PCI_FUNCTION_ID jnz .not_PCI_BIOS_PRESENT mov edx, 'PCI ' - mov al, [OS_BASE+0x2F0000 + 0x9020] - mov bx, [OS_BASE+0x2F0000 + 0x9022] - mov cl, [OS_BASE+0x2F0000 + 0x9021] + mov al, [BOOT_VAR + 0x9020] + mov bx, [BOOT_VAR + 0x9022] + mov cl, [BOOT_VAR + 0x9021] xor ah, ah jmp .return_abcd diff --git a/kernel/branches/kolibri_pe/const.inc b/kernel/branches/kolibri_pe/const.inc index 374bdbeacc..47791f18f9 100644 --- a/kernel/branches/kolibri_pe/const.inc +++ b/kernel/branches/kolibri_pe/const.inc @@ -198,7 +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 +_16BIT_BASE equ 0x00010000 LOAD_BASE equ 0x00100000 OS_BASE equ 0xE0000000 @@ -297,41 +297,42 @@ TMP_BUFF equ (OS_BASE+0x0090000) VGABasePtr equ (OS_BASE+0x00A0000) ;RAMDISK equ (OS_BASE+0x0100000) -RAMDISK_FAT equ (OS_BASE+0x0280000) -FLOPPY_FAT equ (OS_BASE+0x0282000) -IDE_DMA equ 0x284000 +RAMDISK_FAT equ (OS_BASE+0x0180000) +FLOPPY_FAT equ (OS_BASE+0x0182000) -BgrAuxTable equ (OS_BASE+0x0298000) +IDE_DMA equ 0x184000 + +BgrAuxTable equ (OS_BASE+0x0198000) ; unused? -SB16Buffer equ (OS_BASE+0x2A0000) -SB16_Status equ (OS_BASE+0x02B0000) +SB16Buffer equ (OS_BASE+0x01A0000) +SB16_Status equ (OS_BASE+0x01B0000) -BUTTON_INFO equ (OS_BASE+0x02C0000) -RESERVED_PORTS equ (OS_BASE+0x02D0000) -IRQ_SAVE equ (OS_BASE+0x02E0000) -BOOT_VAR equ (OS_BASE+0x02f0000) +BUTTON_INFO equ (OS_BASE+0x01C0000) +RESERVED_PORTS equ (OS_BASE+0x01D0000) +IRQ_SAVE equ (OS_BASE+0x01E0000) +BOOT_VAR equ (OS_BASE+0x01f0000) -stack_data_start equ (OS_BASE+0x0300000) -eth_data_start equ (OS_BASE+0x0300000) -stack_data equ (OS_BASE+0x0304000) -stack_data_end equ (OS_BASE+0x031ffff) -resendQ equ (OS_BASE+0x0320000) -VMODE_BASE equ (OS_BASE+0x0328000) -skin_data equ (OS_BASE+0x0330000) -draw_data equ (OS_BASE+0x0338000); +stack_data_start equ (OS_BASE+0x0200000) +eth_data_start equ (OS_BASE+0x0200000) +stack_data equ (OS_BASE+0x0204000) +stack_data_end equ (OS_BASE+0x021ffff) +resendQ equ (OS_BASE+0x0220000) +VMODE_BASE equ (OS_BASE+0x0228000) +skin_data equ (OS_BASE+0x0230000) +draw_data equ (OS_BASE+0x0238000); -BgrDrawMode equ (OS_BASE+0x033BFF4) -BgrDataWidth equ (OS_BASE+0x033BFF8) -BgrDataHeight equ (OS_BASE+0x033BFFC) +BgrDrawMode equ (OS_BASE+0x023BFF4) +BgrDataWidth equ (OS_BASE+0x023BFF8) +BgrDataHeight equ (OS_BASE+0x023BFFC) -;display_data equ (OS_BASE+0x033C000) ;1024*1280=0x140000 +;display_data equ (OS_BASE+0x023C000) ;1024*1280=0x140000 -virtual at (OS_BASE+0x033CF80) +virtual at (OS_BASE+0x023CF80) tss TSS end virtual -LAST_PAGE equ 0x0340000 +LAST_PAGE equ 0x0240000 ;sys_pgmap equ (OS_BASE+LAST_PAGE) diff --git a/kernel/branches/kolibri_pe/core/v86.inc b/kernel/branches/kolibri_pe/core/v86.inc index a84b1fd993..ee509c56d9 100644 --- a/kernel/branches/kolibri_pe/core/v86.inc +++ b/kernel/branches/kolibri_pe/core/v86.inc @@ -91,8 +91,8 @@ v86_create: ; now V86 specific: initialize known addresses in first Mb pop eax ; first page - BIOS data (shared between all machines!) -; physical address = 0x2f0000 -; linear address = BOOT_VAR = OS_BASE + 0x2f0000 +; physical address = 0x1f0000 +; linear address = BOOT_VAR = OS_BASE + 0x1f0000 mov dword [eax], (BOOT_VAR - OS_BASE) or 111b mov dword [eax+800h], BOOT_VAR ; page before 0xA0000 - Extended BIOS Data Area (shared between all machines!) diff --git a/kernel/branches/kolibri_pe/drivers/infinity.asm b/kernel/branches/kolibri_pe/drivers/infinity.asm index 2e006c935d..e0ad10c419 100644 --- a/kernel/branches/kolibri_pe/drivers/infinity.asm +++ b/kernel/branches/kolibri_pe/drivers/infinity.asm @@ -33,7 +33,7 @@ FORCE_MMX_128 equ 0 ;integer sse2 extensions USE_SSE2_MIXER equ 0 ;floating point mixer. Disabled by default -OS_BASE equ 0x80000000 +OS_BASE equ 0xE0000000 CAPS_SSE2 equ 26 PG_SW equ 0x003 diff --git a/kernel/branches/kolibri_pe/drivers/sb16/CONFIG.INC b/kernel/branches/kolibri_pe/drivers/sb16/CONFIG.INC index d39356ed69..399a12a806 100644 --- a/kernel/branches/kolibri_pe/drivers/sb16/CONFIG.INC +++ b/kernel/branches/kolibri_pe/drivers/sb16/CONFIG.INC @@ -5,11 +5,11 @@ use_cli_sti equ 1 ;driver come more stable (theoretically) ;constants-------------------------------------------------------- API_VERSION equ 0 ;debug -OS_BASE equ 0x80000000 +OS_BASE equ 0xE0000000 new_app_base equ 0x0 PROC_BASE equ (OS_BASE+0x080000) -SB16Buffer equ (OS_BASE+0x2A0000) -SB16_Status equ (OS_BASE+0x2B0000) +SB16Buffer equ (OS_BASE+0x1A0000) +SB16_Status equ (OS_BASE+0x1B0000) DMAPage equ ((SB16Buffer-OS_BASE) shr 16) SB16Buffer0 equ SB16Buffer diff --git a/kernel/branches/kolibri_pe/fs/parse_fn.inc b/kernel/branches/kolibri_pe/fs/parse_fn.inc index 1e0f5196f4..9f1067c71f 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+BOOT_BASE] + mov eax,[_bx_from_load+OS_BASE+_16BIT_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 27309abb0a..547a07bdbe 100644 --- a/kernel/branches/kolibri_pe/kernel.asm +++ b/kernel/branches/kolibri_pe/kernel.asm @@ -123,8 +123,10 @@ public @balloc@4 public __setvars +extrn _16bit_start +extrn _16bit_end + extrn _enter_bootscreen -extrn _leave_bootscreen extrn _init extrn _init_mm @@ -352,14 +354,16 @@ _high_code: call _init_mm mov [pg_data.pg_mutex], 0 - mov esi, _enter_bootscreen - mov ecx, _leave_bootscreen + mov esi, _16bit_start + mov ecx, _16bit_end shr ecx, 2 - mov edi, BOOT_BASE + mov edi, _16BIT_BASE cld rep movsd - jmp far 0x60:0x00000; + xchg bx, bx + + jmp far 0x60:_enter_bootscreen; align 4 __setvars: @@ -376,7 +380,7 @@ __setvars: ; SAVE & CLEAR 0-0xffff xor esi, esi - mov edi,0x2F0000 + mov edi,0x1F0000 mov ecx,0x10000 / 4 rep movsd xor edi, edi @@ -5164,7 +5168,7 @@ yes_shutdown_param: ; mov ecx,1000 ; rep movsb - mov esi,OS_BASE+0x2F0000 ; restore 0x0 - 0xffff + mov esi, BOOT_VAR ; restore 0x0 - 0xffff mov edi, OS_BASE mov ecx,0x10000/4 cld diff --git a/kernel/branches/kolibri_pe/ld.x b/kernel/branches/kolibri_pe/ld.x index beb5e20bac..a4bd738a4a 100644 --- a/kernel/branches/kolibri_pe/ld.x +++ b/kernel/branches/kolibri_pe/ld.x @@ -26,6 +26,7 @@ SECTIONS { *(.bss) *(COMMON) } + __kernel_end = . - 0xE0000000; /DISCARD/ : {