Rev 1272 | Rev 1275 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1272 | Rev 1273 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; |
2 | ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. |
3 | ;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. |
4 | ;; PROGRAMMING: |
4 | ;; PROGRAMMING: |
5 | ;; Ivan Poddubny |
5 | ;; Ivan Poddubny |
6 | ;; Marat Zakiyanov (Mario79) |
6 | ;; Marat Zakiyanov (Mario79) |
7 | ;; VaStaNi |
7 | ;; VaStaNi |
8 | ;; Trans |
8 | ;; Trans |
Line 16... | Line 16... | ||
16 | ;; Iliya Mihailov (Ghost) |
16 | ;; Iliya Mihailov (Ghost) |
17 | ;; Sergey Semyonov (Serge) |
17 | ;; Sergey Semyonov (Serge) |
18 | ;; Johnny_B |
18 | ;; Johnny_B |
19 | ;; SPraid (simba) |
19 | ;; SPraid (simba) |
20 | ;; Hidnplayr |
20 | ;; Hidnplayr |
- | 21 | ;; Alexey Teplov ( |
|
21 | ;; |
22 | ;; |
22 | ;; Data in this file was originally part of MenuetOS project which is |
23 | ;; Data in this file was originally part of MenuetOS project which is |
23 | ;; distributed under the terms of GNU GPL. It is modified and redistributed as |
24 | ;; distributed under the terms of GNU GPL. It is modified and redistributed as |
24 | ;; part of KolibriOS project under the terms of GNU GPL. |
25 | ;; part of KolibriOS project under the terms of GNU GPL. |
25 | ;; |
26 | ;; |
Line 54... | Line 55... | ||
54 | ;; |
55 | ;; |
55 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
56 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 56... | Line 57... | ||
56 | 57 | ||
Line 57... | Line 58... | ||
57 | include 'macros.inc' |
58 | include 'macros.inc' |
Line 58... | Line 59... | ||
58 | 59 | ||
Line 59... | Line 60... | ||
59 | $Revision: 1272 $ |
60 | $Revision: 1273 $ |
Line 1082... | Line 1083... | ||
1082 | mov byte [irq_owner+4*6],al ;1 ; floppy diskette |
1083 | mov byte [irq_owner+4*6],al ;1 ; floppy diskette |
1083 | mov byte [irq_owner+4*13],al ;1 ; math co-pros |
1084 | mov byte [irq_owner+4*13],al ;1 ; math co-pros |
1084 | mov byte [irq_owner+4*14],al ;1 ; ide I |
1085 | mov byte [irq_owner+4*14],al ;1 ; ide I |
1085 | mov byte [irq_owner+4*15],al ;1 ; ide II |
1086 | mov byte [irq_owner+4*15],al ;1 ; ide II |
1086 | pop eax |
1087 | pop eax |
- | 1088 | ||
1087 | ; RESERVE PORTS |
1089 | ; RESERVE PORTS |
1088 | ; mov edi,1 ; 0x00-0x2d |
- | |
1089 | push dword 4 |
1090 | push 4 |
1090 | pop dword [RESERVED_PORTS] ;,edi |
1091 | pop dword [RESERVED_PORTS] ;,edi |
1091 | ; shl edi,4 |
- | |
- | 1092 | ||
1092 | push dword 1 |
1093 | push 1 |
1093 | pop dword [RESERVED_PORTS+16+0] ;,dword 1 |
1094 | pop dword [RESERVED_PORTS+16+0] ;,dword 1 |
1094 | push dword 0 |
- | |
1095 | pop dword [RESERVED_PORTS+16+4] ;,dword 0x0 |
1095 | and dword [RESERVED_PORTS+16+4],0 ;,dword 0x0 |
1096 | push dword 0x2d |
- | |
1097 | pop dword [RESERVED_PORTS+16+8] ;,dword 0x2d |
1096 | mov dword [RESERVED_PORTS+16+8],0x2d ;,dword 0x2d |
1098 | 1097 | ||
1099 | ; inc dword [RESERVED_PORTS] ; 0x30-0x4d |
- | |
1100 | ; mov edi,[RESERVED_PORTS] |
- | |
1101 | ; shl edi,4 |
- | |
1102 | push dword 1 |
1098 | push 1 |
1103 | pop dword [RESERVED_PORTS+32+0] ;,dword 1 |
1099 | pop dword [RESERVED_PORTS+32+0] ;,dword 1 |
1104 | push dword 0x30 |
1100 | push 0x30 |
1105 | pop dword [RESERVED_PORTS+32+4] ;,dword 0x30 |
1101 | pop dword [RESERVED_PORTS+32+4] ;,dword 0x30 |
1106 | push dword 0x4d |
1102 | push 0x4d |
1107 | pop dword [RESERVED_PORTS+32+8] ;,dword 0x4d |
1103 | pop dword [RESERVED_PORTS+32+8] ;,dword 0x4d |
Line 1108... | Line -... | ||
1108 | - | ||
1109 | ; inc dword [RESERVED_PORTS] ; 0x50-0xdf |
- | |
1110 | ; mov edi,[RESERVED_PORTS] |
- | |
1111 | ; shl edi,4 |
1104 | |
1112 | push dword 1 |
1105 | push 1 |
1113 | pop dword [RESERVED_PORTS+48+0] ;,dword 1 |
1106 | pop dword [RESERVED_PORTS+48+0] ;,dword 1 |
1114 | push dword 0x50 |
1107 | push 0x50 |
1115 | pop dword [RESERVED_PORTS+48+4] ;,dword 0x50 |
- | |
1116 | push dword 0xdf |
1108 | pop dword [RESERVED_PORTS+48+4] ;,dword 0x50 |
Line 1117... | Line -... | ||
1117 | pop dword [RESERVED_PORTS+48+8] ;,dword 0xdf |
- | |
1118 | - | ||
1119 | ; inc dword [RESERVED_PORTS] ; 0xe5-0xff |
- | |
1120 | ; mov edi,[RESERVED_PORTS] |
1109 | mov dword [RESERVED_PORTS+48+8],0xdf ;,dword 0xdf |
1121 | ; shl edi,4 |
1110 | |
1122 | push dword 1 |
- | |
1123 | pop dword [RESERVED_PORTS+64+0] ;,dword 1 |
- | |
1124 | push dword 0xe5 |
- | |
1125 | pop dword [RESERVED_PORTS+64+4] ;,dword 0xe5 |
- | |
Line -... | Line 1111... | ||
- | 1111 | push 1 |
|
1126 | push 0xff |
1112 | pop dword [RESERVED_PORTS+64+0] ;,dword 1 |
- | 1113 | ||
1127 | pop dword [RESERVED_PORTS+64+8] ;,dword 0xff |
1114 | mov dword [RESERVED_PORTS+64+4],0xe5 ;,dword 0xe5 |
Line 1128... | Line 1115... | ||
1128 | 1115 | mov dword [RESERVED_PORTS+64+8],0xff ;,dword 0xff |
|
Line 1129... | Line 1116... | ||
1129 | ; popad |
1116 | |
- | 1117 | ret |
|
1130 | ret |
1118 | |
1131 | 1119 | setirqreadports: |
|
1132 | setirqreadports: |
1120 | |
1133 | 1121 | mov [irq12read+0],dword 0x60 + 0x01000000 ; read port 0x60 , byte |
|
1134 | mov [irq12read+0],dword 0x60 + 0x01000000 ; read port 0x60 , byte |
1122 | and dword [irq12read+4],0 ; end of port list |
Line 3378... | Line 3366... | ||
3378 | ; 3 - disable cache. Ret 0 in eax. Ret nothing. Block. ok. |
3366 | ; 3 - disable cache. Ret 0 in eax. Ret nothing. Block. ok. |
3379 | ;eax |
3367 | ;eax |
3380 | ;3 - rdmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok. |
3368 | ;3 - rdmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok. |
3381 | ;4 - wrmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok. |
3369 | ;4 - wrmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok. |
3382 | ;--------------------------------------------------------------------------------------------- |
3370 | ;--------------------------------------------------------------------------------------------- |
- | 3371 | sys_sheduler: |
|
3383 | sys_sheduler: ;noname & halyavin |
3372 | ; old sys_sheduler ;noname & halyavin |
3384 | cmp eax,0 |
3373 | ; cmp eax,0 |
3385 | je shed_counter |
3374 | ; je shed_counter |
3386 | cmp eax,2 |
3375 | ; cmp eax,2 |
3387 | je perf_control |
3376 | ; je perf_control |
3388 | cmp eax,3 |
3377 | ; cmp eax,3 |
3389 | je rdmsr_instr |
3378 | ; je rdmsr_instr |
3390 | cmp eax,4 |
3379 | ; cmp eax,4 |
3391 | je wrmsr_instr |
3380 | ; je wrmsr_instr |
3392 | cmp eax,1 |
3381 | ; cmp eax,1 |
3393 | jne not_supported |
3382 | ; jne not_supported |
3394 | call change_task ;delay,0 |
3383 | ; call change_task ;delay,0 |
- | 3384 | ||
- | 3385 | ;rewritten by |
|
- | 3386 | test eax,eax |
|
- | 3387 | jz .shed_counter ;eax=0 |
|
- | 3388 | dec eax |
|
- | 3389 | jz change_task ;eax=1 |
|
- | 3390 | dec eax |
|
- | 3391 | jz .perf_control ;eax=2 |
|
- | 3392 | dec eax |
|
- | 3393 | jz .rdmsr_instr ;eax=3 |
|
- | 3394 | dec eax |
|
- | 3395 | jnz @f |
|
- | 3396 | ;wrmsr_instr ;eax=4 |
|
- | 3397 | ;.wrmsr_instr: |
|
- | 3398 | ;now counter in ecx |
|
- | 3399 | ;(edx:eax) esi:edi => edx:esi |
|
- | 3400 | ; Fast Call MSR can't be destroy |
|
- | 3401 | ; ® MSR_AMD_EFER ¬®¦® ¨§¬¥ïâì, â.ª. ¢ í⮬ ॣ¨áâॠ«¨è |
|
- | 3402 | ; ¢ª«îç îâáï/¢ëª«îç îâáï à áè¨à¥ë¥ ¢®§¬®¦®á⨠|
|
- | 3403 | cmp ecx, MSR_SYSENTER_CS |
|
- | 3404 | je @f |
|
- | 3405 | cmp ecx, MSR_SYSENTER_ESP |
|
- | 3406 | je @f |
|
- | 3407 | cmp ecx, MSR_SYSENTER_EIP |
|
- | 3408 | je @f |
|
- | 3409 | cmp ecx, MSR_AMD_STAR |
|
- | 3410 | je @f |
|
- | 3411 | ||
- | 3412 | mov eax, esi |
|
- | 3413 | wrmsr |
|
- | 3414 | ; mov [esp + 36], eax |
|
- | 3415 | ; mov [esp + 24], edx ;ret in ebx? |
|
- | 3416 | @@: |
|
3395 | ret |
3417 | ret |
- | 3418 | ||
3396 | shed_counter: |
3419 | .shed_counter: |
3397 | mov eax,[context_counter] |
3420 | mov eax,[context_counter] |
3398 | mov [esp+36],eax |
3421 | mov [esp+36],eax |
3399 | not_supported: |
- | |
3400 | ret |
3422 | ret |
3401 | perf_control: |
3423 | .perf_control: |
3402 | inc eax ;now eax=3 |
3424 | ; inc eax ;now eax=3 |
- | 3425 | add eax,3 ;restore eax=3 |
|
3403 | cmp ebx,eax |
3426 | cmp ebx,eax |
3404 | je cache_disable |
3427 | je cache_disable |
3405 | dec eax |
3428 | dec eax |
3406 | cmp ebx,eax |
3429 | cmp ebx,eax |
3407 | je cache_enable |
3430 | je cache_enable |
Line 3411... | Line 3434... | ||
3411 | dec eax |
3434 | dec eax |
3412 | cmp ebx,eax |
3435 | cmp ebx,eax |
3413 | je modify_pce |
3436 | je modify_pce |
3414 | ret |
3437 | ret |
Line 3415... | Line 3438... | ||
3415 | 3438 | ||
3416 | rdmsr_instr: |
3439 | .rdmsr_instr: |
3417 | ;now counter in ecx |
3440 | ;now counter in ecx |
3418 | ;(edx:eax) esi:edi => edx:esi |
3441 | ;(edx:eax) esi:edi => edx:esi |
3419 | mov eax,esi |
3442 | mov eax,esi |
3420 | rdmsr |
3443 | rdmsr |
3421 | mov [esp+36],eax |
3444 | mov [esp+36],eax |
3422 | mov [esp+24],edx ;ret in ebx? |
3445 | mov [esp+24],edx ;ret in ebx? |
Line 3423... | Line -... | ||
3423 | ret |
- | |
3424 | - | ||
3425 | wrmsr_instr: |
- | |
3426 | ;now counter in ecx |
- | |
3427 | ;(edx:eax) esi:edi => edx:esi |
- | |
3428 | ; Fast Call MSR can't be destroy |
- | |
3429 | ; Íî MSR_AMD_EFER ìîæíî èçìåíÿòü, ò.ê. â ýòîì ðåãèñòðå ëèø |
- | |
3430 | ; âêëþ÷àþòñÿ/âûêëþ÷àþòñÿ ðàñøèðåííûå âîçìîæíîñòè |
- | |
3431 | cmp ecx, MSR_SYSENTER_CS |
- | |
3432 | je @f |
- | |
3433 | cmp ecx, MSR_SYSENTER_ESP |
- | |
3434 | je @f |
- | |
3435 | cmp ecx, MSR_SYSENTER_EIP |
- | |
3436 | je @f |
- | |
3437 | cmp ecx, MSR_AMD_STAR |
- | |
3438 | je @f |
- | |
3439 | - | ||
3440 | mov eax, esi |
- | |
3441 | wrmsr |
- | |
3442 | ; mov [esp + 36], eax |
- | |
3443 | ; mov [esp + 24], edx ;ret in ebx? |
- | |
3444 | @@: |
- | |
3445 | ret |
3446 | ret |
3446 | 3447 | ||
3447 | cache_disable: |
3448 | cache_disable: |
3448 | mov eax,cr0 |
3449 | mov eax,cr0 |
3449 | or eax,01100000000000000000000000000000b |
3450 | or eax,01100000000000000000000000000000b |