CIFS:BugFix

This commit is contained in:
burniouf 2021-07-10 21:09:43 +02:00
parent fdbdee521d
commit e73519e529
8 changed files with 152 additions and 245 deletions

Binary file not shown.

View File

@ -5,15 +5,11 @@ CIFS.ChTyp
CIFS2.ChTyp
*--------------------------------------
CIFS.ChMod
CIFS2.ChMod >DEBUG
lda #MLI.E.BADCALL
sec
rts
CIFS2.ChMod
*--------------------------------------
CIFS.FStat jsr GetPFD
CIFS.FStat
*--------------------------------------
CIFS2.FStat >DEBUG
lda #MLI.E.BADCALL
CIFS2.FStat lda #MLI.E.BADCALL
sec
rts
*--------------------------------------
@ -37,6 +33,8 @@ CIFS.Stat >STYA pPath resolved path
jsr ReqT2SetupPtr2
jsr AppendPathPtr2
jsr AddYReqLenPtr2
jsr SetT2ReqLen
jsr WriteSocket
@ -410,17 +408,25 @@ CIFS2.ReadDir.FillBuf
phx
.5 lda PRODOS.FT.TXT,x
iny
cmp (ZPPtr2),y
.5 iny
lda (ZPPtr2),y
beq .51
cmp #'A'
bcc .50
cmp #'Z'+1
bcs .50
eor #$20
.50 cmp PRODOS.FT.TXT,x
bne .6
inx
txa
and #3
bne .5
bra .5
pla
.51 pla
lsr
lsr
tax
@ -432,8 +438,7 @@ CIFS2.ReadDir.FillBuf
sta (ZPPtr2),y
tya
tax
bra .7
bra .70
.6 pla
clc
@ -445,8 +450,13 @@ CIFS2.ReadDir.FillBuf
cpx #PRODOS.FT.END
bne .4
tya
* sec
adc #3
bra .70
.7 txa
sec +\0
.70 sec +\0
jsr AddA2Ptr2
jsr StatBuf2Ptr2
@ -494,11 +504,6 @@ CIFS2.ChOwn
*--------------------------------------
CIFS.FOpen >STYA pPath resolved path
ldy #2
lda (pStack),y TYPE
jsr ProDOS2TypeLess
jsr GetCtx
ldx #S.SMB.H.CMD.NT.CREATE.ANDX
@ -515,21 +520,26 @@ CIFS.FOpen >STYA pPath resolved path
jsr ReqSetupPtr2
ldy #2
lda (pStack),y TYPE
pha
jsr AppendPathPtr2
tya
pla
beq .2
jsr AppendTypePtr2
.2 tya
ldy #S.NETBIOS+S.SMB.H+6 NameLength
sta (ZPReqPtr),y
inc +1 for \0
jsr Add2ByteCount
ldy ByteCountOfs
sta (ZPReqPtr),y
lda #0
iny ByteCountOfs+1
sta (ZPReqPtr),y
jsr AddYReqLenPtr2
jsr SetReqLen
@ -987,8 +997,7 @@ CIFS2.FSeek
CIFS.FTell
CIFS2.FTell
CIFS.FEOF
CIFS2.FEOF >DEBUG
lda #MLI.E.BADCALL
CIFS2.FEOF lda #MLI.E.BADCALL
sec
rts
*--------------------------------------
@ -1020,7 +1029,6 @@ CIFS.Remove >STYA pPath resolved path
tya
inc +1 for BufferFormat
inc +1 for \0
jsr Add2ByteCount
jsr SetReqLen
@ -1100,7 +1108,6 @@ CIFS.Rename >STYA pPath resolved src path
tya
inc +1 for BufferFormat
inc +1 for \0
jsr Add2ByteCount
jsr SetReqLen

View File

