Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 102 → Rev 103

/kernel/trunk/boot/bootcode.inc
140,6 → 140,9
}
 
pagetable_set:
;eax - physical address
;es:di - page table
;ecx - number of pages to map
or al, 7
@@:
stosd
1047,36 → 1050,10
pop es ; es:di = 6000:0
xor di,di
mov cx,256*map_mem ; Map (mapmem) M
; mov eax,7
; pt2:
; cmp cx,256*(map_mem-8) ; 8 M map to LFB
; jnz pt3
; pop eax
; add eax,7
; pt3:
; cmp cx,256*(map_mem-12) ; 12 M back to linear = physical
; jnz pt4
; mov eax,12*0x100000 + 7
; pt4:
; stosd
; add eax,4096
; loop pt2
; initialize as identity mapping
xor eax, eax
call pagetable_set
; 8M..12M map to LFB
pop eax
; mov cx, 256*4
mov ch, 4
mov di, 2000h
call pagetable_set
 
push 0x7100
pop es
xor di,di
mov eax,8*0x100000
mov cx,256*4
call pagetable_set
; 4 KB PAGE DIRECTORY
 
1086,7 → 1063,6
mov cx, 64 / 4
mov eax, 0x60007 ; for 0 M
call pagetable_set
mov dword [es:0x800],0x71007 ;map region 0x80000000-0x803FFFFF to 0x800000-0xCFFFFF
xor si,si
mov di,second_base_address shr 20
mov cx,64/2
/kernel/trunk/core/mem.inc
25,7 → 25,7
mov eax,[general_page_table]
call MEM_Get_Linear_Address ;eax - linear address of page directory
mov edi,eax
mov ebx,eax
mov ebx,eax ;copy address of page directory to safe place
xor eax,eax
mov ecx,4096/4
cld
52,19 → 52,6
mov ecx,4096/4
;ecx (counter) - number of pages in page table
;current address=4Mb*esi
cmp esi,2
jz .start_lfb_map ;lfb map begin at 0x800000
cmp esi,3
jz .end_lfb_map ;lfb map end at 0xC00000
jmp .loop1
.start_lfb_map:
;current address=lfb address
mov ebp,[0x2f0000+0x9018]
add ebp,7 ;add flags
jmp .loop1
.end_lfb_map:
;current address=linear address
mov ebp,12*0x100000+7
.loop1:
mov [eax],ebp ;write page address (with flags) in page table
76,8 → 63,8
cmp esi,edx
jnz .loop
;map region 0x80000000-0x803fffff to 0x800000-0xcfffff
mov eax,1 ;size of the region is 4Mb so only 1 page table needed
;map region 0x80000000-0x807fffff to LFB
mov eax,2 ;size of the region is 4Mb so only 1 page table needed
mov edx,ebx ;ebx still contains linear address of the page directory
add ebx,0x800
call MEM_Alloc_Pages ;alloc page table for the region
84,16 → 71,25
mov eax,[ebx]
add dword [ebx],7 ;add flags
call MEM_Get_Linear_Address ;get linear address of the page table
mov ebx,eax
mov ecx,4096/4 ;number of pages in page table
mov eax,8*0x100000+7
mov edi,[0xfe80]
add edi,7
.loop3:
;ebx - linear address of page table
;eax - current linear address with flags
mov [ebx],eax
add ebx,4
add eax,4096
;eax - linear address of page table
;edi - current linear address with flags
mov [eax],edi
add eax,4
add edi,4096
loop .loop3
mov eax,[ebx+4]
call MEM_Get_Linear_Address
add dword [ebx+4],7
mov ecx,4096/4
.loop31:
mov [eax],edi
add eax,4
add edi,4096
loop .loop31
;map region 0xC0000000-* to 0x0-*
mov esi,edx ;esi=linear address of the page directory
/kernel/trunk/kernel.asm
413,8 → 413,36
or eax,0x80000000
mov cr0,eax
jmp $+2
mov dword [0xfe80],0x800000
 
call MEM_Init
;add 0x800000-0xc00000 area
cmp word [0xfe0c],0x13
jle .less_memory
mov eax,0x800000 ;linear address
mov ebx,0x400000 shr 12 ;size in pages (4Mb)
mov ecx,0x800000 ;physical address
jmp .end_first_block
.less_memory:
mov eax,0x980000 ;linear address
mov ebx,0x280000 shr 12 ;size in pages (2.5Mb)
mov ecx,0x980000 ;physical address
.end_first_block:
call MEM_Add_Heap ;nobody can lock mutex yet
 
call create_general_page_table
;add 0x1000000(0xd80000)-end_of_memory area
mov eax,second_base_address
mov ebx,[0xfe8c]
mov ecx,[0xfe84]
sub ebx,ecx
shr ebx,12
add eax,ecx
call MEM_Add_Heap
;init physical memory manager.
call Init_Physical_Memory_Manager
mov dword [0xfe80],0x80000000 ;0x800000
 
;Set base of graphic segment to linear address of LFB
mov eax,[0xfe80] ; set for gs
mov [graph_data_l+2],ax
484,32 → 512,7
; jmp $
;extended_region_found:
 
call MEM_Init
;add 0x800000-0xc00000 area
cmp word [0xfe0c],0x13
jle .less_memory
mov eax,0x80000000 ;linear address
mov ebx,0x400000 shr 12 ;size in pages (4Mb)
mov ecx,0x800000 ;physical address
jmp .end_first_block
.less_memory:
mov eax,0x80180000 ;linear address
mov ebx,0x280000 shr 12 ;size in pages (2.5Mb)
mov ecx,0x980000 ;physical address
.end_first_block:
call MEM_Add_Heap ;nobody can lock mutex yet
 
call create_general_page_table
;add 0x1000000(0xd80000)-end_of_memory area
mov eax,second_base_address
mov ebx,[0xfe8c]
mov ecx,[0xfe84]
sub ebx,ecx
shr ebx,12
add eax,ecx
call MEM_Add_Heap
;init physical memory manager.
call Init_Physical_Memory_Manager
 
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f