compact static kernel memory

git-svn-id: svn://kolibrios.org@855 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-08-20 18:37:48 +00:00
parent e7779275eb
commit 06eb2f3614
9 changed files with 83 additions and 46 deletions

View File

@ -16,9 +16,10 @@ CR0_PE equ 0x00000001 ;protected mode
CR0_WP equ 0x00010000 ;write protect CR0_WP equ 0x00010000 ;write protect
CR0_PG equ 0x80000000 ;paging CR0_PG equ 0x80000000 ;paging
public _16bit_start
public _16bit_end
public _enter_bootscreen public _enter_bootscreen
public _leave_bootscreen
public _bx_from_load public _bx_from_load
@ -26,12 +27,14 @@ extrn __setvars
section '.boot' code readable align 16 section '.boot' code readable align 16
_16bit_start:
_enter_bootscreen:
org 0 org 0
use16 use16
_enter_bootscreen:
mov eax, cr0 mov eax, cr0
and eax, not 0x80000001 and eax, not 0x80000001
mov cr0, eax mov cr0, eax
@ -71,4 +74,32 @@ include "../detect/biosdisk.inc"
jmp pword 0x08:__setvars jmp pword 0x08:__setvars
align 4 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:

View File

@ -398,9 +398,9 @@ sys_pcibios:
cmp ebp, 1 ; PCI_FUNCTION_ID cmp ebp, 1 ; PCI_FUNCTION_ID
jnz .not_PCI_BIOS_PRESENT jnz .not_PCI_BIOS_PRESENT
mov edx, 'PCI ' mov edx, 'PCI '
mov al, [OS_BASE+0x2F0000 + 0x9020] mov al, [BOOT_VAR + 0x9020]
mov bx, [OS_BASE+0x2F0000 + 0x9022] mov bx, [BOOT_VAR + 0x9022]
mov cl, [OS_BASE+0x2F0000 + 0x9021] mov cl, [BOOT_VAR + 0x9021]
xor ah, ah xor ah, ah
jmp .return_abcd jmp .return_abcd

View File

@ -198,7 +198,7 @@ OS_TEMP equ 0xDFC00000
kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) ;0xFDE00000 kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) ;0xFDE00000
master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000 master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000
BOOT_BASE equ 0x00010000 _16BIT_BASE equ 0x00010000
LOAD_BASE equ 0x00100000 LOAD_BASE equ 0x00100000
OS_BASE equ 0xE0000000 OS_BASE equ 0xE0000000
@ -297,41 +297,42 @@ TMP_BUFF equ (OS_BASE+0x0090000)
VGABasePtr equ (OS_BASE+0x00A0000) VGABasePtr equ (OS_BASE+0x00A0000)
;RAMDISK equ (OS_BASE+0x0100000) ;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? ; unused?
SB16Buffer equ (OS_BASE+0x2A0000) SB16Buffer equ (OS_BASE+0x01A0000)
SB16_Status equ (OS_BASE+0x02B0000) SB16_Status equ (OS_BASE+0x01B0000)
BUTTON_INFO equ (OS_BASE+0x02C0000) BUTTON_INFO equ (OS_BASE+0x01C0000)
RESERVED_PORTS equ (OS_BASE+0x02D0000) RESERVED_PORTS equ (OS_BASE+0x01D0000)
IRQ_SAVE equ (OS_BASE+0x02E0000) IRQ_SAVE equ (OS_BASE+0x01E0000)
BOOT_VAR equ (OS_BASE+0x02f0000) BOOT_VAR equ (OS_BASE+0x01f0000)
stack_data_start equ (OS_BASE+0x0300000) stack_data_start equ (OS_BASE+0x0200000)
eth_data_start equ (OS_BASE+0x0300000) eth_data_start equ (OS_BASE+0x0200000)
stack_data equ (OS_BASE+0x0304000) stack_data equ (OS_BASE+0x0204000)
stack_data_end equ (OS_BASE+0x031ffff) stack_data_end equ (OS_BASE+0x021ffff)
resendQ equ (OS_BASE+0x0320000) resendQ equ (OS_BASE+0x0220000)
VMODE_BASE equ (OS_BASE+0x0328000) VMODE_BASE equ (OS_BASE+0x0228000)
skin_data equ (OS_BASE+0x0330000) skin_data equ (OS_BASE+0x0230000)
draw_data equ (OS_BASE+0x0338000); draw_data equ (OS_BASE+0x0238000);
BgrDrawMode equ (OS_BASE+0x033BFF4) BgrDrawMode equ (OS_BASE+0x023BFF4)
BgrDataWidth equ (OS_BASE+0x033BFF8) BgrDataWidth equ (OS_BASE+0x023BFF8)
BgrDataHeight equ (OS_BASE+0x033BFFC) 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 tss TSS
end virtual end virtual
LAST_PAGE equ 0x0340000 LAST_PAGE equ 0x0240000
;sys_pgmap equ (OS_BASE+LAST_PAGE) ;sys_pgmap equ (OS_BASE+LAST_PAGE)

