Rev 2455 | Rev 3309 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2455 | Rev 2643 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 2455 $ |
8 | $Revision: 2643 $ |
9 | 9 | ||
10 | 10 | ||
Line 943... | Line 943... | ||
943 | jnz @f |
943 | jnz @f |
944 | mov edx, ecx |
944 | mov edx, ecx |
945 | @@: |
945 | @@: |
946 | ret |
946 | ret |
947 | ; \end{diamond} |
947 | ; \end{diamond} |
- | 948 | ||
- | 949 | reserve_hd1: |
|
- | 950 | ||
- | 951 | cli |
|
- | 952 | cmp [hd1_status], 0 |
|
- | 953 | je reserve_ok1 |
|
- | 954 | ||
- | 955 | sti |
|
- | 956 | call change_task |
|
- | 957 | jmp reserve_hd1 |
|
- | 958 | ||
- | 959 | reserve_ok1: |
|
- | 960 | ||
- | 961 | push eax |
|
- | 962 | mov eax, [CURRENT_TASK] |
|
- | 963 | shl eax, 5 |
|
- | 964 | mov eax, [eax+CURRENT_TASK+TASKDATA.pid] |
|
- | 965 | mov [hd1_status], eax |
|
- | 966 | pop eax |
|
- | 967 | sti |
|
- | 968 | ret |
|
- | 969 | ;******************************************** |
|
- | 970 | ||
- | 971 | uglobal |
|
- | 972 | hd_in_cache db ? |
|
- | 973 | endg |
|
- | 974 | ||
- | 975 | reserve_hd_channel: |
|
- | 976 | ; BIOS disk accesses are protected with common mutex hd1_status |
|
- | 977 | ; This must be modified when hd1_status will not be valid! |
|
- | 978 | cmp [hdpos], 0x80 |
|
- | 979 | jae .ret |
|
- | 980 | cmp [hdbase], 0x1F0 |
|
- | 981 | jne .IDE_Channel_2 |
|
- | 982 | .IDE_Channel_1: |
|
- | 983 | cli |
|
- | 984 | cmp [IDE_Channel_1], 0 |
|
- | 985 | je .reserve_ok_1 |
|
- | 986 | sti |
|
- | 987 | call change_task |
|
- | 988 | jmp .IDE_Channel_1 |
|
- | 989 | .IDE_Channel_2: |
|
- | 990 | cli |
|
- | 991 | cmp [IDE_Channel_2], 0 |
|
- | 992 | je .reserve_ok_2 |
|
- | 993 | sti |
|
- | 994 | call change_task |
|
- | 995 | jmp .IDE_Channel_2 |
|
- | 996 | .reserve_ok_1: |
|
- | 997 | mov [IDE_Channel_1], 1 |
|
- | 998 | push eax |
|
- | 999 | mov al, 1 |
|
- | 1000 | jmp @f |
|
- | 1001 | .reserve_ok_2: |
|
- | 1002 | mov [IDE_Channel_2], 1 |
|
- | 1003 | push eax |
|
- | 1004 | mov al, 3 |
|
- | 1005 | @@: |
|
- | 1006 | cmp [hdid], 1 |
|
- | 1007 | sbb al, -1 |
|
- | 1008 | mov [hd_in_cache], al |
|
- | 1009 | pop eax |
|
- | 1010 | sti |
|
- | 1011 | .ret: |
|
- | 1012 | ret |
|
- | 1013 | ||
- | 1014 | free_hd_channel: |
|
- | 1015 | ; see comment at reserve_hd_channel |
|
- | 1016 | cmp [hdpos], 0x80 |
|
- | 1017 | jae .ret |
|
- | 1018 | cmp [hdbase], 0x1F0 |
|
- | 1019 | jne .IDE_Channel_2 |
|
- | 1020 | .IDE_Channel_1: |
|
- | 1021 | mov [IDE_Channel_1], 0 |
|
- | 1022 | .ret: |
|
- | 1023 | ret |
|
- | 1024 | .IDE_Channel_2: |
|
- | 1025 | mov [IDE_Channel_2], 0 |
|
- | 1026 | ret |
|
- | 1027 | ;******************************************** |