diff --git a/kernel/branches/flat_kernel/blkdev/rd.inc b/kernel/branches/flat_kernel/blkdev/rd.inc index 75f4e835b7..b521d6ad65 100644 --- a/kernel/branches/flat_kernel/blkdev/rd.inc +++ b/kernel/branches/flat_kernel/blkdev/rd.inc @@ -1796,7 +1796,12 @@ fs_RamdiskRewrite: jnz .disk_full2 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 mov word [edi], 0xFFF ; mark as last cluster xchg edi, [esp] diff --git a/kernel/branches/flat_kernel/const.inc b/kernel/branches/flat_kernel/const.inc index debd4f389d..7f84779e2f 100644 --- a/kernel/branches/flat_kernel/const.inc +++ b/kernel/branches/flat_kernel/const.inc @@ -134,7 +134,7 @@ SSE_FZ equ 0x8000 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 @@ -261,13 +261,13 @@ LFB_BASE equ 0x7DC00000 page_tabs equ 0x7FC00000 master_tab equ 0x7FDFF000 -app_page_tabs equ 0x7FE00000 +app_page_tabs equ 0x7FC00000 ;0x7FE00000 sys_pgdir equ (OS_BASE+0x00050000) sys_pgmap equ (OS_BASE+0x00052000) -new_app_base equ 0x80000000 +new_app_base equ 0x01000000 ; 0= flat twdw equ (CURRENT_TASK-window_data) diff --git a/kernel/branches/flat_kernel/core/malloc.inc b/kernel/branches/flat_kernel/core/malloc.inc index bd313b2eeb..b04be9634d 100644 --- a/kernel/branches/flat_kernel/core/malloc.inc +++ b/kernel/branches/flat_kernel/core/malloc.inc @@ -972,9 +972,7 @@ malloc_large: align 4 init_malloc: - stdcall kernel_alloc, 0x20000 - mov [mst.top], eax mov [mst.topsize], 128*1024 mov dword [eax+4], (128*1024) or 1 diff --git a/kernel/branches/flat_kernel/core/memory.inc b/kernel/branches/flat_kernel/core/memory.inc index 06ac99f6e8..99f7e5c7d3 100644 --- a/kernel/branches/flat_kernel/core/memory.inc +++ b/kernel/branches/flat_kernel/core/memory.inc @@ -476,19 +476,17 @@ proc page_fault_handler mov ebx, [ebp-4] cmp ebx, 0x80000000 - jae .user_space + jae .kernel_space + + cmp ebx, page_tabs+0x800 + jae .tab_space cmp ebx, app_page_tabs jae .alloc - cmp ebx, page_tabs - jae .tab_space - cmp ebx, 0x7DC00000 jae .lfb_addr - jmp .kernel_space - .user_space: shr ebx, 12 mov ecx, ebx diff --git a/kernel/branches/flat_kernel/core/taskman.inc b/kernel/branches/flat_kernel/core/taskman.inc index ff3ab737dc..9bc097b3ec 100644 --- a/kernel/branches/flat_kernel/core/taskman.inc +++ b/kernel/branches/flat_kernel/core/taskman.inc @@ -392,19 +392,20 @@ proc create_app_space stdcall, app_size:dword,img_base:dword,img_size:dword mov [dir_addr], eax stdcall map_page,[tmp_task_pdir],eax,dword PG_SW - mov esi, sys_pgdir 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 rep movsd + mov edi, [tmp_task_pdir] mov eax, [dir_addr] or eax, PG_SW - stosd ; [(page_tabs shr 20)]= eax - - mov ecx, 0x800/4 - xor eax, eax - rep stosd + mov [edi+(page_tabs shr 20)], eax mov eax, [dir_addr] call set_cr3 @@ -471,7 +472,6 @@ else add edx, 0x1000 dec [app_pages] jnz .alloc - end if .done: @@ -557,8 +557,7 @@ proc destroy_app_space stdcall, pg_dir:dword and eax, not 0xFFF stdcall map_page,[tmp_task_pdir],eax,dword PG_SW mov esi, [tmp_task_pdir] - add esi, 0x800 - mov edi, 0x800/4 + mov edi, (LFB_BASE shr 20)/4 .destroy: mov eax, [esi] test eax, 1 diff --git a/kernel/branches/flat_kernel/data32.inc b/kernel/branches/flat_kernel/data32.inc index 8db8a0d904..0ef8b40704 100644 --- a/kernel/branches/flat_kernel/data32.inc +++ b/kernel/branches/flat_kernel/data32.inc @@ -149,14 +149,14 @@ app_code_l: dw 0 db 0 db cpl3 - dw G32+D32+0x8000+0x7; + dw G32+D32+(new_app_base shr 16)+0x7; app_data_l: dw 0xFFFF dw 0 db 0 db drw3 - dw G32+D32+0x8000+0x7; + dw G32+D32+(new_app_base shr 16)+0x7; ; --------------- APM --------------------- apm_code_32: diff --git a/kernel/branches/flat_kernel/fdo.inc b/kernel/branches/flat_kernel/fdo.inc index 028667c8b1..1dfe619c85 100644 --- a/kernel/branches/flat_kernel/fdo.inc +++ b/kernel/branches/flat_kernel/fdo.inc @@ -230,7 +230,7 @@ debug_beginf pushad movzx ebx,al mov eax,1 - call sys_msg_board + ; call sys_msg_board popad ret debug_endf @@ -243,7 +243,7 @@ debug_beginf movzx ebx,byte[edx] or bl,bl jz .l2 - call sys_msg_board + ; call sys_msg_board inc edx jmp .l1 .l2: ret diff --git a/kernel/branches/flat_kernel/fs/fat12.inc b/kernel/branches/flat_kernel/fs/fat12.inc index 6931e888c2..3739a9f033 100644 --- a/kernel/branches/flat_kernel/fs/fat12.inc +++ b/kernel/branches/flat_kernel/fs/fat12.inc @@ -1891,7 +1891,11 @@ fs_FloppyRewrite: jnz .ret 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 mov word [edi], 0xFFF ; mark as last cluster xchg edi, [esp+4] diff --git a/kernel/branches/flat_kernel/init.inc b/kernel/branches/flat_kernel/init.inc index 3645b2ba94..a74dd594df 100644 --- a/kernel/branches/flat_kernel/init.inc +++ b/kernel/branches/flat_kernel/init.inc @@ -32,7 +32,6 @@ endp align 4 proc init_mem - mov eax, [MEM_AMOUNT-OS_BASE] mov [pg_data.mem_amount-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 mov [edx], eax - mov [edx+16], eax + mov [edx+(OS_BASE shr 20)], eax add eax, 0x00400000 mov [edx+4], eax - mov [edx+20], eax + mov [edx+(OS_BASE shr 20)+4], eax add eax, 0x00400000 mov [edx+8], eax - mov [edx+24], eax + mov [edx+(OS_BASE shr 20)+8], eax add eax, 0x00400000 mov [edx+12], eax - mov [edx+28], eax - add edx, 32 + mov [edx+(OS_BASE shr 20)+12], eax + add edx, (OS_BASE shr 20)+16 add eax, 0x00400000 ; mov eax, 0x800000+PG_SW @@ -128,7 +127,7 @@ align 4 proc init_page_map 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 xor eax,eax cld @@ -143,8 +142,8 @@ proc init_page_map lea edi, [sys_pgmap-OS_BASE+ebx*4] ;+384 mov edx, [pg_data.pages_count-OS_BASE] mov ecx, [pg_data.kernel_tables-OS_BASE] - add ecx, (HEAP_BASE/4096) and 31 - sub edx, HEAP_BASE/4096 + add ecx, ((HEAP_BASE-OS_BASE)/4096) and 31 + sub edx, (HEAP_BASE-OS_BASE)/4096 sub edx, ecx mov [pg_data.pages_free-OS_BASE], edx diff --git a/kernel/branches/flat_kernel/kernel.asm b/kernel/branches/flat_kernel/kernel.asm index f524a2a24f..d55919ebe9 100644 --- a/kernel/branches/flat_kernel/kernel.asm +++ b/kernel/branches/flat_kernel/kernel.asm @@ -163,7 +163,7 @@ B32: xor eax,eax mov edi,0x280000 - mov ecx,(HEAP_BASE-0x280000) / 4 + mov ecx,(HEAP_BASE-OS_BASE-0x280000) / 4 cld rep stosd @@ -202,6 +202,7 @@ B32: mov eax,cr0 or eax,CR0_PG mov cr0,eax + lgdt [gdts] jmp pword os_code:high_code @@ -210,7 +211,6 @@ __DEBUG_LEVEL__ fix 1 include 'init.inc' org OS_BASE+$ -include 'fdo.inc' align 4 high_code: @@ -353,7 +353,6 @@ high_code: call init_LFB call init_fpu - call init_malloc stdcall alloc_kernel_space, 0x4F000 @@ -382,7 +381,6 @@ high_code: mov [ipc_ptab], eax call init_events - mov eax, srv.fd-SRV_FD_OFFSET mov [srv.fd], eax mov [srv.bk], eax @@ -731,6 +729,7 @@ first_app_found: include 'unpacker.inc' +include 'fdo.inc' align 4 boot_log: @@ -1293,11 +1292,15 @@ draw_num_text: mov eax,[esp+64+32-8+4] push edx ; add window start x & y mov edx,[TASK_BASE] + + mov edi,[CURRENT_TASK] + shl edi,8 + 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 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 pop edx mov ebx,[esp+64+32-12+4] @@ -2476,7 +2479,7 @@ sys_cpuusage: mov esi,[esp] shl esi,5 add esi,window_data + WDATA.box - mov al,[esi+window_data+WDATA.fl_wstate] + mov al,[esi+WDATA.fl_wstate] mov [edi],al pop ebx @@ -2488,9 +2491,6 @@ sys_cpuusage: mov [esp+36],eax ret - - - align 4 sys_clock: cli