forked from KolibriOS/kolibrios
high kernel
git-svn-id: svn://kolibrios.org@394 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ecc2925f76
commit
87fc474bee
@ -1796,7 +1796,12 @@ fs_RamdiskRewrite:
|
|||||||
jnz .disk_full2
|
jnz .disk_full2
|
||||||
dec edi
|
dec edi
|
||||||
dec edi
|
dec edi
|
||||||
lea eax, [edi-(RAMDISK_FAT)]
|
|
||||||
|
; lea eax, [edi-(RAMDISK_FAT)]
|
||||||
|
|
||||||
|
mov eax, edi
|
||||||
|
sub edi, RAMDISK_FAT
|
||||||
|
|
||||||
shr eax, 1 ; eax = cluster
|
shr eax, 1 ; eax = cluster
|
||||||
mov word [edi], 0xFFF ; mark as last cluster
|
mov word [edi], 0xFFF ; mark as last cluster
|
||||||
xchg edi, [esp]
|
xchg edi, [esp]
|
||||||
|
@ -134,7 +134,7 @@ SSE_FZ equ 0x8000
|
|||||||
|
|
||||||
SSE_INIT equ (SSE_IM+SSE_DM+SSE_ZM+SSE_OM+SSE_UM+SSE_PM)
|
SSE_INIT equ (SSE_IM+SSE_DM+SSE_ZM+SSE_OM+SSE_UM+SSE_PM)
|
||||||
|
|
||||||
OS_BASE equ 0x01000000
|
OS_BASE equ 0x80000000
|
||||||
|
|
||||||
window_data equ OS_BASE
|
window_data equ OS_BASE
|
||||||
|
|
||||||
@ -261,13 +261,13 @@ LFB_BASE equ 0x7DC00000
|
|||||||
|
|
||||||
page_tabs equ 0x7FC00000
|
page_tabs equ 0x7FC00000
|
||||||
master_tab equ 0x7FDFF000
|
master_tab equ 0x7FDFF000
|
||||||
app_page_tabs equ 0x7FE00000
|
app_page_tabs equ 0x7FC00000 ;0x7FE00000
|
||||||
|
|
||||||
sys_pgdir equ (OS_BASE+0x00050000)
|
sys_pgdir equ (OS_BASE+0x00050000)
|
||||||
sys_pgmap equ (OS_BASE+0x00052000)
|
sys_pgmap equ (OS_BASE+0x00052000)
|
||||||
|
|
||||||
|
|
||||||
new_app_base equ 0x80000000
|
new_app_base equ 0x01000000 ; 0= flat
|
||||||
|
|
||||||
twdw equ (CURRENT_TASK-window_data)
|
twdw equ (CURRENT_TASK-window_data)
|
||||||
|
|
||||||
|
@ -972,9 +972,7 @@ malloc_large:
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
init_malloc:
|
init_malloc:
|
||||||
|
|
||||||
stdcall kernel_alloc, 0x20000
|
stdcall kernel_alloc, 0x20000
|
||||||
|
|
||||||
mov [mst.top], eax
|
mov [mst.top], eax
|
||||||
mov [mst.topsize], 128*1024
|
mov [mst.topsize], 128*1024
|
||||||
mov dword [eax+4], (128*1024) or 1
|
mov dword [eax+4], (128*1024) or 1
|
||||||
|
@ -476,19 +476,17 @@ proc page_fault_handler
|
|||||||
mov ebx, [ebp-4]
|
mov ebx, [ebp-4]
|
||||||
|
|
||||||
cmp ebx, 0x80000000
|
cmp ebx, 0x80000000
|
||||||
jae .user_space
|
jae .kernel_space
|
||||||
|
|
||||||
|
cmp ebx, page_tabs+0x800
|
||||||
|
jae .tab_space
|
||||||
|
|
||||||
cmp ebx, app_page_tabs
|
cmp ebx, app_page_tabs
|
||||||
jae .alloc
|
jae .alloc
|
||||||
|
|
||||||
cmp ebx, page_tabs
|
|
||||||
jae .tab_space
|
|
||||||
|
|
||||||
cmp ebx, 0x7DC00000
|
cmp ebx, 0x7DC00000
|
||||||
jae .lfb_addr
|
jae .lfb_addr
|
||||||
|
|
||||||
jmp .kernel_space
|
|
||||||
|
|
||||||
.user_space:
|
.user_space:
|
||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
|
@ -392,19 +392,20 @@ proc create_app_space stdcall, app_size:dword,img_base:dword,img_size:dword
|
|||||||
mov [dir_addr], eax
|
mov [dir_addr], eax
|
||||||
stdcall map_page,[tmp_task_pdir],eax,dword PG_SW
|
stdcall map_page,[tmp_task_pdir],eax,dword PG_SW
|
||||||
|
|
||||||
mov esi, sys_pgdir
|
|
||||||
mov edi, [tmp_task_pdir]
|
mov edi, [tmp_task_pdir]
|
||||||
mov ecx, (page_tabs shr 20)/4
|
mov ecx, (LFB_BASE shr 20)/4 ;(page_tabs shr 20)/4
|
||||||
|
xor eax, eax
|
||||||
|
rep stosd
|
||||||
|
|
||||||
|
mov esi, sys_pgdir+(LFB_BASE shr 20) ;(OS_BASE shr 20)
|
||||||
|
mov ecx, (OS_BASE shr 20)/4
|
||||||
cld
|
cld
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
|
mov edi, [tmp_task_pdir]
|
||||||
mov eax, [dir_addr]
|
mov eax, [dir_addr]
|
||||||
or eax, PG_SW
|
or eax, PG_SW
|
||||||
stosd ; [(page_tabs shr 20)]= eax
|
mov [edi+(page_tabs shr 20)], eax
|
||||||
|
|
||||||
mov ecx, 0x800/4
|
|
||||||
xor eax, eax
|
|
||||||
rep stosd
|
|
||||||
|
|
||||||
mov eax, [dir_addr]
|
mov eax, [dir_addr]
|
||||||
call set_cr3
|
call set_cr3
|
||||||
@ -471,7 +472,6 @@ else
|
|||||||
add edx, 0x1000
|
add edx, 0x1000
|
||||||
dec [app_pages]
|
dec [app_pages]
|
||||||
jnz .alloc
|
jnz .alloc
|
||||||
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
.done:
|
.done:
|
||||||
@ -557,8 +557,7 @@ proc destroy_app_space stdcall, pg_dir:dword
|
|||||||
and eax, not 0xFFF
|
and eax, not 0xFFF
|
||||||
stdcall map_page,[tmp_task_pdir],eax,dword PG_SW
|
stdcall map_page,[tmp_task_pdir],eax,dword PG_SW
|
||||||
mov esi, [tmp_task_pdir]
|
mov esi, [tmp_task_pdir]
|
||||||
add esi, 0x800
|
mov edi, (LFB_BASE shr 20)/4
|
||||||
mov edi, 0x800/4
|
|
||||||
.destroy:
|
.destroy:
|
||||||
mov eax, [esi]
|
mov eax, [esi]
|
||||||
test eax, 1
|
test eax, 1
|
||||||
|
@ -149,14 +149,14 @@ app_code_l:
|
|||||||
dw 0
|
dw 0
|
||||||
db 0
|
db 0
|
||||||
db cpl3
|
db cpl3
|
||||||
dw G32+D32+0x8000+0x7;
|
dw G32+D32+(new_app_base shr 16)+0x7;
|
||||||
|
|
||||||
app_data_l:
|
app_data_l:
|
||||||
dw 0xFFFF
|
dw 0xFFFF
|
||||||
dw 0
|
dw 0
|
||||||
db 0
|
db 0
|
||||||
db drw3
|
db drw3
|
||||||
dw G32+D32+0x8000+0x7;
|
dw G32+D32+(new_app_base shr 16)+0x7;
|
||||||
|
|
||||||
; --------------- APM ---------------------
|
; --------------- APM ---------------------
|
||||||
apm_code_32:
|
apm_code_32:
|
||||||
|
@ -230,7 +230,7 @@ debug_beginf
|
|||||||
pushad
|
pushad
|
||||||
movzx ebx,al
|
movzx ebx,al
|
||||||
mov eax,1
|
mov eax,1
|
||||||
call sys_msg_board
|
; call sys_msg_board
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
debug_endf
|
debug_endf
|
||||||
@ -243,7 +243,7 @@ debug_beginf
|
|||||||
movzx ebx,byte[edx]
|
movzx ebx,byte[edx]
|
||||||
or bl,bl
|
or bl,bl
|
||||||
jz .l2
|
jz .l2
|
||||||
call sys_msg_board
|
; call sys_msg_board
|
||||||
inc edx
|
inc edx
|
||||||
jmp .l1
|
jmp .l1
|
||||||
.l2: ret
|
.l2: ret
|
||||||
|
@ -1891,7 +1891,11 @@ fs_FloppyRewrite:
|
|||||||
jnz .ret
|
jnz .ret
|
||||||
dec edi
|
dec edi
|
||||||
dec edi
|
dec edi
|
||||||
lea eax, [edi-(FLOPPY_FAT)]
|
|
||||||
|
; lea eax, [edi-FLOPPY_FAT]
|
||||||
|
mov eax, edi
|
||||||
|
sub edi, FLOPPY_FAT
|
||||||
|
|
||||||
shr eax, 1 ; eax = cluster
|
shr eax, 1 ; eax = cluster
|
||||||
mov word [edi], 0xFFF ; mark as last cluster
|
mov word [edi], 0xFFF ; mark as last cluster
|
||||||
xchg edi, [esp+4]
|
xchg edi, [esp+4]
|
||||||
|
@ -32,7 +32,6 @@ endp
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc init_mem
|
proc init_mem
|
||||||
|
|
||||||
mov eax, [MEM_AMOUNT-OS_BASE]
|
mov eax, [MEM_AMOUNT-OS_BASE]
|
||||||
mov [pg_data.mem_amount-OS_BASE], eax
|
mov [pg_data.mem_amount-OS_BASE], eax
|
||||||
mov [pg_data.kernel_max-OS_BASE], eax
|
mov [pg_data.kernel_max-OS_BASE], eax
|
||||||
@ -74,20 +73,20 @@ proc init_mem
|
|||||||
sub [pg_data.kernel_tables-OS_BASE], 2
|
sub [pg_data.kernel_tables-OS_BASE], 2
|
||||||
|
|
||||||
mov [edx], eax
|
mov [edx], eax
|
||||||
mov [edx+16], eax
|
mov [edx+(OS_BASE shr 20)], eax
|
||||||
add eax, 0x00400000
|
add eax, 0x00400000
|
||||||
|
|
||||||
mov [edx+4], eax
|
mov [edx+4], eax
|
||||||
mov [edx+20], eax
|
mov [edx+(OS_BASE shr 20)+4], eax
|
||||||
add eax, 0x00400000
|
add eax, 0x00400000
|
||||||
|
|
||||||
mov [edx+8], eax
|
mov [edx+8], eax
|
||||||
mov [edx+24], eax
|
mov [edx+(OS_BASE shr 20)+8], eax
|
||||||
add eax, 0x00400000
|
add eax, 0x00400000
|
||||||
|
|
||||||
mov [edx+12], eax
|
mov [edx+12], eax
|
||||||
mov [edx+28], eax
|
mov [edx+(OS_BASE shr 20)+12], eax
|
||||||
add edx, 32
|
add edx, (OS_BASE shr 20)+16
|
||||||
add eax, 0x00400000
|
add eax, 0x00400000
|
||||||
|
|
||||||
; mov eax, 0x800000+PG_SW
|
; mov eax, 0x800000+PG_SW
|
||||||
@ -128,7 +127,7 @@ align 4
|
|||||||
proc init_page_map
|
proc init_page_map
|
||||||
|
|
||||||
mov edi, sys_pgmap-OS_BASE
|
mov edi, sys_pgmap-OS_BASE
|
||||||
mov ecx, (HEAP_BASE/4096)/32 ;384/4
|
mov ecx, ((HEAP_BASE-OS_BASE)/4096)/32 ;384/4
|
||||||
mov ebx, ecx
|
mov ebx, ecx
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
cld
|
cld
|
||||||
@ -143,8 +142,8 @@ proc init_page_map
|
|||||||
lea edi, [sys_pgmap-OS_BASE+ebx*4] ;+384
|
lea edi, [sys_pgmap-OS_BASE+ebx*4] ;+384
|
||||||
mov edx, [pg_data.pages_count-OS_BASE]
|
mov edx, [pg_data.pages_count-OS_BASE]
|
||||||
mov ecx, [pg_data.kernel_tables-OS_BASE]
|
mov ecx, [pg_data.kernel_tables-OS_BASE]
|
||||||
add ecx, (HEAP_BASE/4096) and 31
|
add ecx, ((HEAP_BASE-OS_BASE)/4096) and 31
|
||||||
sub edx, HEAP_BASE/4096
|
sub edx, (HEAP_BASE-OS_BASE)/4096
|
||||||
sub edx, ecx
|
sub edx, ecx
|
||||||
mov [pg_data.pages_free-OS_BASE], edx
|
mov [pg_data.pages_free-OS_BASE], edx
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ B32:
|
|||||||
|
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
mov edi,0x280000
|
mov edi,0x280000
|
||||||
mov ecx,(HEAP_BASE-0x280000) / 4
|
mov ecx,(HEAP_BASE-OS_BASE-0x280000) / 4
|
||||||
cld
|
cld
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
@ -202,6 +202,7 @@ B32:
|
|||||||
mov eax,cr0
|
mov eax,cr0
|
||||||
or eax,CR0_PG
|
or eax,CR0_PG
|
||||||
mov cr0,eax
|
mov cr0,eax
|
||||||
|
|
||||||
lgdt [gdts]
|
lgdt [gdts]
|
||||||
jmp pword os_code:high_code
|
jmp pword os_code:high_code
|
||||||
|
|
||||||
@ -210,7 +211,6 @@ __DEBUG_LEVEL__ fix 1
|
|||||||
include 'init.inc'
|
include 'init.inc'
|
||||||
|
|
||||||
org OS_BASE+$
|
org OS_BASE+$
|
||||||
include 'fdo.inc'
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
high_code:
|
high_code:
|
||||||
@ -353,7 +353,6 @@ high_code:
|
|||||||
|
|
||||||
call init_LFB
|
call init_LFB
|
||||||
call init_fpu
|
call init_fpu
|
||||||
|
|
||||||
call init_malloc
|
call init_malloc
|
||||||
|
|
||||||
stdcall alloc_kernel_space, 0x4F000
|
stdcall alloc_kernel_space, 0x4F000
|
||||||
@ -382,7 +381,6 @@ high_code:
|
|||||||
mov [ipc_ptab], eax
|
mov [ipc_ptab], 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
|
||||||
mov [srv.bk], eax
|
mov [srv.bk], eax
|
||||||
@ -731,6 +729,7 @@ first_app_found:
|
|||||||
|
|
||||||
|
|
||||||
include 'unpacker.inc'
|
include 'unpacker.inc'
|
||||||
|
include 'fdo.inc'
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
boot_log:
|
boot_log:
|
||||||
@ -1293,11 +1292,15 @@ draw_num_text:
|
|||||||
mov eax,[esp+64+32-8+4]
|
mov eax,[esp+64+32-8+4]
|
||||||
push edx ; add window start x & y
|
push edx ; add window start x & y
|
||||||
mov edx,[TASK_BASE]
|
mov edx,[TASK_BASE]
|
||||||
|
|
||||||
|
mov edi,[CURRENT_TASK]
|
||||||
|
shl edi,8
|
||||||
|
|
||||||
mov ebx,[edx-twdw+WDATA.box.left]
|
mov ebx,[edx-twdw+WDATA.box.left]
|
||||||
add ebx, [(edx-CURRENT_TASK)*8+SLOT_BASE+APPDATA.wnd_clientbox.left]
|
add ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
|
||||||
shl ebx,16
|
shl ebx,16
|
||||||
add ebx,[edx-twdw+WDATA.box.top]
|
add ebx,[edx-twdw+WDATA.box.top]
|
||||||
add ebx, [(edx-CURRENT_TASK)*8+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
add ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
||||||
add eax,ebx
|
add eax,ebx
|
||||||
pop edx
|
pop edx
|
||||||
mov ebx,[esp+64+32-12+4]
|
mov ebx,[esp+64+32-12+4]
|
||||||
@ -2476,7 +2479,7 @@ sys_cpuusage:
|
|||||||
mov esi,[esp]
|
mov esi,[esp]
|
||||||
shl esi,5
|
shl esi,5
|
||||||
add esi,window_data + WDATA.box
|
add esi,window_data + WDATA.box
|
||||||
mov al,[esi+window_data+WDATA.fl_wstate]
|
mov al,[esi+WDATA.fl_wstate]
|
||||||
mov [edi],al
|
mov [edi],al
|
||||||
|
|
||||||
pop ebx
|
pop ebx
|
||||||
@ -2488,9 +2491,6 @@ sys_cpuusage:
|
|||||||
mov [esp+36],eax
|
mov [esp+36],eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
sys_clock:
|
sys_clock:
|
||||||
cli
|
cli
|
||||||
|
Loading…
Reference in New Issue
Block a user