@ -142,7 +142,7 @@ J.CIFS2 .DA CIFS2.ChTyp
.DA CIFS2.Rename
*--------------------------------------
L.LIBTCPIP .DA LIBTCPIP
L.NETBIOS .DA NETBIOS
L.NETBIOS.H .DA NETBIOS.H
.DA 0
*--------------------------------------
LIB.LOAD >LDYA L.LIBTCPIP
@ -189,8 +189,8 @@ CIFS.Negotiate lda (pStack)
ldy #1 hSocket
lda (pStack),y
>PUSHA
>PUSHW L.NETBIOS
>PUSHWI SMB.NegReq.end-NETBIOS
>PUSHW L.NETBIOS.H
>PUSHWI SMB.NegReq.end-NETBIOS.H
ldx #LIBTCPIP.Send
jsr GO.LIBTCPIP
@ -199,7 +199,7 @@ CIFS.Negotiate lda (pStack)
lda #0
sec
rts
*--------------------------------------
.1 dec
sta (pStack)
beq .98
@ -207,8 +207,7 @@ CIFS.Negotiate lda (pStack)
ldy #1 hSocket
lda (pStack),y
ldx #LIBTCPIP.Recv
jsr GO.LIBTCPIP
jsr ReadSocketA
bcc .3
cmp #E.NODATA
@ -293,15 +292,12 @@ CIFS.SessionSetup
cpx #SMB.SessionSetup.H.Len
bne .2
phy save Y = LEN
iny
iny
jsr ReqSetupPtr2
ldx #0
.3 lda SMB.SessionSetup.Guest,x
sta (ZPReqPtr),y
iny
jsr PutBytePtr2
inx
cpx #SMB.SessionSetup.Guest.Len
bne .3
@ -309,37 +305,31 @@ CIFS.SessionSetup
ldx #0
.4 lda SMB.SessionSetup.T,x
sta (ZPReqPtr),y
iny
jsr PutBytePtr2
inx
cpx #SMB.SessionSetup.T.Len
bne .4
pla
jsr Add2ByteCount
jsr SetReqLenYAtA
jsr SetReqLen
ldy #6 hSocket
lda (pStack),y
>PUSHA
>PUSHW ZPReqPtr
>PUSHW ZPReqLen
ldx #LIBTCPIP.Send
jsr GO.LIBTCPIP
jsr WriteSocketA
bcs .99
lda #0
sec
rts
*--------------------------------------
.5 dec
sta (pStack)
beq .98
ldy #6 hSocket
lda (pStack),y
ldx #LIBTCPIP.Recv
jsr GO.LIBTCPIP
jsr ReadSocketA
bcc .6
cmp #E.NODATA
@ -392,10 +382,10 @@ CIFS.TreeConnect
ldy #1 pathname
lda (pStack),y
sta ZPPtr1
sta pPath
iny
lda (pStack),y
sta ZPPtr1+1
sta pPath+1
iny hSMBContext
jsr GetSMBContext
@ -412,38 +402,23 @@ CIFS.TreeConnect
cpx #SMB.TreeConnect.H.Len
bne .1
phy save Y = LEN
iny Skip ByteCount
iny
jsr ReqSetupPtr2
lda #0
sta (ZPReqPtr),y PASSWORD = "\0"
iny
.2 lda (ZPPtr1)
inc ZPPtr1
bne .3
inc ZPPtr1+1
.3 sta (ZPReqPtr),y
iny
tax
bne .2
jsr PutBytePtr2 PASSWORD = "\0"
jsr AppendPathPtr2
jsr AddYReqLenPtr2
ldx #0
.4 lda SMB.TreeConnect.T,x
sta (ZPReqPtr),y
iny
jsr PutBytePtr2
inx
cpx #SMB.TreeConnect.T.Len
bne .4
pla
jsr SetReqLenYAtA
jsr SetReqLen
ldy #4 hSocket
lda (pStack),y
@ -460,8 +435,7 @@ CIFS.TreeConnect
ldy #4 hSocket
lda (pStack),y
ldx #LIBTCPIP.Recv
jsr GO.LIBTCPIP
jsr ReadSocketA
bcc .6
cmp #E.NODATA
@ -554,119 +528,6 @@ CIFS.CallBack bit CIFS.Status
.2 pla
ply
jmp (J.CIFS2,x)
*--------------------------------------
.INB usr/src/lib/libcifs.io.s
*--------------------------------------
TypeLess2ProDOS ldy #$ff
.1 iny
lda (ZPPtr1),y
bne .1
tya
tax save finename len
sbc #4 "x.EXT" ?
beq .9
ldx #0
.4 phy Y = '.' offset
phx
.5 lda PRODOS.FT.TXT,x
iny
cmp (ZPPtr1),y
bne .6
inx
txa
and #3
bne .5
pla
lsr
lsr
tax
lda PRODOS.FT.HEX,x
ply Y = truncated len, A = type
rts
.6 pla
clc
adc #4
tax
ply
cpx #PRODOS.FT.END
bne .4
.9 lda #0 Y = full len, A = 0 (no type)
rts
*--------------------------------------
ProDOS2TypeLess tax
beq .8
ldx #0
.1 cmp PRODOS.FT.HEX,x
beq .4
inx
cpx #PRODOS.FT.TXT-PRODOS.FT.HEX
bne .1
pha
lsr
lsr
lsr
lsr
ora #$30
cmp #'9'+1
bcc .2
adc #6
.2 sta PRODOS.FT.DFLT+1
pla
and #$0F
ora #$30
cmp #'9'+1
bcc .3
adc #6
.3 sta PRODOS.FT.DFLT+2
.4 txa
asl
asl
tax
ldy #0
.5 iny
lda (pPath),y
bne .5
lda #'.'
sta (pPath),y
iny
.6 lda PRODOS.FT.TXT,x
sta (pPath),y
beq .8
inx
iny
bra .6
.8 rts
*--------------------------------------
GetPFD tax
phx
@ -786,17 +647,71 @@ AppendPathPtr2 ldx #0
.5 sta (ZPPtr2),y A = 0
tya
rts
*--------------------------------------
AppendTypePtr2 ldx #0
.1 cmp PRODOS.FT.HEX,x
beq .4
inx
cpx #PRODOS.FT.TXT-PRODOS.FT.HEX
bne .1
pha
lsr
lsr
lsr
lsr
ora #$30
cmp #'9'+1
bcc .2
adc #6
.2 sta PRODOS.FT.DFLT+1
pla
and #$0F
ora #$30
cmp #'9'+1
bcc .3
adc #6
.3 sta PRODOS.FT.DFLT+2
.4 txa
asl
asl
tax
lda #'.'
sta (ZPPtr2),y
iny
.6 lda PRODOS.FT.TXT,x
sta (ZPPtr2),y
beq .8
inx
iny
bra .6
.8 rts
*--------------------------------------
AddYReqLenPtr2 tya
sec +1 for \0
adc ZPReqLen
sta ZPReqLen
bcc .6
bcc .1
inc ZPReqLen+1
.6 tya
.1 tya
sec +1 for \0
@ -805,8 +720,6 @@ AppendPathPtr2 ldx #0
bcc .8
inc ZPPtr2+1
.8 rts
*--------------------------------------
Add2ByteCount ldy ByteCountOfs
@ -848,30 +761,6 @@ AppendPath ldx #0
.5 rts
*--------------------------------------
* Y = LEN from S.NETBIOS.TYPE
* A = Ptr to LEN Word
*--------------------------------------
SetReqLenYAtA sty ZPReqLen
stz ZPReqLen+1
sta ZPPtr1
pha
tya
dec
dec
sec
sbc ZPPtr1
ply
sta (ZPReqPtr),y
iny
lda #0
sta (ZPReqPtr),y
bra SetReqLen
*--------------------------------------
SetT2ReqLenYA sty ZPReqLen
stz ZPReqLen+1
@ -1168,12 +1057,15 @@ WriteSocketA >PUSHA
jmp (pLIBTCPIP)
*--------------------------------------
ReadSocket lda MountTable+3 hSocket
ldx #LIBTCPIP.Recv
ReadSocketA ldx #LIBTCPIP.Recv
GO.LIBTCPIP jmp (pLIBTCPIP)
*--------------------------------------
CIFS.BADCALL lda #MLI.E.BADCALL
sec
rts
*--------------------------------------
.INB usr/src/lib/libcifs.io.s
*--------------------------------------
CS.END
PRODOS.FT.HEX .HS 0406FAFCFDCBCCCFFF
@ -1192,7 +1084,7 @@ PRODOS.FT.DFLT .AZ "$ "
SMBERR01 .DA #2,#3,#32
MLIERR01 .DA #MLI.E.FNOTFND,#MLI.E.PNOTFND,#MLI.E.OPEN
*--------------------------------------
NETBIOS .DA #0 DIRECT TCP TRANSPORT
NETBIOS.H .DA #0 DIRECT TCP TRANSPORT
.DA #0 24 BITS LENGTH
.DA /SMB.NegReq.end-SMB.H
.DA #SMB.NegReq.end-SMB.H

