AHCICD.SYS alternatives? (Users)
> I think, a diff file produced with -U2
(default) would be
> okay. Maybe -U1
is already enough.
I'm afraid this is no useful approach - because the first thing I did with the original was to "reformat" the source: indent reduced to 4, code labels and opcodes separated to 2 lines.
But the changes are indeed minimal - one can see from this that Mr. Loew was a master.
Here's the changes, in case anyone desperately needs such a driver:
OUT DX,EAX
POP EBX
POP EDX
RET
include hbap.inc
GETHBA:
@setint0d
PUSH EDX ;AX = ADDR
MOV EDX,CS:[HBA]
if 0
AND EDX,EDX
JS GHP
OUT DX,AX
ADD DX,4
IN EAX,DX
JMP GHE
GHP:
CALL PUTPCI
ADD EDX,4
CALL GETPCI
GHE:
else
movzx eax,ax
mov eax,[edx+eax]
endif
POP EDX
@restint0d
RET
PUTHBA:
@setint0d
PUSH EDX ;AX = ADDR ECX = VALUE
MOV EDX,CS:[HBA]
if 0
AND EDX,EDX
JS PHP
OUT DX,AX
ADD DX,4
MOV EAX,ECX
OUT DX,EAX
JMP PHE
PHP:
CALL PUTPCI
ADD EDX,4
MOV EAX,ECX
CALL PUTPCI
PHE:
else
movzx eax,ax
mov [edx+eax], ecx
endif
POP EDX
@restint0d
RET
and, in the init section:
GOTHBA:
DEC BP
JNZ NXTHBA
if 0 ;don't search for SATA compatibility header
MOV DL,34H
CALL GETPCI
GETCAP:
AND AL,AL
JZ NG
MOV DL,AL
CALL GETPCI
CMP AL,12H
JZ GOTCAP
MOV AL,AH
JMP GETCAP
GOTCAP:
ADD DL,4
CALL GETPCI
CMP AL,0FH
JNZ IOPORT
ADD DL,4
MOV DS:[HBA],EDX
JMP ENDHBA
IOPORT:
MOV CX,AX
SHR CL,2
AND CL,0FCH
AND AL,0FH
SHL AL,2
MOV DL,AL
CALL GETPCI
TEST AL,1
JZ NG
AND AL,0FEH
ADD AX,CX
MOV DS:[HBA],EAX
ENDHBA:
else
smsw ax
test ax,1
jz @F
mov dx,offset msg6
jmp NG1
msg6 db "ahcicdp driver can't work in V86 mode!",13,10,13,10,'$'
@@:
mov dl,24h ;get ABAR5
call getpci
mov ds:[HBA],eax
mov eax,cs
shl eax,4
add eax,offset gdt-8
mov dword ptr ds:[gdtr+2],eax ;set linear address of GDT
endif
MOV AX,4
CALL GETHBA
my changes are easy to identify, they are in lower case.
Finally, there's a new file, named hbap.inc, where I put the "unreal" stuff into:
;--- define macros @setint0d and @restint0d
;--- these macros activate unreal mode
align 8
gdt label qword
dw -1,0,9200h,0CFh ; 32-bit flat data descriptor
; dw -1,0,9200h,0 ; 16-bit data descriptor
SEL_FLAT equ 8
;SEL_DATA16 equ 16
gdtr dw 3*8-1,0,0
;--- exception 0D: no need to check if it's a real exception,
;--- since interrupts were disabled.
int0d:
push ds
push eax
lgdt fword ptr cs:[gdtr]
mov eax,cr0
inc ax
mov cr0,eax
jmp @F
@@:
dec ax
push SEL_FLAT
pop ds
mov cr0,eax
pop eax
pop ds
iret
@setint0d macro
pushf
cli
push ds
push 0
pop ds
push ebx
push cs
push offset int0d
mov ebx,ds:[13*4]
pop dword ptr ds:[13*4]
endm
@restint0d macro
mov ds:[13*4],ebx
pop ebx
pop ds
popf
endm
to assemble, enter:
jwasm -bin -Foahcicd.sys ahcicd.asm
Hint: better do NOT move the XBDA if you load this driver. In my machine, several HBA data regions are located in this area.
Also, be aware that this driver runs in real-mode only. There's a check, but it's in the init phase only, so if you load the driver before loading jemm386, you won't get a warning.
---
MS-DOS forever!
Complete thread:
- AHCICD.SYS alternatives? - Japheth, 12.01.2021, 14:57 (Users)
- AHCICD.SYS alternatives? - mceric, 12.01.2021, 17:21
- AHCICD.SYS alternatives? - tom, 12.01.2021, 19:22
- AHCICD.SYS alternatives? - Khusraw, 13.01.2021, 09:32
- AHCICD.SYS alternatives? - RayeR, 13.01.2021, 13:36
- AHCICD.SYS alternatives? - tom, 13.01.2021, 23:22
- AHCICD.SYS alternatives? - Japheth, 15.01.2021, 08:47
- AHCICD.SYS alternatives? - Khusraw, 13.01.2021, 09:32
- AHCICD.SYS alternatives? - Japheth, 12.01.2021, 20:31
- AHCICD.SYS alternatives? - tom, 12.01.2021, 19:22
- AHCICD.SYS alternatives? - RayeR, 13.01.2021, 02:45
- AHCICD.SYS alternatives? - Japheth, 13.01.2021, 04:52
- AHCICD.SYS alternatives? - RayeR, 13.01.2021, 05:56
- AHCICD.SYS alternatives? - RayeR, 13.01.2021, 13:44
- AHCICD.SYS alternatives? - rr, 13.01.2021, 11:14
- AHCICD.SYS alternatives? - Japheth, 13.01.2021, 13:43
- AHCICD.SYS alternatives? - Laaca, 13.01.2021, 23:16
- AHCICD.SYS alternatives? - Japheth, 14.01.2021, 04:54
- AHCICD.SYS alternatives? - Laaca, 13.01.2021, 23:16
- AHCICD.SYS alternatives? - Japheth, 13.01.2021, 13:43
- AHCICD.SYS alternatives? - RayeR, 13.01.2021, 05:56
- AHCICD.SYS alternatives? - Japheth, 13.01.2021, 04:52
- AHCICD.SYS alternatives? - RayeR, 14.01.2021, 01:31
- AHCICD.SYS alternatives? - Japheth, 14.01.2021, 04:48
- AHCICD.SYS alternatives? - RayeR, 14.01.2021, 08:12
- AHCICD.SYS alternatives? - Japheth, 14.01.2021, 10:08
- AHCICD.SYS alternatives? - Japheth, 14.01.2021, 13:27
- AHCICD.SYS alternatives? - Laaca, 14.01.2021, 17:05
- AHCICD.SYS alternatives? - Japheth, 15.01.2021, 08:39
- AHCICD.SYS alternatives? - RayeR, 16.01.2021, 02:51
- AHCICD.SYS alternatives? - Japheth, 16.01.2021, 06:15
- AHCICD.SYS alternatives? - RayeR, 20.01.2021, 15:40
- AHCICD.SYS alternatives? - Japheth, 20.01.2021, 20:45
- AHCICD.SYS alternatives? - RayeR, 21.01.2021, 02:13
- AHCICD.SYS alternatives? - Japheth, 21.01.2021, 02:55
- AHCICD.SYS alternatives? - Khusraw, 22.01.2021, 21:49
- AHCICD.SYS alternatives? - Japheth, 23.01.2021, 08:54
- AHCICD.SYS alternatives? - RayeR, 23.01.2021, 20:28
- AHCICD.SYS alternatives? - Japheth, 23.01.2021, 22:30
- AHCICD.SYS alternatives? - Khusraw, 22.01.2021, 21:49
- AHCICD.SYS alternatives? - Japheth, 21.01.2021, 02:55
- AHCICD.SYS alternatives? - RayeR, 21.01.2021, 02:13
- AHCICD.SYS alternatives? - Japheth, 20.01.2021, 20:45
- AHCICD.SYS alternatives? - RayeR, 20.01.2021, 15:40
- AHCICD.SYS alternatives? - Japheth, 16.01.2021, 06:15
- AHCICD.SYS alternatives? - Laaca, 14.01.2021, 17:05
- AHCICD.SYS alternatives? - Japheth, 14.01.2021, 13:27
- AHCICD.SYS alternatives? - Japheth, 14.01.2021, 10:08
- AHCICD.SYS alternatives? - rr, 14.01.2021, 14:41
- AHCICD.SYS alternatives? - mceric, 14.01.2021, 17:30
- AHCICD.SYS alternatives? - rr, 14.01.2021, 18:54
- AHCICD.SYS alternatives? - RayeR, 14.01.2021, 21:31
- AHCICD.SYS alternatives? - rr, 14.01.2021, 18:54
- AHCICD.SYS alternatives? - mceric, 14.01.2021, 17:30
- AHCICD.SYS alternatives? - RayeR, 14.01.2021, 08:12
- AHCICD.SYS alternatives? - Japheth, 14.01.2021, 04:48
- AHCICD.SYS alternatives? - mceric, 12.01.2021, 17:21