Subversion Repositories Kolibri OS

Rev

Rev 25 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25 Rev 103
Line 23... Line 23...
23
    mov   ebx,general_page_table ;write address to [general_page_table]
23
    mov   ebx,general_page_table ;write address to [general_page_table]
24
    call  MEM_Alloc_Pages        ;allocate page directory
24
    call  MEM_Alloc_Pages        ;allocate page directory
25
    mov   eax,[general_page_table]
25
    mov   eax,[general_page_table]
26
    call  MEM_Get_Linear_Address ;eax - linear address of page directory
26
    call  MEM_Get_Linear_Address ;eax - linear address of page directory
27
    mov   edi,eax
27
    mov   edi,eax
28
    mov   ebx,eax
28
    mov   ebx,eax                ;copy address of page directory to safe place
29
    xor   eax,eax
29
    xor   eax,eax
30
    mov   ecx,4096/4
30
    mov   ecx,4096/4
31
    cld
31
    cld
32
    rep   stosd                  ;clear page directory
32
    rep   stosd                  ;clear page directory
Line 50... Line 50...
50
    call  MEM_Get_Linear_Address
50
    call  MEM_Get_Linear_Address
51
;eax - linear address of page table     
51
;eax - linear address of page table     
52
    mov   ecx,4096/4
52
    mov   ecx,4096/4
53
;ecx (counter) - number of pages in page table
53
;ecx (counter) - number of pages in page table
54
;current address=4Mb*esi     
54
;current address=4Mb*esi     
55
    cmp   esi,2
-
 
56
    jz    .start_lfb_map         ;lfb map begin at 0x800000
-
 
57
    cmp   esi,3
-
 
58
    jz    .end_lfb_map           ;lfb map end at 0xC00000
-
 
59
    jmp   .loop1
-
 
60
.start_lfb_map:
-
 
61
;current address=lfb address
-
 
62
    mov   ebp,[0x2f0000+0x9018]
-
 
63
    add   ebp,7                  ;add flags
-
 
64
    jmp   .loop1
-
 
65
.end_lfb_map:
-
 
66
;current address=linear address
-
 
67
    mov   ebp,12*0x100000+7
-
 
Line 68... Line 55...
68
    
55
    
69
.loop1:
56
.loop1:
70
    mov   [eax],ebp              ;write page address (with flags) in page table 
57
    mov   [eax],ebp              ;write page address (with flags) in page table 
71
    add   eax,4
58
    add   eax,4
Line 74... Line 61...
74
    
61
    
75
    inc   esi                    ;next page directory entry
62
    inc   esi                    ;next page directory entry
76
    cmp   esi,edx
63
    cmp   esi,edx
Line 77... Line 64...
77
    jnz   .loop
64
    jnz   .loop
78
    
65
    
79
;map region 0x80000000-0x803fffff to 0x800000-0xcfffff
66
;map region 0x80000000-0x807fffff to LFB
80
    mov   eax,1                  ;size of the region is 4Mb so only 1 page table needed
67
    mov   eax,2                  ;size of the region is 4Mb so only 1 page table needed
81
    mov   edx,ebx                ;ebx still contains linear address of the page directory
68
    mov   edx,ebx                ;ebx still contains linear address of the page directory
82
    add   ebx,0x800
69
    add   ebx,0x800
83
    call  MEM_Alloc_Pages        ;alloc page table for the region
70
    call  MEM_Alloc_Pages        ;alloc page table for the region
84
    mov   eax,[ebx]
71
    mov   eax,[ebx]
85
    add   dword [ebx],7          ;add flags
-
 
86
    call  MEM_Get_Linear_Address ;get linear address of the page table
72
    add   dword [ebx],7          ;add flags
87
    mov   ebx,eax
73
    call  MEM_Get_Linear_Address ;get linear address of the page table
-
 
74
    mov   ecx,4096/4             ;number of pages in page table
88
    mov   ecx,4096/4             ;number of pages in page table
75
    mov   edi,[0xfe80]
89
    mov   eax,8*0x100000+7
76
    add   edi,7
90
.loop3:
77
.loop3:
91
;ebx - linear address of page table
78
;eax - linear address of page table
92
;eax - current linear address with flags
79
;edi - current linear address with flags
93
    mov   [ebx],eax
80
    mov   [eax],edi
94
    add   ebx,4
81
    add   eax,4
-
 
82
    add   edi,4096
-
 
83
    loop  .loop3
-
 
84
    mov   eax,[ebx+4]
-
 
85
    call  MEM_Get_Linear_Address
-
 
86
    add   dword [ebx+4],7
-
 
87
    mov   ecx,4096/4
-
 
88
.loop31:
-
 
89
    mov   [eax],edi
-
 
90
    add   eax,4
Line 95... Line 91...
95
    add   eax,4096
91
    add   edi,4096
96
    loop  .loop3
92
    loop  .loop31
97
    
93
    
98
;map region 0xC0000000-* to 0x0-*
94
;map region 0xC0000000-* to 0x0-*