View File

@ -518,7 +518,7 @@ CS.RUN.CopyStart
>LDYAI X.COPY.BUF.SIZE
>SYSCALL GetMem
bcs .9
bcs .99
>STYA ZPPtr1
txa
@ -527,7 +527,7 @@ CS.RUN.CopyStart
ldy #hSrcFullPath
lda #O.RDONLY
jsr CS.RUN.Open
bcs .9
bcs CS.RUN.CopyEnd
>STA.G hSrcFile
@ -535,14 +535,14 @@ CS.RUN.CopyStart
lda #O.WRONLY+O.CREATE
jsr CS.RUN.Open
.9 bcs CS.RUN.CopyEnd
bcs CS.RUN.CopyEnd
>STA.G hDstFile
lda #$ff
>STA.G bCopy
* clc
rts
.99 rts
*--------------------------------------
CS.RUN.Copy >PUSHB.G hSrcFile
>PUSHW ZPPtr1 Dst Ptr
@ -555,7 +555,7 @@ CS.RUN.Copy >PUSHB.G hSrcFile
lda #0
clc
bra .9
bra CS.RUN.CopyEnd
.1 phy
pha
@ -565,7 +565,7 @@ CS.RUN.Copy >PUSHB.G hSrcFile
ply
>PUSHYA Bytes To Write
>SYSCALL FWrite
bcs .9
bcs CS.RUN.CopyEnd
bit bQuiet
bmi .8
@ -575,12 +575,13 @@ CS.RUN.Copy >PUSHB.G hSrcFile
.8 rts
.9 >STA.G CopyRC
.9 sec
*--------------------------------------
CS.RUN.CopyEnd php
pha
>STA.G CopyRC
CS.RUN.CopyEnd >STA.G CopyRC
php
pha
>LDA.G hDstFile
beq .1
@ -597,8 +598,10 @@ CS.RUN.CopyEnd php
>SYSCALL FreeMem
.3 >STZ.G bCopy
pla
plp
rts
.FIN
*--------------------------------------

