forked from KolibriOS/kolibrios
boot time allocator
git-svn-id: svn://kolibrios.org@841 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3a719cd911
commit
b2e313b0d9
@ -324,13 +324,15 @@ BgrDrawMode equ (OS_BASE+0x033BFF4)
|
|||||||
BgrDataWidth equ (OS_BASE+0x033BFF8)
|
BgrDataWidth equ (OS_BASE+0x033BFF8)
|
||||||
BgrDataHeight equ (OS_BASE+0x033BFFC)
|
BgrDataHeight equ (OS_BASE+0x033BFFC)
|
||||||
|
|
||||||
;display_data equ (OS_BASE+0x033C000) ;1024*1280=0x140000
|
;display_data equ (OS_BASE+0x033C000) ;1024*1280=0x140000
|
||||||
|
|
||||||
virtual at (OS_BASE+0x033CF80)
|
virtual at (OS_BASE+0x033CF80)
|
||||||
tss TSS
|
tss TSS
|
||||||
end virtual
|
end virtual
|
||||||
|
|
||||||
sys_pgmap equ (OS_BASE+0x033F000)
|
LAST_PAGE equ 0x0340000
|
||||||
|
|
||||||
|
sys_pgmap equ (OS_BASE+LAST_PAGE)
|
||||||
|
|
||||||
twdw equ 0x3000 ;(CURRENT_TASK-window_data)
|
twdw equ 0x3000 ;(CURRENT_TASK-window_data)
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ init_kernel_heap:
|
|||||||
not eax
|
not eax
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
stdcall alloc_pages, dword 32
|
mov ecx, 128*1024
|
||||||
add eax, OS_BASE
|
fastcall _balloc
|
||||||
|
|
||||||
mov [mem_block_start], mem_block_map
|
mov [mem_block_start], mem_block_map
|
||||||
mov [mem_block_end], mem_block_map+512
|
mov [mem_block_end], mem_block_map+512
|
||||||
|
@ -1306,3 +1306,14 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
|
align 4
|
||||||
|
_balloc: ; gcc fastcall
|
||||||
|
|
||||||
|
mov eax, [_last_page]
|
||||||
|
add ecx, 4095
|
||||||
|
and ecx, -4096
|
||||||
|
add ecx, eax
|
||||||
|
mov [_last_page], ecx
|
||||||
|
add eax, OS_BASE
|
||||||
|
ret
|
||||||
|
|
||||||
|
@ -109,7 +109,10 @@ vrr_m db 'VRR_M',0
|
|||||||
kernel_file db 'KERNEL MNT'
|
kernel_file db 'KERNEL MNT'
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
;supported videomodes
|
|
||||||
|
_last_page dd LAST_PAGE
|
||||||
|
|
||||||
|
;supported videomodes
|
||||||
mode_1280_1024_32:
|
mode_1280_1024_32:
|
||||||
dw 1280,1024,32,60
|
dw 1280,1024,32,60
|
||||||
mode_1280_1024_24:
|
mode_1280_1024_24:
|
||||||
|
@ -58,6 +58,8 @@ include 'macros.inc'
|
|||||||
$Revision$
|
$Revision$
|
||||||
|
|
||||||
|
|
||||||
|
fastcall equ call
|
||||||
|
|
||||||
USE_COM_IRQ equ 1 ;make irq 3 and irq 4 available for PCI devices
|
USE_COM_IRQ equ 1 ;make irq 3 and irq 4 available for PCI devices
|
||||||
|
|
||||||
include "proc32.inc"
|
include "proc32.inc"
|
||||||
@ -320,7 +322,8 @@ init_mem:
|
|||||||
shr eax, 3
|
shr eax, 3
|
||||||
and eax, -4
|
and eax, -4
|
||||||
mov [pg_data.pagemap_size], eax
|
mov [pg_data.pagemap_size], eax
|
||||||
|
mov ecx, eax
|
||||||
|
fastcall _balloc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@ -333,7 +336,9 @@ init_page_map:
|
|||||||
cld
|
cld
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
mov ecx, 0x800000 ;reserve 8 Mb
|
xchg bx, bx
|
||||||
|
|
||||||
|
mov ecx, [_last_page]
|
||||||
mov edx, [pg_data.pages_count]
|
mov edx, [pg_data.pages_count]
|
||||||
shr ecx, 12
|
shr ecx, 12
|
||||||
sub edx, ecx
|
sub edx, ecx
|
||||||
@ -395,6 +400,43 @@ high_code:
|
|||||||
|
|
||||||
call init_mem
|
call init_mem
|
||||||
|
|
||||||
|
mov ecx, 1280*1024
|
||||||
|
fastcall _balloc
|
||||||
|
mov [_display_data], eax
|
||||||
|
|
||||||
|
mov ecx, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
|
||||||
|
(unpack.lc+unpack.lp)))*4
|
||||||
|
fastcall _balloc
|
||||||
|
mov [unpack.p], eax
|
||||||
|
|
||||||
|
mov ecx, (RING0_STACK_SIZE+512)
|
||||||
|
fastcall _balloc
|
||||||
|
mov [os_stack_seg], eax
|
||||||
|
|
||||||
|
lea esp, [eax+RING0_STACK_SIZE]
|
||||||
|
|
||||||
|
mov [tss._ss0], os_stack
|
||||||
|
mov [tss._esp0], esp
|
||||||
|
mov [tss._esp], esp
|
||||||
|
mov [tss._cs],os_code
|
||||||
|
mov [tss._ss],os_stack
|
||||||
|
mov [tss._ds],app_data
|
||||||
|
mov [tss._es],app_data
|
||||||
|
mov [tss._fs],app_data
|
||||||
|
mov [tss._gs],app_data
|
||||||
|
mov [tss._io],128
|
||||||
|
;Add IO access table - bit array of permitted ports
|
||||||
|
mov edi, tss._io_map_0
|
||||||
|
xor eax, eax
|
||||||
|
not eax
|
||||||
|
mov ecx, 8192/4
|
||||||
|
rep stosd ; access to 4096*8=65536 ports
|
||||||
|
|
||||||
|
mov ax,tss0
|
||||||
|
ltr ax
|
||||||
|
|
||||||
|
call init_kernel_heap ; FIXME initialize heap after pager
|
||||||
|
|
||||||
call init_page_map
|
call init_page_map
|
||||||
|
|
||||||
|
|
||||||
@ -548,37 +590,9 @@ high_code:
|
|||||||
call build_interrupt_table
|
call build_interrupt_table
|
||||||
lidt [idtreg]
|
lidt [idtreg]
|
||||||
|
|
||||||
call init_kernel_heap
|
mov [LFBSize], 0x800000
|
||||||
|
|
||||||
stdcall alloc_pages, (RING0_STACK_SIZE+512) shr 12
|
|
||||||
add eax, OS_BASE
|
|
||||||
mov [os_stack_seg], eax
|
|
||||||
|
|
||||||
lea esp, [eax+RING0_STACK_SIZE]
|
|
||||||
|
|
||||||
mov [tss._ss0], os_stack
|
|
||||||
mov [tss._esp0], esp
|
|
||||||
mov [tss._esp], esp
|
|
||||||
mov [tss._cs],os_code
|
|
||||||
mov [tss._ss],os_stack
|
|
||||||
mov [tss._ds],app_data
|
|
||||||
mov [tss._es],app_data
|
|
||||||
mov [tss._fs],app_data
|
|
||||||
mov [tss._gs],app_data
|
|
||||||
mov [tss._io],128
|
|
||||||
;Add IO access table - bit array of permitted ports
|
|
||||||
mov edi, tss._io_map_0
|
|
||||||
xor eax, eax
|
|
||||||
not eax
|
|
||||||
mov ecx, 8192/4
|
|
||||||
rep stosd ; access to 4096*8=65536 ports
|
|
||||||
|
|
||||||
mov ax,tss0
|
|
||||||
ltr ax
|
|
||||||
|
|
||||||
mov [LFBSize], 0x800000
|
|
||||||
call init_LFB
|
call init_LFB
|
||||||
call init_fpu
|
call init_fpu
|
||||||
call init_malloc
|
call init_malloc
|
||||||
|
|
||||||
stdcall alloc_kernel_space, 0x51000
|
stdcall alloc_kernel_space, 0x51000
|
||||||
@ -609,15 +623,6 @@ high_code:
|
|||||||
add eax, ebx
|
add eax, ebx
|
||||||
mov [ipc_ptab], eax
|
mov [ipc_ptab], eax
|
||||||
|
|
||||||
stdcall alloc_pages, (1280*1024)/4096
|
|
||||||
add eax, OS_BASE
|
|
||||||
mov [_display_data], eax
|
|
||||||
|
|
||||||
stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
|
|
||||||
(unpack.lc+unpack.lp)))*4
|
|
||||||
|
|
||||||
mov [unpack.p], eax
|
|
||||||
|
|
||||||
call init_events
|
call init_events
|
||||||
mov eax, srv.fd-SRV_FD_OFFSET
|
mov eax, srv.fd-SRV_FD_OFFSET
|
||||||
mov [srv.fd], eax
|
mov [srv.fd], eax
|
||||||
@ -933,18 +938,11 @@ first_app_found:
|
|||||||
|
|
||||||
; wait until 8042 is ready
|
; wait until 8042 is ready
|
||||||
xor ecx,ecx
|
xor ecx,ecx
|
||||||
@@:
|
@@:
|
||||||
in al,64h
|
in al,64h
|
||||||
and al,00000010b
|
and al,00000010b
|
||||||
loopnz @b
|
loopnz @b
|
||||||
|
|
||||||
; mov al, 0xED ; svetodiody - only for testing!
|
|
||||||
; call kb_write
|
|
||||||
; call kb_read
|
|
||||||
; mov al, 111b
|
|
||||||
; call kb_write
|
|
||||||
; call kb_read
|
|
||||||
|
|
||||||
mov al, 0xF3 ; set repeat rate & delay
|
mov al, 0xF3 ; set repeat rate & delay
|
||||||
call kb_write
|
call kb_write
|
||||||
; call kb_read
|
; call kb_read
|
||||||
|
Loading…
Reference in New Issue
Block a user