1)fixed memory size in fn 18.16 & 18.17
2)added fn 18.20 - get extended memory info git-svn-id: svn://kolibrios.org@170 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
6c854695d0
commit
9395f92693
@ -315,7 +315,6 @@ struc SYS_VARS
|
||||
dd ?
|
||||
}
|
||||
|
||||
|
||||
struc BOOT_DATA
|
||||
{ .bpp dd ?
|
||||
.scanline dd ?
|
||||
|
@ -127,7 +127,9 @@ proc init_kernel_heap
|
||||
mov [ebx+block_base], HEAP_BASE+4096*MEM_BLOCK_SIZE
|
||||
|
||||
mov ecx, [MEM_AMOUNT]
|
||||
sub ecx, 0x00C00000 + 4096*MEM_BLOCK_SIZE
|
||||
sub ecx, 0x01000000 + 4096*MEM_BLOCK_SIZE
|
||||
mov [heap_size], ecx
|
||||
mov [heap_free], ecx
|
||||
mov [ebx+block_size], ecx
|
||||
mov [ebx+block_flags], FREE_BLOCK
|
||||
|
||||
@ -137,6 +139,8 @@ proc init_kernel_heap
|
||||
mov [mem_used_list], eax
|
||||
mov [mem_block_list+63*4], ebx
|
||||
mov byte [mem_block_map], 0xFC
|
||||
mov [heap_blocks], 4095
|
||||
mov [free_blocks], 4095
|
||||
ret
|
||||
endp
|
||||
|
||||
@ -190,7 +194,6 @@ proc get_block stdcall, index:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc alloc_mem_block
|
||||
|
||||
@ -216,6 +219,7 @@ found:
|
||||
add eax,ebx
|
||||
shl eax, 5
|
||||
add eax, [mem_block_arr]
|
||||
dec [free_blocks]
|
||||
popfd
|
||||
ret
|
||||
endp
|
||||
@ -228,6 +232,7 @@ proc free_mem_block
|
||||
|
||||
mov ebx, mem_block_map
|
||||
bts [ebx], eax
|
||||
inc [free_blocks]
|
||||
shr eax, 3
|
||||
and eax, not 3
|
||||
add eax, ebx
|
||||
@ -256,6 +261,8 @@ proc alloc_kernel_space stdcall, size:dword
|
||||
add eax, 0xFFF
|
||||
and eax, 0xFFFFF000;
|
||||
mov [size], eax
|
||||
cmp eax, [heap_free]
|
||||
ja .error
|
||||
|
||||
shr eax, 12
|
||||
sub eax, 1
|
||||
@ -341,6 +348,8 @@ proc alloc_kernel_space stdcall, size:dword
|
||||
mov [esi+block_flags], USED_BLOCK
|
||||
mov [mem_used_list], esi
|
||||
mov eax, [esi+block_base]
|
||||
mov ebx, [size]
|
||||
sub [heap_free], ebx
|
||||
popfd
|
||||
ret
|
||||
|
||||
@ -361,6 +370,8 @@ proc alloc_kernel_space stdcall, size:dword
|
||||
mov [mem_used_list], edi
|
||||
mov [edi+block_flags], USED_BLOCK
|
||||
mov eax, [edi+block_base]
|
||||
mov ebx, [size]
|
||||
sub [heap_free], ebx
|
||||
popfd
|
||||
ret
|
||||
.error:
|
||||
@ -386,6 +397,9 @@ proc free_kernel_space stdcall, base:dword
|
||||
cmp [esi+block_flags], USED_BLOCK
|
||||
jne .fail
|
||||
|
||||
mov eax, [esi+block_size]
|
||||
add [heap_free], eax
|
||||
|
||||
mov edi, [esi+block_next]
|
||||
test edi, edi
|
||||
jz .prev
|
||||
|
@ -111,75 +111,6 @@ proc init_memEx
|
||||
ret
|
||||
endp
|
||||
|
||||
;align 4
|
||||
;proc init_mem
|
||||
;
|
||||
; xor eax, eax
|
||||
; mov edi, sys_pgdir
|
||||
; mov ecx, 2048
|
||||
; rep stosd
|
||||
;
|
||||
; bt [cpu_caps], CAPS_PSE
|
||||
; jc .use_PSE
|
||||
;
|
||||
; mov eax, PG_SW
|
||||
; mov esi, tmp_page_tab
|
||||
; mov ecx, 4096/4 ;0x0 - 0x00FFFFFF
|
||||
;
|
||||
;.map_low:
|
||||
; mov [esi], eax
|
||||
; add eax, 0x1000
|
||||
; mov [esi+4], eax
|
||||
; add eax, 0x1000
|
||||
; mov [esi+8], eax
|
||||
; add eax, 0x1000
|
||||
; mov [esi+12], eax
|
||||
; add eax, 0x1000
|
||||
; add esi, 16
|
||||
; dec ecx
|
||||
; jnz .map_low ;ÿäðî
|
||||
|
||||
; mov eax, tmp_page_tab+PG_SW
|
||||
; mov ecx, 4
|
||||
; xor ebx, ebx
|
||||
|
||||
;.map_page_tables:
|
||||
; mov [sys_pgdir+ebx], eax
|
||||
; mov [sys_master_tab+ebx], eax
|
||||
; add eax, 0x1000
|
||||
; add ebx, 4
|
||||
; dec ecx
|
||||
; jnz .map_page_tables
|
||||
|
||||
; mov dword [sys_pgdir+0x600], sys_master_tab+PG_SW
|
||||
; mov dword [sys_master_tab+0x600], sys_master_tab+PG_SW
|
||||
|
||||
; ret
|
||||
|
||||
;.use_PSE:
|
||||
; mov ebx, cr4
|
||||
; or ebx, CR4_PSE
|
||||
; mov eax, PG_LARGE+PG_SW
|
||||
; bt [cpu_caps], CAPS_PGE
|
||||
; jnc @F
|
||||
; or eax, PG_GLOBAL
|
||||
; or ebx, CR4_PGE
|
||||
;@@:
|
||||
; mov dword [sys_pgdir], eax
|
||||
; add eax, 0x00400000
|
||||
; mov dword [sys_pgdir+4], eax
|
||||
; add eax, 0x00400000
|
||||
; mov dword [sys_pgdir+8], eax
|
||||
; add eax, 0x00400000
|
||||
; mov dword [sys_pgdir+12], eax
|
||||
;
|
||||
; mov dword [sys_pgdir+0x600], sys_master_tab+PG_SW
|
||||
; mov dword [sys_master_tab+0x600], sys_master_tab+PG_SW
|
||||
|
||||
; mov cr4, ebx
|
||||
; ret
|
||||
;endp
|
||||
|
||||
align 4
|
||||
proc init_page_map
|
||||
mov edi, sys_pgmap
|
||||
@ -226,63 +157,6 @@ proc init_page_map
|
||||
ret
|
||||
endp
|
||||
|
||||
;align 4
|
||||
;proc init_pg_mem
|
||||
;
|
||||
; mov edi, sys_pgmap
|
||||
; mov ecx, 512/4
|
||||
; xor eax,eax
|
||||
; cld
|
||||
; rep stosd
|
||||
;
|
||||
; not eax
|
||||
; mov ecx, [pg_data.pagemap_size]
|
||||
; sub ecx, 512
|
||||
; shr ecx, 2
|
||||
; rep stosd
|
||||
;
|
||||
; shl eax, PAGES_USED
|
||||
; mov [sys_pgmap+512], eax
|
||||
;
|
||||
; mov [page_start], sys_pgmap+512
|
||||
; mov ebx, sys_pgmap
|
||||
; add ebx, [pg_data.pagemap_size]
|
||||
; mov [page_end], ebx
|
||||
; mov eax, [pg_data.pages_count]
|
||||
; sub eax, 4096+PAGES_USED
|
||||
; mov [pg_data.pages_free], eax
|
||||
;
|
||||
; mov [pg_data.pages_faults], 0
|
||||
;
|
||||
; mov edi, OS_BASE+0x01000000
|
||||
; mov esi, [pg_data.kernel_tables]
|
||||
; sub esi, 4
|
||||
; ja @f
|
||||
; mov esi, 1
|
||||
;@@:
|
||||
; call alloc_page
|
||||
; stdcall map_page_table, sys_pgdir, edi, eax
|
||||
; add edi, 0x00400000
|
||||
; dec esi
|
||||
; jnz @B
|
||||
;
|
||||
; mov ecx, [pg_data.kernel_tables]
|
||||
; sub ecx, 4
|
||||
; shl ecx, 10
|
||||
; mov edi, OS_BASE+0x01000000
|
||||
; shr edi, 10
|
||||
; add edi, pages_tab
|
||||
; xor eax, eax
|
||||
; cld
|
||||
; rep stosd
|
||||
;
|
||||
; mov eax, cr3
|
||||
; mov cr3, eax
|
||||
;
|
||||
; mov [pg_data.pg_mutex], 0
|
||||
; ret
|
||||
;endp
|
||||
|
||||
align 4
|
||||
proc alloc_page
|
||||
|
||||
@ -1025,19 +899,25 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc get_mem_info stdcall, val:dword
|
||||
|
||||
mov esi, [val]
|
||||
sysfn_meminfo:
|
||||
|
||||
add ebx, new_app_base
|
||||
mov eax, [pg_data.pages_count]
|
||||
mov [esi], eax
|
||||
mov ebx, [pg_data.pages_free]
|
||||
mov [esi+4], ebx
|
||||
mov ecx, [pg_data.pages_faults]
|
||||
mov [esi+8], ecx
|
||||
mov [ebx], eax
|
||||
mov ecx, [pg_data.pages_free]
|
||||
mov [ebx+4], ecx
|
||||
mov edx, [pg_data.pages_faults]
|
||||
mov [ebx+8], edx
|
||||
mov esi, [heap_size]
|
||||
mov [ebx+12], esi
|
||||
mov edi, [heap_free]
|
||||
mov [ebx+16], edi
|
||||
mov eax, [heap_blocks]
|
||||
mov [ebx+20], eax
|
||||
mov ecx, [free_blocks]
|
||||
mov [ebx+24], ecx
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
new_services:
|
||||
@ -1045,17 +925,17 @@ new_services:
|
||||
cmp eax,4
|
||||
jle sys_sheduler
|
||||
|
||||
cmp eax, 10
|
||||
cmp eax, 11
|
||||
jb .fail
|
||||
ja @f
|
||||
|
||||
add ebx, new_app_base
|
||||
stdcall get_mem_info, ebx
|
||||
mov [esp+36], eax
|
||||
ret
|
||||
@@:
|
||||
cmp eax, 11
|
||||
ja @f
|
||||
; add ebx, new_app_base
|
||||
; stdcall get_mem_info, ebx
|
||||
; mov [esp+36], eax
|
||||
; ret
|
||||
;@@:
|
||||
; cmp eax, 11
|
||||
; ja @f
|
||||
|
||||
stdcall init_heap, ebx
|
||||
mov [esp+36], eax
|
||||
@ -1355,7 +1235,6 @@ proc set_mtrr stdcall, reg:dword,base:dword,size:dword,mem_type:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
iglobal
|
||||
align 4
|
||||
intel_str db "GenuineIntel",0
|
||||
@ -1408,11 +1287,15 @@ align 16
|
||||
mem_block_start rd 1
|
||||
mem_block_end rd 1
|
||||
mem_block_mask rd 2
|
||||
heap_size rd 1
|
||||
heap_free rd 1
|
||||
heap_blocks rd 1
|
||||
free_blocks rd 1
|
||||
|
||||
page_start rd 1
|
||||
page_end rd 1
|
||||
sys_page_map rd 1
|
||||
app_load rd 1
|
||||
; app_load rd 1
|
||||
endg
|
||||
|
||||
|
||||
@ -1421,7 +1304,6 @@ endg
|
||||
; mov edx, 0x400 ;bocsh
|
||||
; mov al,0xff ;bocsh
|
||||
; out dx, al ;bocsh
|
||||
; nop ;bocsh fix
|
||||
; pop edx
|
||||
; pop eax
|
||||
|
||||
|
@ -298,25 +298,28 @@ e7:
|
||||
fxrstor [eax]
|
||||
restore_ring3_context
|
||||
iret
|
||||
.init:
|
||||
fninit ; ¬ ¥ ã¦ë ¥¬ ᪨஢ ë¥ ¨áª«î票ï
|
||||
mov dword [ebx+PROC_BASE+APPDATA.fpu_init], 1
|
||||
.exit:
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
.no_SSE:
|
||||
fnsave [eax]
|
||||
mov ebx, [CURRENT_TASK]
|
||||
mov [fpu_owner], ebx
|
||||
shl ebx, 8
|
||||
cmp dword [ebx+PROC_BASE+APPDATA.fpu_init], 0
|
||||
je .init
|
||||
je .ready
|
||||
|
||||
mov eax, [ebx+PROC_BASE+APPDATA.fpu_state]
|
||||
frstor [eax]
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
.init:
|
||||
fninit ; ¬ ¥ ã¦ë ¥¬ ᪨஢ ë¥ ¨áª«î票ï
|
||||
.ready:
|
||||
mov dword [ebx+PROC_BASE+APPDATA.fpu_init], 1
|
||||
.exit:
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
iglobal
|
||||
fpu_owner dd 1
|
||||
endg
|
||||
|
@ -1,3 +1,5 @@
|
||||
GREEDY_KERNEL equ 0; 1
|
||||
|
||||
|
||||
struc APP_HEADER_00
|
||||
{ .banner dq ?
|
||||
@ -134,18 +136,27 @@ proc create_app_space stdcall, app_size:dword,img_size:dword
|
||||
mov ebx, eax
|
||||
shr eax, 12
|
||||
mov [app_pages], eax
|
||||
|
||||
add ebx, 0x3FFFFF
|
||||
and ebx, NOT(0x3FFFFF)
|
||||
shr ebx, 22
|
||||
mov [app_tabs], ebx
|
||||
|
||||
mov eax, [img_size]
|
||||
add eax, 4095
|
||||
and eax, NOT(4095)
|
||||
mov ecx, [img_size]
|
||||
add ecx, 4095
|
||||
and ecx, NOT(4095)
|
||||
|
||||
mov [img_size], eax
|
||||
shr eax, 12
|
||||
mov [img_pages], eax
|
||||
mov [img_size], ecx
|
||||
shr ecx, 12
|
||||
mov [img_pages], ecx
|
||||
|
||||
if GREEDY_KERNEL
|
||||
lea eax, [ecx+ebx+2] ;only image size
|
||||
else
|
||||
lea eax, [eax+ebx+2] ;all requested memory
|
||||
end if
|
||||
cmp eax, [pg_data.pages_free]
|
||||
ja .fail
|
||||
|
||||
call alloc_page
|
||||
test eax, eax
|
||||
@ -539,10 +550,12 @@ proc fs_exec stdcall file_name:dword, cmd_line:dword, flags:dword,\
|
||||
rep stosb
|
||||
|
||||
; read header
|
||||
|
||||
lea eax, [file_size]
|
||||
mov ebx, [eax]
|
||||
mov [img_size], ebx
|
||||
mov edi, TMP_BUFF
|
||||
call [fn_read]
|
||||
|
||||
test eax, eax
|
||||
jnz .err
|
||||
|
||||
@ -561,7 +574,11 @@ proc fs_exec stdcall file_name:dword, cmd_line:dword, flags:dword,\
|
||||
|
||||
mov eax, cr3
|
||||
mov [save_cr3], eax
|
||||
stdcall create_app_space,[app_mem], [app_mem];[file_size]
|
||||
if GREEDY_KERNEL
|
||||
stdcall create_app_space,[app_mem],[img_size]
|
||||
else
|
||||
stdcall create_app_space,[app_mem],[app_mem]
|
||||
end if
|
||||
test eax, eax
|
||||
jz .failed
|
||||
|
||||
|
@ -4481,4 +4481,4 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
<EFBFBD>ਠ§ ¯ã᪥ ¯à®£à ¬¬ë ¢®§¬®¦ë â ª¦¥ á«¥¤ãî騥 ª®¤ë ®è¨¡®ª:
|
||||
* 30 = 0x1E = ¥¤®áâ â®ç® ¯ ¬ïâ¨
|
||||
* 31 = 0x1F = ä ©« ¥ ï¥âáï ¨á¯®«¨¬ë¬
|
||||
* 32 = 0x20 = ᫨誮¬ ¬®£® ¯à®æ¥áᮢ
|
||||
* 32 = 0x20 = ᫨誮¬ ¬®£® ¯à®æ¥áᮢ
|
||||
|
@ -113,7 +113,7 @@ endp
|
||||
align 4
|
||||
proc update_stream
|
||||
locals
|
||||
stream_index dd 0
|
||||
stream_index dd ?
|
||||
endl
|
||||
|
||||
mov [stream_index], 0
|
||||
|
@ -672,7 +672,6 @@ include 'vmodeld.inc'
|
||||
mov ax,tss0
|
||||
ltr ax
|
||||
|
||||
|
||||
; READ TSC / SECOND
|
||||
|
||||
mov esi,boot_tsc
|
||||
@ -1912,6 +1911,7 @@ sys_end:
|
||||
jmp waitterm
|
||||
|
||||
iglobal
|
||||
align 4
|
||||
sys_system_table:
|
||||
dd sysfn_shutdown ; 1 = system shutdown
|
||||
dd sysfn_terminate ; 2 = terminate thread
|
||||
@ -1933,6 +1933,7 @@ sys_system_table:
|
||||
dd sysfn_terminate2 ; 18 = terminate thread using PID
|
||||
; instead of slot
|
||||
dd sysfn_mouse_acceleration; 19 = set/get mouse acceleration
|
||||
dd sysfn_meminfo ; 20 = get extended memory info
|
||||
sysfn_num = ($ - sys_system_table)/4
|
||||
endg
|
||||
|
||||
@ -2164,16 +2165,14 @@ sysfn_mouse_acceleration: ; 18.19 = set/get mouse features
|
||||
ret
|
||||
|
||||
sysfn_getfreemem:
|
||||
mov eax,[MEM_FreeSpace]
|
||||
shl eax,2
|
||||
mov [esp+36],eax
|
||||
mov eax, [pg_data.pages_free]
|
||||
shl eax, 2
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
|
||||
sysfn_getallmem:
|
||||
mov eax,[0xFE8C]
|
||||
shr eax,10
|
||||
; mov eax,[MEM_AllSpace]
|
||||
; shl eax,2
|
||||
mov eax,[MEM_AMOUNT]
|
||||
shr eax, 10
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user