Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 433 → Rev 434

/kernel/trunk/const.inc
146,6 → 146,7
 
CURRENT_TASK equ (OS_BASE+0x0003000)
TASK_COUNT equ (OS_BASE+0x0003004)
CURRENT_RING0_ESP equ (OS_BASE+0x0003008)
TASK_BASE equ (OS_BASE+0x0003010)
TASK_DATA equ (OS_BASE+0x0003020)
TASK_EVENT equ (OS_BASE+0x0003020)
/kernel/trunk/core/sched.inc
159,6 → 159,12
 
mov [CURRENT_TASK],ebx
mov [TASK_BASE],edi
push ebx
shl ebx, 8
mov ebx, [SLOT_BASE + ebx + APPDATA.pl0_stack]
add ebx, RING0_STACK_SIZE
mov [CURRENT_RING0_ESP], ebx
pop ebx
 
cmp al, 5
jne .noevents
/kernel/trunk/core/sys32.inc
42,23 → 42,18
mov esi, sys_int
mov ecx, 0x40
@@:
mov eax, [esi]
mov [edi], ax ; lower part of offset
mov [edi+2], word os_code ; segment selector
shr eax, 16
mov [edi+4], word 10001110b shl 8 ; interrupt descriptor
mov [edi+6], ax
add esi, 4
add edi, 8
dec ecx
jnz @b
lodsd
mov [edi], ax ; lower part of offset
mov [edi+2], word os_code ; segment selector
mov ax, word 10001110b shl 8 ; type: interrupt gate
mov [edi+4], eax
add edi, 8
loop @b
 
;mov edi,8*0x40+idts+8
mov [edi + 0], word (i40 and ((1 shl 16)-1))
mov [edi + 2], word os_code
mov [edi + 4], word 11101110b*256
mov [edi + 6], word (i40 shr 16)
 
mov dword [edi], (i40 and 0xFFFF) or (os_code shl 16)
mov dword [edi+4], (11101111b shl 8) or (i40 and 0xFFFF0000)
; type: trap gate
ret
 
iglobal
/kernel/trunk/core/syscall.inc
14,6 → 14,8
 
align 32
i40:
; diamond, 27.03.2007: handler does not require disabled interrupts
; so interrupts remain enabled when calling int 0x40
push ds es
pushad
cld
31,7 → 33,7
mov edi, [esp+28]
 
; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler
sti
; sti
push eax
and edi,0xff
call dword [servetable+edi*4]
49,10 → 51,10
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
uglobal
times 100 db ?
sysenter_stack:
endg
;uglobal
;times 100 db ?
;sysenter_stack:
;endg
 
align 32
SYSENTER_VAR equ 0
65,11 → 67,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_RING0_ESP]
 
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
106,9 → 105,15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 32
syscall_entry:
 
; cli syscall clear IF
xchg ecx, [esp]
mov [SYSENTER_VAR + 4], esp
xchg esp, [ss:CURRENT_RING0_ESP]
push ecx
lea ecx, [esp+4]
xchg ecx, [ss:CURRENT_RING0_ESP]
sti
push ecx
mov ecx, [ecx]
 
; mov [ss:sysenter_stack - 4], eax
; mov eax, [ss:CURRENT_TASK]
117,12 → 122,6
; 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
pushad
148,10 → 147,10
pop es ds
;------------------
 
cli
mov esp, [SYSENTER_VAR + 4]
xchg ecx, [esp]
sysret
mov ecx, [ss:esp+4]
pop esp
sysret
 
iglobal
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SYSTEM FUNCTIONS TABLE ;;
/kernel/trunk/kernel.asm
441,7 → 441,8
mov eax, os_code
wrmsr
mov ecx, MSR_SYSENTER_ESP
mov eax, sysenter_stack ; Check it
; mov eax, sysenter_stack ; Check it
xor eax, eax
wrmsr
mov ecx, MSR_SYSENTER_EIP
mov eax, sysenter_entry