Subversion Repositories Kolibri OS

Rev

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

Rev 103 Rev 115
Line 186... Line 186...
186
 
186
 
187
    mov   ebx,eax
187
    mov   ebx,eax
188
    mov   eax,[general_page_table]
188
    mov   eax,[general_page_table]
189
    call  simple_clone_cr3_table ;clone general page table
189
    call  simple_clone_cr3_table ;clone general page table
190
    shl   ebx,8
190
    shl   ebx,8
Line 191... Line 191...
191
    mov   [second_base_address+0x80000+ebx+0xB8],eax ;save address of page directory
191
    mov   [second_base_address+0x80000+ebx+APPDATA.dir_table],eax ;save address of page directory
192
    
192
    
193
    pop   ebx
193
    pop   ebx
194
    ret
194
    ret
195
;-----------------------------------------------------------------------------
195
;-----------------------------------------------------------------------------
196
get_cr3_table:
196
get_cr3_table:
197
;Input:
197
;Input:
198
;  eax - slot of process    
198
;  eax - slot of process    
199
;result:
199
;result:
200
;  eax - physical address of page directory
200
;  eax - physical address of page directory
201
   shl    eax,8                  ;size of process extended information=256 bytes
201
   shl    eax,8                  ;size of process extended information=256 bytes
202
   mov    eax,[second_base_address+0x80000+eax+0xB8]
202
   mov    eax,[second_base_address+0x80000+eax+APPDATA.dir_table]
203
   ret
203
   ret
204
;-----------------------------------------------------------------------------    
204
;-----------------------------------------------------------------------------    
205
dispose_app_cr3_table:
205
dispose_app_cr3_table:
Line 211... Line 211...
211
;page tables and all memory of process.
211
;page tables and all memory of process.
212
    pushad
212
    pushad
213
    mov   ebp,eax
213
    mov   ebp,eax
214
;ebp = process slot in the procedure.
214
;ebp = process slot in the procedure.
215
    shl   eax,8
215
    shl   eax,8
216
    mov   eax,[second_base_address+0x80000+eax+0xB8]
216
    mov   eax,[second_base_address+0x80000+eax+APPDATA.dir_table]
217
    mov   ebx,eax
217
    mov   ebx,eax
218
;ebx = physical address of page directory    
218
;ebx = physical address of page directory    
219
    call  MEM_Get_Linear_Address
219
    call  MEM_Get_Linear_Address
220
    mov   edi,eax
220
    mov   edi,eax
221
;edi = linear address of page directory    
221
;edi = linear address of page directory    
Line 232... Line 232...
232
  
232
  
233
.loop:
233
.loop:
234
;eax = current slot of process  
234
;eax = current slot of process  
235
    mov   ecx,eax
235
    mov   ecx,eax
236
    shl   ecx,5
236
    shl   ecx,5
237
    cmp   byte [second_base_address+0x3000+ecx+0xa],9 ;if process running?
237
    cmp   byte [second_base_address+0x3000+ecx+TASKDATA.state],9 ;if process running?
238
    jz    .next                  ;skip empty slots
238
    jz    .next                  ;skip empty slots
239
    shl   ecx,3
239
    shl   ecx,3
240
    cmp   [second_base_address+0x80000+ecx+0xB8],ebx  ;compare page directory addresses
240
    cmp   [second_base_address+0x80000+ecx+APPDATA.dir_table],ebx  ;compare page directory addresses
241
    jnz   .next
241
    jnz   .next
242
    inc   edx                    ;thread found
242
    inc   edx                    ;thread found
243
.next:
243
.next:
244
    inc   eax
244
    inc   eax