View File

@ -258,7 +258,7 @@ K.InsDrv >STYA ZPPtr3 SRC PTR for move
sta BIN.R.End+1
sbc BIN.R.CS.Start+1
>STYA BIN.R.Size
jsr MEM.GetKrnlBuf Y,A = CODE + DATA
jsr MEM.GetKBuf Y,A = CODE + DATA
bcs .9 No More Room to load Driver
>STYA ZPPtr1 Y,A = DST Buf for RelDrv...
@ -341,7 +341,7 @@ BIN.RelDrv ldy #2 start after CLD JMP
.3 lda (ZPPtr1) get OPCODE
lsr /2
tax
lda BIN.65816,x get OPCODE definition
lda BIN.65R02,x get OPCODE definition
bcs .4 go get LO nibble
lsr
lsr move HI -> LO
@ -418,7 +418,7 @@ BIN.RelAtPtr1Y lda (ZPPtr1),y Get LO
* Bit 2-1-0 : opcode + @ length
*--------------------------------------
* 0.1.2.3.4.5.6.7.8.9.A.B.C.D.E.F
BIN.65816
* BIN.65816
* TO DO : Make 2 different tables
* http://axis.llx.com/~nparker/a2/opcodes.html
*--------------------------------------

View File

@ -188,7 +188,7 @@ K.MKDev jsr SHARED.PullP2P1 ptr2=name,tr1=fd
tay
lda #0
jsr MEM.GetKrnlBuf
jsr MEM.GetKBuf
bcs .99
>STYA pFD
@ -357,8 +357,13 @@ DEV.Destroy ldx IO.hDevNod
ldx IO.hDevNod
.1 lda Nod.Table.hFD-2,x
beq .8
stz Nod.Table.hFD-2,x
jmp K.FreeMem
.8 clc
rts
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.dev

View File

@ -10,7 +10,7 @@ NEW
* if A2osX Drivers cannot clear IRQ,
* must call regular System Handler
*--------------------------------------
MSLOT .EQ $7f8
*MSLOT .EQ $7f8
*--------------------------------------
*IRQ.BRK jmp IRQ.6
*--------------------------------------

View File

@ -331,9 +331,7 @@ MEM.Init0 phx
* none.
* (X unmodified)
*\--------------------------------------
K.FreeMem.MSG .AZ "FreeMem:hMem=$%h,PID=%d\r\n"
*--------------------------------------
K.FreeMem.ERR >PUSHWI K.FreeMem.MSG
K.FreeMem.ERR >PUSHWI .1
tya hMem n Y
>PUSHA
@ -348,6 +346,8 @@ K.FreeMem.ERR >PUSHWI K.FreeMem.MSG
lda #E.INVH
sec
rts
.1 .AZ "Free($%h),PID=%d\r\n"
*--------------------------------------
K.FreeMem tay
beq K.FreeMem.ERR Slot=0, reserved by Kernel
@ -648,7 +648,7 @@ MEM.SetA1A2 jsr K.GetMemPtr
rts
*--------------------------------------
MEM.GetKrnlBuf pha
MEM.GetKBuf pha
tya
clc
adc DevMgr.Free