/kernel/branches/kolibri-process/blkdev/cd_drv.inc |
---|
5,9 → 5,9 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 3742 $ |
$Revision: 4734 $ |
;----------------------------------------------------------------------------- |
;********************************************************** |
; Непосредственная работа с устройством СD (ATAPI) |
;********************************************************** |
37,16 → 37,17 |
xor edi, edi |
add esi, 8 |
inc edi |
;-------------------------------------- |
align 4 |
.hdreadcache: |
; cmp dword [esi+4],0 ; empty |
; je .nohdcache |
cmp [esi], eax ; correct sector |
je .yeshdcache |
.nohdcache: |
add esi, 8 |
inc edi |
dec ecx |
jnz .hdreadcache |
call find_empty_slot_CD_cache ; ret in edi |
push edi |
66,7 → 67,7 |
call cd_calculate_cache_1 |
lea esi, [edi*8+esi] |
mov [esi], eax ; sector number |
; mov dword [esi+4],1 ; hd read - mark as same as in hd |
;-------------------------------------- |
.yeshdcache: |
mov esi, edi |
shl esi, 11;9 |
78,16 → 79,18 |
mov ecx, 512;/4 |
cld |
rep movsd ; move data |
;-------------------------------------- |
.exit: |
popad |
ret |
;----------------------------------------------------------------------------- |
ReadCDWRetr_1: |
pushad |
; Цикл, пока команда не выполнена успешно или не |
; исчерпано количество попыток |
mov ECX, MaxRetr |
mov ecx, MaxRetr |
;-------------------------------------- |
align 4 |
@@NextRetr: |
; Подать команду |
;************************************************* |
103,9 → 106,6 |
;************************************************* |
;ReadCD: |
push ecx |
; pusha |
; Задать размер сектора |
; mov [CDBlockSize],2048 ;2352 |
; Очистить буфер пакетной команды |
call clear_packet_buffer |
; Сформировать пакетную команду для считывания |
113,79 → 113,67 |
; Задать код команды Read CD |
mov [PacketCommand], byte 0x28;0xBE |
; Задать адрес сектора |
mov AX, word [CDSectorAddress+2] |
xchg AL, AH |
mov word [PacketCommand+2], AX |
mov AX, word [CDSectorAddress] |
xchg AL, AH |
mov word [PacketCommand+4], AX |
; mov eax,[CDSectorAddress] |
; mov [PacketCommand+2],eax |
mov ax, word [CDSectorAddress+2] |
xchg al, ah |
mov word [PacketCommand+2], ax |
mov ax, word [CDSectorAddress] |
xchg al, ah |
mov word [PacketCommand+4], ax |
; Задать количество считываемых секторов |
mov [PacketCommand+8], byte 1 |
; Задать считывание данных в полном объеме |
; mov [PacketCommand+9],byte 0xF8 |
; Подать команду |
call SendPacketDatCommand |
pop ecx |
; ret |
; cmp [DevErrorCode],0 |
test eax, eax |
jz @@End_4 |
or ecx, ecx ;{SPraid.simba} (for cd load) |
jz @@End_4 |
dec ecx |
cmp [timer_ticks_enable], 0 |
jne @f |
mov eax, NoTickWaitTime |
;-------------------------------------- |
align 4 |
.wait: |
dec eax |
; test eax,eax |
jz @@NextRetr |
jmp .wait |
;-------------------------------------- |
align 4 |
@@: |
; Задержка на 2,5 секунды |
; mov EAX,[timer_ticks] |
; add EAX,50 ;250 |
;@@Wait: |
; call change_task |
; cmp EAX,[timer_ticks] |
; ja @@Wait |
loop @@NextRetr |
;-------------------------------------- |
@@End_4: |
mov dword [DevErrorCode], eax |
popad |
ret |
;----------------------------------------------------------------------------- |
; Универсальные процедуры, обеспечивающие выполнение |
; пакетных команд в режиме PIO |
; Максимально допустимое время ожидания реакции |
; устройства на пакетную команду (в тиках) |
;----------------------------------------------------------------------------- |
MaxCDWaitTime equ 1000 ;200 ;10 секунд |
uglobal |
; Область памяти для формирования пакетной команды |
PacketCommand: |
rb 12 ;DB 12 DUP (?) |
; Область памяти для приема данных от дисковода |
;CDDataBuf DB 4096 DUP (0) |
; Размер принимаемого блока данных в байтах |
;CDBlockSize DW ? |
; Адрес считываемого сектора данных |
CDSectorAddress: |
DD ? |
CDSectorAddress: dd ? |
; Время начала очередной операции с диском |
TickCounter_1 DD 0 |
TickCounter_1 dd 0 |
; Время начала ожидания готовности устройства |
WURStartTime DD 0 |
WURStartTime dd 0 |
; указатель буфера для считывания |
CDDataBuf_pointer dd 0 |
endg |
;----------------------------------------------------------------------------- |
;**************************************************** |
;* ПОСЛАТЬ УСТРОЙСТВУ ATAPI ПАКЕТНУЮ КОМАНДУ, * |
;* ПРЕДУСМАТРИВАЮЩУЮ ПЕРЕДАЧУ ОДНОГО СЕКТОРА ДАННЫХ * |
200,7 → 188,6 |
;**************************************************** |
SendPacketDatCommand: |
xor eax, eax |
; mov byte [DevErrorCode],al |
; Задать режим CHS |
mov byte [ATAAddressMode], al |
; Послать ATA-команду передачи пакетной команды |
209,125 → 196,134 |
mov byte [ATASectorNumber], al |
; Загрузить размер передаваемого блока |
mov [ATAHead], al |
; mov AX,[CDBlockSize] |
mov [ATACylinder], CDBlockSize |
mov [ATACommand], 0A0h |
mov [ATACommand], 0xA0 |
call SendCommandToHDD_1 |
test eax, eax |
; cmp [DevErrorCode],0 ;проверить код ошибки |
jnz @@End_8 ;закончить, сохранив код ошибки |
; Ожидание готовности дисковода к приему |
; пакетной команды |
mov DX, [ATABasePortAddr] |
add DX, 7 ;порт 1х7h |
mov dx, [ATABasePortAddr] |
add dx, 7 ;порт 1х7h |
mov ecx, NoTickWaitTime |
;-------------------------------------- |
align 4 |
@@WaitDevice0: |
cmp [timer_ticks_enable], 0 |
jne @f |
dec ecx |
; test ecx,ecx |
jz @@Err1_1 |
jmp .test |
;-------------------------------------- |
align 4 |
@@: |
call change_task |
; Проверить время выполнения команды |
mov EAX, [timer_ticks] |
sub EAX, [TickCounter_1] |
cmp EAX, BSYWaitTime |
mov eax, [timer_ticks] |
sub eax, [TickCounter_1] |
cmp eax, BSYWaitTime |
ja @@Err1_1 ;ошибка тайм-аута |
; Проверить готовность |
;-------------------------------------- |
align 4 |
.test: |
in AL, DX |
test AL, 80h ;состояние сигнала BSY |
in al, dx |
test al, 0x80 ;состояние сигнала BSY |
jnz @@WaitDevice0 |
test AL, 1 ;состояние сигнала ERR |
test al, 1 ;состояние сигнала ERR |
jnz @@Err6 |
test AL, 08h ;состояние сигнала DRQ |
test al, 0x8 ;состояние сигнала DRQ |
jz @@WaitDevice0 |
; Послать пакетную команду |
cli |
mov DX, [ATABasePortAddr] |
mov AX, [PacketCommand] |
out DX, AX |
mov AX, [PacketCommand+2] |
out DX, AX |
mov AX, [PacketCommand+4] |
out DX, AX |
mov AX, [PacketCommand+6] |
out DX, AX |
mov AX, [PacketCommand+8] |
out DX, AX |
mov AX, [PacketCommand+10] |
out DX, AX |
mov dx, [ATABasePortAddr] |
mov ax, [PacketCommand] |
out dx, ax |
mov ax, [PacketCommand+2] |
out dx, ax |
mov ax, [PacketCommand+4] |
out dx, ax |
mov ax, [PacketCommand+6] |
out dx, ax |
mov ax, [PacketCommand+8] |
out dx, ax |
mov ax, [PacketCommand+10] |
out dx, ax |
sti |
; Ожидание готовности данных |
mov DX, [ATABasePortAddr] |
add DX, 7 ;порт 1х7h |
mov dx, [ATABasePortAddr] |
add dx, 7 ;порт 1х7h |
mov ecx, NoTickWaitTime |
;-------------------------------------- |
align 4 |
@@WaitDevice1: |
cmp [timer_ticks_enable], 0 |
jne @f |
dec ecx |
; test ecx,ecx |
jz @@Err1_1 |
jmp .test_1 |
;-------------------------------------- |
align 4 |
@@: |
call change_task |
; Проверить время выполнения команды |
mov EAX, [timer_ticks] |
sub EAX, [TickCounter_1] |
cmp EAX, MaxCDWaitTime |
mov eax, [timer_ticks] |
sub eax, [TickCounter_1] |
cmp eax, MaxCDWaitTime |
ja @@Err1_1 ;ошибка тайм-аута |
; Проверить готовность |
;-------------------------------------- |
align 4 |
.test_1: |
in AL, DX |
test AL, 80h ;состояние сигнала BSY |
in al, dx |
test al, 0x80 ;состояние сигнала BSY |
jnz @@WaitDevice1 |
test AL, 1 ;состояние сигнала ERR |
test al, 1 ;состояние сигнала ERR |
jnz @@Err6_temp |
test AL, 08h ;состояние сигнала DRQ |
test al, 0x8 ;состояние сигнала DRQ |
jz @@WaitDevice1 |
; Принять блок данных от контроллера |
mov EDI, [CDDataBuf_pointer];0x7000 ;CDDataBuf |
mov edi, [CDDataBuf_pointer] |
; Загрузить адрес регистра данных контроллера |
mov DX, [ATABasePortAddr];порт 1x0h |
mov dx, [ATABasePortAddr] |
; Загрузить в счетчик размер блока в байтах |
xor ecx, ecx |
mov CX, CDBlockSize |
mov cx, CDBlockSize |
; Вычислить размер блока в 16-разрядных словах |
shr CX, 1;разделить размер блока на 2 |
shr cx, 1 ;разделить размер блока на 2 |
; Принять блок данных |
cli |
cld |
rep insw |
sti |
;-------------------------------------- |
; Успешное завершение приема данных |
@@End_8: |
xor eax, eax |
ret |
;-------------------------------------- |
; Записать код ошибки |
@@Err1_1: |
xor eax, eax |
inc eax |
ret |
; mov [DevErrorCode],1 |
; ret |
;-------------------------------------- |
@@Err6_temp: |
mov eax, 7 |
ret |
; mov [DevErrorCode],7 |
; ret |
;-------------------------------------- |
@@Err6: |
mov eax, 6 |
ret |
; mov [DevErrorCode],6 |
;@@End_8: |
; ret |
;----------------------------------------------------------------------------- |
;*********************************************** |
;* ПОСЛАТЬ УСТРОЙСТВУ ATAPI ПАКЕТНУЮ КОМАНДУ, * |
;* НЕ ПРЕДУСМАТРИВАЮЩУЮ ПЕРЕДАЧИ ДАННЫХ * |
340,7 → 336,6 |
SendPacketNoDatCommand: |
pushad |
xor eax, eax |
; mov byte [DevErrorCode],al |
; Задать режим CHS |
mov byte [ATAAddressMode], al |
; Послать ATA-команду передачи пакетной команды |
349,82 → 344,93 |
mov byte [ATASectorNumber], al |
mov word [ATACylinder], ax |
mov byte [ATAHead], al |
mov [ATACommand], 0A0h |
mov [ATACommand], 0xA0 |
call SendCommandToHDD_1 |
; cmp [DevErrorCode],0 ;проверить код ошибки |
test eax, eax |
jnz @@End_9 ;закончить, сохранив код ошибки |
; Ожидание готовности дисковода к приему |
; пакетной команды |
mov DX, [ATABasePortAddr] |
add DX, 7 ;порт 1х7h |
mov dx, [ATABasePortAddr] |
add dx, 7 ;порт 1х7h |
;-------------------------------------- |
align 4 |
@@WaitDevice0_1: |
call change_task |
; Проверить время ожидания |
mov EAX, [timer_ticks] |
sub EAX, [TickCounter_1] |
cmp EAX, BSYWaitTime |
mov eax, [timer_ticks] |
sub eax, [TickCounter_1] |
cmp eax, BSYWaitTime |
ja @@Err1_3 ;ошибка тайм-аута |
; Проверить готовность |
in AL, DX |
test AL, 80h ;состояние сигнала BSY |
in al, dx |
test al, 0x80 ;состояние сигнала BSY |
jnz @@WaitDevice0_1 |
test AL, 1 ;состояние сигнала ERR |
test al, 1 ;состояние сигнала ERR |
jnz @@Err6_1 |
test AL, 08h ;состояние сигнала DRQ |
test al, 0x8 ;состояние сигнала DRQ |
jz @@WaitDevice0_1 |
; Послать пакетную команду |
; cli |
mov DX, [ATABasePortAddr] |
mov AX, word [PacketCommand] |
out DX, AX |
mov AX, word [PacketCommand+2] |
out DX, AX |
mov AX, word [PacketCommand+4] |
out DX, AX |
mov AX, word [PacketCommand+6] |
out DX, AX |
mov AX, word [PacketCommand+8] |
out DX, AX |
mov AX, word [PacketCommand+10] |
out DX, AX |
mov dx, [ATABasePortAddr] |
mov ax, word [PacketCommand] |
out dx, ax |
mov ax, word [PacketCommand+2] |
out dx, ax |
mov ax, word [PacketCommand+4] |
out dx, ax |
mov ax, word [PacketCommand+6] |
out dx, ax |
mov ax, word [PacketCommand+8] |
out dx, ax |
mov ax, word [PacketCommand+10] |
out dx, ax |
; sti |
cmp [ignore_CD_eject_wait], 1 |
je @@clear_DEC |
; Ожидание подтверждения приема команды |
mov DX, [ATABasePortAddr] |
add DX, 7 ;порт 1х7h |
mov dx, [ATABasePortAddr] |
add dx, 7 ;порт 1х7h |
;-------------------------------------- |
align 4 |
@@WaitDevice1_1: |
call change_task |
; Проверить время выполнения команды |
mov EAX, [timer_ticks] |
sub EAX, [TickCounter_1] |
cmp EAX, MaxCDWaitTime |
mov eax, [timer_ticks] |
sub eax, [TickCounter_1] |
cmp eax, MaxCDWaitTime |
ja @@Err1_3 ;ошибка тайм-аута |
; Ожидать освобождения устройства |
in AL, DX |
test AL, 80h ;состояние сигнала BSY |
in al, dx |
test al, 0x80 ;состояние сигнала BSY |
jnz @@WaitDevice1_1 |
test AL, 1 ;состояние сигнала ERR |
test al, 1 ;состояние сигнала ERR |
jnz @@Err6_1 |
test AL, 40h ;состояние сигнала DRDY |
test al, 0x40 ;состояние сигнала DRDY |
jz @@WaitDevice1_1 |
;-------------------------------------- |
@@clear_DEC: |
and [DevErrorCode], 0 |
popad |
ret |
;-------------------------------------- |
; Записать код ошибки |
@@Err1_3: |
xor eax, eax |
inc eax |
jmp @@End_9 |
;-------------------------------------- |
@@Err6_1: |
mov eax, 6 |
;-------------------------------------- |
@@End_9: |
mov [DevErrorCode], eax |
popad |
ret |
;----------------------------------------------------------------------------- |
;**************************************************** |
;* ПОСЛАТЬ КОМАНДУ ЗАДАННОМУ ДИСКУ * |
;* Входные параметры передаются через глобальные * |
445,45 → 451,56 |
;* возвращен код ошибки в eax * |
;**************************************************** |
SendCommandToHDD_1: |
; pushad |
; mov [DevErrorCode],0 not need |
; Проверить значение кода режима |
cmp [ATAAddressMode], 1 |
ja @@Err2_4 |
; Проверить корректность номера канала |
mov BX, [ChannelNumber] |
cmp BX, 1 |
mov bx, [ChannelNumber] |
cmp bx, 1 |
jb @@Err3_4 |
cmp BX, 2 |
cmp bx, 2 |
ja @@Err3_4 |
; Установить базовый адрес |
dec BX |
shl BX, 1 |
dec bx |
shl ebx, 2 |
movzx ebx, bx |
mov AX, [ebx+StandardATABases] |
mov [ATABasePortAddr], AX |
mov eax, [cdpos] |
dec eax |
shr eax, 2 |
imul eax, sizeof.IDE_DATA |
add eax, IDE_controller_1 |
add eax, ebx |
mov ax, [eax+IDE_DATA.BAR0_val] |
mov [ATABasePortAddr], ax |
; Ожидание готовности HDD к приему команды |
; Выбрать нужный диск |
mov DX, [ATABasePortAddr] |
add DX, 6 ;адрес регистра головок |
mov AL, [DiskNumber] |
cmp AL, 1 ;проверить номера диска |
mov dx, [ATABasePortAddr] |
add dx, 6 ;адрес регистра головок |
mov al, [DiskNumber] |
cmp al, 1 ;проверить номера диска |
ja @@Err4_4 |
shl AL, 4 |
or AL, 10100000b |
out DX, AL |
shl al, 4 |
or al, 10100000b |
out dx, al |
; Ожидать, пока диск не будет готов |
inc DX |
inc dx |
mov eax, [timer_ticks] |
mov [TickCounter_1], eax |
mov ecx, NoTickWaitTime |
;-------------------------------------- |
align 4 |
@@WaitHDReady_2: |
cmp [timer_ticks_enable], 0 |
jne @f |
dec ecx |
; test ecx,ecx |
jz @@Err1_4 |
jmp .test |
;-------------------------------------- |
align 4 |
@@: |
call change_task |
; Проверить время ожидания |
491,81 → 508,78 |
sub eax, [TickCounter_1] |
cmp eax, BSYWaitTime;300 ;ожидать 3 сек. |
ja @@Err1_4 ;ошибка тайм-аута |
; Прочитать регистр состояния |
;-------------------------------------- |
align 4 |
.test: |
in AL, DX |
in al, dx ; Прочитать регистр состояния |
; Проверить состояние сигнала BSY |
test AL, 80h |
test al, 0x80 |
jnz @@WaitHDReady_2 |
; Проверить состояние сигнала DRQ |
test AL, 08h |
test al, 0x8 |
jnz @@WaitHDReady_2 |
; Загрузить команду в регистры контроллера |
cli |
mov DX, [ATABasePortAddr] |
inc DX ;регистр "особенностей" |
mov AL, [ATAFeatures] |
out DX, AL |
inc DX ;счетчик секторов |
mov AL, [ATASectorCount] |
out DX, AL |
inc DX ;регистр номера сектора |
mov AL, [ATASectorNumber] |
out DX, AL |
inc DX ;номер цилиндра (младший байт) |
mov AX, [ATACylinder] |
out DX, AL |
inc DX ;номер цилиндра (старший байт) |
mov AL, AH |
out DX, AL |
inc DX ;номер головки/номер диска |
mov AL, [DiskNumber] |
shl AL, 4 |
cmp [ATAHead], 0Fh;проверить номер головки |
mov dx, [ATABasePortAddr] |
inc dx ;регистр "особенностей" |
mov al, [ATAFeatures] |
out dx, al |
inc dx ;счетчик секторов |
mov al, [ATASectorCount] |
out dx, al |
inc dx ;регистр номера сектора |
mov al, [ATASectorNumber] |
out dx, al |
inc dx ;номер цилиндра (младший байт) |
mov ax, [ATACylinder] |
out dx, al |
inc dx ;номер цилиндра (старший байт) |
mov al, ah |
out dx, al |
inc dx ;номер головки/номер диска |
mov al, [DiskNumber] |
shl al, 4 |
cmp [ATAHead], 0xF ;проверить номер головки |
ja @@Err5_4 |
or AL, [ATAHead] |
or AL, 10100000b |
mov AH, [ATAAddressMode] |
shl AH, 6 |
or AL, AH |
out DX, AL |
or al, [ATAHead] |
or al, 10100000b |
mov ah, [ATAAddressMode] |
shl ah, 6 |
or al, ah |
out dx, al |
; Послать команду |
mov AL, [ATACommand] |
inc DX ;регистр команд |
out DX, AL |
mov al, [ATACommand] |
inc dx ;регистр команд |
out dx, al |
sti |
; Сбросить признак ошибки |
; mov [DevErrorCode],0 |
;-------------------------------------- |
@@End_10: |
xor eax, eax |
ret |
;-------------------------------------- |
; Записать код ошибки |
@@Err1_4: |
xor eax, eax |
inc eax |
; mov [DevErrorCode],1 |
ret |
;-------------------------------------- |
@@Err2_4: |
mov eax, 2 |
; mov [DevErrorCode],2 |
ret |
;-------------------------------------- |
@@Err3_4: |
mov eax, 3 |
; mov [DevErrorCode],3 |
ret |
;-------------------------------------- |
@@Err4_4: |
mov eax, 4 |
; mov [DevErrorCode],4 |
ret |
;-------------------------------------- |
@@Err5_4: |
mov eax, 5 |
; mov [DevErrorCode],5 |
; Завершение работы программы |
ret |
; sti |
; popad |
;----------------------------------------------------------------------------- |
;************************************************* |
;* ОЖИДАНИЕ ГОТОВНОСТИ УСТРОЙСТВА К РАБОТЕ * |
;* Входные параметры передаются через глобальные * |
576,25 → 590,31 |
WaitUnitReady: |
pusha |
; Запомнить время начала операции |
mov EAX, [timer_ticks] |
mov [WURStartTime], EAX |
mov eax, [timer_ticks] |
mov [WURStartTime], eax |
; Очистить буфер пакетной команды |
call clear_packet_buffer |
; Сформировать команду TEST UNIT READY |
mov [PacketCommand], word 00h |
mov [PacketCommand], word 0 |
; ЦИКЛ ОЖИДАНИЯ ГОТОВНОСТИ УСТРОЙСТВА |
mov ecx, NoTickWaitTime |
;-------------------------------------- |
align 4 |
@@SendCommand: |
; Подать команду проверки готовности |
call SendPacketNoDatCommand |
cmp [timer_ticks_enable], 0 |
jne @f |
cmp [DevErrorCode], 0 |
je @@End_11 |
dec ecx |
; cmp ecx,0 |
jz .Error |
jmp @@SendCommand |
;-------------------------------------- |
align 4 |
@@: |
call change_task |
; Проверить код ошибки |
601,17 → 621,19 |
cmp [DevErrorCode], 0 |
je @@End_11 |
; Проверить время ожидания готовности |
mov EAX, [timer_ticks] |
sub EAX, [WURStartTime] |
cmp EAX, MaxCDWaitTime |
mov eax, [timer_ticks] |
sub eax, [WURStartTime] |
cmp eax, MaxCDWaitTime |
jb @@SendCommand |
;-------------------------------------- |
.Error: |
; Ошибка тайм-аута |
mov [DevErrorCode], 1 |
;-------------------------------------- |
@@End_11: |
popa |
ret |
;----------------------------------------------------------------------------- |
;************************************************* |
;* ЗАПРЕТИТЬ СМЕНУ ДИСКА * |
;* Входные параметры передаются через глобальные * |
635,7 → 657,7 |
mov [eax], byte 1 |
popa |
ret |
;----------------------------------------------------------------------------- |
;************************************************* |
;* РАЗРЕШИТЬ СМЕНУ ДИСКА * |
;* Входные параметры передаются через глобальные * |
650,7 → 672,7 |
; Задать код команды |
mov [PacketCommand], byte 0x1E |
; Задать код запрета |
mov [PacketCommand+4], byte 00b |
mov [PacketCommand+4], byte 0 |
; Подать команду |
call SendPacketNoDatCommand |
mov eax, ATAPI_IDE0_lock |
659,7 → 681,7 |
mov [eax], byte 0 |
popa |
ret |
;----------------------------------------------------------------------------- |
;************************************************* |
;* ЗАГРУЗИТЬ НОСИТЕЛЬ В ДИСКОВОД * |
;* Входные параметры передаются через глобальные * |
673,7 → 695,7 |
call clear_packet_buffer |
; Сформировать команду START/STOP UNIT |
; Задать код команды |
mov [PacketCommand], word 1Bh |
mov [PacketCommand], word 0x1B |
; Задать операцию загрузки носителя |
mov [PacketCommand+4], word 00000011b |
; Подать команду |
680,7 → 702,7 |
call SendPacketNoDatCommand |
popa |
ret |
;----------------------------------------------------------------------------- |
;************************************************* |
;* ИЗВЛЕЧЬ НОСИТЕЛЬ ИЗ ДИСКОВОДА * |
;* Входные параметры передаются через глобальные * |
694,7 → 716,7 |
call clear_packet_buffer |
; Сформировать команду START/STOP UNIT |
; Задать код команды |
mov [PacketCommand], word 1Bh |
mov [PacketCommand], word 0x1B |
; Задать операцию извлечения носителя |
mov [PacketCommand+4], word 00000010b |
; Подать команду |
701,7 → 723,7 |
call SendPacketNoDatCommand |
popa |
ret |
;----------------------------------------------------------------------------- |
;************************************************* |
;* Проверить событие нажатия кнопки извлечения * |
;* диска * |
715,15 → 737,16 |
sub eax, [timer_ATAPI_check] |
cmp eax, 100 |
jb .no |
.yes: |
xor eax, eax |
inc eax |
ret |
;-------------------------------------- |
.no: |
xor eax, eax |
ret |
endp |
;----------------------------------------------------------------------------- |
align 4 |
check_ATAPI_device_event: |
pusha |
731,43 → 754,96 |
sub eax, [timer_ATAPI_check] |
cmp eax, 100 |
jb .end_1 |
pushfd |
mov al, [DRIVE_DATA+1] |
and al, 11b |
cmp al, 10b |
jz .ide3 |
;-------------------------------------- |
.ide2_1: |
mov al, [DRIVE_DATA+1] |
and al, 1100b |
cmp al, 1000b |
jz .ide2 |
;-------------------------------------- |
.ide1_1: |
mov al, [DRIVE_DATA+1] |
and al, 110000b |
cmp al, 100000b |
jz .ide1 |
;-------------------------------------- |
.ide0_1: |
mov al, [DRIVE_DATA+1] |
and al, 11000000b |
cmp al, 10000000b |
jz .ide0 |
;-------------------------------------- |
.ide7_1: |
mov al, [DRIVE_DATA+6] |
and al, 11b |
cmp al, 10b |
jz .ide7 |
;-------------------------------------- |
.ide6_1: |
mov al, [DRIVE_DATA+6] |
and al, 1100b |
cmp al, 1000b |
jz .ide6 |
;-------------------------------------- |
.ide5_1: |
mov al, [DRIVE_DATA+6] |
and al, 110000b |
cmp al, 100000b |
jz .ide5 |
;-------------------------------------- |
.ide4_1: |
mov al, [DRIVE_DATA+6] |
and al, 11000000b |
cmp al, 10000000b |
jz .ide4 |
;-------------------------------------- |
.ide11_1: |
mov al, [DRIVE_DATA+11] |
and al, 11b |
cmp al, 10b |
jz .ide11 |
;-------------------------------------- |
.ide10_1: |
mov al, [DRIVE_DATA+11] |
and al, 1100b |
cmp al, 1000b |
jz .ide10 |
;-------------------------------------- |
.ide9_1: |
mov al, [DRIVE_DATA+11] |
and al, 110000b |
cmp al, 100000b |
jz .ide9 |
;-------------------------------------- |
.ide8_1: |
mov al, [DRIVE_DATA+11] |
and al, 11000000b |
cmp al, 10000000b |
jz .ide8 |
;-------------------------------------- |
.end: |
sti |
popfd |
mov eax, [timer_ticks] |
mov [timer_ATAPI_check], eax |
;-------------------------------------- |
.end_1: |
popa |
ret |
;----------------------------------------------------------------------------- |
.ide3: |
cli |
cmp [ATAPI_IDE3_lock], 1 |
jne .ide2_1 |
cmp [IDE_Channel_2], 0 |
jne .ide1_1 |
cmp [cd_status], 0 |
jne .end |
mov [IDE_Channel_2], 1 |
mov ecx, ide_channel2_mutex |
call mutex_lock |
call reserve_ok2 |
776,23 → 852,22 |
mov [cdpos], 4 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
je .eject_ide3 |
call syscall_cdaudio.free |
jmp .ide2_1 |
.eject_ide3: |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .ide2_1 |
;----------------------------------------------------------------------------- |
.ide2: |
cli |
cmp [ATAPI_IDE2_lock], 1 |
jne .ide1_1 |
cmp [IDE_Channel_2], 0 |
jne .ide1_1 |
cmp [cd_status], 0 |
jne .end |
mov [IDE_Channel_2], 1 |
mov ecx, ide_channel2_mutex |
call mutex_lock |
call reserve_ok2 |
801,23 → 876,22 |
mov [cdpos], 3 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
je .eject_ide2 |
call syscall_cdaudio.free |
jmp .ide1_1 |
.eject_ide2: |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .ide1_1 |
;----------------------------------------------------------------------------- |
.ide1: |
cli |
cmp [ATAPI_IDE1_lock], 1 |
jne .ide0_1 |
cmp [IDE_Channel_1], 0 |
jne .end |
cmp [cd_status], 0 |
jne .end |
mov [IDE_Channel_1], 1 |
mov ecx, ide_channel1_mutex |
call mutex_lock |
call reserve_ok2 |
826,23 → 900,22 |
mov [cdpos], 2 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
je .eject_ide1 |
call syscall_cdaudio.free |
jmp .ide0_1 |
.eject_ide1: |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .ide0_1 |
;----------------------------------------------------------------------------- |
.ide0: |
cli |
cmp [ATAPI_IDE0_lock], 1 |
jne .end |
cmp [IDE_Channel_1], 0 |
jne .end |
jne .ide7_1 |
cmp [cd_status], 0 |
jne .end |
mov [IDE_Channel_1], 1 |
mov ecx, ide_channel1_mutex |
call mutex_lock |
call reserve_ok2 |
851,14 → 924,206 |
mov [cdpos], 1 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
je .eject_ide0 |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .end |
.eject_ide0: |
jmp .ide7_1 |
;----------------------------------------------------------------------------- |
.ide7: |
cli |
cmp [ATAPI_IDE7_lock], 1 |
jne .ide6_1 |
cmp [cd_status], 0 |
jne .end |
mov ecx, ide_channel4_mutex |
call mutex_lock |
call reserve_ok2 |
mov [ChannelNumber], 2 |
mov [DiskNumber], 1 |
mov [cdpos], 8 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .ide6_1 |
;----------------------------------------------------------------------------- |
.ide6: |
cli |
cmp [ATAPI_IDE6_lock], 1 |
jne .ide5_1 |
cmp [cd_status], 0 |
jne .end |
mov ecx, ide_channel4_mutex |
call mutex_lock |
call reserve_ok2 |
mov [ChannelNumber], 2 |
mov [DiskNumber], 0 |
mov [cdpos], 7 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .ide5_1 |
;----------------------------------------------------------------------------- |
.ide5: |
cli |
cmp [ATAPI_IDE5_lock], 1 |
jne .ide4_1 |
cmp [cd_status], 0 |
jne .end |
mov ecx, ide_channel3_mutex |
call mutex_lock |
call reserve_ok2 |
mov [ChannelNumber], 1 |
mov [DiskNumber], 1 |
mov [cdpos], 6 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .ide4_1 |
;----------------------------------------------------------------------------- |
.ide4: |
cli |
cmp [ATAPI_IDE4_lock], 1 |
jne .ide11_1 |
cmp [cd_status], 0 |
jne .end |
mov ecx, ide_channel3_mutex |
call mutex_lock |
call reserve_ok2 |
mov [ChannelNumber], 1 |
mov [DiskNumber], 0 |
mov [cdpos], 5 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .ide11_1 |
;----------------------------------------------------------------------------- |
.ide11: |
cli |
cmp [ATAPI_IDE11_lock], 1 |
jne .ide10_1 |
cmp [cd_status], 0 |
jne .end |
mov ecx, ide_channel6_mutex |
call mutex_lock |
call reserve_ok2 |
mov [ChannelNumber], 2 |
mov [DiskNumber], 1 |
mov [cdpos], 12 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .ide10_1 |
;----------------------------------------------------------------------------- |
.ide10: |
cli |
cmp [ATAPI_IDE10_lock], 1 |
jne .ide9_1 |
cmp [cd_status], 0 |
jne .end |
mov ecx, ide_channel6_mutex |
call mutex_lock |
call reserve_ok2 |
mov [ChannelNumber], 2 |
mov [DiskNumber], 0 |
mov [cdpos], 11 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .ide9_1 |
;----------------------------------------------------------------------------- |
.ide9: |
cli |
cmp [ATAPI_IDE9_lock], 1 |
jne .ide8_1 |
cmp [cd_status], 0 |
jne .end |
mov ecx, ide_channel5_mutex |
call mutex_lock |
call reserve_ok2 |
mov [ChannelNumber], 1 |
mov [DiskNumber], 1 |
mov [cdpos], 10 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .ide8_1 |
;----------------------------------------------------------------------------- |
.ide8: |
cli |
cmp [ATAPI_IDE8_lock], 1 |
jne .end |
cmp [cd_status], 0 |
jne .end |
mov ecx, ide_channel5_mutex |
call mutex_lock |
call reserve_ok2 |
mov [ChannelNumber], 1 |
mov [DiskNumber], 0 |
mov [cdpos], 9 |
call GetEvent_StatusNotification |
cmp [CDDataBuf+4], byte 1 |
jne @f |
call .eject |
;-------------------------------------- |
@@: |
call syscall_cdaudio.free |
jmp .end |
;----------------------------------------------------------------------------- |
.eject: |
call clear_CD_cache |
call allow_medium_removal |
866,6 → 1131,7 |
call EjectMedium |
mov [ignore_CD_eject_wait], 0 |
ret |
;----------------------------------------------------------------------------- |
iglobal |
timer_ATAPI_check dd 0 |
ATAPI_IDE0_lock db 0 |
872,8 → 1138,17 |
ATAPI_IDE1_lock db 0 |
ATAPI_IDE2_lock db 0 |
ATAPI_IDE3_lock db 0 |
ATAPI_IDE4_lock db 0 |
ATAPI_IDE5_lock db 0 |
ATAPI_IDE6_lock db 0 |
ATAPI_IDE7_lock db 0 |
ATAPI_IDE8_lock db 0 |
ATAPI_IDE9_lock db 0 |
ATAPI_IDE10_lock db 0 |
ATAPI_IDE11_lock db 0 |
ignore_CD_eject_wait db 0 |
endg |
;----------------------------------------------------------------------------- |
;************************************************* |
;* Получить сообщение о событии или состоянии * |
;* устройства * |
899,7 → 1174,7 |
call SendPacketDatCommand |
popa |
ret |
;----------------------------------------------------------------------------- |
;************************************************* |
; прочитать информацию из TOC |
;* Входные параметры передаются через глобальные * |
924,7 → 1199,7 |
call SendPacketDatCommand |
popa |
ret |
;----------------------------------------------------------------------------- |
;************************************************* |
;* ОПРЕДЕЛИТЬ ОБЩЕЕ КОЛИЧЕСТВО СЕКТОРОВ НА ДИСКЕ * |
;* Входные параметры передаются через глобальные * |
944,7 → 1219,7 |
; call SendPacketDatCommand |
; popa |
; ret |
;----------------------------------------------------------------------------- |
clear_packet_buffer: |
; Очистить буфер пакетной команды |
and [PacketCommand], dword 0 |
951,3 → 1226,4 |
and [PacketCommand+4], dword 0 |
and [PacketCommand+8], dword 0 |
ret |
;----------------------------------------------------------------------------- |
/kernel/branches/kolibri-process/blkdev/flp_drv.inc |
---|
379,10 → 379,16 |
mov al, 8 |
call FDCDataOutput |
call FDCDataInput |
push eax |
; DEBUGF 1,' %x',al |
call FDCDataInput |
; DEBUGF 1,' %x',al |
; DEBUGF 1,'\n' |
pop eax |
test al, 0xC0 |
jz @f |
mov [FDC_Status], FDC_DiskNotFound |
@@: |
.fail: |
call save_timer_fdd_motor |
popa |
/kernel/branches/kolibri-process/blkdev/hd_drv.inc |
---|
17,7 → 17,7 |
hdid dd ? |
hdpos dd ? |
ends |
;----------------------------------------------------------------------------- |
iglobal |
align 4 |
ide_callbacks: |
35,18 → 35,34 |
hd1_data HD_DATA ?, 0x10, 2 |
hd2_data HD_DATA ?, 0, 3 |
hd3_data HD_DATA ?, 0x10, 4 |
hd4_data HD_DATA ?, 0, 5 |
hd5_data HD_DATA ?, 0x10, 6 |
hd6_data HD_DATA ?, 0, 7 |
hd7_data HD_DATA ?, 0x10, 8 |
hd8_data HD_DATA ?, 0, 9 |
hd9_data HD_DATA ?, 0x10, 10 |
hd10_data HD_DATA ?, 0, 11 |
hd11_data HD_DATA ?, 0x10, 12 |
hd_address_table: |
dd 0x1f0, 0x00, 0x1f0, 0x10 |
dd 0x170, 0x00, 0x170, 0x10 |
ide_mutex_table: |
dd ide_channel1_mutex |
dd ide_channel2_mutex |
dd ide_channel3_mutex |
dd ide_channel4_mutex |
dd ide_channel5_mutex |
dd ide_channel6_mutex |
endg |
;----------------------------------------------------------------------------- |
uglobal |
ide_mutex MUTEX |
ide_channel1_mutex MUTEX |
ide_channel2_mutex MUTEX |
ide_channel3_mutex MUTEX |
ide_channel4_mutex MUTEX |
ide_channel5_mutex MUTEX |
ide_channel6_mutex MUTEX |
endg |
;----------------------------------------------------------------------------- |
proc ide_read stdcall uses edi, \ |
hd_data, buffer, startsector:qword, numsectors |
; hd_data = pointer to hd*_data |
67,15 → 83,13 |
; 2. Acquire the global lock. |
mov ecx, ide_mutex |
call mutex_lock |
mov ecx, ide_channel2_mutex |
mov eax, [hd_data] |
push ecx |
mov ecx, [hd_address_table] |
cmp [eax+HD_DATA.hdbase], ecx ; 0x1F0 |
pop ecx |
jne .IDE_Channel_2 |
mov ecx, ide_channel1_mutex |
.IDE_Channel_2: |
mov ecx, [hd_data] |
mov ecx, [ecx+HD_DATA.hdpos] |
dec ecx |
shr ecx, 1 |
shl ecx, 2 |
mov ecx, [ecx + ide_mutex_table] |
mov [channel_lock], ecx |
call mutex_lock |
; 3. Convert parameters to the form suitable for worker procedures. |
83,6 → 97,7 |
; Worker procedures use global variables and edi for [buffer]. |
cmp dword [startsector+4], 0 |
jnz .fail |
and [hd_error], 0 |
mov ecx, [hd_data] |
mov eax, [ecx+HD_DATA.hdbase] |
98,55 → 113,65 |
; DMA read is permitted if [allow_dma_access]=1 or 2 |
cmp [allow_dma_access], 2 |
ja .nodma |
cmp [dma_hdd], 1 |
jnz .nodma |
;-------------------------------------- |
push eax |
mov eax, [hd_address_table] |
cmp [hdbase], eax ; 0x1F0 |
pop eax |
jnz @f |
test [DRIVE_DATA+1], byte 10100000b |
push eax ecx |
mov ecx, [hdpos] |
dec ecx |
shr ecx, 2 |
imul ecx, sizeof.IDE_DATA |
add ecx, IDE_controller_1 |
mov [IDE_controller_pointer], ecx |
mov eax, [hdpos] |
dec eax |
and eax, 11b |
shr eax, 1 |
add eax, ecx |
cmp [eax+IDE_DATA.dma_hdd_channel_1], 1 |
pop ecx eax |
jnz .nodma |
jmp .dma |
@@: |
test [DRIVE_DATA+1], byte 1010b |
jnz .nodma |
.dma: |
;-------------------------------------- |
call hd_read_dma |
jmp @f |
;-------------------------------------- |
.nodma: |
call hd_read_pio |
;-------------------------------------- |
@@: |
cmp [hd_error], 0 |
jnz .fail |
mov ecx, [numsectors] |
inc dword [ecx] ; one more sector is read |
dec [sectors_todo] |
jz .done |
inc eax |
jnz .sectors_loop |
;-------------------------------------- |
; 5. Loop is done, either due to error or because everything is done. |
; Release the global lock and return the corresponding status. |
.fail: |
mov ecx, [channel_lock] |
call mutex_unlock |
mov ecx, ide_mutex |
call mutex_unlock |
or eax, -1 |
ret |
;-------------------------------------- |
.done: |
mov ecx, [channel_lock] |
call mutex_unlock |
mov ecx, ide_mutex |
call mutex_unlock |
xor eax, eax |
ret |
endp |
;----------------------------------------------------------------------------- |
proc ide_write stdcall uses esi edi, \ |
hd_data, buffer, startsector:qword, numsectors |
; hd_data = pointer to hd*_data |
167,15 → 192,13 |
; 2. Acquire the global lock. |
mov ecx, ide_mutex |
call mutex_lock |
mov ecx, ide_channel2_mutex |
mov eax, [hd_data] |
push ecx |
mov ecx, [hd_address_table] |
cmp [eax+HD_DATA.hdbase], ecx ; 0x1F0 |
pop ecx |
jne .IDE_Channel_2 |
mov ecx, ide_channel1_mutex |
.IDE_Channel_2: |
mov ecx, [hd_data] |
mov ecx, [ecx+HD_DATA.hdpos] |
dec ecx |
shr ecx, 1 |
shl ecx, 2 |
mov ecx, [ecx + ide_mutex_table] |
mov [channel_lock], ecx |
call mutex_lock |
; 3. Convert parameters to the form suitable for worker procedures. |
183,6 → 206,7 |
; Worker procedures use global variables and esi for [buffer]. |
cmp dword [startsector+4], 0 |
jnz .fail |
and [hd_error], 0 |
mov ecx, [hd_data] |
mov eax, [ecx+HD_DATA.hdbase] |
200,66 → 224,79 |
mov ecx, 16 |
cmp ecx, [sectors_todo] |
jbe @f |
mov ecx, [sectors_todo] |
;-------------------------------------- |
@@: |
mov [cache_chain_size], cl |
; DMA write is permitted only if [allow_dma_access]=1 |
cmp [allow_dma_access], 2 |
jae .nodma |
cmp [dma_hdd], 1 |
jnz .nodma |
;-------------------------------------- |
push eax |
mov eax, [hd_address_table] |
cmp [hdbase], eax ; 0x1F0 |
pop eax |
jnz @f |
test [DRIVE_DATA+1], byte 10100000b |
push eax ecx |
mov ecx, [hdpos] |
dec ecx |
shr ecx, 2 |
imul ecx, sizeof.IDE_DATA |
add ecx, IDE_controller_1 |
mov [IDE_controller_pointer], ecx |
mov eax, [hdpos] |
dec eax |
and eax, 11b |
shr eax, 1 |
add eax, ecx |
cmp [eax+IDE_DATA.dma_hdd_channel_1], 1 |
pop ecx eax |
jnz .nodma |
jmp .dma |
@@: |
test [DRIVE_DATA+1], byte 1010b |
jnz .nodma |
.dma: |
;-------------------------------------- |
call cache_write_dma |
jmp .common |
;-------------------------------------- |
.nodma: |
mov [cache_chain_size], 1 |
call cache_write_pio |
;-------------------------------------- |
.common: |
cmp [hd_error], 0 |
jnz .fail |
movzx ecx, [cache_chain_size] |
mov eax, [numsectors] |
add [eax], ecx |
sub [sectors_todo], ecx |
jz .done |
add [edi], ecx |
jc .fail |
shl ecx, 9 |
add esi, ecx |
jmp .sectors_loop |
;-------------------------------------- |
; 5. Loop is done, either due to error or because everything is done. |
; Release the global lock and return the corresponding status. |
.fail: |
mov ecx, [channel_lock] |
call mutex_unlock |
mov ecx, ide_mutex |
call mutex_unlock |
or eax, -1 |
ret |
;-------------------------------------- |
.done: |
mov ecx, [channel_lock] |
call mutex_unlock |
mov ecx, ide_mutex |
call mutex_unlock |
xor eax, eax |
ret |
endp |
;----------------------------------------------------------------------------- |
; This is a stub. |
proc ide_querymedia stdcall, hd_data, mediainfo |
mov eax, [mediainfo] |
270,7 → 307,6 |
xor eax, eax |
ret |
endp |
;----------------------------------------------------------------------------- |
align 4 |
; input: eax = sector, edi -> buffer |
277,7 → 313,6 |
; output: edi = edi + 512 |
hd_read_pio: |
push eax edx |
; Select the desired drive |
mov edx, [hdbase] |
add edx, 6 ;адрес регистра головок |
286,9 → 321,9 |
out dx, al; номер головки/номер диска |
call wait_for_hd_idle |
cmp [hd_error], 0 |
jne hd_read_error |
; ATA with 28 or 48 bit for sector number? |
mov eax, [esp+4] |
cmp eax, 0x10000000 |
372,7 → 407,6 |
pushfd |
cli |
mov ecx, 256 |
mov edx, [hdbase] |
cld |
393,6 → 427,7 |
out dx, al ; номер головки/номер диска |
call wait_for_hd_idle |
cmp [hd_error], 0 |
jne hd_write_error |
550,6 → 585,7 |
align 4 |
wfhil1: |
call check_hd_wait_timeout |
cmp [hd_error], 0 |
jne @f |
556,7 → 592,7 |
in al, dx |
test al, 128 |
jnz wfhil1 |
;-------------------------------------- |
@@: |
pop edx eax |
ret |
573,6 → 609,7 |
align 4 |
hdwait_sbuf: ; wait for sector buffer to be ready |
call check_hd_wait_timeout |
cmp [hd_error], 0 |
jne @f |
587,9 → 624,10 |
test al, 1 ; previous command ended up with an error |
jz buf_wait_ok |
;-------------------------------------- |
@@: |
mov [hd_error], 1 |
;-------------------------------------- |
buf_wait_ok: |
pop edx eax |
ret |
606,22 → 644,17 |
align 4 |
.wait: |
call change_task |
cmp [IDE_common_irq_param], 0 |
jz .done |
call check_hd_wait_timeout |
cmp [hd_error], 0 |
jz .wait |
; clear Bus Master IDE Command register |
pushfd |
cli |
mov [IDE_common_irq_param], 0 |
mov dx, [IDEContrRegsBaseAddr] |
mov al, 0 |
out dx, al |
popfd |
;-------------------------------------- |
align 4 |
.done: |
pop edx |
pop eax |
636,23 → 669,17 |
align 4 |
.wait: |
call change_task |
cmp [IDE_common_irq_param], 0 |
jz .done |
call check_hd_wait_timeout |
cmp [hd_error], 0 |
jz .wait |
; clear Bus Master IDE Command register |
pushfd |
cli |
mov [IDE_common_irq_param], 0 |
mov dx, [IDEContrRegsBaseAddr] |
add dx, 8 |
mov al, 0 |
out dx, al |
popfd |
;-------------------------------------- |
align 4 |
.done: |
pop edx |
pop eax |
660,7 → 687,8 |
;----------------------------------------------------------------------------- |
iglobal |
align 4 |
; note that IDE descriptor table must be 4-byte aligned and do not cross 4K boundary |
; note that IDE descriptor table must be 4-byte aligned |
; and do not cross 4K boundary |
IDE_descriptor_table: |
dd IDE_DMA |
dw 0x2000 |
673,19 → 701,14 |
;----------------------------------------------------------------------------- |
uglobal |
; all uglobals are zeroed at boot |
dma_process dd 0 |
dma_slot_ptr dd 0 |
cache_chain_pos dd 0 |
cache_chain_ptr dd 0 |
cache_chain_size db 0 |
cache_chain_started db 0 |
dma_task_switched db 0 |
dma_hdd db 0 |
allow_dma_access db 0 |
endg |
;----------------------------------------------------------------------------- |
align 4 |
IDE_irq_14_handler: |
; DEBUGF 1, 'K : IDE_irq_14_handler %x\n', [IDE_common_irq_param]:2 |
cmp [IDE_common_irq_param], irq14_num |
jne .exit |
693,7 → 716,8 |
cli |
pushad |
mov [IDE_common_irq_param], 0 |
mov dx, [IDEContrRegsBaseAddr] |
mov ecx, [IDE_controller_pointer] |
mov dx, [ecx+IDE_DATA.RegsBaseAddres] |
; test whether it is our interrupt? |
add edx, 2 |
in al, dx |
715,12 → 739,10 |
mov al, 1 |
ret |
;-------------------------------------- |
align 4 |
@@: |
popad |
popfd |
;-------------------------------------- |
align 4 |
.exit: |
mov al, 0 |
ret |
727,6 → 749,7 |
;----------------------------------------------------------------------------- |
align 4 |
IDE_irq_15_handler: |
; DEBUGF 1, 'K : IDE_irq_15_handler %x\n', [IDE_common_irq_param]:2 |
cmp [IDE_common_irq_param], irq15_num |
jne .exit |
734,7 → 757,8 |
cli |
pushad |
mov [IDE_common_irq_param], 0 |
mov dx, [IDEContrRegsBaseAddr] |
mov ecx, [IDE_controller_pointer] |
mov dx, [ecx+IDE_DATA.RegsBaseAddres] |
add dx, 8 |
; test whether it is our interrupt? |
add edx, 2 |
757,12 → 781,10 |
mov al, 1 |
ret |
;-------------------------------------- |
align 4 |
@@: |
popad |
popfd |
;-------------------------------------- |
align 4 |
.exit: |
mov al, 0 |
ret |
769,14 → 791,16 |
;----------------------------------------------------------------------------- |
align 4 |
IDE_common_irq_handler: |
; DEBUGF 1, 'K : IDE_common_irq_handler %x\n', [IDE_common_irq_param]:2 |
pushfd |
cli |
cmp [IDE_common_irq_param], 0 |
je .exit |
pushfd |
cli |
pushad |
xor ebx, ebx |
mov dx, [IDEContrRegsBaseAddr] |
mov ecx, [IDE_controller_pointer] |
mov dx, [ecx+IDE_DATA.RegsBaseAddres] |
mov eax, IDE_common_irq_param |
cmp [eax], irq14_num |
mov [eax], bl |
784,7 → 808,6 |
add dx, 8 |
;-------------------------------------- |
align 4 |
@@: |
; test whether it is our interrupt? |
add edx, 2 |
807,13 → 830,11 |
mov al, 1 |
ret |
;-------------------------------------- |
align 4 |
@@: |
popad |
popfd |
;-------------------------------------- |
align 4 |
.exit: |
popfd |
mov al, 0 |
ret |
;----------------------------------------------------------------------------- |
824,26 → 845,31 |
mov edx, [dma_hdpos] |
cmp edx, [hdpos] |
jne .notread |
mov edx, [dma_cur_sector] |
cmp eax, edx |
jb .notread |
add edx, 15 |
cmp [esp+4], edx |
ja .notread |
mov eax, [esp+4] |
sub eax, [dma_cur_sector] |
shl eax, 9 |
add eax, (OS_BASE+IDE_DMA) |
push ecx esi |
mov esi, eax |
mov ecx, 512/4 |
cld |
rep movsd |
pop esi ecx |
pop edx |
pop eax |
ret |
;-------------------------------------- |
.notread: |
; set data for PRD Table |
mov eax, IDE_descriptor_table |
851,13 → 877,18 |
mov word [eax+4], 0x2000 |
sub eax, OS_BASE |
; select controller Primary or Secondary |
mov dx, [IDEContrRegsBaseAddr] |
mov ecx, [IDE_controller_pointer] |
mov dx, [ecx+IDE_DATA.RegsBaseAddres] |
push eax |
mov eax, [hd_address_table] |
cmp [hdbase], eax ; 0x1F0 |
mov eax, [hdpos] |
dec eax |
test eax, 10b |
pop eax |
jz @f |
add edx, 8 |
;-------------------------------------- |
@@: |
push edx |
; Bus Master IDE PRD Table Address |
881,9 → 912,9 |
out dx, al ; номер головки/номер диска |
call wait_for_hd_idle |
cmp [hd_error], 0 |
jnz hd_read_error |
; ATA with 28 or 48 bit for sector number? |
mov eax, [esp+4] |
; -10h because the PreCache hits the boundary between lba28 and lba48 |
961,47 → 992,55 |
;-------------------------------------- |
.continue: |
; select controller Primary or Secondary |
mov dx, [IDEContrRegsBaseAddr] |
mov eax, [hd_address_table] |
cmp [hdbase], eax ; 0x1F0 |
mov ecx, [IDE_controller_pointer] |
mov dx, [ecx+IDE_DATA.RegsBaseAddres] |
mov eax, [hdpos] |
dec eax |
test eax, 10b |
jz @f |
add dx, 8 |
;-------------------------------------- |
@@: |
; set write to memory and Start Bus Master |
mov al, 9 |
out dx, al |
mov eax, [CURRENT_TASK] |
mov [dma_process], eax |
mov eax, [TASK_BASE] |
mov [dma_slot_ptr], eax |
mov eax, [hd_address_table] |
cmp [hdbase], eax ; 0x1F0 |
mov eax, [hdpos] |
dec eax |
test eax, 10b |
jnz .ide1 |
mov [IDE_common_irq_param], irq14_num |
jmp @f |
;-------------------------------------- |
.ide1: |
mov [IDE_common_irq_param], irq15_num |
;-------------------------------------- |
@@: |
popfd |
; wait for interrupt |
mov eax, [hd_address_table] |
cmp [hdbase], eax ; 0x1F0 |
mov eax, [hdpos] |
dec eax |
test eax, 10b |
jnz .wait_ide1 |
call wait_for_sector_dma_ide0 |
jmp @f |
;-------------------------------------- |
.wait_ide1: |
call wait_for_sector_dma_ide1 |
;-------------------------------------- |
@@: |
cmp [hd_error], 0 |
jnz hd_read_error |
mov eax, [hdpos] |
mov [dma_hdpos], eax |
pop edx |
pop eax |
mov [dma_cur_sector], eax |
jmp hd_read_dma |
;----------------------------------------------------------------------------- |
1011,6 → 1050,7 |
; set data for PRD Table |
mov eax, IDE_descriptor_table |
mov edx, eax |
pusha |
mov edi, (OS_BASE+IDE_DMA) |
mov dword [edx], IDE_DMA |
1021,15 → 1061,21 |
cld |
rep movsd |
popa |
sub eax, OS_BASE |
; select controller Primary or Secondary |
mov dx, [IDEContrRegsBaseAddr] |
mov ecx, [IDE_controller_pointer] |
mov dx, [ecx+IDE_DATA.RegsBaseAddres] |
push eax |
mov eax, [hd_address_table] |
cmp [hdbase], eax ; 0x1F0 |
mov eax, [hdpos] |
dec eax |
test eax, 10b |
pop eax |
jz @f |
add edx, 8 |
;-------------------------------------- |
@@: |
push edx |
; Bus Master IDE PRD Table Address |
1053,9 → 1099,9 |
out dx, al ; номер головки/номер диска |
call wait_for_hd_idle |
cmp [hd_error], 0 |
jnz hd_write_error_dma |
; ATA with 28 or 48 bit for sector number? |
mov esi, [cache_chain_ptr] |
mov eax, [esi] |
1134,38 → 1180,49 |
;-------------------------------------- |
.continue: |
; select controller Primary or Secondary |
mov dx, [IDEContrRegsBaseAddr] |
mov eax, [hd_address_table] |
cmp [hdbase], eax ; 0x1F0 |
mov ecx, [IDE_controller_pointer] |
mov dx, [ecx+IDE_DATA.RegsBaseAddres] |
mov eax, [hdpos] |
dec eax |
test eax, 10b |
jz @f |
add dx, 8 |
;-------------------------------------- |
@@: |
; set write to device and Start Bus Master |
mov al, 1 |
out dx, al |
mov eax, [CURRENT_TASK] |
mov [dma_process], eax |
mov eax, [TASK_BASE] |
mov [dma_slot_ptr], eax |
mov eax, [hd_address_table] |
cmp [hdbase], eax ; 0x1F0 |
mov eax, [hdpos] |
dec eax |
test eax, 10b |
jnz .ide1 |
mov [IDE_common_irq_param], irq14_num |
jmp @f |
;-------------------------------------- |
.ide1: |
mov [IDE_common_irq_param], irq15_num |
;-------------------------------------- |
@@: |
popfd |
; wait for interrupt |
mov [dma_cur_sector], not 0x40 |
mov eax, [hd_address_table] |
cmp [hdbase], eax ; 0x1F0 |
mov eax, [hdpos] |
dec eax |
test eax, 10b |
jnz .wait_ide1 |
call wait_for_sector_dma_ide0 |
jmp @f |
;-------------------------------------- |
.wait_ide1: |
call wait_for_sector_dma_ide1 |
;-------------------------------------- |
@@: |
cmp [hd_error], 0 |
jnz hd_write_error_dma |
1172,31 → 1229,27 |
pop esi |
ret |
;----------------------------------------------------------------------------- |
uglobal |
align 4 |
IDE_Interrupt dw ? |
IDEContrRegsBaseAddr dw ? |
IDEContrProgrammingInterface dw ? |
IDE_BAR0_val dw ? |
IDE_BAR1_val dw ? |
IDE_BAR2_val dw ? |
IDE_BAR3_val dw ? |
endg |
;----------------------------------------------------------------------------- |
proc clear_pci_ide_interrupts |
mov esi, pcidev_list |
;-------------------------------------- |
align 4 |
.loop: |
mov esi, [esi+PCIDEV.fd] |
cmp esi, pcidev_list |
jz .done |
cmp [esi+PCIDEV.class], 0x01018F |
; cmp [esi+PCIDEV.class], 0x01018F |
mov eax, [esi+PCIDEV.class] |
shr eax, 4 |
cmp eax, 0x01018 |
jnz .loop |
mov ah, [esi+PCIDEV.bus] |
mov al, 2 |
mov bh, [esi+PCIDEV.devfn] |
mov bl, 0x20 |
call pci_read_reg |
and eax, 0FFFCh |
mov edx, eax |
add edx, 2 |
1212,6 → 1265,8 |
in al, dx |
DEBUGF 1,'-> %x\n',al |
jmp .loop |
;-------------------------------------- |
.done: |
ret |
endp |
;----------------------------------------------------------------------------- |
/kernel/branches/kolibri-process/blkdev/ide_cache.inc |
---|
41,53 → 41,29 |
ret |
;-------------------------------------------------------------------- |
clear_CD_cache: |
DEBUGF 1, 'K : clear_CD_cache\n' |
pusha |
.ide0: |
mov esi, [cdpos] |
dec esi |
imul esi, sizeof.IDE_CACHE |
add esi, cache_ide0 |
xor eax, eax |
cmp [cdpos], 1 |
jne .ide1 |
mov [cache_ide0_search_start], eax |
mov ecx, [cache_ide0_system_sad_size] |
mov edi, [cache_ide0_pointer] |
mov [esi+IDE_CACHE.search_start], eax |
mov ecx, [esi+IDE_CACHE.system_sad_size] |
mov edi, [esi+IDE_CACHE.pointer] |
call .clear |
mov [cache_ide0_appl_search_start], eax |
mov ecx, [cache_ide0_appl_sad_size] |
mov edi, [cache_ide0_data_pointer] |
jmp .continue |
.ide1: |
cmp [cdpos], 2 |
jne .ide2 |
mov [cache_ide1_search_start], eax |
mov ecx, [cache_ide1_system_sad_size] |
mov edi, [cache_ide1_pointer] |
mov [esi+IDE_CACHE.appl_search_start], eax |
mov ecx, [esi+IDE_CACHE.appl_sad_size] |
mov edi, [esi+IDE_CACHE.data_pointer] |
call .clear |
mov [cache_ide1_appl_search_start], eax |
mov ecx, [cache_ide1_appl_sad_size] |
mov edi, [cache_ide1_data_pointer] |
jmp .continue |
.ide2: |
cmp [cdpos], 3 |
jne .ide3 |
mov [cache_ide2_search_start], eax |
mov ecx, [cache_ide2_system_sad_size] |
mov edi, [cache_ide2_pointer] |
call .clear |
mov [cache_ide2_appl_search_start], eax |
mov ecx, [cache_ide2_appl_sad_size] |
mov edi, [cache_ide2_data_pointer] |
jmp .continue |
.ide3: |
mov [cache_ide3_search_start], eax |
mov ecx, [cache_ide3_system_sad_size] |
mov edi, [cache_ide3_pointer] |
call .clear |
mov [cache_ide3_appl_search_start], eax |
mov ecx, [cache_ide3_appl_sad_size] |
mov edi, [cache_ide3_data_pointer] |
.continue: |
call .clear |
popa |
ret |
;-------------------------------------- |
.clear: |
shl ecx, 1 |
cld |
96,272 → 72,131 |
;-------------------------------------------------------------------- |
align 4 |
cd_calculate_cache: |
; 1 - IDE0 ... 4 - IDE3 |
.ide0: |
cmp [cdpos], 1 |
jne .ide1 |
; 1 - IDE0 ... 12 - IDE11 |
push eax |
mov eax, [cdpos] |
dec eax |
imul eax, sizeof.IDE_CACHE |
add eax, cache_ide0 |
cmp [cd_appl_data], 0 |
jne .ide0_appl_data |
mov ecx, [cache_ide0_system_sad_size] |
mov esi, [cache_ide0_pointer] |
jne @f |
mov ecx, [eax+IDE_CACHE.system_sad_size] |
mov esi, [eax+IDE_CACHE.pointer] |
pop eax |
ret |
.ide0_appl_data: |
mov ecx, [cache_ide0_appl_sad_size] |
mov esi, [cache_ide0_data_pointer] |
;-------------------------------------- |
@@: |
mov ecx, [eax+IDE_CACHE.appl_sad_size] |
mov esi, [eax+IDE_CACHE.data_pointer] |
pop eax |
ret |
.ide1: |
cmp [cdpos], 2 |
jne .ide2 |
cmp [cd_appl_data], 0 |
jne .ide1_appl_data |
mov ecx, [cache_ide1_system_sad_size] |
mov esi, [cache_ide1_pointer] |
ret |
.ide1_appl_data: |
mov ecx, [cache_ide1_appl_sad_size] |
mov esi, [cache_ide1_data_pointer] |
ret |
.ide2: |
cmp [cdpos], 3 |
jne .ide3 |
cmp [cd_appl_data], 0 |
jne .ide2_appl_data |
mov ecx, [cache_ide2_system_sad_size] |
mov esi, [cache_ide2_pointer] |
ret |
.ide2_appl_data: |
mov ecx, [cache_ide2_appl_sad_size] |
mov esi, [cache_ide2_data_pointer] |
ret |
.ide3: |
cmp [cd_appl_data], 0 |
jne .ide3_appl_data |
mov ecx, [cache_ide3_system_sad_size] |
mov esi, [cache_ide3_pointer] |
ret |
.ide3_appl_data: |
mov ecx, [cache_ide3_appl_sad_size] |
mov esi, [cache_ide3_data_pointer] |
ret |
;-------------------------------------------------------------------- |
align 4 |
cd_calculate_cache_1: |
; 1 - IDE0 ... 4 - IDE3 |
.ide0: |
cmp [cdpos], 1 |
jne .ide1 |
; 1 - IDE0 ... 12 - IDE11 |
push eax |
mov eax, [cdpos] |
dec eax |
imul eax, sizeof.IDE_CACHE |
add eax, cache_ide0 |
cmp [cd_appl_data], 0 |
jne .ide0_appl_data |
mov esi, [cache_ide0_pointer] |
jne @f |
mov esi, [eax+IDE_CACHE.pointer] |
pop eax |
ret |
.ide0_appl_data: |
mov esi, [cache_ide0_data_pointer] |
;-------------------------------------- |
@@: |
mov esi, [eax+IDE_CACHE.data_pointer] |
pop eax |
ret |
.ide1: |
cmp [cdpos], 2 |
jne .ide2 |
cmp [cd_appl_data], 0 |
jne .ide1_appl_data |
mov esi, [cache_ide1_pointer] |
ret |
.ide1_appl_data: |
mov esi, [cache_ide1_data_pointer] |
ret |
.ide2: |
cmp [cdpos], 3 |
jne .ide3 |
cmp [cd_appl_data], 0 |
jne .ide2_appl_data |
mov esi, [cache_ide2_pointer] |
ret |
.ide2_appl_data: |
mov esi, [cache_ide2_data_pointer] |
ret |
.ide3: |
cmp [cd_appl_data], 0 |
jne .ide3_appl_data |
mov esi, [cache_ide3_pointer] |
ret |
.ide3_appl_data: |
mov esi, [cache_ide3_data_pointer] |
ret |
;-------------------------------------------------------------------- |
align 4 |
cd_calculate_cache_2: |
; 1 - IDE0 ... 4 - IDE3 |
.ide0: |
cmp [cdpos], 1 |
jne .ide1 |
; 1 - IDE0 ... 12 - IDE11 |
mov eax, [cdpos] |
dec eax |
imul eax, sizeof.IDE_CACHE |
add eax, cache_ide0 |
cmp [cd_appl_data], 0 |
jne .ide0_appl_data |
mov eax, [cache_ide0_system_data] |
jne @f |
mov eax, [eax+IDE_CACHE.system_data] |
ret |
.ide0_appl_data: |
mov eax, [cache_ide0_appl_data] |
;-------------------------------------- |
@@: |
mov eax, [eax+IDE_CACHE.appl_data] |
ret |
.ide1: |
cmp [cdpos], 2 |
jne .ide2 |
cmp [cd_appl_data], 0 |
jne .ide1_appl_data |
mov eax, [cache_ide1_system_data] |
ret |
.ide1_appl_data: |
mov eax, [cache_ide1_appl_data] |
ret |
.ide2: |
cmp [cdpos], 3 |
jne .ide3 |
cmp [cd_appl_data], 0 |
jne .ide2_appl_data |
mov eax, [cache_ide2_system_data] |
ret |
.ide2_appl_data: |
mov eax, [cache_ide2_appl_data] |
ret |
.ide3: |
cmp [cd_appl_data], 0 |
jne .ide3_appl_data |
mov eax, [cache_ide3_system_data] |
ret |
.ide3_appl_data: |
mov eax, [cache_ide3_appl_data] |
ret |
;-------------------------------------------------------------------- |
align 4 |
cd_calculate_cache_3: |
; mov ecx,cache_max*10/100 |
; mov edi,[cache_search_start] |
; 1 - IDE0 ... 12 - IDE11 |
push eax |
; 1 - IDE0 ... 4 - IDE3 |
.ide0: |
cmp [cdpos], 1 |
jne .ide1 |
mov eax, [cdpos] |
dec eax |
imul eax, sizeof.IDE_CACHE |
add eax, cache_ide0 |
cmp [cd_appl_data], 0 |
jne .ide0_appl_data |
mov edi, [cache_ide0_search_start] |
jne @f |
mov edi, [eax+IDE_CACHE.search_start] |
pop eax |
ret |
.ide0_appl_data: |
mov edi, [cache_ide0_appl_search_start] |
;-------------------------------------- |
@@: |
mov edi, [eax+IDE_CACHE.appl_search_start] |
pop eax |
ret |
.ide1: |
cmp [cdpos], 2 |
jne .ide2 |
cmp [cd_appl_data], 0 |
jne .ide1_appl_data |
mov edi, [cache_ide1_search_start] |
ret |
.ide1_appl_data: |
mov edi, [cache_ide1_appl_search_start] |
ret |
.ide2: |
cmp [cdpos], 3 |
jne .ide3 |
cmp [cd_appl_data], 0 |
jne .ide2_appl_data |
mov edi, [cache_ide2_search_start] |
ret |
.ide2_appl_data: |
mov edi, [cache_ide2_appl_search_start] |
ret |
.ide3: |
cmp [cd_appl_data], 0 |
jne .ide3_appl_data |
mov edi, [cache_ide3_search_start] |
ret |
.ide3_appl_data: |
mov edi, [cache_ide3_appl_search_start] |
ret |
;-------------------------------------------------------------------- |
align 4 |
cd_calculate_cache_4: |
; cmp edi,cache_max |
; 1 - IDE0 ... 4 - IDE3 |
.ide0: |
cmp [cdpos], 1 |
jne .ide1 |
; 1 - IDE0 ... 12 - IDE11 |
push eax |
mov eax, [cdpos] |
dec eax |
imul eax, sizeof.IDE_CACHE |
add eax, cache_ide0 |
cmp [cd_appl_data], 0 |
jne .ide0_appl_data |
cmp edi, [cache_ide0_system_sad_size] |
jne @f |
cmp edi, [eax+IDE_CACHE.system_sad_size] |
pop eax |
ret |
.ide0_appl_data: |
cmp edi, [cache_ide0_appl_sad_size] |
;-------------------------------------- |
@@: |
cmp edi, [eax+IDE_CACHE.appl_sad_size] |
pop eax |
ret |
.ide1: |
cmp [cdpos], 2 |
jne .ide2 |
cmp [cd_appl_data], 0 |
jne .ide1_appl_data |
cmp edi, [cache_ide1_system_sad_size] |
ret |
.ide1_appl_data: |
cmp edi, [cache_ide1_appl_sad_size] |
ret |
.ide2: |
cmp [cdpos], 3 |
jne .ide3 |
cmp [cd_appl_data], 0 |
jne .ide2_appl_data |
cmp edi, [cache_ide2_system_sad_size] |
ret |
.ide2_appl_data: |
cmp edi, [cache_ide2_appl_sad_size] |
ret |
.ide3: |
cmp [cd_appl_data], 0 |
jne .ide3_appl_data |
cmp edi, [cache_ide3_system_sad_size] |
ret |
.ide3_appl_data: |
cmp edi, [cache_ide3_appl_sad_size] |
ret |
;-------------------------------------------------------------------- |
align 4 |
cd_calculate_cache_5: |
; mov [cache_search_start],edi |
; 1 - IDE0 ... 4 - IDE3 |
.ide0: |
cmp [cdpos], 1 |
jne .ide1 |
; 1 - IDE0 ... 12 - IDE11 |
push eax |
mov eax, [cdpos] |
dec eax |
imul eax, sizeof.IDE_CACHE |
add eax, cache_ide0 |
cmp [cd_appl_data], 0 |
jne .ide0_appl_data |
mov [cache_ide0_search_start], edi |
jne @f |
mov [eax+IDE_CACHE.search_start], edi |
pop eax |
ret |
.ide0_appl_data: |
mov [cache_ide0_appl_search_start], edi |
;-------------------------------------- |
@@: |
mov [eax+IDE_CACHE.appl_search_start], edi |
pop eax |
ret |
.ide1: |
cmp [cdpos], 2 |
jne .ide2 |
cmp [cd_appl_data], 0 |
jne .ide1_appl_data |
mov [cache_ide1_search_start], edi |
ret |
.ide1_appl_data: |
mov [cache_ide1_appl_search_start], edi |
ret |
.ide2: |
cmp [cdpos], 3 |
jne .ide3 |
cmp [cd_appl_data], 0 |
jne .ide2_appl_data |
mov [cache_ide2_search_start], edi |
ret |
.ide2_appl_data: |
mov [cache_ide2_appl_search_start], edi |
ret |
.ide3: |
cmp [cd_appl_data], 0 |
jne .ide3_appl_data |
mov [cache_ide3_search_start], edi |
ret |
.ide3_appl_data: |
mov [cache_ide3_appl_search_start], edi |
ret |
;-------------------------------------------------------------------- |
;align 4 |
;calculate_linear_to_real: |
; shr eax, 12 |
; mov eax, [page_tabs+eax*4] |
; and eax, 0xFFFFF000 |
; ret |
/kernel/branches/kolibri-process/boot/bootcode.inc |
---|
401,129 → 401,7 |
push 0 |
pop es |
xor ax, ax |
and word [es:BOOT_IDE_BASE_ADDR], ax ;0 |
and word [es:BOOT_IDE_BAR0_16], ax ;0 |
and word [es:BOOT_IDE_BAR1_16], ax ;0 |
and word [es:BOOT_IDE_BAR2_16], ax ;0 |
and word [es:BOOT_IDE_BAR3_16], ax ;0 |
; \begin{Mario79} |
; find HDD IDE DMA PCI device |
; check for PCI BIOS |
mov ax, 0xB101 |
int 0x1A |
jc .nopci |
cmp edx, 'PCI ' |
jnz .nopci |
; find PCI class code |
; class 1 = mass storage |
; subclass 1 = IDE controller |
; a) class 1, subclass 1, programming interface 0x80 |
; This is a Parallel IDE Controller which uses IRQs 14 and 15. |
mov ax, 0xB103 |
mov ecx, 1*10000h + 1*100h + 0x80 |
mov [es:BOOT_IDE_PI_16], cx |
xor si, si ; device index = 0 |
int 0x1A |
jnc .found_1 ; Parallel IDE Controller |
; b) class 1, subclass 1, programming interface 0x8f |
mov ax, 0xB103 |
mov ecx, 1*10000h + 1*100h + 0x8f |
mov [es:BOOT_IDE_PI_16], cx |
xor si, si ; device index = 0 |
int 0x1A |
jnc .found_1 |
; c) class 1, subclass 1, programming interface 0x85 |
mov ax, 0xB103 |
mov ecx, 1*10000h + 1*100h + 0x85 |
mov [es:BOOT_IDE_PI_16], cx |
xor si, si ; device index = 0 |
int 0x1A |
jnc .found_1 |
; d) class 1, subclass 1, programming interface 0x8A |
; This is a Parallel IDE Controller which uses IRQs 14 and 15. |
mov ax, 0xB103 |
mov ecx, 1*10000h + 1*100h + 0x8A |
mov [es:BOOT_IDE_PI_16], cx |
xor si, si ; device index = 0 |
int 0x1A |
jnc .found_1 ; Parallel IDE Controller |
; Controller not found! |
xor ax, ax |
mov [es:BOOT_IDE_PI_16], ax |
jmp .nopci |
;-------------------------------------- |
.found_1: |
; get memory base BAR4 |
mov ax, 0xB10A |
mov di, 0x20 ; memory base is config register at 0x20 |
push cx |
int 0x1A |
jc .no_BAR4 ;.nopci |
and cx, 0xFFFC ; clear address decode type |
mov [es:BOOT_IDE_BASE_ADDR], cx |
.no_BAR4: |
pop cx |
;-------------------------------------- |
.found: |
; get Interrupt Line |
mov ax, 0xB10A |
mov di, 0x3c ; memory base is config register at 0x3c |
push cx |
int 0x1A |
jc .no_Interrupt ;.nopci |
mov [es:BOOT_IDE_INTERR_16], cx |
.no_Interrupt: |
pop cx |
;-------------------------------------- |
; get memory base BAR0 |
mov ax, 0xB10A |
mov di, 0x10 ; memory base is config register at 0x10 |
push cx |
int 0x1A |
jc .no_BAR0 ;.nopci |
mov [es:BOOT_IDE_BAR0_16], cx |
.no_BAR0: |
pop cx |
;-------------------------------------- |
; get memory base BAR1 |
mov ax, 0xB10A |
mov di, 0x14 ; memory base is config register at 0x14 |
push cx |
int 0x1A |
jc .no_BAR1 ;.nopci |
mov [es:BOOT_IDE_BAR1_16], cx |
.no_BAR1: |
pop cx |
;-------------------------------------- |
; get memory base BAR2 |
mov ax, 0xB10A |
mov di, 0x18 ; memory base is config register at 0x18 |
push cx |
int 0x1A |
jc .no_BAR2 ;.nopci |
mov [es:BOOT_IDE_BAR2_16], cx |
.no_BAR2: |
pop cx |
;-------------------------------------- |
; get memory base BAR3 |
mov ax, 0xB10A |
mov di, 0x1C ; memory base is config register at 0x1c |
push cx |
int 0x1A |
jc .no_BAR3 ;.nopci |
mov [es:BOOT_IDE_BAR3_16], cx |
.no_BAR3: |
pop cx |
;-------------------------------------- |
.nopci: |
; \end{Mario79} |
mov al, 0xf6 ; Сброс клавиатуры, разрешить сканирование |
out 0x60, al |
xor cx, cx |
/kernel/branches/kolibri-process/boot/booten.inc |
---|
55,7 → 55,7 |
start_msg db "Press [abcde] to change settings, press [Enter] to continue booting",13,10,0 |
time_msg db " or wait " |
time_str db " 5 seconds" |
db " before automatical continuation",13,10,0 |
db " to continue automatically",13,10,0 |
current_cfg_msg db "Current settings:",13,10,0 |
curvideo_msg db " [a] Videomode: ",0 |
/kernel/branches/kolibri-process/boot/bootvesa.inc |
---|
476,8 → 476,8 |
jne .next |
cmp word [es:si+8], 32 |
je .ok |
cmp word [es:si+8], 24 |
je .ok |
; cmp word [es:si+8], 24 |
; je .ok |
.next: |
add si, size_of_step |
cmp word [es:si], -1 |
/kernel/branches/kolibri-process/boot/rdload.inc |
---|
9,10 → 9,10 |
read_ramdisk: |
; READ RAMDISK IMAGE FROM HD |
; READ RAMDISK IMAGE FROM HD (only for IDE0, IDE1, IDE2, IDE3) |
cmp [boot_dev+OS_BASE+0x10000], 1 |
jne no_sys_on_hd |
jne no_sys_on_hd.1 |
xor ebp, ebp |
.hd_loop: |
69,9 → 69,19 |
jb .hd_loop |
jmp no_sys_on_hd |
.yes: |
DEBUGF 1, "K : RD found: %s\n", read_image_fsinfo.name |
pop edi esi eax |
call register_ramdisk |
jmp yes_sys_on_hd |
;----------------------------------------------------------------------------- |
; Register ramdisk file system |
register_ramdisk: |
mov esi, boot_initramdisk |
call boot_log |
call ramdisk_init |
ret |
;----------------------------------------------------------------------------- |
iglobal |
align 4 |
read_image_fsinfo: |
79,7 → 89,7 |
dq 0 ; offset: zero |
dd 1474560 ; size |
dd RAMDISK ; buffer |
db '/hd' |
.name db '/hd' |
.name_digit db '0' |
db '/' |
.partition: |
99,6 → 109,8 |
ret |
no_sys_on_hd: |
DEBUGF 1, "K : RD not found\n" |
.1: |
; test_to_format_ram_disk (need if not using ram disk) |
cmp [boot_dev+OS_BASE+0x10000], 3 |
jne not_format_ram_disk |
/kernel/branches/kolibri-process/bus/pci/pci32.inc |
---|
165,10 → 165,7 |
call pci_make_config_cmd |
mov ebx, eax |
; get current state |
mov dx, 0xcf8 |
in eax, dx |
push eax |
; set up addressing to config data |
mov eax, ebx |
and al, 0xfc; make address dword-aligned |
194,14 → 191,7 |
jmp pci_fin_read1 |
pci_read_dword1: |
in eax, dx |
jmp pci_fin_read1 |
pci_fin_read1: |
; restore configuration control |
xchg eax, [esp] |
mov dx, 0xcf8 |
out dx, eax |
pop eax |
pop esi ebx |
ret |
pci_read_reg_2: |
212,15 → 202,8 |
mov esi, eax ; save register size into ESI |
and esi, 3 |
push eax |
;store current state of config space |
mov dx, 0xcf8 |
in al, dx |
mov ah, al |
mov dl, 0xfa |
in al, dx |
mov dx, 0xcfa |
xchg eax, [esp] |
; out 0xcfa,bus |
mov al, ah |
out dx, al |
249,18 → 232,8 |
jmp pci_fin_read2 |
pci_read_dword2: |
in eax, dx |
; jmp pci_fin_read2 |
pci_fin_read2: |
; restore configuration space |
xchg eax, [esp] |
mov dx, 0xcfa |
out dx, al |
mov dl, 0xf8 |
mov al, ah |
out dx, al |
pop eax |
pop esi ebx |
ret |
296,10 → 269,7 |
call pci_make_config_cmd |
mov ebx, eax |
; get current state into ecx |
mov dx, 0xcf8 |
in eax, dx |
push eax |
; set up addressing to config data |
mov eax, ebx |
and al, 0xfc; make address dword-aligned |
326,14 → 296,8 |
jmp pci_fin_write1 |
pci_write_dword1: |
out dx, eax |
jmp pci_fin_write1 |
pci_fin_write1: |
; restore configuration control |
pop eax |
mov dl, 0xf8 |
out dx, eax |
xor eax, eax |
pop ebx esi |
347,14 → 311,7 |
mov esi, eax ; save register size into ESI |
and esi, 3 |
push eax |
;store current state of config space |
mov dx, 0xcf8 |
in al, dx |
mov ah, al |
mov dl, 0xfa |
in al, dx |
xchg eax, [esp] |
mov dx, 0xcfa |
; out 0xcfa,bus |
mov al, ah |
out dx, al |
385,15 → 342,7 |
jmp pci_fin_write2 |
pci_write_dword2: |
out dx, eax |
jmp pci_fin_write2 |
pci_fin_write2: |
; restore configuration space |
pop eax |
mov dx, 0xcfa |
out dx, al |
mov dl, 0xf8 |
mov al, ah |
out dx, al |
xor eax, eax |
pop ebx esi |
/kernel/branches/kolibri-process/bus/usb/hccommon.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; USB Host Controller support code: hardware-independent part, |
; common for all controller types. |
/kernel/branches/kolibri-process/bus/usb/hub.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; Support for USB (non-root) hubs: |
; powering up/resetting/disabling ports, |
; watching for adding/removing devices. |
/kernel/branches/kolibri-process/bus/usb/init.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; Initialization of the USB subsystem. |
; Provides usb_init procedure, includes all needed files. |
/kernel/branches/kolibri-process/bus/usb/memory.inc |
---|
1,3 → 1,12 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; Memory management for USB structures. |
; Protocol layer uses the common kernel heap malloc/free. |
; Hardware layer has special requirements: |
/kernel/branches/kolibri-process/bus/usb/pipe.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; Functions for USB pipe manipulation: opening/closing, sending data etc. |
; |
USB_STDCALL_VERIFY = 1 |
/kernel/branches/kolibri-process/bus/usb/protocol.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; Implementation of the USB protocol for device enumeration. |
; Manage a USB device when it becomes ready for USB commands: |
; configure, enumerate, load the corresponding driver(s), |
/kernel/branches/kolibri-process/const.inc |
---|
179,8 → 179,7 |
_io_map_1 rb 4096 |
ends |
PARTITION_COUNT equ 64 |
DRIVE_DATA_SIZE equ (16+PARTITION_COUNT*100) |
DRIVE_DATA_SIZE equ 16 |
OS_BASE equ 0x80000000 |
205,7 → 204,7 |
WIN_TEMP_XY equ (OS_BASE+0x000F300) |
KEY_COUNT equ (OS_BASE+0x000F400) |
KEY_BUFF equ (OS_BASE+0x000F401) |
KEY_BUFF equ (OS_BASE+0x000F401) ; 120*2 + 2*2 = 244 bytes, actually 255 bytes |
BTN_COUNT equ (OS_BASE+0x000F500) |
BTN_BUFF equ (OS_BASE+0x000F501) |
304,7 → 303,7 |
BOOT_DMA equ 0x901F ; |
BOOT_PCI_DATA equ 0x9020 ;8bytes pci data |
BOOT_VRR equ 0x9030 ;byte VRR start enabled 1, 2-no |
BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr |
;BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr ; now free and is not used |
BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount |
BOOT_APM_ENTRY equ 0x9040 |
313,12 → 312,12 |
BOOT_APM_CODE_32 equ 0x9050 |
BOOT_APM_CODE_16 equ 0x9052 |
BOOT_APM_DATA_16 equ 0x9054 |
BOOT_IDE_BAR0_16 equ 0x9056 |
BOOT_IDE_BAR1_16 equ 0x9058 |
BOOT_IDE_BAR2_16 equ 0x905A |
BOOT_IDE_BAR3_16 equ 0x905C |
BOOT_IDE_PI_16 equ 0x905E |
BOOT_IDE_INTERR_16 equ 0x9060 |
;BOOT_IDE_BAR0_16 equ 0x9056 ; now free and is not used |
;BOOT_IDE_BAR1_16 equ 0x9058 ; now free and is not used |
;BOOT_IDE_BAR2_16 equ 0x905A ; now free and is not used |
;BOOT_IDE_BAR3_16 equ 0x905C ; now free and is not used |
;BOOT_IDE_PI_16 equ 0x905E ; now free and is not used |
;BOOT_IDE_INTERR_16 equ 0x9060 ; now free and is not used |
TMP_FILE_NAME equ 0 |
TMP_CMD_LINE equ 1024 |
/kernel/branches/kolibri-process/core/apic.inc |
---|
1,11 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
iglobal |
IRQ_COUNT dd 24 |
endg |
/kernel/branches/kolibri-process/core/clipboard.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
;------------------------------------------------------------------------------ |
align 4 |
sys_clipboard: |
/kernel/branches/kolibri-process/core/conf_lib-sp.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; Éste archivo debe ser editado con codificación CP866 |
ugui_mouse_speed cp850 'velocidad del ratón',0 |
/kernel/branches/kolibri-process/core/debug.inc |
---|
136,9 → 136,18 |
; ecx=pid |
; edx=sizeof(CONTEXT) |
; esi->CONTEXT |
; destroys eax,ecx,edx,esi,edi |
cmp edx, 28h |
jnz .ret |
; destroys eax,ebx,ecx,edx,esi,edi |
xor ebx, ebx ; 0 - get only gp regs |
cmp edx, 40 |
je .std_ctx |
cmp edx, 48+288 |
jne .ret |
inc ebx ; 1 - get sse context |
; TODO legacy 32-bit FPU/MMX context |
.std_ctx: |
; push ecx |
; mov ecx, esi |
call check_region |
147,8 → 156,15 |
jnz .ret |
call get_debuggee_slot |
jc .ret |
shr eax, 5 |
cmp eax, [fpu_owner] |
jne @f |
inc bh ; set swap context flag |
@@: |
shl eax, 8 |
mov edi, esi |
mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack] |
mov eax, [eax+SLOT_BASE+APPDATA.pl0_stack] |
lea esi, [eax+RING0_STACK_SIZE] |
.ring0: |
178,6 → 194,29 |
mov [edi+4], eax |
lodsd ;esp |
mov [edi+18h], eax |
dec bl |
js .ret |
dec bl |
jns .ret |
test bh, bh ; check swap flag |
jz @F |
ffree st0 ; swap context |
@@: |
add esi, 4 ;top of ring0 stack |
;fpu/sse context saved here |
add edi, 40 |
mov eax, 1 ;sse context |
stosd |
xor eax, eax ;reserved dword |
stosd |
mov ecx, 288/4 |
rep movsd ;copy sse context |
.ret: |
sti |
ret |
/kernel/branches/kolibri-process/core/irq.inc |
---|
1,10 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
IRQ_RESERVED equ 24 |
IRQ_POOL_SIZE equ 48 |
/kernel/branches/kolibri-process/core/memory.inc |
---|
1313,113 → 1313,6 |
endp |
align 4 |
proc init_mtrr |
cmp [BOOT_VARS+BOOT_MTRR], byte 2 |
je .exit |
bt [cpu_caps], CAPS_MTRR |
jnc .exit |
mov eax, cr0 |
or eax, 0x60000000 ;disable caching |
mov cr0, eax |
wbinvd ;invalidate cache |
mov ecx, 0x2FF |
rdmsr ; |
; has BIOS already initialized MTRRs? |
test ah, 8 |
jnz .skip_init |
; rarely needed, so mainly placeholder |
; main memory - cached |
push eax |
mov eax, [MEM_AMOUNT] |
; round eax up to next power of 2 |
dec eax |
bsr ecx, eax |
mov ebx, 2 |
shl ebx, cl |
dec ebx |
; base of memory range = 0, type of memory range = MEM_WB |
xor edx, edx |
mov eax, MEM_WB |
mov ecx, 0x200 |
wrmsr |
; mask of memory range = 0xFFFFFFFFF - (size - 1), ebx = size - 1 |
mov eax, 0xFFFFFFFF |
mov edx, 0x0000000F |
sub eax, ebx |
sbb edx, 0 |
or eax, 0x800 |
inc ecx |
wrmsr |
; clear unused MTRRs |
xor eax, eax |
xor edx, edx |
@@: |
inc ecx |
wrmsr |
cmp ecx, 0x20F |
jb @b |
; enable MTRRs |
pop eax |
or ah, 8 |
and al, 0xF0; default memtype = UC |
mov ecx, 0x2FF |
wrmsr |
.skip_init: |
stdcall set_mtrr, [LFBAddress], [LFBSize], MEM_WC |
wbinvd ;again invalidate |
mov eax, cr0 |
and eax, not 0x60000000 |
mov cr0, eax ; enable caching |
.exit: |
ret |
endp |
align 4 |
proc set_mtrr stdcall, base:dword,size:dword,mem_type:dword |
; find unused register |
mov ecx, 0x201 |
@@: |
rdmsr |
dec ecx |
test ah, 8 |
jz .found |
rdmsr |
mov al, 0; clear memory type field |
cmp eax, [base] |
jz .ret |
add ecx, 3 |
cmp ecx, 0x210 |
jb @b |
; no free registers, ignore the call |
.ret: |
ret |
.found: |
; found, write values |
xor edx, edx |
mov eax, [base] |
or eax, [mem_type] |
wrmsr |
mov ebx, [size] |
dec ebx |
mov eax, 0xFFFFFFFF |
mov edx, 0x00000000 |
sub eax, ebx |
sbb edx, 0 |
or eax, 0x800 |
inc ecx |
wrmsr |
ret |
endp |
align 4 |
proc create_ring_buffer stdcall, size:dword, flags:dword |
locals |
buf_ptr dd ? |
/kernel/branches/kolibri-process/core/sched.inc |
---|
29,8 → 29,7 |
.nocounter: |
xor ecx, ecx ; send End Of Interrupt signal |
call irq_eoi |
; btr dword[DONT_SWITCH], 0 |
; jc .return |
mov bl, SCHEDULE_ANY_PRIORITY |
call find_next_task |
jz .return ; if there is only one running process |
44,26 → 43,10 |
pushfd |
cli |
pushad |
if 0 |
; \begin{Mario79} ; <- must be refractoried, if used... |
cmp [dma_task_switched], 1 |
jne .find_next_task |
mov [dma_task_switched], 0 |
mov ebx, [dma_process] |
cmp [CURRENT_TASK], ebx |
je .return |
mov edi, [dma_slot_ptr] |
mov [CURRENT_TASK], ebx |
mov [TASK_BASE], edi |
jmp @f |
.find_next_task: |
; \end{Mario79} |
end if |
mov bl, SCHEDULE_ANY_PRIORITY |
call find_next_task |
jz .return ; the same task -> skip switch |
@@: |
; mov byte[DONT_SWITCH], 1 |
call do_change_task |
.return: |
popad |
/kernel/branches/kolibri-process/core/sys32-sp.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; Éste archivo debe ser editado con codificación CP866 |
msg_sel_ker cp850 "núcleo", 0 |
/kernel/branches/kolibri-process/core/sys32.inc |
---|
418,7 → 418,6 |
.slot equ esp+4 ;locals |
.process equ esp ;ptr to parent process |
xchg bx, bx |
push esi ;save .slot |
453,7 → 452,7 |
mov ecx, [esi+8] |
mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx |
.nov86: |
;destroy per-thread kerlen objects |
;destroy per-thread kernel objects |
mov esi, [.slot] |
shl esi, 8 |
add esi, SLOT_BASE+APP_OBJ_OFFSET |
749,7 → 748,6 |
.xd1: |
;release slot |
xchg bx, bx |
bts [thr_slot_map], esi |
/kernel/branches/kolibri-process/core/taskman.inc |
---|
389,7 → 389,6 |
xor eax, eax |
ret |
align 4 |
alloc_thread_slot: |
;input: |
431,6 → 430,10 |
app_tabs dd ? |
endl |
push ebx |
push esi |
push edi |
mov ecx, pg_data.mutex |
call mutex_lock |
552,6 → 555,10 |
mov ecx, pg_data.mutex |
call mutex_unlock |
mov eax, [process] |
pop edi |
pop esi |
pop ebx |
ret |
.fail: |
mov ecx, pg_data.mutex |
561,6 → 568,9 |
;; stdcall destroy_app_space, [dir_addr], 0 |
@@: |
xor eax, eax |
pop edi |
pop esi |
pop ebx |
ret |
endp |
/kernel/branches/kolibri-process/core/v86.inc |
---|
922,3 → 922,74 |
call do_change_task |
popad |
iretd |
align 4 |
v86_entry: |
xchg bx, bx |
mov ebx, 100000 |
call delay_hs |
jmp v86_entry |
align 4 |
proc v86_init |
locals |
v86_slot dd ? |
v86_cmdline dd ? ;0x00 |
v86_path dd ? ;0x04 |
v86_eip dd ? ;0x08 |
v86_esp dd ? ;0x0C |
v86_mem dd ? ;0x10 |
endl |
xor eax, eax |
mov [v86_eip], v86_entry |
mov [v86_cmdline], eax |
mov [v86_esp], eax |
mov [v86_path], eax |
call lock_application_table |
call alloc_thread_slot |
test eax, eax |
jz .failed |
mov [v86_slot], eax |
mov edi, eax |
shl edi, 8 |
add edi, SLOT_BASE |
mov esi, edi ;edx=edi - pointer to extended infomation about new thread |
mov ecx, 256/4 |
xor eax, eax |
cld |
rep stosd ;clean extended information about new thread |
mov [esi], dword 'V86 ' |
stdcall create_process, 4096, OS_BASE, 4096 |
test eax, eax |
jz .failed |
mov [eax+PROC.mem_used], 4096 |
mov [esi+APPDATA.process], eax |
lea ebx, [esi+APPDATA.list] |
lea ecx, [eax+PROC.thr_list] |
list_add_tail ebx, ecx ;add thread to process child's list |
lea eax, [v86_cmdline] |
stdcall set_app_params , [v86_slot], eax, 0, 0, 2 |
mov eax, [process_number] ;set result |
call unlock_application_table |
ret |
.failed: |
xor eax, eax |
.failed1: |
call unlock_application_table |
dec eax ;-1 |
ret |
endp |
/kernel/branches/kolibri-process/data32.inc |
---|
168,8 → 168,10 |
notifyapp db '@notify',0 |
if lang eq ru |
ud_user_message cp866 'Ошибка: неподдерживаемая инструкция процессора',0 |
mtrr_user_message cp866 '"Обнаружена проблема с конфигурацией MTRR.\nПроизводительность может быть пониженной" -dW',0 |
else if ~ lang eq sp |
ud_user_message db 'Error: unsupported processor instruction',0 |
mtrr_user_message db '"There is a problem with MTRR configuration.\nPerformance can be low" -dW',0 |
end if |
vmode db '/sys/drivers/VMODE.MDR',0 |
497,63 → 499,12 |
skin_data rd 1 |
cache_ide0: |
cache_ide0_pointer rd 1 |
cache_ide0_size rd 1 ; not use |
cache_ide0_data_pointer rd 1 |
cache_ide0_system_data_size rd 1 ; not use |
cache_ide0_appl_data_size rd 1 ; not use |
cache_ide0_system_data rd 1 |
cache_ide0_appl_data rd 1 |
cache_ide0_system_sad_size rd 1 |
cache_ide0_appl_sad_size rd 1 |
cache_ide0_search_start rd 1 |
cache_ide0_appl_search_start rd 1 |
cache_ide1: |
cache_ide1_pointer rd 1 |
cache_ide1_size rd 1 ; not use |
cache_ide1_data_pointer rd 1 |
cache_ide1_system_data_size rd 1 ; not use |
cache_ide1_appl_data_size rd 1 ; not use |
cache_ide1_system_data rd 1 |
cache_ide1_appl_data rd 1 |
cache_ide1_system_sad_size rd 1 |
cache_ide1_appl_sad_size rd 1 |
cache_ide1_search_start rd 1 |
cache_ide1_appl_search_start rd 1 |
cache_ide2: |
cache_ide2_pointer rd 1 |
cache_ide2_size rd 1 ; not use |
cache_ide2_data_pointer rd 1 |
cache_ide2_system_data_size rd 1 ; not use |
cache_ide2_appl_data_size rd 1 ; not use |
cache_ide2_system_data rd 1 |
cache_ide2_appl_data rd 1 |
cache_ide2_system_sad_size rd 1 |
cache_ide2_appl_sad_size rd 1 |
cache_ide2_search_start rd 1 |
cache_ide2_appl_search_start rd 1 |
cache_ide3: |
cache_ide3_pointer rd 1 |
cache_ide3_size rd 1 ; not use |
cache_ide3_data_pointer rd 1 |
cache_ide3_system_data_size rd 1 ; not use |
cache_ide3_appl_data_size rd 1 ; not use |
cache_ide3_system_data rd 1 |
cache_ide3_appl_data rd 1 |
cache_ide3_system_sad_size rd 1 |
cache_ide3_appl_sad_size rd 1 |
cache_ide3_search_start rd 1 |
cache_ide3_appl_search_start rd 1 |
debug_step_pointer rd 1 |
lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled |
pci_access_enabled rd 1 ; 0 = disabled , 1 = enabled |
cpu_phys_addr_width rb 1 ; also known as MAXPHYADDR in Intel manuals |
hdd_appl_data rb 1 ; 0 = system cache, 1 - application cache |
cd_appl_data rb 1 ; 0 = system cache, 1 - application cache |
/kernel/branches/kolibri-process/data32et.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
boot_initirq latin1 'Algväärtustan IRQ',0 |
boot_picinit latin1 'Algväärtustan PIC',0 |
boot_v86machine latin1 'Algväärtustan süsteemi V86 masinat',0 |
/kernel/branches/kolibri-process/data32sp.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
boot_initirq: cp850 'Inicializar IRQ',0 |
boot_picinit: cp850 'Inicializar PIC',0 |
boot_v86machine: cp850 'Inicializar sistema V86',0 |
41,3 → 51,4 |
msg_www: cp850 'por favor, visita www.kolibrios.org',13,10,0 |
ud_user_message:cp850 'Error: instrucción no soportada por el procesador',0 |
mtrr_user_message cp850 '"There is a problem with MTRR configuration.\nPerformance can be low" -dW',0 |
/kernel/branches/kolibri-process/detect/biosdisk.inc |
---|
1,10 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2008-2011. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2008-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; Detect all BIOS hard drives. |
; diamond, 2008 |
; Do not include USB mass storages. CleverMouse, 2013 |
/kernel/branches/kolibri-process/detect/biosmem.inc |
---|
1,10 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2009-2011. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2009-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; Query physical memory map from BIOS. |
; diamond, 2009 |
/kernel/branches/kolibri-process/detect/dev_hdcd.inc |
---|
17,93 → 17,190 |
;**************************************************** |
;* ПОИСК HDD и CD * |
;**************************************************** |
cmp [IDEContrProgrammingInterface], 0 |
cmp [ecx+IDE_DATA.ProgrammingInterface], 0 |
je EndFindHDD |
FindHDD: |
push ecx |
xor ebx, ebx |
inc ebx |
cmp ecx, IDE_controller_2 |
jne @f |
add bl, 5 |
jmp .find |
@@: |
cmp ecx, IDE_controller_3 |
jne .find |
add bl, 10 |
;-------------------------------------- |
.find: |
mov [ChannelNumber], 1 |
mov [DiskNumber], 0 |
call FindHDD_3 |
; mov ax,[Sector512+176] |
; mov [DRIVE_DATA+6],ax |
; mov ax,[Sector512+126] |
; mov [DRIVE_DATA+8],ax |
; mov ax,[Sector512+128] |
; mov [DRIVE_DATA+8],ax |
call FindHDD_2 |
mov [DiskNumber], 1 |
call FindHDD_3 |
; mov al,[Sector512+176] |
; mov [DRIVE_DATA+7],al |
call FindHDD_2 |
inc [ChannelNumber] |
mov [DiskNumber], 0 |
call FindHDD_3 |
; mov al,[Sector512+176] |
; mov [DRIVE_DATA+8],al |
call FindHDD_2 |
mov [DiskNumber], 1 |
call FindHDD_1 |
; mov al,[Sector512+176] |
; mov [DRIVE_DATA+9],al |
pop ecx |
jmp EndFindHDD |
;----------------------------------------------------------------------------- |
FindHDD_2: |
call FindHDD_1 |
shl byte [ebx+DRIVE_DATA], 2 |
ret |
;----------------------------------------------------------------------------- |
FindHDD_1: |
DEBUGF 1, "K : Channel %d ",[ChannelNumber]:2 |
DEBUGF 1, "Disk %d\n",[DiskNumber]:1 |
push ebx ecx |
call ReadHDD_ID |
pop ecx ebx |
cmp [DevErrorCode], 0 |
jne FindHDD_2 |
jne .FindCD |
cmp [Sector512+6], word 16 |
ja FindHDD_2 |
ja .FindCD |
cmp [Sector512+12], word 255 |
ja FindHDD_2 |
inc byte [DRIVE_DATA+1] |
jmp Print_Device_Name |
FindHDD_2: |
ja .FindCD |
inc byte [ebx+DRIVE_DATA] |
jmp .Print_Device_Name |
;-------------------------------------- |
.FindCD: |
push ebx ecx |
call DeviceReset |
pop ecx ebx |
cmp [DevErrorCode], 0 |
jne FindHDD_2_2 |
jne .end |
push ebx ecx |
call ReadCD_ID |
pop ecx ebx |
cmp [DevErrorCode], 0 |
jne FindHDD_2_2 |
inc byte [DRIVE_DATA+1] |
inc byte [DRIVE_DATA+1] |
Print_Device_Name: |
jne .end |
add [ebx+DRIVE_DATA], byte 2 |
;-------------------------------------- |
.Print_Device_Name: |
pushad |
pushfd |
xor ebx, ebx |
mov bx, [ChannelNumber] |
dec ebx |
shl ebx, 1 |
add bl, [DiskNumber] |
shl ebx, 1 |
call calculate_IDE_device_values_storage |
;-------------------------------------- |
.copy_dev_name: |
mov esi, Sector512+27*2 |
mov edi, dev_name |
mov ecx, 20 |
cld |
;-------------------------------------- |
@@: |
lodsw |
xchg ah, al |
stosw |
loop @b |
popfd |
popad |
DEBUGF 1, "K : Dev: %s \n", dev_name |
xor eax, eax |
mov ax, [Sector512+64*2] |
DEBUGF 1, "K : PIO mode %x\n", eax |
DEBUGF 1, "K : PIO possible modes %x\n", al |
mov ax, [Sector512+51*2] |
mov al, ah |
call convert_Sector512_value |
DEBUGF 1, "K : PIO set mode %x\n", ah |
mov ax, [Sector512+63*2] |
DEBUGF 1, "K : Multiword DMA mode %x\n", eax |
DEBUGF 1, "K : Multiword DMA possible modes %x\n", al |
mov al, ah |
call convert_Sector512_value |
DEBUGF 1, "K : Multiword DMA set mode %x\n", ah |
mov ax, [Sector512+88*2] |
DEBUGF 1, "K : Ultra DMA mode %x\n", eax |
FindHDD_2_2: |
DEBUGF 1, "K : Ultra DMA possible modes %x\n", al |
mov [ebx+IDE_DEVICE.UDMA_possible_modes], al |
mov al, ah |
call convert_Sector512_value |
DEBUGF 1, "K : Ultra DMA set mode %x\n", ah |
mov [ebx+IDE_DEVICE.UDMA_set_mode], ah |
popfd |
popad |
ret |
;-------------------------------------- |
.end: |
DEBUGF 1, "K : Device not found\n" |
ret |
;----------------------------------------------------------------------------- |
calculate_IDE_device_values_storage: |
cmp ecx, IDE_controller_1 |
jne @f |
FindHDD_3: |
call FindHDD_1 |
shl byte [DRIVE_DATA+1], 2 |
add ebx, IDE_device_1 |
jmp .exit |
;-------------------------------------- |
@@: |
cmp ecx, IDE_controller_2 |
jne @f |
add ebx, IDE_device_2 |
jmp .exit |
;-------------------------------------- |
@@: |
add ebx, IDE_device_3 |
;-------------------------------------- |
.exit: |
ret |
;----------------------------------------------------------------------------- |
convert_Sector512_value: |
mov ecx, 8 |
xor ah, ah |
;-------------------------------------- |
@@: |
test al, 1b |
jnz .end |
shr al, 1 |
inc ah |
loop @b |
xor ah, ah |
;-------------------------------------- |
.end: |
ret |
;----------------------------------------------------------------------------- |
; Адрес считываемого сектора в режиме LBA |
uglobal |
SectorAddress DD ? |
SectorAddress dd ? |
dev_name: |
rb 41 |
endg |
;----------------------------------------------------------------------------- |
;************************************************* |
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА ЖЕСТКОГО ДИСКА * |
;* Входные параметры передаются через глобальные * |
119,32 → 216,32 |
; Послать команду идентификации устройства |
mov [ATAFeatures], 0 |
mov [ATAHead], 0 |
mov [ATACommand], 0ECh |
mov [ATACommand], 0xEC |
call SendCommandToHDD |
cmp [DevErrorCode], 0;проверить код ошибки |
jne @@End ;закончить, сохранив код ошибки |
mov DX, [ATABasePortAddr] |
add DX, 7 ;адрес регистра состояни |
mov dx, [ATABasePortAddr] |
add dx, 7 ;адрес регистра состояни |
mov ecx, 0xffff |
@@WaitCompleet: |
; Проверить время выполнения команды |
dec ecx |
; cmp ecx,0 |
jz @@Error1 ;ошибка тайм-аута |
; Проверить готовность |
in AL, DX |
test AL, 80h ;состояние сигнала BSY |
in al, dx |
test al, 80h ;состояние сигнала BSY |
jnz @@WaitCompleet |
test AL, 1 ;состояние сигнала ERR |
test al, 1 ;состояние сигнала ERR |
jnz @@Error6 |
test AL, 08h ;состояние сигнала DRQ |
test al, 08h ;состояние сигнала DRQ |
jz @@WaitCompleet |
; Принять блок данных от контроллера |
; mov AX,DS |
; mov ES,AX |
mov EDI, Sector512 ;offset Sector512 |
mov DX, [ATABasePortAddr];регистр данных |
mov CX, 256 ;число считываемых слов |
mov edi, Sector512 |
mov dx, [ATABasePortAddr];регистр данных |
mov cx, 256 ;число считываемых слов |
rep insw ;принять блок данных |
ret |
; Записать код ошибки |
155,27 → 252,24 |
mov [DevErrorCode], 6 |
@@End: |
ret |
iglobal |
;----------------------------------------------------------------------------- |
uglobal |
; Стандартные базовые адреса каналов 1 и 2 |
StandardATABases DW 1F0h, 170h |
endg |
uglobal |
StandardATABases dw ?, ? ; 1F0h, 170h |
; Номер канала |
ChannelNumber DW ? |
ChannelNumber dw ? |
; Номер диска |
DiskNumber DB ? |
DiskNumber db ? |
; Базовый адрес группы портов контроллера ATA |
ATABasePortAddr DW ? |
ATABasePortAddr dw ? |
; Параметры ATA-команды |
ATAFeatures DB ? ;особенности |
ATASectorCount DB ? ;количество обрабатываемых секторов |
ATASectorNumber DB ? ;номер начального сектора |
ATACylinder DW ? ;номер начального цилиндра |
ATAHead DB ? ;номер начальной головки |
ATAAddressMode DB ? ;режим адресации (0 - CHS, 1 - LBA) |
ATACommand DB ? ;код команды, подлежащей выполнению |
ATAFeatures db ? ;особенности |
ATASectorCount db ? ;количество обрабатываемых секторов |
ATASectorNumber db ? ;номер начального сектора |
ATACylinder dw ? ;номер начального цилиндра |
ATAHead db ? ;номер начальной головки |
ATAAddressMode db ? ;режим адресации (0 - CHS, 1 - LBA) |
ATACommand db ? ;код команды, подлежащей выполнению |
; Код ошибки (0 - нет ошибок, 1 - превышен допустимый |
; интервал ожидания, 2 - неверный код режима адресации, |
; 3 - неверный номер канала, 4 - неверный номер диска, |
183,6 → 277,7 |
; команды) |
DevErrorCode dd ? |
endg |
;----------------------------------------------------------------------------- |
;**************************************************** |
;* ПОСЛАТЬ КОМАНДУ ЗАДАННОМУ ДИСКУ * |
;* Входные параметры передаются через глобальные * |
207,82 → 302,78 |
cmp [ATAAddressMode], 1 |
ja @@Err2 |
; Проверить корректность номера канала |
mov BX, [ChannelNumber] |
cmp BX, 1 |
mov bx, [ChannelNumber] |
cmp bx, 1 |
jb @@Err3 |
cmp BX, 2 |
cmp bx, 2 |
ja @@Err3 |
; Установить базовый адрес |
dec BX |
shl BX, 1 |
dec bx |
shl bx, 1 |
movzx ebx, bx |
mov AX, [ebx+StandardATABases] |
mov [ATABasePortAddr], AX |
mov ax, [ebx+StandardATABases] |
mov [ATABasePortAddr], ax |
; Ожидание готовности HDD к приему команды |
; Выбрать нужный диск |
mov DX, [ATABasePortAddr] |
add DX, 6 ;адрес регистра головок |
mov AL, [DiskNumber] |
cmp AL, 1 ;проверить номера диска |
mov dx, [ATABasePortAddr] |
add dx, 6 ;адрес регистра головок |
mov al, [DiskNumber] |
cmp al, 1 ;проверить номера диска |
ja @@Err4 |
shl AL, 4 |
or AL, 10100000b |
out DX, AL |
shl al, 4 |
or al, 10100000b |
out dx, al |
; Ожидать, пока диск не будет готов |
inc DX |
inc dx |
mov ecx, 0xfff |
; mov eax,[timer_ticks] |
; mov [TickCounter_1],eax |
@@WaitHDReady: |
; Проверить время ожидани |
dec ecx |
; cmp ecx,0 |
jz @@Err1 |
; mov eax,[timer_ticks] |
; sub eax,[TickCounter_1] |
; cmp eax,300 ;ожидать 300 тиков |
; ja @@Err1 ;ошибка тайм-аута |
; Прочитать регистр состояни |
in AL, DX |
in al, dx |
; Проверить состояние сигнала BSY |
test AL, 80h |
test al, 80h |
jnz @@WaitHDReady |
; Проверить состояние сигнала DRQ |
test AL, 08h |
test al, 08h |
jnz @@WaitHDReady |
; Загрузить команду в регистры контроллера |
cli |
mov DX, [ATABasePortAddr] |
inc DX ;регистр "особенностей" |
mov AL, [ATAFeatures] |
out DX, AL |
inc DX ;счетчик секторов |
mov AL, [ATASectorCount] |
out DX, AL |
inc DX ;регистр номера сектора |
mov AL, [ATASectorNumber] |
out DX, AL |
inc DX ;номер цилиндра (младший байт) |
mov AX, [ATACylinder] |
out DX, AL |
inc DX ;номер цилиндра (старший байт) |
mov AL, AH |
out DX, AL |
inc DX ;номер головки/номер диска |
mov AL, [DiskNumber] |
shl AL, 4 |
cmp [ATAHead], 0Fh;проверить номер головки |
mov dx, [ATABasePortAddr] |
inc dx ;регистр "особенностей" |
mov al, [ATAFeatures] |
out dx, AL |
inc dx ;счетчик секторов |
mov al, [ATASectorCount] |
out dx, AL |
inc dx ;регистр номера сектора |
mov al, [ATASectorNumber] |
out dx, AL |
inc dx ;номер цилиндра (младший байт) |
mov ax, [ATACylinder] |
out dx, AL |
inc dx ;номер цилиндра (старший байт) |
mov al, AH |
out dx, AL |
inc dx ;номер головки/номер диска |
mov al, [DiskNumber] |
shl al, 4 |
cmp [ATAHead], 0xF ;проверить номер головки |
ja @@Err5 |
or AL, [ATAHead] |
or AL, 10100000b |
mov AH, [ATAAddressMode] |
shl AH, 6 |
or AL, AH |
out DX, AL |
or al, [ATAHead] |
or al, 10100000b |
mov ah, [ATAAddressMode] |
shl ah, 6 |
or al, ah |
out dx, al |
; Послать команду |
mov AL, [ATACommand] |
inc DX ;регистр команд |
out DX, AL |
mov al, [ATACommand] |
inc dx ;регистр команд |
out dx, al |
sti |
; Сбросить признак ошибки |
mov [DevErrorCode], 0 |
304,7 → 395,7 |
mov [DevErrorCode], 5 |
; Завершение работы программы |
ret |
;----------------------------------------------------------------------------- |
;************************************************* |
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА УСТРОЙСТВА ATAPI * |
;* Входные параметры передаются через глобальные * |
323,33 → 414,32 |
mov [ATASectorNumber], 0 |
mov [ATACylinder], 0 |
mov [ATAHead], 0 |
mov [ATACommand], 0A1h |
mov [ATACommand], 0xA1 |
call SendCommandToHDD |
cmp [DevErrorCode], 0;проверить код ошибки |
jne @@End_1 ;закончить, сохранив код ошибки |
; Ожидать готовность данных HDD |
mov DX, [ATABasePortAddr] |
add DX, 7 ;порт 1х7h |
mov dx, [ATABasePortAddr] |
add dx, 7 ;порт 1х7h |
mov ecx, 0xffff |
@@WaitCompleet_1: |
; Проверить врем |
dec ecx |
; cmp ecx,0 |
jz @@Error1_1 ;ошибка тайм-аута |
; Проверить готовность |
in AL, DX |
test AL, 80h ;состояние сигнала BSY |
in al, dx |
test al, 80h ;состояние сигнала BSY |
jnz @@WaitCompleet_1 |
test AL, 1 ;состояние сигнала ERR |
test al, 1 ;состояние сигнала ERR |
jnz @@Error6_1 |
test AL, 08h ;состояние сигнала DRQ |
test al, 08h ;состояние сигнала DRQ |
jz @@WaitCompleet_1 |
; Принять блок данных от контроллера |
; mov AX,DS |
; mov ES,AX |
mov EDI, Sector512 ;offset Sector512 |
mov DX, [ATABasePortAddr];порт 1x0h |
mov CX, 256;число считываемых слов |
mov edi, Sector512 ;offset Sector512 |
mov dx, [ATABasePortAddr];порт 1x0h |
mov cx, 256;число считываемых слов |
rep insw |
ret |
; Записать код ошибки |
360,7 → 450,7 |
mov [DevErrorCode], 6 |
@@End_1: |
ret |
;----------------------------------------------------------------------------- |
;************************************************* |
;* СБРОС УСТРОЙСТВА * |
;* Входные параметры передаются через глобальные * |
370,39 → 460,40 |
;************************************************* |
DeviceReset: |
; Проверить корректность номера канала |
mov BX, [ChannelNumber] |
cmp BX, 1 |
mov bx, [ChannelNumber] |
cmp bx, 1 |
jb @@Err3_2 |
cmp BX, 2 |
cmp bx, 2 |
ja @@Err3_2 |
; Установить базовый адрес |
dec BX |
shl BX, 1 |
dec bx |
shl bx, 1 |
movzx ebx, bx |
mov DX, [ebx+StandardATABases] |
mov [ATABasePortAddr], DX |
mov dx, [ebx+StandardATABases] |
mov [ATABasePortAddr], dx |
; Выбрать нужный диск |
add DX, 6 ;адрес регистра головок |
mov AL, [DiskNumber] |
cmp AL, 1 ;проверить номера диска |
add dx, 6 ;адрес регистра головок |
mov al, [DiskNumber] |
cmp al, 1 ;проверить номера диска |
ja @@Err4_2 |
shl AL, 4 |
or AL, 10100000b |
out DX, AL |
shl al, 4 |
or al, 10100000b |
out dx, al |
; Послать команду "Сброс" |
mov AL, 08h |
inc DX ;регистр команд |
out DX, AL |
mov al, 0x8 |
inc dx ;регистр команд |
out dx, al |
mov ecx, 0x80000 |
@@WaitHDReady_1: |
; Проверить время ожидани |
dec ecx |
; cmp ecx,0 |
je @@Err1_2 ;ошибка тайм-аута |
; Прочитать регистр состояни |
in AL, DX |
in al, dx |
; Проверить состояние сигнала BSY |
test AL, 80h |
test al, 80h |
jnz @@WaitHDReady_1 |
; Сбросить признак ошибки |
mov [DevErrorCode], 0 |
418,6 → 509,5 |
mov [DevErrorCode], 4 |
; Записать код ошибки |
ret |
;----------------------------------------------------------------------------- |
EndFindHDD: |
/kernel/branches/kolibri-process/detect/getcache.inc |
---|
7,6 → 7,7 |
$Revision: 3742 $ |
;----------------------------------------------------------------------------- |
pusha |
mov eax, [pg_data.pages_free] |
20,89 → 21,167 |
; check a upper size of the cache, no more than 1 Mb on the physical device |
cmp eax, 1024*1024 |
jbe @f |
mov eax, 1024*1024 |
jmp .continue |
;-------------------------------------- |
@@: |
; check a lower size of the cache, not less than 128 Kb on the physical device |
cmp eax, 128*1024 |
jae @f |
jae .continue |
mov eax, 128*1024 |
;-------------------------------------- |
.continue: |
push ecx |
mov ecx, 12 |
mov esi, cache_ide0+IDE_CACHE.size |
cld |
@@: |
.continue: |
mov [cache_ide0_size], eax |
mov [cache_ide1_size], eax |
mov [cache_ide2_size], eax |
mov [cache_ide3_size], eax |
mov [esi], eax |
add esi, sizeof.IDE_CACHE |
loop @b |
pop ecx |
xor eax, eax |
mov [hdd_appl_data], 1;al |
mov [cd_appl_data], 1 |
;-------------------------------------- |
test byte [DRIVE_DATA+1], 0x80 |
je @f |
test byte [DRIVE_DATA+1], 2 |
je .ide2 |
mov esi, cache_ide3 |
mov esi, cache_ide0 |
call get_cache_ide |
.ide2: |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+1], 0x20 |
je @f |
mov esi, cache_ide1 |
call get_cache_ide |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+1], 8 |
je .ide1 |
je @f |
mov esi, cache_ide2 |
call get_cache_ide |
.ide1: |
test byte [DRIVE_DATA+1], 0x20 |
je .ide0 |
mov esi, cache_ide1 |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+1], 2 |
je @f |
mov esi, cache_ide3 |
call get_cache_ide |
.ide0: |
test byte [DRIVE_DATA+1], 0x80 |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+6], 0x80 |
je @f |
mov esi, cache_ide0 |
mov esi, cache_ide4 |
call get_cache_ide |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+6], 0x20 |
je @f |
mov esi, cache_ide5 |
call get_cache_ide |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+6], 8 |
je @f |
mov esi, cache_ide6 |
call get_cache_ide |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+6], 2 |
je @f |
mov esi, cache_ide7 |
call get_cache_ide |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+11], 0x80 |
je @f |
mov esi, cache_ide8 |
call get_cache_ide |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+11], 0x20 |
je @f |
mov esi, cache_ide9 |
call get_cache_ide |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+11], 8 |
je @f |
mov esi, cache_ide10 |
call get_cache_ide |
;-------------------------------------- |
@@: |
test byte [DRIVE_DATA+11], 2 |
je end_get_cache |
mov esi, cache_ide11 |
call get_cache_ide |
jmp end_get_cache |
;----------------------------------------------------------------------------- |
get_cache_ide: |
and [esi+IDE_CACHE.search_start], 0 |
and [esi+IDE_CACHE.appl_search_start], 0 |
get_cache_ide: |
and [esi+cache_ide0_search_start-cache_ide0], 0 |
and [esi+cache_ide0_appl_search_start-cache_ide0], 0 |
push ecx |
stdcall kernel_alloc, [esi+cache_ide0_size-cache_ide0] |
mov [esi+cache_ide0_pointer-cache_ide0], eax |
; DEBUGF 1, "K : IDE_CACHE.size %x\n", [esi+IDE_CACHE.size] |
stdcall kernel_alloc, [esi+IDE_CACHE.size] |
mov [esi+IDE_CACHE.pointer], eax |
pop ecx |
mov edx, eax |
mov eax, [esi+cache_ide0_size-cache_ide0] |
mov eax, [esi+IDE_CACHE.size] |
shr eax, 3 |
mov [esi+cache_ide0_system_data_size-cache_ide0], eax |
; DEBUGF 1, "K : IDE_CACHE.system_data_size %x\n", eax |
mov [esi+IDE_CACHE.system_data_size], eax |
mov ebx, eax |
imul eax, 7 |
mov [esi+cache_ide0_appl_data_size-cache_ide0], eax |
; DEBUGF 1, "K : IDE_CACHE.appl_data_size %x\n", eax |
mov [esi+IDE_CACHE.appl_data_size], eax |
add ebx, edx |
mov [esi+cache_ide0_data_pointer-cache_ide0], ebx |
mov [esi+IDE_CACHE.data_pointer], ebx |
.cd: |
push ecx |
mov eax, [esi+cache_ide0_system_data_size-cache_ide0] |
mov eax, [esi+IDE_CACHE.system_data_size] |
call calculate_for_cd |
add eax, [esi+cache_ide0_pointer-cache_ide0] |
mov [esi+cache_ide0_system_data-cache_ide0], eax |
mov [esi+cache_ide0_system_sad_size-cache_ide0], ecx |
add eax, [esi+IDE_CACHE.pointer] |
mov [esi+IDE_CACHE.system_data], eax |
mov [esi+IDE_CACHE.system_sad_size], ecx |
push edi |
mov edi, [esi+cache_ide0_pointer-cache_ide0] |
mov edi, [esi+IDE_CACHE.pointer] |
call clear_ide_cache |
pop edi |
mov eax, [esi+cache_ide0_appl_data_size-cache_ide0] |
mov eax, [esi+IDE_CACHE.appl_data_size] |
call calculate_for_cd |
add eax, [esi+cache_ide0_data_pointer-cache_ide0] |
mov [esi+cache_ide0_appl_data-cache_ide0], eax |
mov [esi+cache_ide0_appl_sad_size-cache_ide0], ecx |
add eax, [esi+IDE_CACHE.data_pointer] |
mov [esi+IDE_CACHE.appl_data], eax |
mov [esi+IDE_CACHE.appl_sad_size], ecx |
push edi |
mov edi, [esi+cache_ide0_data_pointer-cache_ide0] |
mov edi, [esi+IDE_CACHE.data_pointer] |
call clear_ide_cache |
pop edi |
pop ecx |
ret |
;----------------------------------------------------------------------------- |
calculate_for_cd: |
push eax |
mov ebx, eax |
116,7 → 195,7 |
sub eax, ebx |
dec ecx |
ret |
;----------------------------------------------------------------------------- |
clear_ide_cache: |
push eax |
shl ecx, 1 |
125,6 → 204,6 |
rep stosd |
pop eax |
ret |
;----------------------------------------------------------------------------- |
end_get_cache: |
popa |
/kernel/branches/kolibri-process/detect/sear_par.inc |
---|
8,21 → 8,42 |
$Revision: 3742 $ |
search_partitions: |
push ecx |
; 1. Fill missing parameters in HD_DATA structures. |
mov eax, [hd_address_table] |
mov [hd0_data.hdbase], eax ;0x1f0 |
xor eax, eax |
mov edx, IDE_controller_1 |
mov ax, [edx + IDE_DATA.BAR0_val] |
mov [hd0_data.hdbase], eax |
mov [hd1_data.hdbase], eax |
mov eax, [hd_address_table+16] |
mov ax, [edx + IDE_DATA.BAR2_val] |
mov [hd2_data.hdbase], eax |
mov [hd3_data.hdbase], eax |
mov edx, IDE_controller_2 |
mov ax, [edx + IDE_DATA.BAR0_val] |
mov [hd4_data.hdbase], eax |
mov [hd5_data.hdbase], eax |
mov ax, [edx + IDE_DATA.BAR2_val] |
mov [hd6_data.hdbase], eax |
mov [hd7_data.hdbase], eax |
mov edx, IDE_controller_3 |
mov ax, [edx + IDE_DATA.BAR0_val] |
mov [hd8_data.hdbase], eax |
mov [hd9_data.hdbase], eax |
mov ax, [edx + IDE_DATA.BAR2_val] |
mov [hd10_data.hdbase], eax |
mov [hd11_data.hdbase], eax |
; 2. Notify the system about /hd* disks. |
; For every existing disk, call ide_disk_add with correct parameters. |
; Generate name "hdN" on the stack; this is 4 bytes including terminating zero. |
;----------------------------------------------------------------------------- |
; 2a. /hd0: exists if mask 0x40 in [DRIVE_DATA+1] is set, |
; data: hd0_data, |
; number of partitions: [DRIVE_DATA+2] |
test [DRIVE_DATA+1], byte 0x40 |
jz @f |
push 'hd0' |
mov eax, esp ; name |
mov edx, hd0_data |
29,6 → 50,7 |
call ide_disk_add |
mov [DRIVE_DATA+2], al |
pop ecx ; restore the stack |
;----------------------------------------------------------------------------- |
@@: |
; 2b. /hd1: exists if mask 0x10 in [DRIVE_DATA+1] is set, |
; data: hd1_data, |
35,6 → 57,7 |
; number of partitions: [DRIVE_DATA+3] |
test [DRIVE_DATA+1], byte 0x10 |
jz @f |
push 'hd1' |
mov eax, esp |
mov edx, hd1_data |
41,6 → 64,7 |
call ide_disk_add |
mov [DRIVE_DATA+3], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 2c. /hd2: exists if mask 4 in [DRIVE_DATA+1] is set, |
; data: hd2_data, |
47,6 → 71,7 |
; number of partitions: [DRIVE_DATA+4] |
test [DRIVE_DATA+1], byte 4 |
jz @f |
push 'hd2' |
mov eax, esp |
mov edx, hd2_data |
53,6 → 78,7 |
call ide_disk_add |
mov [DRIVE_DATA+4], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 2d. /hd3: exists if mask 1 in [DRIVE_DATA+1] is set, |
; data: hd3_data, |
59,6 → 85,7 |
; number of partitions: [DRIVE_DATA+5] |
test [DRIVE_DATA+1], byte 1 |
jz @f |
push 'hd3' |
mov eax, esp |
mov edx, hd3_data |
65,7 → 92,120 |
call ide_disk_add |
mov [DRIVE_DATA+5], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 2e. /hd4: exists if mask 0x40 in [DRIVE_DATA+6] is set, |
; data: hd4_data, |
; number of partitions: [DRIVE_DATA+7] |
test [DRIVE_DATA+6], byte 0x40 |
jz @f |
push 'hd4' |
mov eax, esp ; name |
mov edx, hd4_data |
call ide_disk_add |
mov [DRIVE_DATA+7], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 2f. /hd5: exists if mask 0x10 in [DRIVE_DATA+6] is set, |
; data: hd5_data, |
; number of partitions: [DRIVE_DATA+8] |
test [DRIVE_DATA+6], byte 0x10 |
jz @f |
push 'hd5' |
mov eax, esp |
mov edx, hd5_data |
call ide_disk_add |
mov [DRIVE_DATA+8], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 2g. /hd6: exists if mask 4 in [DRIVE_DATA+6] is set, |
; data: hd6_data, |
; number of partitions: [DRIVE_DATA+9] |
test [DRIVE_DATA+6], byte 4 |
jz @f |
push 'hd6' |
mov eax, esp |
mov edx, hd6_data |
call ide_disk_add |
mov [DRIVE_DATA+9], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 2h. /hd7: exists if mask 1 in [DRIVE_DATA+6] is set, |
; data: hd7_data, |
; number of partitions: [DRIVE_DATA+10] |
test [DRIVE_DATA+6], byte 1 |
jz @f |
push 'hd7' |
mov eax, esp |
mov edx, hd7_data |
call ide_disk_add |
mov [DRIVE_DATA+10], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 2i. /hd8: exists if mask 0x40 in [DRIVE_DATA+11] is set, |
; data: hd8_data, |
; number of partitions: [DRIVE_DATA+12] |
test [DRIVE_DATA+11], byte 0x40 |
jz @f |
push 'hd8' |
mov eax, esp ; name |
mov edx, hd8_data |
call ide_disk_add |
mov [DRIVE_DATA+12], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 2j. /hd9: exists if mask 0x10 in [DRIVE_DATA+11] is set, |
; data: hd9_data, |
; number of partitions: [DRIVE_DATA+13] |
test [DRIVE_DATA+11], byte 0x10 |
jz @f |
push 'hd9' |
mov eax, esp |
mov edx, hd9_data |
call ide_disk_add |
mov [DRIVE_DATA+13], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 2k. /hd10: exists if mask 4 in [DRIVE_DATA+11] is set, |
; data: hd10_data, |
; number of partitions: [DRIVE_DATA+14] |
test [DRIVE_DATA+14], byte 4 |
jz @f |
push 'hd10' |
mov eax, esp |
mov edx, hd10_data |
call ide_disk_add |
mov [DRIVE_DATA+9], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 2l. /hd11: exists if mask 1 in [DRIVE_DATA+11] is set, |
; data: hd11_data, |
; number of partitions: [DRIVE_DATA+15] |
test [DRIVE_DATA+11], byte 1 |
jz @f |
push 'hd11' |
mov eax, esp |
mov edx, hd11_data |
call ide_disk_add |
mov [DRIVE_DATA+15], al |
pop ecx |
;----------------------------------------------------------------------------- |
@@: |
; 3. Notify the system about /bd* disks. |
; 3a. Check whether there are BIOS disks. If no, skip step 3. |
xor esi, esi |
115,10 → 255,10 |
pop ecx ecx ; restore stack after name |
.nobd: |
jmp end_search_partitions |
;----------------------------------------------------------------------------- |
; Helper procedure for search_partitions, adds one IDE disk. |
; For compatibility, number of partitions for IDE disks is kept in a separate variable, |
; so the procedure returns number of partitions. |
; For compatibility, number of partitions for IDE disks is kept in a separate |
; variable, so the procedure returns number of partitions. |
; eax -> name, edx -> disk data |
proc ide_disk_add |
stdcall disk_add, ide_callbacks, eax, edx, 0 |
134,6 → 274,6 |
@@: |
ret |
endp |
;----------------------------------------------------------------------------- |
end_search_partitions: |
pop ecx |
/kernel/branches/kolibri-process/encoding.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; fetch the UTF-8 character in string+offs to char |
; common part for all encodings: translate pseudographics |
; Pseudographics for the boot screen: |
/kernel/branches/kolibri-process/fs/ext2/blocks.inc |
---|
2,11 → 2,14 |
;; ;; |
;; Contains ext2 block handling code. ;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under the terms of the new BSD license. ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4891 $ |
;--------------------------------------------------------------------- |
; Write ext2 block from memory to disk. |
; Input: eax = i_block (block number in ext2 terms); |
/kernel/branches/kolibri-process/fs/ext2/ext2.asm |
---|
2,11 → 2,14 |
;; ;; |
;; Contains ext2 initialization, plus syscall handling code. ;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under the terms of the new BSD license. ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4891 $ |
include 'ext2.inc' |
include 'blocks.inc' |
include 'inode.inc' |
/kernel/branches/kolibri-process/fs/ext2/ext2.inc |
---|
2,11 → 2,14 |
;; ;; |
;; Contains ext2 structures, and macros. ;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under the terms of the new BSD license. ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4891 $ |
; Future jobs for driver, in order of preference: |
; * clean up existing extents support. |
; * add b-tree directories support. |
/kernel/branches/kolibri-process/fs/ext2/inode.inc |
---|
2,11 → 2,14 |
;; ;; |
;; Contains ext2 inode handling code. ;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under the terms of the new BSD license. ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4891 $ |
;--------------------------------------------------------------------- |
; Receives block number from extent-based inode. |
; Input: ecx = number of block in inode |
/kernel/branches/kolibri-process/fs/ext2/resource.inc |
---|
2,11 → 2,14 |
;; ;; |
;; Contains common resource allocation + freeing code. ;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under the terms of the new BSD license. ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4891 $ |
;--------------------------------------------------------------------- |
; Frees a resource (block/inode). |
; Input: eax = resource ID. |
/kernel/branches/kolibri-process/fs/fs_lfn.inc |
---|
43,6 → 43,30 |
db 3,'cd3' |
dd fs_OnCd3 |
dd fs_NextCd |
db 3,'cd4' |
dd fs_OnCd4 |
dd fs_NextCd |
db 3,'cd5' |
dd fs_OnCd5 |
dd fs_NextCd |
db 3,'cd6' |
dd fs_OnCd6 |
dd fs_NextCd |
db 3,'cd7' |
dd fs_OnCd7 |
dd fs_NextCd |
db 3,'cd8' |
dd fs_OnCd8 |
dd fs_NextCd |
db 3,'cd9' |
dd fs_OnCd9 |
dd fs_NextCd |
db 4,'cd10' |
dd fs_OnCd10 |
dd fs_NextCd |
db 4,'cd11' |
dd fs_OnCd11 |
dd fs_NextCd |
;*********************************************** |
db 0 |
57,6 → 81,22 |
db 'cd2',0 |
dd fs_HasCd3 |
db 'cd3',0 |
dd fs_HasCd4 |
db 'cd4',0 |
dd fs_HasCd5 |
db 'cd5',0 |
dd fs_HasCd6 |
db 'cd6',0 |
dd fs_HasCd7 |
db 'cd7',0 |
dd fs_HasCd8 |
db 'cd8',0 |
dd fs_HasCd9 |
db 'cd9',0 |
dd fs_HasCd10 |
db 'cd10',0 |
dd fs_HasCd11 |
db 'cd11',0 |
;********************************************** |
dd 0 |
endg |
149,8 → 189,8 |
cmp dword [ebx], 1 |
jnz .access_denied |
xor eax, eax |
mov ebp, [ebx+12] ;количество блоков для считывания |
mov edx, [ebx+16] ;куда записывать рузельтат |
mov ebp, [ebx+12] ;the number of blocks to read |
mov edx, [ebx+16] ;where to write the result |
; add edx, std_application_base_address |
push dword [ebx+4] ; first block |
mov ebx, [ebx+8] ; flags |
404,8 → 444,7 |
fs_NotImplemented: |
mov eax, 2 |
ret |
;******************************************************* |
;----------------------------------------------------------------------------- |
fs_OnCd0: |
call reserve_cd |
mov [ChannelNumber], 1 |
413,6 → 452,7 |
push 6 |
push 1 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd1: |
call reserve_cd |
mov [ChannelNumber], 1 |
420,6 → 460,7 |
push 4 |
push 2 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd2: |
call reserve_cd |
mov [ChannelNumber], 2 |
427,6 → 468,7 |
push 2 |
push 3 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd3: |
call reserve_cd |
mov [ChannelNumber], 2 |
433,16 → 475,89 |
mov [DiskNumber], 1 |
push 0 |
push 4 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd4: |
call reserve_cd |
mov [ChannelNumber], 1 |
mov [DiskNumber], 0 |
push 6 |
push 5 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd5: |
call reserve_cd |
mov [ChannelNumber], 1 |
mov [DiskNumber], 1 |
push 4 |
push 6 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd6: |
call reserve_cd |
mov [ChannelNumber], 2 |
mov [DiskNumber], 0 |
push 2 |
push 7 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd7: |
call reserve_cd |
mov [ChannelNumber], 2 |
mov [DiskNumber], 1 |
push 0 |
push 8 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd8: |
call reserve_cd |
mov [ChannelNumber], 1 |
mov [DiskNumber], 0 |
push 6 |
push 9 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd9: |
call reserve_cd |
mov [ChannelNumber], 1 |
mov [DiskNumber], 1 |
push 4 |
push 10 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd10: |
call reserve_cd |
mov [ChannelNumber], 2 |
mov [DiskNumber], 0 |
push 2 |
push 11 |
jmp fs_OnCd |
;----------------------------------------------------------------------------- |
fs_OnCd11: |
call reserve_cd |
mov [ChannelNumber], 2 |
mov [DiskNumber], 1 |
push 0 |
push 12 |
;----------------------------------------------------------------------------- |
fs_OnCd: |
call reserve_cd_channel |
pop eax |
mov [cdpos], eax |
call reserve_cd_channel |
pop eax |
cmp ecx, 0x100 |
jae .nf |
push ecx ebx |
mov cl, al |
mov bl, [DRIVE_DATA+1] |
push eax |
mov eax, [cdpos] |
dec eax |
shr eax, 2 |
lea eax, [eax*5] |
mov bl, [eax+DRIVE_DATA+1] |
pop eax |
shr bl, cl |
test bl, 2 |
pop ebx ecx |
472,7 → 587,7 |
and [cd_status], 0 |
mov dword [image_of_eax], 2 ; not implemented |
ret |
;----------------------------------------------------------------------------- |
fs_CdServices: |
dd fs_CdRead |
dd fs_CdReadFolder |
485,32 → 600,74 |
dd fs_NotImplemented |
dd fs_NotImplemented |
fs_NumCdServices = ($ - fs_CdServices)/4 |
;******************************************************* |
;----------------------------------------------------------------------------- |
fs_HasCd0: |
test byte [DRIVE_DATA+1], 10000000b |
setnz al |
ret |
;-------------------------------------- |
fs_HasCd1: |
test byte [DRIVE_DATA+1], 00100000b |
setnz al |
ret |
;-------------------------------------- |
fs_HasCd2: |
test byte [DRIVE_DATA+1], 00001000b |
setnz al |
ret |
;-------------------------------------- |
fs_HasCd3: |
test byte [DRIVE_DATA+1], 00000010b |
setnz al |
ret |
;******************************************************* |
;-------------------------------------- |
fs_HasCd4: |
test byte [DRIVE_DATA+6], 10000000b |
setnz al |
ret |
;-------------------------------------- |
fs_HasCd5: |
test byte [DRIVE_DATA+6], 00100000b |
setnz al |
ret |
;-------------------------------------- |
fs_HasCd6: |
test byte [DRIVE_DATA+6], 00001000b |
setnz al |
ret |
;-------------------------------------- |
fs_HasCd7: |
test byte [DRIVE_DATA+6], 00000010b |
setnz al |
ret |
;-------------------------------------- |
fs_HasCd8: |
test byte [DRIVE_DATA+11], 10000000b |
setnz al |
ret |
;-------------------------------------- |
fs_HasCd9: |
test byte [DRIVE_DATA+11], 00100000b |
setnz al |
ret |
;-------------------------------------- |
fs_HasCd10: |
test byte [DRIVE_DATA+11], 00001000b |
setnz al |
ret |
;-------------------------------------- |
fs_HasCd11: |
test byte [DRIVE_DATA+11], 00000010b |
setnz al |
ret |
;----------------------------------------------------------------------------- |
; |
; fs_NextXXX functions: |
; in: eax = partition number, from which start to scan |
; out: CF=1 => no more partitions |
; CF=0 => eax=next partition number |
;******************************************************* |
; |
;----------------------------------------------------------------------------- |
fs_NextCd: |
; we always have /cdX/1 |
test eax, eax |
520,8 → 677,6 |
clc |
@@: |
ret |
;******************************************************* |
;----------------------------------------------------------------------------- |
process_replace_file_name: |
; in |
/kernel/branches/kolibri-process/fs/iso9660.inc |
---|
5,20 → 5,17 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 3742 $ |
$Revision: 4700 $ |
;----------------------------------------------------------------------------- |
uglobal |
cd_current_pointer_of_input dd 0 |
cd_current_pointer_of_input_2 dd 0 |
cd_mem_location dd 0 |
cd_counter_block dd 0 |
IDE_Channel_1 db 0 |
IDE_Channel_2 db 0 |
endg |
;----------------------------------------------------------------------------- |
reserve_cd: |
cli |
cmp [cd_status], 0 |
je reserve_ok2 |
26,9 → 23,8 |
sti |
call change_task |
jmp reserve_cd |
;----------------------------------------------------------------------------- |
reserve_ok2: |
push eax |
mov eax, [CURRENT_TASK] |
shl eax, 5 |
37,48 → 33,105 |
pop eax |
sti |
ret |
;----------------------------------------------------------------------------- |
reserve_cd_channel: |
pushad |
mov eax, [cdpos] |
dec eax |
shr eax, 2 |
reserve_cd_channel: |
test eax, eax |
jnz .1 |
cmp [ChannelNumber], 1 |
jne .IDE_Channel_2 |
.IDE_Channel_1: |
pushad |
jne @f |
mov ecx, ide_channel1_mutex |
jmp .mutex_lock |
;-------------------------------------- |
@@: |
mov ecx, ide_channel2_mutex |
jmp .mutex_lock |
;-------------------------------------- |
.1: |
dec eax |
jnz .2 |
cmp [ChannelNumber], 1 |
jne @f |
mov ecx, ide_channel3_mutex |
jmp .mutex_lock |
;-------------------------------------- |
@@: |
mov ecx, ide_channel4_mutex |
jmp .mutex_lock |
;-------------------------------------- |
.2: |
cmp [ChannelNumber], 1 |
jne @f |
mov ecx, ide_channel5_mutex |
jmp .mutex_lock |
;-------------------------------------- |
@@: |
mov ecx, ide_channel6_mutex |
.mutex_lock: |
call mutex_lock |
mov [IDE_Channel_1], 1 |
popad |
ret |
.IDE_Channel_2: |
;----------------------------------------------------------------------------- |
free_cd_channel: |
pushad |
mov ecx, ide_channel2_mutex |
call mutex_lock |
mov [IDE_Channel_2], 1 |
popad |
ret |
mov eax, [cdpos] |
dec eax |
shr eax, 2 |
free_cd_channel: |
test eax, eax |
jnz .1 |
cmp [ChannelNumber], 1 |
jne .IDE_Channel_2 |
.IDE_Channel_1: |
mov [IDE_Channel_1], 0 |
pushad |
jne @f |
mov ecx, ide_channel1_mutex |
call mutex_unlock |
popad |
ret |
.IDE_Channel_2: |
mov [IDE_Channel_2], 0 |
pushad |
jmp .mutex_unlock |
;-------------------------------------- |
@@: |
mov ecx, ide_channel2_mutex |
jmp .mutex_unlock |
;-------------------------------------- |
.1: |
dec eax |
jnz .2 |
cmp [ChannelNumber], 1 |
jne @f |
mov ecx, ide_channel3_mutex |
jmp .mutex_unlock |
;-------------------------------------- |
@@: |
mov ecx, ide_channel4_mutex |
jmp .mutex_unlock |
;-------------------------------------- |
.2: |
cmp [ChannelNumber], 1 |
jne @f |
mov ecx, ide_channel5_mutex |
jmp .mutex_unlock |
;-------------------------------------- |
@@: |
mov ecx, ide_channel6_mutex |
.mutex_unlock: |
call mutex_unlock |
popad |
ret |
;----------------------------------------------------------------------------- |
uglobal |
cd_status dd 0 |
endg |
;---------------------------------------------------------------- |
;----------------------------------------------------------------------------- |
; |
; fs_CdRead - LFN variant for reading CD disk |
; |
91,91 → 144,114 |
; ret ebx = bytes read or 0xffffffff file not found |
; eax = 0 ok read or other = errormsg |
; |
;-------------------------------------------------------------- |
;----------------------------------------------------------------------------- |
fs_CdRead: |
push edi |
cmp byte [esi], 0 |
jnz @f |
;-------------------------------------- |
.noaccess: |
pop edi |
;-------------------------------------- |
.noaccess_2: |
or ebx, -1 |
mov eax, ERROR_ACCESS_DENIED |
ret |
;-------------------------------------- |
.noaccess_3: |
pop eax edx ecx edi |
jmp .noaccess_2 |
;-------------------------------------- |
@@: |
call cd_find_lfn |
jnc .found |
pop edi |
cmp [DevErrorCode], 0 |
jne .noaccess_2 |
or ebx, -1 |
mov eax, ERROR_FILE_NOT_FOUND |
ret |
;-------------------------------------- |
.found: |
mov edi, [cd_current_pointer_of_input] |
test byte [edi+25], 10b; do not allow read directories |
jnz .noaccess |
test ebx, ebx |
jz .l1 |
cmp dword [ebx+4], 0 |
jz @f |
xor ebx, ebx |
;-------------------------------------- |
.reteof: |
mov eax, 6; end of file |
pop edi |
ret |
;-------------------------------------- |
@@: |
mov ebx, [ebx] |
;-------------------------------------- |
.l1: |
push ecx edx |
push 0 |
mov eax, [edi+10] ; реальный размер файловой секции |
mov eax, [edi+10] ; real size of the file section |
sub eax, ebx |
jb .eof |
cmp eax, ecx |
jae @f |
mov ecx, eax |
mov byte [esp], 6 |
;-------------------------------------- |
@@: |
mov eax, [edi+2] |
mov [CDSectorAddress], eax |
;-------------------------------------- |
; now eax=cluster, ebx=position, ecx=count, edx=buffer for data |
.new_sector: |
test ecx, ecx |
jz .done |
sub ebx, 2048 |
jae .next |
add ebx, 2048 |
jnz .incomplete_sector |
cmp ecx, 2048 |
jb .incomplete_sector |
; we may read and memmove complete sector |
mov [CDDataBuf_pointer], edx |
call ReadCDWRetr; читаем сектор файла |
call ReadCDWRetr ; read sector of file |
cmp [DevErrorCode], 0 |
jne .noaccess_3 |
add edx, 2048 |
sub ecx, 2048 |
;-------------------------------------- |
.next: |
inc dword [CDSectorAddress] |
jmp .new_sector |
;-------------------------------------- |
.incomplete_sector: |
; we must read and memmove incomplete sector |
mov [CDDataBuf_pointer], CDDataBuf |
call ReadCDWRetr; читаем сектор файла |
call ReadCDWRetr ; read sector of file |
cmp [DevErrorCode], 0 |
jne .noaccess_3 |
push ecx |
add ecx, ebx |
cmp ecx, 2048 |
jbe @f |
mov ecx, 2048 |
;-------------------------------------- |
@@: |
sub ecx, ebx |
push edi esi ecx |
189,19 → 265,19 |
pop ecx |
xor ebx, ebx |
jmp .next |
;-------------------------------------- |
.done: |
mov ebx, edx |
pop eax edx ecx edi |
sub ebx, edx |
ret |
;-------------------------------------- |
.eof: |
mov ebx, edx |
pop eax edx ecx |
sub ebx, edx |
jmp .reteof |
;---------------------------------------------------------------- |
;----------------------------------------------------------------------------- |
; |
; fs_CdReadFolder - LFN variant for reading CD disk folder |
; |
215,30 → 291,37 |
; ret ebx = blocks read or 0xffffffff folder not found |
; eax = 0 ok read or other = errormsg |
; |
;-------------------------------------------------------------- |
;----------------------------------------------------------------------------- |
fs_CdReadFolder: |
push edi |
call cd_find_lfn |
jnc .found |
pop edi |
cmp [DevErrorCode], 0 |
jne .noaccess_1 |
or ebx, -1 |
mov eax, ERROR_FILE_NOT_FOUND |
ret |
;-------------------------------------- |
.found: |
mov edi, [cd_current_pointer_of_input] |
test byte [edi+25], 10b ; do not allow read directories |
jnz .found_dir |
pop edi |
;-------------------------------------- |
.noaccess_1: |
or ebx, -1 |
mov eax, ERROR_ACCESS_DENIED |
ret |
;-------------------------------------- |
.found_dir: |
mov eax, [edi+2] ; eax=cluster |
mov [CDSectorAddress], eax |
mov eax, [edi+10] ; размер директрории |
mov eax, [edi+10] ; directory size |
;-------------------------------------- |
.doit: |
; init header |
push eax ecx |
250,21 → 333,23 |
mov byte [edx], 1 ; version |
mov [cd_mem_location], edx |
add [cd_mem_location], 32 |
; начинаем переброску БДВК в УСВК |
;.mainloop: |
mov [cd_counter_block], dword 0 |
dec dword [CDSectorAddress] |
push ecx |
;-------------------------------------- |
.read_to_buffer: |
inc dword [CDSectorAddress] |
mov [CDDataBuf_pointer], CDDataBuf |
call ReadCDWRetr ; читаем сектор директории |
call ReadCDWRetr ; read sector of directory |
cmp [DevErrorCode], 0 |
jne .noaccess_1 |
call .get_names_from_buffer |
sub eax, 2048 |
; директория закончилась? |
; directory is over? |
ja .read_to_buffer |
mov edi, [cd_counter_block] |
mov [edx+8], edi |
mov edi, [ebx] |
272,24 → 357,30 |
xor eax, eax |
dec ecx |
js @f |
mov al, ERROR_END_OF_FILE |
;-------------------------------------- |
@@: |
pop ecx edi |
mov ebx, [edx+4] |
ret |
;-------------------------------------- |
.get_names_from_buffer: |
mov [cd_current_pointer_of_input_2], CDDataBuf |
push eax esi edi edx |
;-------------------------------------- |
.get_names_from_buffer_1: |
call cd_get_name |
jc .end_buffer |
inc dword [cd_counter_block] |
mov eax, [cd_counter_block] |
cmp [ebx], eax |
jae .get_names_from_buffer_1 |
test ecx, ecx |
jz .get_names_from_buffer_1 |
mov edi, [cd_counter_block] |
mov [edx+4], edi |
dec ecx |
298,10 → 389,11 |
add edi, 40 |
test dword [ebx+4], 1; 0=ANSI, 1=UNICODE |
jnz .unicode |
; jmp .unicode |
;-------------------------------------- |
.ansi: |
cmp [cd_counter_block], 2 |
jbe .ansi_parent_directory |
cld |
lodsw |
xchg ah, al |
308,163 → 400,178 |
call uni2ansi_char |
cld |
stosb |
; проверка конца файла |
; check end of file |
mov ax, [esi] |
cmp ax, word 3B00h; сепаратор конца файла ';' |
cmp ax, word 3B00h ; separator end of file ';' |
je .cd_get_parameters_of_file_1 |
; проверка для файлов не заканчивающихся сепаратором |
; check for files not ending with separator |
movzx eax, byte [ebp-33] |
add eax, ebp |
sub eax, 34 |
cmp esi, eax |
je .cd_get_parameters_of_file_1 |
; проверка конца папки |
; check the end of the directory |
movzx eax, byte [ebp-1] |
add eax, ebp |
cmp esi, eax |
jb .ansi |
;-------------------------------------- |
.cd_get_parameters_of_file_1: |
mov [edi], byte 0 |
call cd_get_parameters_of_file |
add [cd_mem_location], 304 |
jmp .get_names_from_buffer_1 |
;-------------------------------------- |
.ansi_parent_directory: |
cmp [cd_counter_block], 2 |
je @f |
mov [edi], byte '.' |
inc edi |
jmp .cd_get_parameters_of_file_1 |
;-------------------------------------- |
@@: |
mov [edi], word '..' |
add edi, 2 |
jmp .cd_get_parameters_of_file_1 |
;-------------------------------------- |
.unicode: |
cmp [cd_counter_block], 2 |
jbe .unicode_parent_directory |
cld |
movsw |
; проверка конца файла |
; check end of file |
mov ax, [esi] |
cmp ax, word 3B00h; сепаратор конца файла ';' |
cmp ax, word 3B00h; separator end of file ';' |
je .cd_get_parameters_of_file_2 |
; проверка для файлов не заканчивающихся сепаратором |
; check for files not ending with separator |
movzx eax, byte [ebp-33] |
add eax, ebp |
sub eax, 34 |
cmp esi, eax |
je .cd_get_parameters_of_file_2 |
; проверка конца папки |
; check the end of the directory |
movzx eax, byte [ebp-1] |
add eax, ebp |
cmp esi, eax |
jb .unicode |
;-------------------------------------- |
.cd_get_parameters_of_file_2: |
mov [edi], word 0 |
call cd_get_parameters_of_file |
add [cd_mem_location], 560 |
jmp .get_names_from_buffer_1 |
;-------------------------------------- |
.unicode_parent_directory: |
cmp [cd_counter_block], 2 |
je @f |
mov [edi], word 2E00h; '.' |
add edi, 2 |
jmp .cd_get_parameters_of_file_2 |
;-------------------------------------- |
@@: |
mov [edi], dword 2E002E00h; '..' |
add edi, 4 |
jmp .cd_get_parameters_of_file_2 |
;-------------------------------------- |
.end_buffer: |
pop edx edi esi eax |
ret |
;----------------------------------------------------------------------------- |
cd_get_parameters_of_file: |
mov edi, [cd_mem_location] |
cd_get_parameters_of_file_1: |
; получаем атрибуты файла |
; get file attributes |
xor eax, eax |
; файл не архивировался |
; file is not archived |
inc eax |
shl eax, 1 |
; это каталог? |
; is a directory? |
test [ebp-8], byte 2 |
jz .file |
inc eax |
;-------------------------------------- |
.file: |
; метка тома не как в FAT, в этом виде отсутсвует |
; файл не является системным |
; not as a volume label in the FAT, in this form not available |
; file is not a system |
shl eax, 3 |
; файл является скрытым? (атрибут существование) |
; file is hidden? (attribute of existence) |
test [ebp-8], byte 1 |
jz .hidden |
inc eax |
;-------------------------------------- |
.hidden: |
shl eax, 1 |
; файл всегда только для чтения, так как это CD |
; file is always read-only, as this CD |
inc eax |
mov [edi], eax |
; получаем время для файла |
;час |
; get the time to file |
; hour |
movzx eax, byte [ebp-12] |
shl eax, 8 |
;минута |
; minute |
mov al, [ebp-11] |
shl eax, 8 |
;секунда |
; second |
mov al, [ebp-10] |
;время создания файла |
; file creation time |
mov [edi+8], eax |
;время последнего доступа |
; last access time |
mov [edi+16], eax |
;время последней записи |
; last write time |
mov [edi+24], eax |
; получаем дату для файла |
;год |
; get date for file |
; year |
movzx eax, byte [ebp-15] |
add eax, 1900 |
shl eax, 8 |
;месяц |
; month |
mov al, [ebp-14] |
shl eax, 8 |
;день |
; day |
mov al, [ebp-13] |
;дата создания файла |
; file creation date |
mov [edi+12], eax |
;время последнего доступа |
; last access date |
mov [edi+20], eax |
;время последней записи |
; last write date |
mov [edi+28], eax |
; получаем тип данных имени |
; get the data type of name |
xor eax, eax |
test dword [ebx+4], 1; 0=ANSI, 1=UNICODE |
jnz .unicode_1 |
mov [edi+4], eax |
jmp @f |
;-------------------------------------- |
.unicode_1: |
inc eax |
mov [edi+4], eax |
;-------------------------------------- |
@@: |
; получаем размер файла в байтах |
; get the file size in bytes |
xor eax, eax |
mov [edi+32+4], eax |
mov eax, [ebp-23] |
mov [edi+32], eax |
ret |
;---------------------------------------------------------------- |
;----------------------------------------------------------------------------- |
; |
; fs_CdGetFileInfo - LFN variant for CD |
; get file/directory attributes structure |
; |
;---------------------------------------------------------------- |
;----------------------------------------------------------------------------- |
fs_CdGetFileInfo: |
cmp byte [esi], 0 |
jnz @f |
mov eax, 2 |
ret |
;-------------------------------------- |
@@: |
push edi |
call cd_find_lfn |
471,16 → 578,20 |
pushfd |
cmp [DevErrorCode], 0 |
jz @f |
popfd |
pop edi |
mov eax, 11 |
ret |
;-------------------------------------- |
@@: |
popfd |
jnc @f |
pop edi |
mov eax, ERROR_FILE_NOT_FOUND |
ret |
;-------------------------------------- |
@@: |
mov edi, edx |
493,8 → 604,7 |
pop edi |
xor eax, eax |
ret |
;---------------------------------------------------------------- |
;----------------------------------------------------------------------------- |
cd_find_lfn: |
mov [cd_appl_data], 0 |
; in: esi+ebp -> name |
501,14 → 611,13 |
; out: CF=1 - file not found |
; else CF=0 and [cd_current_pointer_of_input] direntry |
push eax esi |
; 16 сектор начало набора дескрипторов томов |
; Sector 16 - start set of volume descriptors |
call WaitUnitReady |
cmp [DevErrorCode], 0 |
jne .access_denied |
call prevent_medium_removal |
; тестовое чтение |
; testing of reading |
mov [CDSectorAddress], dword 16 |
mov [CDDataBuf_pointer], CDDataBuf |
call ReadCDWRetr;_1 |
515,10 → 624,11 |
cmp [DevErrorCode], 0 |
jne .access_denied |
; вычисление последней сессии |
; calculation of the last session |
call WaitUnitReady |
cmp [DevErrorCode], 0 |
jne .access_denied |
call Read_TOC |
mov ah, [CDDataBuf+4+4] |
mov al, [CDDataBuf+4+5] |
529,7 → 639,7 |
mov [CDSectorAddress], eax |
; mov [CDSectorAddress],dword 15 |
mov [CDDataBuf_pointer], CDDataBuf |
;-------------------------------------- |
.start: |
inc dword [CDSectorAddress] |
call ReadCDWRetr;_1 |
537,111 → 647,128 |
jne .access_denied |
.start_check: |
; проверка на вшивость |
; checking for "lice" |
cmp [CDDataBuf+1], dword 'CD00' |
jne .access_denied |
cmp [CDDataBuf+5], byte '1' |
jne .access_denied |
; сектор является терминатором набор дескрипторов томов? |
; sector is the terminator of set of descriptors volumes? |
cmp [CDDataBuf], byte 0xff |
je .access_denied |
; сектор является дополнительным и улучшенным дескриптором тома? |
; sector is an additional and improved descriptor of volume? |
cmp [CDDataBuf], byte 0x2 |
jne .start |
; сектор является дополнительным дескриптором тома? |
; sector is an additional descriptor of volume? |
cmp [CDDataBuf+6], byte 0x1 |
jne .start |
; параметры root директрории |
mov eax, [CDDataBuf+0x9c+2]; начало root директрории |
; parameters of root directory |
mov eax, [CDDataBuf+0x9c+2]; start of root directory |
mov [CDSectorAddress], eax |
mov eax, [CDDataBuf+0x9c+10]; размер root директрории |
mov eax, [CDDataBuf+0x9c+10]; size of root directory |
cmp byte [esi], 0 |
jnz @f |
mov [cd_current_pointer_of_input], CDDataBuf+0x9c |
jmp .done |
;-------------------------------------- |
@@: |
; начинаем поиск |
; start the search |
.mainloop: |
dec dword [CDSectorAddress] |
;-------------------------------------- |
.read_to_buffer: |
inc dword [CDSectorAddress] |
mov [CDDataBuf_pointer], CDDataBuf |
call ReadCDWRetr ; читаем сектор директории |
call ReadCDWRetr ; read sector of directory |
cmp [DevErrorCode], 0 |
jne .access_denied |
push ebp |
call cd_find_name_in_buffer |
pop ebp |
jnc .found |
sub eax, 2048 |
; директория закончилась? |
; directory is over? |
cmp eax, 0 |
ja .read_to_buffer |
; нет искомого элемента цепочки |
; desired element of chain is not found |
.access_denied: |
pop esi eax |
mov [cd_appl_data], 1 |
stc |
ret |
; искомый элемент цепочки найден |
;-------------------------------------- |
; desired element of chain found |
.found: |
; конец пути файла |
; the end of the file path |
cmp byte [esi-1], 0 |
jz .done |
.nested: |
mov eax, [cd_current_pointer_of_input] |
push dword [eax+2] |
pop dword [CDSectorAddress] ; начало директории |
mov eax, [eax+2+8]; размер директории |
pop dword [CDSectorAddress] ; beginning of the directory |
mov eax, [eax+2+8] ; size of directory |
jmp .mainloop |
; указатель файла найден |
;-------------------------------------- |
; file pointer found |
.done: |
test ebp, ebp |
jz @f |
mov esi, ebp |
xor ebp, ebp |
jmp .nested |
;-------------------------------------- |
@@: |
pop esi eax |
mov [cd_appl_data], 1 |
clc |
ret |
;----------------------------------------------------------------------------- |
cd_find_name_in_buffer: |
mov [cd_current_pointer_of_input_2], CDDataBuf |
;-------------------------------------- |
.start: |
call cd_get_name |
jc .not_found |
call cd_compare_name |
jc .start |
;-------------------------------------- |
.found: |
clc |
ret |
;-------------------------------------- |
.not_found: |
stc |
ret |
;----------------------------------------------------------------------------- |
cd_get_name: |
push eax |
mov ebp, [cd_current_pointer_of_input_2] |
mov [cd_current_pointer_of_input], ebp |
mov eax, [ebp] |
test eax, eax ; входы закончились? |
test eax, eax ; entry's is over? |
jz .next_sector |
cmp ebp, CDDataBuf+2048 ; буфер закончился? |
cmp ebp, CDDataBuf+2048 ; buffer is over? |
jae .next_sector |
movzx eax, byte [ebp] |
add [cd_current_pointer_of_input_2], eax; следующий вход каталога |
add ebp, 33; указатель установлен на начало имени |
add [cd_current_pointer_of_input_2], eax ; next entry of directory |
add ebp, 33; pointer is set to the beginning of the name |
pop eax |
clc |
ret |
;-------------------------------------- |
.next_sector: |
pop eax |
stc |
ret |
;----------------------------------------------------------------------------- |
cd_compare_name: |
; compares ASCIIZ-names, case-insensitive (cp866 encoding) |
; in: esi->name, ebp->name |
650,6 → 777,7 |
; destroys eax |
push esi eax edi |
mov edi, ebp |
;-------------------------------------- |
.loop: |
cld |
lodsb |
666,31 → 794,37 |
sub edi, 2 |
scasw |
jne .name_not_coincide |
;-------------------------------------- |
.coincides: |
cmp [esi], byte '/'; разделитель пути, конец имени текущего элемента |
cmp [esi], byte '/' ; path separator is end of current element |
je .done |
cmp [esi], byte 0; разделитель пути, конец имени текущего элемента |
cmp [esi], byte 0 ; path separator end of name |
je .done |
jmp .loop |
;-------------------------------------- |
.name_not_coincide: |
pop edi eax esi |
stc |
ret |
;-------------------------------------- |
.done: |
; проверка конца файла |
cmp [edi], word 3B00h; сепаратор конца файла ';' |
; check end of file |
cmp [edi], word 3B00h; separator end of file ';' |
je .done_1 |
; проверка для файлов не заканчивающихся сепаратором |
; check for files not ending with separator |
movzx eax, byte [ebp-33] |
add eax, ebp |
sub eax, 34 |
cmp edi, eax |
je .done_1 |
; проверка конца папки |
; check the end of directory |
movzx eax, byte [ebp-1] |
add eax, ebp |
cmp edi, eax |
jne .name_not_coincide |
;-------------------------------------- |
.done_1: |
pop edi eax |
add esp, 4 |
697,7 → 831,7 |
inc esi |
clc |
ret |
;----------------------------------------------------------------------------- |
char_todown: |
; convert character to uppercase, using cp866 encoding |
; in: al=symbol |
704,24 → 838,30 |
; out: al=converted symbol |
cmp al, 'A' |
jb .ret |
cmp al, 'Z' |
jbe .az |
cmp al, 0x80 ; 'А' |
jb .ret |
cmp al, 0x90 ; 'Р' |
jb .rus1 |
cmp al, 0x9F ; 'Я' |
ja .ret |
; 0x90-0x9F -> 0xE0-0xEF |
add al, 0xE0-0x90 |
;-------------------------------------- |
.ret: |
ret |
;-------------------------------------- |
.rus1: |
; 0x80-0x8F -> 0xA0-0xAF |
.az: |
add al, 0x20 |
ret |
;----------------------------------------------------------------------------- |
uni2ansi_char: |
; convert UNICODE character in al to ANSI character in ax, using cp866 encoding |
; in: ax=UNICODE character |
728,32 → 868,44 |
; out: al=converted ANSI character |
cmp ax, 0x80 |
jb .ascii |
cmp ax, 0x401 |
jz .yo1 |
cmp ax, 0x451 |
jz .yo2 |
cmp ax, 0x410 |
jb .unk |
cmp ax, 0x440 |
jb .rus1 |
cmp ax, 0x450 |
jb .rus2 |
;-------------------------------------- |
.unk: |
mov al, '_' |
jmp .doit |
;-------------------------------------- |
.yo1: |
mov al, 0xF0 ; 'Ё' in cp866 |
jmp .doit |
;-------------------------------------- |
.yo2: |
mov al, 0xF1 ; 'ё' in cp866 |
jmp .doit |
;-------------------------------------- |
.rus1: |
; 0x410-0x43F -> 0x80-0xAF |
add al, 0x70 |
jmp .doit |
;-------------------------------------- |
.rus2: |
; 0x440-0x44F -> 0xE0-0xEF |
add al, 0xA0 |
;-------------------------------------- |
.ascii: |
.doit: |
ret |
;----------------------------------------------------------------------------- |
/kernel/branches/kolibri-process/fs/xfs.asm |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
include 'xfs.inc' |
; |
/kernel/branches/kolibri-process/fs/xfs.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; from stat.h |
; distinguish file types |
S_IFMT = 0170000o ; These bits determine file type. |
/kernel/branches/kolibri-process/gui/event.inc |
---|
454,7 → 454,11 |
cmp al, 120 |
jae .result ;overflow |
inc byte[KEY_COUNT] |
mov [KEY_COUNT+1+eax], dl |
mov [KEY_BUFF+eax], dl |
; store empty scancode |
add eax, 120+2 |
mov [KEY_BUFF+eax], byte 0 |
sub eax, 120+2 |
;-------------------------------------- |
align 4 |
.result: |
/kernel/branches/kolibri-process/gui/skincode.inc |
---|
11,7 → 11,7 |
include "skindata.inc" |
;skin_data = 0x00778000 |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------- |
align 4 |
read_skin_file: |
stdcall load_file, ebx |
121,7 → 121,7 |
lea esi, [ebx+SKIN_PARAMS.dtp.data] |
mov edi, common_colours |
mov ecx, [ebx+SKIN_PARAMS.dtp.size] |
and ecx, 127 |
and ecx, 255 |
rep movsb |
mov eax, dword[ebx+SKIN_PARAMS.margin.right] |
mov dword[_skinmargins+0], eax |
/kernel/branches/kolibri-process/gui/skindata.inc |
---|
9,7 → 9,7 |
; |
; WINDOW SKIN DATA |
; WINDOW SKIN DATA. |
; |
iglobal |
/kernel/branches/kolibri-process/gui/window.inc |
---|
26,7 → 26,7 |
} |
uglobal |
common_colours rd 32 |
common_colours rd 48 |
draw_limits RECT |
endg |
34,7 → 34,7 |
;------------------------------------------------------------------------------ |
syscall_draw_window: ;///// system function 0 ///////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;? <description>. |
;------------------------------------------------------------------------------ |
mov eax, edx |
shr eax, 24 |
173,7 → 173,10 |
syscall_display_settings.02: |
dec ebx |
mov esi, ecx |
and edx, 127 |
cmp edx, 192 |
jnae @f |
mov edx, 192 ; max size |
@@: |
mov edi, common_colours |
mov ecx, edx |
rep movsb |
183,7 → 186,10 |
align 4 |
syscall_display_settings.03: |
mov edi, ecx |
and edx, 127 |
cmp edx, 192 |
jnae @f |
mov edx, 192 ; max size |
@@: |
mov esi, common_colours |
mov ecx, edx |
rep movsb |
/kernel/branches/kolibri-process/hid/keyboard.inc |
---|
488,7 → 488,19 |
jae .exit.irq1 |
inc eax |
mov [KEY_COUNT], al |
mov [KEY_COUNT+eax], bl |
; store ascii or scancode |
mov [KEY_COUNT+eax], bl ; actually KEY_BUFF + EAX - 1 |
; store original scancode |
add eax, 120+2 |
push ecx |
cmp [keyboard_mode], 0; return from keymap |
je @f |
xor ch, ch |
@@: |
mov [KEY_COUNT+eax], ch ; actually KEY_BUFF + EAX - 1 |
pop ecx |
sub eax, 120+2 |
.exit.irq1: |
ret |
;--------------------------------------------------------------------- |
/kernel/branches/kolibri-process/hid/mousedrv.inc |
---|
479,54 → 479,53 |
ret |
;----------------------------------------------------------------------------- |
align 4 |
proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword |
proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword |
mov eax, [BtnState] |
and eax, 0x3FFFFFFF ; Top 2 bits are used to flag absolute movements |
mov [BTN_DOWN], eax |
;-------------------------------------- |
mov eax, [XMoving] |
test [BtnState], 0x80000000 |
jnz @@M1 |
jnz .absolute_x |
call mouse_acceleration |
add ax, [MOUSE_X];[XCoordinate] |
add ax, [MOUSE_X] |
cmp ax, 0 |
jge @@M1 |
jge .check_x |
mov eax, 0 |
jmp @@M2 |
jmp .set_x |
.absolute_x: |
mov edx, [_display.width] |
mul edx |
shr eax, 15 |
.check_x: |
cmp ax, word[Screen_Max_X] |
jl .set_x |
mov ax, word[Screen_Max_X] |
.set_x: |
mov [MOUSE_X], ax |
;-------------------------------------- |
align 4 |
@@M1: |
cmp ax, word [Screen_Max_X];ScreenLength |
jl @@M2 |
mov ax, word [Screen_Max_X];ScreenLength-1 |
;-------------------------------------- |
align 4 |
@@M2: |
mov [MOUSE_X], ax;[XCoordinate] |
mov eax, [YMoving] |
test [BtnState], 0x40000000 |
jnz @@M3 |
jnz .absolute_y |
neg eax |
call mouse_acceleration |
add ax, [MOUSE_Y];[YCoordinate] |
add ax, [MOUSE_Y] |
cmp ax, 0 |
jge @@M3 |
jge .check_y |
mov ax, 0 |
jmp @@M4 |
jmp .set_y |
.absolute_y: |
mov edx, [_display.height] |
mul edx |
shr eax, 15 |
.check_y: |
cmp ax, word[Screen_Max_Y] |
jl .set_y |
mov ax, word[Screen_Max_Y] |
.set_y: |
mov [MOUSE_Y], ax |
;-------------------------------------- |
align 4 |
@@M3: |
cmp ax, word [Screen_Max_Y];ScreenHeigth |
jl @@M4 |
mov ax, word [Screen_Max_Y];ScreenHeigth-1 |
;-------------------------------------- |
align 4 |
@@M4: |
mov [MOUSE_Y], ax;[YCoordinate] |
mov eax, [VScroll] |
add [MOUSE_SCROLL_V], ax |
/kernel/branches/kolibri-process/init.inc |
---|
354,6 → 354,7 |
mov [cpu_type], eax |
mov [cpu_caps-OS_BASE], eax |
mov [cpu_caps+4-OS_BASE], eax |
mov [cpu_phys_addr_width-OS_BASE], 32 |
pushfd |
pop eax |
378,7 → 379,6 |
pop eax |
xor eax, ecx |
je .end_cpuid |
mov [cpu_id], 1 |
xor eax, eax |
cpuid |
402,6 → 402,20 |
mov [cpu_caps-OS_BASE], edx |
mov [cpu_caps+4-OS_BASE], ecx |
bt edx, CAPS_PAE |
jnc @f |
mov [cpu_phys_addr_width-OS_BASE], 36 |
@@: |
mov eax, 0x80000000 |
cpuid |
cmp eax, 0x80000008 |
jb @f |
mov eax, 0x80000008 |
cpuid |
mov [cpu_phys_addr_width-OS_BASE], al |
@@: |
mov eax, [cpu_sign-OS_BASE] |
shr eax, 8 |
and eax, 0x0f |
ret |
/kernel/branches/kolibri-process/kernel.asm |
---|
343,78 → 343,17 |
call mutex_init |
mov ecx, ide_channel2_mutex |
call mutex_init |
mov ecx, ide_channel3_mutex |
call mutex_init |
mov ecx, ide_channel4_mutex |
call mutex_init |
mov ecx, ide_channel5_mutex |
call mutex_init |
mov ecx, ide_channel6_mutex |
call mutex_init |
;----------------------------------------------------------------------------- |
; SAVE REAL MODE VARIABLES |
;----------------------------------------------------------------------------- |
save_variables_IDE_controller: |
xor eax, eax |
mov ax, [BOOT_VARS + BOOT_IDE_INTERR_16] |
mov [IDE_Interrupt], ax |
;-------------------------------------- |
mov ax, [BOOT_VARS + BOOT_IDE_PI_16] |
mov [IDEContrProgrammingInterface], ax |
;-------------------------------------- |
mov ax, [BOOT_VARS + BOOT_IDE_BASE_ADDR] |
mov [IDEContrRegsBaseAddr], ax |
;-------------------------------------- |
mov ax, [BOOT_VARS + BOOT_IDE_BAR0_16] |
cmp ax, 0 |
je @f |
cmp ax, 1 |
jne .no_PATA_BAR0 |
@@: |
mov ax, 0x1F0 |
jmp @f |
.no_PATA_BAR0: |
and ax, 0xFFFC |
@@: |
mov [StandardATABases], ax |
mov [hd_address_table], eax |
mov [hd_address_table+8], eax |
mov [IDE_BAR0_val], ax |
;-------------------------------------- |
mov ax, [BOOT_VARS + BOOT_IDE_BAR1_16] |
cmp ax, 0 |
je @f |
cmp ax, 1 |
jne .no_PATA_BAR1 |
@@: |
mov ax, 0x3F4 |
jmp @f |
.no_PATA_BAR1: |
and ax, 0xFFFC |
@@: |
mov [IDE_BAR1_val], ax |
;-------------------------------------- |
mov ax, [BOOT_VARS + BOOT_IDE_BAR2_16] |
cmp ax, 0 |
je @f |
cmp ax, 1 |
jne .no_PATA_BAR2 |
@@: |
mov ax, 0x170 |
jmp @f |
.no_PATA_BAR2: |
and ax, 0xFFFC |
@@: |
mov [StandardATABases+2], ax |
mov [hd_address_table+16], eax |
mov [hd_address_table+24], eax |
mov [IDE_BAR2_val], ax |
;-------------------------------------- |
mov ax, [BOOT_VARS + BOOT_IDE_BAR3_16] |
cmp ax, 0 |
je @f |
cmp ax, 1 |
jne .no_PATA_BAR3 |
@@: |
mov ax, 0x374 |
jmp @f |
.no_PATA_BAR3: |
and ax, 0xFFFC |
@@: |
mov [IDE_BAR3_val], ax |
; --------------- APM --------------------- |
; init selectors |
742,8 → 681,12 |
mov esi, boot_v86machine |
call boot_log |
; Initialize system V86 machine |
call init_sys_v86 |
; call init_sys_v86 |
xchg bx, bx |
call v86_init |
mov esi, boot_inittimer |
call boot_log |
; Initialize system timer (IRQ0) |
750,10 → 693,12 |
call PIT_init |
; Register ramdisk file system |
mov esi, boot_initramdisk |
call boot_log |
call ramdisk_init |
cmp [boot_dev+OS_BASE+0x10000], 1 |
je @f |
call register_ramdisk |
;-------------------------------------- |
@@: |
mov esi, boot_initapic |
call boot_log |
; Try to Initialize APIC |
766,6 → 711,48 |
call unmask_timer |
stdcall enable_irq, 2 ; @#$%! PIC |
stdcall enable_irq, 13 ; co-processor |
; Setup serial output console (if enabled) |
if defined debug_com_base |
; reserve port so nobody else will use it |
xor ebx, ebx |
mov ecx, debug_com_base |
mov edx, debug_com_base+7 |
call r_f_port_area |
; enable Divisor latch |
mov dx, debug_com_base+3 |
mov al, 1 shl 7 |
out dx, al |
; Set speed to 115200 baud (max speed) |
mov dx, debug_com_base |
mov al, 0x01 |
out dx, al |
mov dx, debug_com_base+1 |
mov al, 0x00 |
out dx, al |
; No parity, 8bits words, one stop bit, dlab bit back to 0 |
mov dx, debug_com_base+3 |
mov al, 3 |
out dx, al |
; disable interrupts |
mov dx, debug_com_base+1 |
mov al, 0 |
out dx, al |
; clear + enable fifo (64 bits) |
mov dx, debug_com_base+2 |
mov al, 0x7 + 1 shl 5 |
out dx, al |
end if |
;----------------------------------------------------------------------------- |
; show SVN version of kernel on the message board |
;----------------------------------------------------------------------------- |
787,184 → 774,15 |
call boot_log |
include 'detect/dev_fd.inc' |
;----------------------------------------------------------------------------- |
; START of initialisation IDE ATA code |
; create pci-devices list |
;----------------------------------------------------------------------------- |
cmp [IDEContrProgrammingInterface], 0 |
je @f |
mov esi, boot_disabling_ide |
call boot_log |
;-------------------------------------- |
; Disable IDE interrupts, because the search |
; for IDE partitions is in the PIO mode. |
;-------------------------------------- |
.disable_IDE_interrupt: |
; Disable interrupts in IDE controller for PIO |
mov al, 2 |
mov dx, [IDE_BAR1_val] ;0x3F4 |
add dx, 2 ;0x3F6 |
out dx, al |
mov dx, [IDE_BAR3_val] ;0x374 |
add dx, 2 ;0x376 |
out dx, al |
@@: |
; show base variables of IDE controller |
DEBUGF 1, "K : BAR0 %x \n", [IDE_BAR0_val]:4 |
DEBUGF 1, "K : BAR1 %x \n", [IDE_BAR1_val]:4 |
DEBUGF 1, "K : BAR2 %x \n", [IDE_BAR2_val]:4 |
DEBUGF 1, "K : BAR3 %x \n", [IDE_BAR3_val]:4 |
DEBUGF 1, "K : BAR4 %x \n", [IDEContrRegsBaseAddr]:4 |
DEBUGF 1, "K : IDEContrProgrammingInterface %x \n", [IDEContrProgrammingInterface]:4 |
DEBUGF 1, "K : IDE_Interrupt %x \n", [IDE_Interrupt]:4 |
mov [pci_access_enabled], 1 |
call pci_enum |
;----------------------------------------------------------------------------- |
mov esi, boot_detecthdcd |
call boot_log |
include 'detect/dev_hdcd.inc' |
mov esi, boot_getcache |
call boot_log |
include 'detect/getcache.inc' |
mov esi, boot_detectpart |
call boot_log |
include 'detect/sear_par.inc' |
; initialisation IDE ATA code |
;----------------------------------------------------------------------------- |
mov dx, [IDEContrRegsBaseAddr] |
; test whether it is our interrupt? |
add dx, 2 |
in al, dx |
test al, 100b |
jz @f |
; clear Bus Master IDE Status register |
; clear Interrupt bit |
out dx, al |
@@: |
add dx, 8 |
; test whether it is our interrupt? |
in al, dx |
test al, 100b |
jz @f |
; clear Bus Master IDE Status register |
; clear Interrupt bit |
out dx, al |
@@: |
; read status register and remove the interrupt request |
mov dx, [IDE_BAR0_val] ;0x1F0 |
add dx, 0x7 ;0x1F7 |
in al, dx |
mov dx, [IDE_BAR2_val] ;0x170 |
add dx, 0x7 ;0x177 |
in al, dx |
include 'detect/init_ata.inc' |
;----------------------------------------------------------------------------- |
push eax edx |
mov dx, [IDEContrRegsBaseAddr] |
xor eax, eax |
add dx, 2 |
in al, dx |
DEBUGF 1, "K : Primary Bus Master IDE Status Register %x\n", eax |
add dx, 8 |
in al, dx |
DEBUGF 1, "K : Secondary Bus Master IDE Status Register %x\n", eax |
pop edx eax |
cmp [IDEContrRegsBaseAddr], 0 |
setnz [dma_hdd] |
cmp [IDEContrProgrammingInterface], 0 |
je set_interrupts_for_IDE_controllers.continue |
;----------------------------------------------------------------------------- |
; set interrupts for IDE Controller |
;----------------------------------------------------------------------------- |
mov esi, boot_set_int_IDE |
call boot_log |
set_interrupts_for_IDE_controllers: |
mov ax, [IDEContrProgrammingInterface] |
cmp ax, 0x0180 |
je .pata_ide |
cmp ax, 0x018a |
jne .sata_ide |
;-------------------------------------- |
.pata_ide: |
cmp [IDEContrRegsBaseAddr], 0 |
je .end_set_interrupts |
stdcall attach_int_handler, 14, IDE_irq_14_handler, 0 |
DEBUGF 1, "K : Set IDE IRQ14 return code %x\n", eax |
stdcall attach_int_handler, 15, IDE_irq_15_handler, 0 |
DEBUGF 1, "K : Set IDE IRQ15 return code %x\n", eax |
jmp .enable_IDE_interrupt |
;-------------------------------------- |
.sata_ide: |
cmp ax, 0x0185 |
je .sata_ide_1 |
cmp ax, 0x018f |
jne .end_set_interrupts |
;-------------------------------------- |
.sata_ide_1: |
cmp [IDEContrRegsBaseAddr], 0 |
je .end_set_interrupts |
mov ax, [IDE_Interrupt] |
movzx eax, al |
stdcall attach_int_handler, eax, IDE_common_irq_handler, 0 |
DEBUGF 1, "K : Set IDE IRQ%d return code %x\n", [IDE_Interrupt]:1, eax |
;-------------------------------------- |
.enable_IDE_interrupt: |
mov esi, boot_enabling_ide |
call boot_log |
; Enable interrupts in IDE controller for DMA |
mov al, 0 |
mov ah, [DRIVE_DATA+1] |
test ah, 10100000b |
jz @f |
DEBUGF 1, "K : IDE CH1 PIO, because ATAPI drive present\n" |
jmp .ch2_check |
@@: |
mov dx, [IDE_BAR1_val] ;0x3F4 |
add dx, 2 ;0x3F6 |
out dx, al |
DEBUGF 1, "K : IDE CH1 DMA enabled\n" |
.ch2_check: |
test ah, 1010b |
jz @f |
DEBUGF 1, "K : IDE CH2 PIO, because ATAPI drive present\n" |
jmp .end_set_interrupts |
@@: |
mov dx, [IDE_BAR3_val] ;0x374 |
add dx, 2 ;0x376 |
out dx, al |
DEBUGF 1, "K : IDE CH2 DMA enabled\n" |
;-------------------------------------- |
.end_set_interrupts: |
;----------------------------------------------------------------------------- |
cmp [dma_hdd], 0 |
je .print_pio |
.print_dma: |
DEBUGF 1, "K : IDE DMA mode\n" |
jmp .continue |
.print_pio: |
DEBUGF 1, "K : IDE PIO mode\n" |
.continue: |
;----------------------------------------------------------------------------- |
; END of initialisation IDE ATA code |
;----------------------------------------------------------------------------- |
mov esi, boot_init_sys |
call boot_log |
call Parser_params |
if ~ defined extended_primary_loader |
; ramdisk image should be loaded by extended primary loader if it exists |
; READ RAMDISK IMAGE FROM HD |
;!!!!!!!!!!!!!!!!!!!!!!! |
include 'boot/rdload.inc' |
;!!!!!!!!!!!!!!!!!!!!!!! |
end if |
if 0 |
mov ax, [OS_BASE+0x10000+bx_from_load] |
cmp ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba} |
1015,8 → 833,6 |
; mov esi, boot_devices |
; call boot_log |
mov [pci_access_enabled], 1 |
call pci_enum |
call clear_pci_ide_interrupts |
include "detect/vortex86.inc" ; Vortex86 SoC detection code |
1092,7 → 908,7 |
; STACK AND FDC |
; call stack_init |
call stack_init |
call fdc_init |
; PALETTE FOR 320x200 and 640x480 16 col |
1135,7 → 951,7 |
mov ebp, firstapp |
call fs_execute_from_sysdir |
test eax, eax |
jnz first_app_found |
jns first_app_found |
mov esi, boot_failed |
call boot_log |
1186,7 → 1002,7 |
call set_lights |
;// mike.dld ] |
stdcall attach_int_handler, 1, irq1, 0 |
DEBUGF 1, "K : IRQ1 error code %x\n", eax |
DEBUGF 1, "K : IRQ1 return code %x\n", eax |
.no_keyboard: |
; Load PS/2 mouse driver |
1198,45 → 1014,6 |
call boot_log |
call setmouse |
; Setup serial output console (if enabled) |
if defined debug_com_base |
; reserve port so nobody else will use it |
xor ebx, ebx |
mov ecx, debug_com_base |
mov edx, debug_com_base+7 |
call r_f_port_area |
; enable Divisor latch |
mov dx, debug_com_base+3 |
mov al, 1 shl 7 |
out dx, al |
; Set speed to 115200 baud (max speed) |
mov dx, debug_com_base |
mov al, 0x01 |
out dx, al |
mov dx, debug_com_base+1 |
mov al, 0x00 |
out dx, al |
; No parity, 8bits words, one stop bit, dlab bit back to 0 |
mov dx, debug_com_base+3 |
mov al, 3 |
out dx, al |
; disable interrupts |
mov dx, debug_com_base+1 |
mov al, 0 |
out dx, al |
; clear + enable fifo (64 bits) |
mov dx, debug_com_base+2 |
mov al, 0x7 + 1 shl 5 |
out dx, al |
end if |
; START MULTITASKING |
; A 'All set - press ESC to start' messages if need |
1252,8 → 1029,9 |
mov [timer_ticks_enable], 1 ; for cd driver |
sti |
; call change_task |
call mtrr_validate |
jmp osloop |
1341,12 → 1119,13 |
xchg eax, [osloop_nonperiodic_work] |
test eax, eax |
jz .no_periodic |
; call [draw_pointer] |
call __sys_draw_pointer |
call window_check_events |
call mouse_check_events |
call checkmisc |
call checkVga_N13 |
;-------------------------------------- |
.no_periodic: |
call stack_handler |
call check_fdd_motor_status |
1353,6 → 1132,7 |
call check_ATAPI_device_event |
call check_lights_state |
call check_timers |
jmp osloop |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; ; |
1720,266 → 1500,231 |
mov eax, [esp+64+8] ; background color (if given) |
mov edi, [esp+64+4] |
jmp dtext |
;----------------------------------------------------------------------------- |
iglobal |
midi_base dw 0 |
endg |
;----------------------------------------------------------------------------- |
align 4 |
sys_setup: |
; 1=roland mpu midi base , base io address |
; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus |
; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
; 3 = not used |
; 4 = not used |
; 5=system language, 1eng 2fi 3ger 4rus |
; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
; 8=fat32 partition in hd |
; 9 |
; 10 = sound dma channel |
; 6 = not used |
; 7 = not used |
; 8 = not used |
; 9 = not used |
; 10 = not used |
; 11 = enable lba read |
; 12 = enable pci access |
;----------------------------------------------------------------------------- |
and [esp+32], dword 0 |
; F.21.1 - set MPU MIDI base port |
dec ebx |
jnz @f |
and [esp+32], dword 0 |
dec ebx ; MIDI |
jnz nsyse1 |
cmp ecx, 0x100 |
jb @f |
jb nsyse1 |
mov esi, 65535 |
cmp esi, ecx |
jb @f |
jb nsyse1 |
mov [midi_base], cx ;bx |
mov word [mididp], cx;bx |
inc cx ;bx |
mov word [midisp], cx;bx |
mov [midi_base], cx |
mov word [mididp], cx |
inc cx |
mov word [midisp], cx |
ret |
;-------------------------------------- |
@@: |
; F.21.2 - set keyboard layout |
dec ebx |
jnz @f |
iglobal |
midi_base dw 0 |
endg |
nsyse1: |
dec ebx ; KEYBOARD |
jnz nsyse2 |
mov edi, [TASK_BASE] |
mov eax, [edi+TASKDATA.mem_start] |
add eax, edx |
; 1 = normal layout |
dec ecx |
jnz .shift |
dec ecx |
jnz kbnobase |
mov ebx, keymap |
mov ecx, 128 |
call memmove |
ret |
kbnobase: |
;-------------------------------------- |
.shift: |
; 2 = layout at pressed Shift |
dec ecx |
jnz kbnoshift |
jnz .alt |
mov ebx, keymap_shift |
mov ecx, 128 |
call memmove |
ret |
kbnoshift: |
;-------------------------------------- |
.alt: |
; 3 = layout at pressed Alt |
dec ecx |
jnz kbnoalt |
jnz .country |
mov ebx, keymap_alt |
mov ecx, 128 |
call memmove |
ret |
kbnoalt: |
;-------------------------------------- |
.country: |
; country identifier |
sub ecx, 6 |
jnz kbnocountry |
jnz .error |
mov word [keyboard], dx |
ret |
kbnocountry: |
mov [esp+32], dword 1 |
ret |
nsyse2: |
dec ebx ; CD |
jnz nsyse4 |
;-------------------------------------- |
@@: |
; F.21.5 - set system language |
sub ebx, 3 |
jnz @f |
test ecx, ecx |
jz nosesl |
cmp ecx, 4 |
ja nosesl |
mov [cd_base], cl |
dec ecx |
jnz noprma |
mov eax, [hd_address_table] |
mov [cdbase], eax ;0x1f0 |
mov [cdid], 0xa0 |
noprma: |
dec ecx |
jnz noprsl |
mov eax, [hd_address_table] |
mov [cdbase], eax ;0x1f0 |
mov [cdid], 0xb0 |
noprsl: |
dec ecx |
jnz nosema |
mov eax, [hd_address_table+16] |
mov [cdbase], eax ;0x170 |
mov [cdid], 0xa0 |
nosema: |
dec ecx |
jnz nosesl |
mov eax, [hd_address_table+16] |
mov [cdbase], eax ;0x170 |
mov [cdid], 0xb0 |
nosesl: |
ret |
iglobal |
cd_base db 0 |
endg |
nsyse4: |
sub ebx, 2 ; SYSTEM LANGUAGE |
jnz nsyse5 |
mov [syslang], ecx |
ret |
nsyse5: |
;-------------------------------------- |
@@: |
; F.21.11 - enable/disable low-level access to HD |
and ecx, 1 |
sub ebx, 6 |
jnz @f |
sub ebx, 2 ; HD BASE - obsolete |
jnz nsyse7 |
nosethd: |
mov [lba_read_enabled], ecx |
ret |
nsyse7: |
; cmp eax,8 ; HD PARTITION - obsolete |
;-------------------------------------- |
@@: |
; F.21.12 - enable/disable low-level access to PCI |
dec ebx |
jnz nsyse8 |
ret |
jnz .error |
nsyse8: |
; cmp eax,11 ; ENABLE LBA READ |
and ecx, 1 |
sub ebx, 3 |
jnz no_set_lba_read |
mov [lba_read_enabled], ecx |
ret |
no_set_lba_read: |
; cmp eax,12 ; ENABLE PCI ACCESS |
dec ebx |
jnz sys_setup_err |
mov [pci_access_enabled], ecx |
ret |
sys_setup_err: |
;-------------------------------------- |
.error: |
or [esp+32], dword -1 |
ret |
;----------------------------------------------------------------------------- |
align 4 |
sys_getsetup: |
; 1=roland mpu midi base , base io address |
; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus |
; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
; 3 = not used |
; 4 = not used |
; 5=system language, 1eng 2fi 3ger 4rus |
; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
; 8=fat32 partition in hd |
; 6 = not used |
; 7 = not used |
; 8 = not used |
; 9=get hs timer tic |
; 10 = not used |
; 11 = get the state "lba read" |
; 12 = get the state "pci access" |
;----------------------------------------------------------------------------- |
; F.26.1 - get MPU MIDI base port |
dec ebx |
jnz @f |
; cmp eax,1 |
dec ebx |
jnz ngsyse1 |
movzx eax, [midi_base] |
mov [esp+32], eax |
ret |
ngsyse1: |
; cmp eax,2 |
;-------------------------------------- |
@@: |
; F.26.2 - get keyboard layout |
dec ebx |
jnz ngsyse2 |
jnz @f |
mov edi, [TASK_BASE] |
mov ebx, [edi+TASKDATA.mem_start] |
add ebx, edx |
; 1 = normal layout |
dec ecx |
jnz .shift |
; cmp ebx,1 |
dec ecx |
jnz kbnobaseret |
mov eax, keymap |
mov ecx, 128 |
call memmove |
ret |
kbnobaseret: |
; cmp ebx,2 |
;-------------------------------------- |
.shift: |
; 2 = layout with pressed Shift |
dec ecx |
jnz kbnoshiftret |
jnz .alt |
mov eax, keymap_shift |
mov ecx, 128 |
call memmove |
ret |
kbnoshiftret: |
; cmp ebx,3 |
;-------------------------------------- |
.alt: |
; 3 = layout with pressed Alt |
dec ecx |
jne kbnoaltret |
jne .country |
mov eax, keymap_alt |
mov ecx, 128 |
call memmove |
ret |
kbnoaltret: |
; cmp ebx,9 |
;-------------------------------------- |
.country: |
; 9 = country identifier |
sub ecx, 6 |
jnz ngsyse2 |
jnz .error |
movzx eax, word [keyboard] |
mov [esp+32], eax |
ret |
;-------------------------------------- |
@@: |
; F.26.5 - get system language |
sub ebx, 3 |
jnz @f |
ngsyse2: |
; cmp eax,3 |
dec ebx |
jnz ngsyse3 |
movzx eax, [cd_base] |
mov [esp+32], eax |
ret |
ngsyse3: |
; cmp eax,5 |
sub ebx, 2 |
jnz ngsyse5 |
mov eax, [syslang] |
mov [esp+32], eax |
ret |
ngsyse5: |
; cmp eax,9 |
;-------------------------------------- |
@@: |
; F.26.9 - get the value of the time counter |
sub ebx, 4 |
jnz ngsyse9 |
mov eax, [timer_ticks];[0xfdf0] |
jnz @f |
mov eax, [timer_ticks] |
mov [esp+32], eax |
ret |
ngsyse9: |
; cmp eax,11 |
;-------------------------------------- |
@@: |
; F.26.11 - Find out whether low-level HD access is enabled |
sub ebx, 2 |
jnz ngsyse11 |
jnz @f |
mov eax, [lba_read_enabled] |
mov [esp+32], eax |
ret |
ngsyse11: |
; cmp eax,12 |
;-------------------------------------- |
@@: |
; F.26.12 - Find out whether low-level PCI access is enabled |
dec ebx |
jnz ngsyse12 |
jnz .error |
mov eax, [pci_access_enabled] |
mov [esp+32], eax |
ret |
ngsyse12: |
mov [esp+32], dword 1 |
;-------------------------------------- |
.error: |
or [esp+32], dword -1 |
ret |
;----------------------------------------------------------------------------- |
get_timer_ticks: |
mov eax, [timer_ticks] |
ret |
;----------------------------------------------------------------------------- |
iglobal |
align 4 |
mousefn dd msscreen, mswin, msbutton, msset |
1988,7 → 1733,7 |
dd app_delete_cursor |
dd msz |
endg |
;----------------------------------------------------------------------------- |
readmousepos: |
; eax=0 screen relative |
2461,27 → 2206,15 |
;------------------------------------------------------------------------------ |
align 4 |
sysfn_getdiskinfo: ; 18.11 = get disk info table |
; cmp ecx,1 |
dec ecx |
jnz full_table |
small_table: |
call for_all_tables |
mov ecx, 10 |
cld |
rep movsb |
ret |
for_all_tables: |
jnz .exit |
.small_table: |
mov edi, edx |
mov esi, DRIVE_DATA |
ret |
full_table: |
; cmp ecx,2 |
dec ecx |
jnz exit_for_anyone |
call for_all_tables |
mov ecx, DRIVE_DATA_SIZE/4 |
mov ecx, DRIVE_DATA_SIZE ;10 |
cld |
rep movsd |
rep movsb |
.exit: |
ret |
;------------------------------------------------------------------------------ |
sysfn_lastkey: ; 18.12 = return 0 (backward compatibility) |
2513,10 → 2246,10 |
;* mouse centered - start code- Mario79 |
;mouse_centered: |
; push eax |
mov eax, [Screen_Max_X] |
mov eax, [_display.width] |
shr eax, 1 |
mov [MOUSE_X], ax |
mov eax, [Screen_Max_Y] |
mov eax, [_display.height] |
shr eax, 1 |
mov [MOUSE_Y], ax |
call wakeup_osloop |
2558,11 → 2291,11 |
; cmp ecx,4 ; set mouse pointer position |
dec ecx |
jnz .set_mouse_button |
cmp dx, word[Screen_Max_Y] |
ja .end |
cmp dx, word[_display.height] |
jae .end |
rol edx, 16 |
cmp dx, word[Screen_Max_X] |
ja .end |
cmp dx, word[_display.width] |
jae .end |
mov [MOUSE_X], edx |
mov [mouse_active], 1 |
call wakeup_osloop |
2989,22 → 2722,22 |
jnz nosb9 |
; ecx = [left]*65536 + [right] |
; edx = [top]*65536 + [bottom] |
mov eax, [Screen_Max_X] |
mov ebx, [Screen_Max_Y] |
mov eax, [_display.width] |
mov ebx, [_display.height] |
; check [right] |
cmp cx, ax |
ja .exit |
jae .exit |
; check [left] |
ror ecx, 16 |
cmp cx, ax |
ja .exit |
jae .exit |
; check [bottom] |
cmp dx, bx |
ja .exit |
jae .exit |
; check [top] |
ror edx, 16 |
cmp dx, bx |
ja .exit |
jae .exit |
movzx eax, cx ; [left] |
movzx ebx, dx ; [top] |
3117,8 → 2850,10 |
jne .finish |
cmp [KEY_COUNT], byte 0 |
je .finish |
movzx eax, byte [KEY_BUFF] |
movzx ax, byte [KEY_BUFF + 120 + 2] |
shl eax, 8 |
mov al, byte [KEY_BUFF] |
shl eax, 8 |
push eax |
dec byte [KEY_COUNT] |
and byte [KEY_COUNT], 127 |
3127,6 → 2862,9 |
mov eax, KEY_BUFF + 1 |
mov ebx, KEY_BUFF |
call memmove |
add eax, 120 + 2 |
add ebx, 120 + 2 |
call memmove |
pop eax |
;-------------------------------------- |
align 4 |
4969,9 → 4707,9 |
jnz @f |
mov word [msg_board_pos+2], (42*6) |
add word [msg_board_pos], 10 |
mov ax, word [Screen_Max_Y] |
mov ax, word [_display.height] |
cmp word [msg_board_pos], ax |
jbe @f |
jb @f |
mov word [msg_board_pos], 10 |
@@: |
; // end if |
5281,38 → 5019,61 |
mov ax, word [Screen_Max_Y] |
mov [esp + 32], eax |
ret |
;----------------------------------------------------------------------------- |
align 4 |
syscall_cdaudio: |
; ECX - position of CD/DVD-drive |
; from 0=Primary Master to 3=Secondary Slave for first IDE contr. |
; from 4=Primary Master to 7=Secondary Slave for second IDE contr. |
; from 8=Primary Master to 11=Secondary Slave for third IDE contr. |
cmp ecx, 11 |
ja .exit |
syscall_cdaudio: ; CD |
mov eax, ecx |
shr eax, 2 |
lea eax, [eax*5] |
mov al, [eax+DRIVE_DATA+1] |
push ecx ebx |
mov ebx, ecx |
and ebx, 11b |
shl ebx, 1 |
mov cl, 6 |
sub cl, bl |
shr al, cl |
test al, 2 ; it's not an ATAPI device |
pop ebx ecx |
jz .exit |
cmp ebx, 4 |
jb .audio |
jz .eject |
je .eject |
cmp ebx, 5 |
jnz .ret |
je .load |
;-------------------------------------- |
.exit: |
ret |
;-------------------------------------- |
.load: |
call .reserve |
call LoadMedium |
;call .free |
jmp .free |
; ret |
;-------------------------------------- |
.eject: |
call .reserve |
call clear_CD_cache |
call allow_medium_removal |
call EjectMedium |
; call .free |
jmp .free |
; ret |
.audio: |
call sys_cd_audio |
mov [esp+36-4], eax |
.ret: |
ret |
;-------------------------------------- |
.reserve: |
call reserve_cd |
mov ebx, ecx |
inc ebx |
mov [cdpos], ebx |
mov eax, ecx |
shr eax, 1 |
and eax, 1 |
5322,32 → 5083,19 |
and eax, 1 |
mov [DiskNumber], al |
call reserve_cd_channel |
and ebx, 3 |
inc ebx |
mov [cdpos], ebx |
add ebx, ebx |
mov cl, 8 |
sub cl, bl |
mov al, [DRIVE_DATA+1] |
shr al, cl |
test al, 2 |
jz .free;.err |
ret |
;-------------------------------------- |
.free: |
call free_cd_channel |
and [cd_status], 0 |
ret |
.err: |
call .free |
; pop eax |
ret |
;----------------------------------------------------------------------------- |
align 4 |
syscall_getpixel_WinMap: ; GetPixel WinMap |
cmp ebx, [Screen_Max_X] |
jbe @f |
cmp ecx, [Screen_Max_Y] |
jbe @f |
cmp ebx, [_display.width] |
jb @f |
cmp ecx, [_display.height] |
jb @f |
xor eax, eax |
jmp .store |
;-------------------------------------- |
5364,8 → 5112,7 |
;----------------------------------------------------------------------------- |
align 4 |
syscall_getpixel: ; GetPixel |
mov ecx, [Screen_Max_X] |
inc ecx |
mov ecx, [_display.width] |
xor edx, edx |
mov eax, ebx |
div ecx |
5738,8 → 5485,6 |
ret |
@@: |
call stop_all_services |
movi eax, 3 |
call sys_cd_audio |
yes_shutdown_param: |
cli |
/kernel/branches/kolibri-process/kernel32.inc |
---|
168,7 → 168,37 |
ends |
struct IDE_DATA |
ProgrammingInterface dd ? |
Interrupt dw ? |
RegsBaseAddres dw ? |
BAR0_val dw ? |
BAR1_val dw ? |
BAR2_val dw ? |
BAR3_val dw ? |
dma_hdd_channel_1 db ? |
dma_hdd_channel_2 db ? |
ends |
struct IDE_CACHE |
pointer dd ? |
size dd ? ; not use |
data_pointer dd ? |
system_data_size dd ? ; not use |
appl_data_size dd ? ; not use |
system_data dd ? |
appl_data dd ? |
system_sad_size dd ? |
appl_sad_size dd ? |
search_start dd ? |
appl_search_start dd ? |
ends |
struct IDE_DEVICE |
UDMA_possible_modes db ? |
UDMA_set_mode db ? |
ends |
; Core functions |
include "core/sync.inc" ; macros for synhronization objects |
include "core/sys32.inc" ; process management |
176,6 → 206,7 |
include "core/syscall.inc" ; system call |
include "core/fpu.inc" ; all fpu/sse support |
include "core/memory.inc" |
include "core/mtrr.inc" |
include "core/heap.inc" ; kernel and app heap |
include "core/malloc.inc" ; small kernel heap |
include "core/taskman.inc" |
258,7 → 289,6 |
; CD drive controller |
include "blkdev/cdrom.inc" |
include "blkdev/cd_drv.inc" |
; Character devices |
/kernel/branches/kolibri-process/kernelsp.inc |
---|
1,3 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2013-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
; Éste archivo debe ser editado con codificación CP866 |
version cp850 'Kolibri OS versión 0.7.7.0+ ',13,10,13,10,0 |
/kernel/branches/kolibri-process/network/PPPoE.inc |
---|
14,6 → 14,9 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
struct PPPoE_frame |
VersionAndType db ? |
Code db ? |
/kernel/branches/kolibri-process/network/icmp.inc |
---|
294,12 → 294,12 |
call mutex_unlock |
popa |
DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input: no socket found\n" |
DEBUGF DEBUG_NETWORK_ERROR, "ICMP_input: no socket found\n" |
jmp .dump |
.checksum_mismatch: |
DEBUGF DEBUG_NETWORK_VERBOSE, "checksum mismatch\n" |
DEBUGF DEBUG_NETWORK_ERROR, "ICMP_input: checksum mismatch\n" |
.dump: |
DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input: dumping\n" |
/kernel/branches/kolibri-process/network/tcp_usreq.inc |
---|
14,7 → 14,9 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
;------------------------- |
; |
; TCP_usrclose |
/kernel/branches/kolibri-process/video/blitter.inc |
---|
1,10 → 1,13 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2011-2012. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2011-2014. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 4850 $ |
struct BLITTER_BLOCK |
xmin dd ? |
ymin dd ? |
/kernel/branches/kolibri-process/video/cursors.inc |
---|
295,9 → 295,7 |
; jne .fail |
mov ebx, [current_slot] |
xchg eax, [ebx+APPDATA.cursor] |
mov [redrawmouse_unconditional], 1 |
call __sys_draw_pointer |
ret |
jmp .end |
;-------------------------------------- |
align 4 |
.fail: |
304,6 → 302,10 |
mov eax, [def_cursor] |
mov ebx, [current_slot] |
xchg eax, [ebx+APPDATA.cursor] |
align 4 |
.end: |
mov [redrawmouse_unconditional], 1 |
call __sys_draw_pointer |
ret |
endp |
;------------------------------------------------------------------------------ |
/kernel/branches/kolibri-process/video/vesa20.inc |
---|
218,8 → 218,7 |
add eax, [putimg.arg_0] |
mov [putimg.line_increment], eax |
; winmap new line increment |
mov eax, [Screen_Max_X] |
inc eax |
mov eax, [_display.width] |
sub eax, [putimg.real_sx] |
mov [putimg.winmap_newline], eax |
; screen new line increment |
687,10 → 686,10 |
; edi = 0x00000001 force |
pushad |
cmp [Screen_Max_X], eax |
jb .exit |
cmp [Screen_Max_Y], ebx |
jb .exit |
cmp eax, [_display.width] |
jae .exit |
cmp ebx, [_display.height] |
jae .exit |
test edi, 1 ; force ? |
jnz .forced |
1210,9 → 1209,8 |
.end_y: |
mov [drbar.real_sy], ebx |
; line_inc_map |
mov eax, [Screen_Max_X] |
mov eax, [_display.width] |
sub eax, [drbar.real_sx] |
inc eax |
mov [drbar.line_inc_map], eax |
; line_inc_scr |
mov eax, [drbar.real_sx] |
1926,8 → 1924,7 |
; advance edi, ebp to next scan line |
sub eax, [draw_data+32+RECT.left] |
sub ebp, eax |
add ebp, [Screen_Max_X] |
add ebp, 1 |
add ebp, [_display.width] |
sub edi, eax |
sub edi, eax |
sub edi, eax |
1958,8 → 1955,7 |
push edi |
mov esi, bgr_next_line |
mov edi, bgr_cur_line |
mov ecx, [Screen_Max_X] |
inc ecx |
mov ecx, [_display.width] |
rep movsd |
jmp bgr_resmooth1 |
;-------------------------------------- |