/kernel/branches/flat_kernel/core/memory.inc |
---|
248,10 → 248,9 |
bt [cpu_caps], CAPS_PSE |
jnc .map_page_tables |
or esi, PG_LARGE+PG_UW |
shr edx, 20 |
mov ecx, edx |
mov edx, sys_pgdir+(LFB_BASE shr 20) |
@@: |
mov [sys_pgdir+edx], esi |
mov [edx], esi |
add edx, 4 |
add esi, 0x00400000 |
dec edi |
259,7 → 258,7 |
bt [cpu_caps], CAPS_PGE |
jnc @F |
or dword [sys_pgdir+ecx], PG_GLOBAL |
or dword [sys_pgdir+(LFB_BASE shr 20)], PG_GLOBAL |
@@: |
mov dword [LFBAddress], LFB_BASE |
mov eax, cr3 ;flush TLB |
/kernel/branches/flat_kernel/core/syscall.inc |
---|
50,13 → 50,18 |
SYSENTER_VAR equ 0 |
sysenter_entry: |
; Íàñòðàèâàåì ñòåê |
cli |
push eax |
mov eax, [ss:CURRENT_TASK] |
shl eax, 8 |
mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack] |
lea esp, [ss:eax + RING0_STACK_SIZE] ; configure ESP |
mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app |
; cli sysenter clear IF |
; push eax |
; mov eax, [ss:CURRENT_TASK] |
; shl eax, 8 |
; mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack] |
; lea esp, [eax + RING0_STACK_SIZE] ; configure ESP |
; mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app |
mov esp, [ss:CURRENT_TASK] |
shl esp, 8 |
mov esp, [ss:SLOT_BASE + esp + APPDATA.pl0_stack] |
add esp, RING0_STACK_SIZE ; configure ESP |
sti |
;------------------ |
push ds es |
93,15 → 98,22 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
align 32 |
syscall_entry: |
cli |
; cli syscall clear IF |
xchg ecx, [esp] |
mov [SYSENTER_VAR + 4], esp |
mov [ss:sysenter_stack - 4], eax |
mov eax, [ss:CURRENT_TASK] |
shl eax, 8 |
mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack] |
lea esp, [ss:eax + RING0_STACK_SIZE] ; configure ESP |
mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app |
; mov [ss:sysenter_stack - 4], eax |
; mov eax, [ss:CURRENT_TASK] |
; shl eax, 8 |
; mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack] |
; lea esp, [eax + RING0_STACK_SIZE] ; configure ESP |
; mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app |
mov esp, [ss:CURRENT_TASK] |
shl esp, 8 |
mov esp, [ss:SLOT_BASE + esp + APPDATA.pl0_stack] |
add esp, RING0_STACK_SIZE ; configure ESP |
sti |
;------------------ |
push ds es |
127,6 → 139,8 |
popad |
pop es ds |
;------------------ |
cli |
mov esp, [SYSENTER_VAR + 4] |
xchg ecx, [esp] |
sysret |
/kernel/branches/flat_kernel/core/taskman.inc |
---|
226,7 → 226,6 |
mov eax, [save_cr3] |
call set_cr3 |
; popfd |
xor ebx, ebx |
mov [application_table_status],ebx ;unlock application_table_status mutex |
mov eax,[process_number] ;set result |
235,7 → 234,6 |
mov eax, [save_cr3] |
call set_cr3 |
.err: |
; popfd |
.err_hdr: |
stdcall kernel_free,[file_base] |
.err_file: |
334,9 → 332,7 |
cmp eax,256 |
jge .failed ;it should be <256 |
mov word [ebx+0xa],9 ;set process state to 9 (for slot after hight boundary) |
; mov [new_process_place], eax |
ret |
.failed: |
xor eax,eax |
ret |
393,21 → 389,20 |
stdcall map_page,[tmp_task_pdir],eax,dword PG_SW |
mov edi, [tmp_task_pdir] |
mov ecx, (LFB_BASE shr 20)/4 ;(page_tabs shr 20)/4 |
mov ecx, (page_tabs shr 20)/4 |
xor eax, eax |
rep stosd |
mov esi, sys_pgdir+(LFB_BASE shr 20) ;(OS_BASE shr 20) |
mov eax, [dir_addr] |
or eax, PG_SW |
stosd |
mov esi, sys_pgdir+(OS_BASE shr 20) |
mov ecx, (OS_BASE shr 20)/4 |
cld |
rep movsd |
mov edi, [tmp_task_pdir] |
mov eax, [dir_addr] |
or eax, PG_SW |
mov [edi+(page_tabs shr 20)], eax |
mov eax, [dir_addr] |
call set_cr3 |
mov edx, [app_tabs] |
531,7 → 526,6 |
xor edx,edx |
mov eax,0x2 |
mov ebx, [pg_dir] |
.loop: |
;eax = current slot of process |
mov ecx,eax |
557,7 → 551,7 |
and eax, not 0xFFF |
stdcall map_page,[tmp_task_pdir],eax,dword PG_SW |
mov esi, [tmp_task_pdir] |
mov edi, (LFB_BASE shr 20)/4 |
mov edi, (page_tabs shr 20)/4 |
.destroy: |
mov eax, [esi] |
test eax, 1 |