forked from KolibriOS/kolibrios
Now 8Mb of address space reserved for LFB. New linear address of LFB is 0x80000000.
git-svn-id: svn://kolibrios.org@103 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c5b30426a8
commit
16e3ab15b2
@ -140,6 +140,9 @@ macro _setcursor row,column
|
|||||||
}
|
}
|
||||||
|
|
||||||
pagetable_set:
|
pagetable_set:
|
||||||
|
;eax - physical address
|
||||||
|
;es:di - page table
|
||||||
|
;ecx - number of pages to map
|
||||||
or al, 7
|
or al, 7
|
||||||
@@:
|
@@:
|
||||||
stosd
|
stosd
|
||||||
@ -1047,36 +1050,10 @@ sayerr_plain:
|
|||||||
pop es ; es:di = 6000:0
|
pop es ; es:di = 6000:0
|
||||||
xor di,di
|
xor di,di
|
||||||
mov cx,256*map_mem ; Map (mapmem) M
|
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
|
; initialize as identity mapping
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
call pagetable_set
|
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
|
; 4 KB PAGE DIRECTORY
|
||||||
|
|
||||||
@ -1086,7 +1063,6 @@ sayerr_plain:
|
|||||||
mov cx, 64 / 4
|
mov cx, 64 / 4
|
||||||
mov eax, 0x60007 ; for 0 M
|
mov eax, 0x60007 ; for 0 M
|
||||||
call pagetable_set
|
call pagetable_set
|
||||||
mov dword [es:0x800],0x71007 ;map region 0x80000000-0x803FFFFF to 0x800000-0xCFFFFF
|
|
||||||
xor si,si
|
xor si,si
|
||||||
mov di,second_base_address shr 20
|
mov di,second_base_address shr 20
|
||||||
mov cx,64/2
|
mov cx,64/2
|
||||||
|
@ -25,7 +25,7 @@ create_general_page_table:
|
|||||||
mov eax,[general_page_table]
|
mov eax,[general_page_table]
|
||||||
call MEM_Get_Linear_Address ;eax - linear address of page directory
|
call MEM_Get_Linear_Address ;eax - linear address of page directory
|
||||||
mov edi,eax
|
mov edi,eax
|
||||||
mov ebx,eax
|
mov ebx,eax ;copy address of page directory to safe place
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
mov ecx,4096/4
|
mov ecx,4096/4
|
||||||
cld
|
cld
|
||||||
@ -52,19 +52,6 @@ create_general_page_table:
|
|||||||
mov ecx,4096/4
|
mov ecx,4096/4
|
||||||
;ecx (counter) - number of pages in page table
|
;ecx (counter) - number of pages in page table
|
||||||
;current address=4Mb*esi
|
;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:
|
.loop1:
|
||||||
mov [eax],ebp ;write page address (with flags) in page table
|
mov [eax],ebp ;write page address (with flags) in page table
|
||||||
@ -76,24 +63,33 @@ create_general_page_table:
|
|||||||
cmp esi,edx
|
cmp esi,edx
|
||||||
jnz .loop
|
jnz .loop
|
||||||
|
|
||||||
;map region 0x80000000-0x803fffff to 0x800000-0xcfffff
|
;map region 0x80000000-0x807fffff to LFB
|
||||||
mov eax,1 ;size of the region is 4Mb so only 1 page table needed
|
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
|
mov edx,ebx ;ebx still contains linear address of the page directory
|
||||||
add ebx,0x800
|
add ebx,0x800
|
||||||
call MEM_Alloc_Pages ;alloc page table for the region
|
call MEM_Alloc_Pages ;alloc page table for the region
|
||||||
mov eax,[ebx]
|
mov eax,[ebx]
|
||||||
add dword [ebx],7 ;add flags
|
add dword [ebx],7 ;add flags
|
||||||
call MEM_Get_Linear_Address ;get linear address of the page table
|
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 ecx,4096/4 ;number of pages in page table
|
||||||
mov eax,8*0x100000+7
|
mov edi,[0xfe80]
|
||||||
|
add edi,7
|
||||||
.loop3:
|
.loop3:
|
||||||
;ebx - linear address of page table
|
;eax - linear address of page table
|
||||||
;eax - current linear address with flags
|
;edi - current linear address with flags
|
||||||
mov [ebx],eax
|
mov [eax],edi
|
||||||
add ebx,4
|
add eax,4
|
||||||
add eax,4096
|
add edi,4096
|
||||||
loop .loop3
|
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-*
|
;map region 0xC0000000-* to 0x0-*
|
||||||
mov esi,edx ;esi=linear address of the page directory
|
mov esi,edx ;esi=linear address of the page directory
|
||||||
|
@ -413,7 +413,35 @@ include 'detect/disks.inc'
|
|||||||
or eax,0x80000000
|
or eax,0x80000000
|
||||||
mov cr0,eax
|
mov cr0,eax
|
||||||
jmp $+2
|
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
|
;Set base of graphic segment to linear address of LFB
|
||||||
mov eax,[0xfe80] ; set for gs
|
mov eax,[0xfe80] ; set for gs
|
||||||
@ -484,32 +512,7 @@ include 'vmodeld.inc'
|
|||||||
; jmp $
|
; jmp $
|
||||||
;extended_region_found:
|
;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
|
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user