View File

@ -91,8 +91,8 @@ v86_create:
; now V86 specific: initialize known addresses in first Mb ; now V86 specific: initialize known addresses in first Mb
pop eax pop eax
; first page - BIOS data (shared between all machines!) ; first page - BIOS data (shared between all machines!)
; physical address = 0x2f0000 ; physical address = 0x1f0000
; linear address = BOOT_VAR = OS_BASE + 0x2f0000 ; linear address = BOOT_VAR = OS_BASE + 0x1f0000
mov dword [eax], (BOOT_VAR - OS_BASE) or 111b mov dword [eax], (BOOT_VAR - OS_BASE) or 111b
mov dword [eax+800h], BOOT_VAR mov dword [eax+800h], BOOT_VAR
; page before 0xA0000 - Extended BIOS Data Area (shared between all machines!) ; page before 0xA0000 - Extended BIOS Data Area (shared between all machines!)

View File

@ -33,7 +33,7 @@ FORCE_MMX_128 equ 0 ;integer sse2 extensions
USE_SSE2_MIXER equ 0 ;floating point mixer. Disabled by default USE_SSE2_MIXER equ 0 ;floating point mixer. Disabled by default
OS_BASE equ 0x80000000 OS_BASE equ 0xE0000000
CAPS_SSE2 equ 26 CAPS_SSE2 equ 26
PG_SW equ 0x003 PG_SW equ 0x003

View File

@ -5,11 +5,11 @@ use_cli_sti equ 1 ;driver come more stable (theoretically)
;constants-------------------------------------------------------- ;constants--------------------------------------------------------
API_VERSION equ 0 ;debug API_VERSION equ 0 ;debug
OS_BASE equ 0x80000000 OS_BASE equ 0xE0000000
new_app_base equ 0x0 new_app_base equ 0x0
PROC_BASE equ (OS_BASE+0x080000) PROC_BASE equ (OS_BASE+0x080000)
SB16Buffer equ (OS_BASE+0x2A0000) SB16Buffer equ (OS_BASE+0x1A0000)
SB16_Status equ (OS_BASE+0x2B0000) SB16_Status equ (OS_BASE+0x1B0000)
DMAPage equ ((SB16Buffer-OS_BASE) shr 16) DMAPage equ ((SB16Buffer-OS_BASE) shr 16)
SB16Buffer0 equ SB16Buffer SB16Buffer0 equ SB16Buffer

View File

@ -40,7 +40,7 @@ proc Parser_params
locals locals
buff db 4 dup(?) ; for test cd buff db 4 dup(?) ; for test cd
endl 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,sysdir_path
mov [ecx-64],dword 'sys' mov [ecx-64],dword 'sys'
cmp al,'r' ; if ram disk cmp al,'r' ; if ram disk

View File

@ -123,8 +123,10 @@ public @balloc@4
public __setvars public __setvars
extrn _16bit_start
extrn _16bit_end
extrn _enter_bootscreen extrn _enter_bootscreen
extrn _leave_bootscreen
extrn _init extrn _init
extrn _init_mm extrn _init_mm
@ -352,14 +354,16 @@ _high_code:
call _init_mm call _init_mm
mov [pg_data.pg_mutex], 0 mov [pg_data.pg_mutex], 0
mov esi, _enter_bootscreen mov esi, _16bit_start
mov ecx, _leave_bootscreen mov ecx, _16bit_end
shr ecx, 2 shr ecx, 2
mov edi, BOOT_BASE mov edi, _16BIT_BASE
cld cld
rep movsd rep movsd
jmp far 0x60:0x00000; xchg bx, bx
jmp far 0x60:_enter_bootscreen;
align 4 align 4
__setvars: __setvars:
@ -376,7 +380,7 @@ __setvars:
; SAVE & CLEAR 0-0xffff ; SAVE & CLEAR 0-0xffff
xor esi, esi xor esi, esi
mov edi,0x2F0000 mov edi,0x1F0000
mov ecx,0x10000 / 4 mov ecx,0x10000 / 4
rep movsd rep movsd
xor edi, edi xor edi, edi
@ -5164,7 +5168,7 @@ yes_shutdown_param:
; mov ecx,1000 ; mov ecx,1000
; rep movsb ; rep movsb
mov esi,OS_BASE+0x2F0000 ; restore 0x0 - 0xffff mov esi, BOOT_VAR ; restore 0x0 - 0xffff
mov edi, OS_BASE mov edi, OS_BASE
mov ecx,0x10000/4 mov ecx,0x10000/4
cld cld

View File

@ -26,6 +26,7 @@ SECTIONS
{ {
*(.bss) *(COMMON) *(.bss) *(COMMON)
} }
__kernel_end = . - 0xE0000000;
/DISCARD/ : /DISCARD/ :
{ {