Kernel version 0.9 :

-TCP, bugfix (#8) ...nearly working!!!
-MKNod API implementation for stream SOCKET
-Bugfix in Smartort controller/device detection
-Memory leak in CP/MV/RM
This commit is contained in:
Rémy GIBERT 2017-04-10 08:07:14 +02:00
parent 3903a2001f
commit e4f2c60ada
13 changed files with 138 additions and 104 deletions

View File

@ -628,7 +628,7 @@ CS.QUIT jsr LeaveSubDir
.2 ldy #hFilter
lda (pData),y
beq .8
* >SYSCALL FreeMemA
>SYSCALL FreeMemA
.8 clc
rts

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -176,17 +176,18 @@ S.TCB.INFREE .EQ 4
S.TCB.INUSED .EQ 6
*
S.TCB.OUTTAIL .EQ 8
S.TCB.NEXTOUTTAIL .EQ 10
S.TCB.OUTTAILNEXT .EQ 10
S.TCB.OUTHEAD .EQ 12
S.TCB.OUTFREE .EQ 14
S.TCB.TOSEND .EQ 16
S.TCB.OUTTOSEND .EQ 16
S.TCB.OUTUSED .EQ 18
*
S.TCB.SEQNUM .EQ 20 Send:SEQ not yet ACKed
S.TCB.ACKNUM .EQ 24 Rcvd:Last ACK recieved from remote
S.TCB.NEXTSEQ .EQ 28 Rcvd:Next SEQ accepted data from remote
S.TCB.INLASTSEQNUM .EQ 20 Rcvd:Last SEQ recieved from remote
S.TCB.OUTSEQNUM .EQ 24 Send:SEQ sent not yet ACKed (retransmit)
S.TCB.OUTNEXTSEQ .EQ 28 Send:Next SEQ to send
S.TCB.OUTACKNUM .EQ 32 Send:ACK to send to remote
*
S.TCB .EQ 32
S.TCB .EQ 36
*--------------------------------------
S.ETH.FRAMELEN .EQ 0
S.ETH.DSTMAC .EQ 2
@ -246,8 +247,8 @@ S.UDP .EQ S.IP+8
*--------------------------------------
S.TCP.SRCPORT .EQ S.IP+0
S.TCP.DSTPORT .EQ S.IP+2
S.TCP.SEQ.NUMBER .EQ S.IP+4
S.TCP.ACK.NUMBER .EQ S.IP+8
S.TCP.SEQNUM .EQ S.IP+4
S.TCP.ACKNUM .EQ S.IP+8
S.TCP.DATAOFFSET .EQ S.IP+12
S.TCP.OPTIONS .EQ S.IP+13
S.TCP.OPTIONS.URG .EQ %00100000

View File

@ -104,7 +104,7 @@ SKT.New.Listen sec
>LDYA ZPTmpPtr3
>STYA ZPPtrSKT
lda #S.TCP.OPTIONS.SYN
jsr TCP.OUT.SendOpt Only for CLIENT conn!!!!
jsr TCP.OUT.SendOptA Send SYN,Only for CLIENT conn!!!!
bcs .99
ldy #S.SOCKET.TCP.STATUS
@ -155,7 +155,7 @@ SKT.CloseA and #$7f
ora #S.TCP.OPTIONS.FIN
sta (ZPPtrSKT),y
jsr TCP.OUT Try to push FIN
jsr TCP.OUT SKT.Close, Try to push FIN
clc
rts
@ -309,10 +309,22 @@ SKT.AcceptA jsr SKT.GetA.I
* ## Out :
* A = hFile
*\--------------------------------------
SKT.MkNodA
SKT.MkNodA sta NODE.SSOCK+S.NODE.SSOCK.HSKT
>SYSCALL MkNodA
bcs .9
sec
rts
>STYA ZPTmpPtr1
ldy #S.NODE.SSOCK-1
.1 lda NODE.SSOCK,y
sta (ZPTmpPtr1),y
dey
bpl .1
txa
* clc
.9 rts
*/--------------------------------------
* # SKT.Write (DGRAM,STREAM,RAW)
* Send block of data
@ -630,11 +642,11 @@ SKT.AddDataToSktIn
sbc ZPDataInLen+1
bcc .9 Not enough room in Q
ldy #S.TCP.SEQ.NUMBER+3
ldy #S.TCP.SEQNUM+3
ldx #3
.10 lda (ZPFrameInPtr),y
eor SKT.TCBCache+S.TCB.NEXTSEQ,x
eor SKT.TCBCache+S.TCB.INLASTSEQNUM,x
bne .9
dey
dex
@ -719,19 +731,20 @@ SKT.AddDataToSktIn
clc
lda SKT.TCBCache+S.TCB.NEXTSEQ+3
lda SKT.TCBCache+S.TCB.INLASTSEQNUM+3
adc ZPDataInLen
sta SKT.TCBCache+S.TCB.NEXTSEQ+3
sta SKT.TCBCache+S.TCB.INLASTSEQNUM+3
lda SKT.TCBCache+S.TCB.NEXTSEQ+2
lda SKT.TCBCache+S.TCB.INLASTSEQNUM+2
adc ZPDataInLen+1
sta SKT.TCBCache+S.TCB.NEXTSEQ+2
sta SKT.TCBCache+S.TCB.INLASTSEQNUM+2
bcc .80
inc SKT.TCBCache+S.TCB.NEXTSEQ+1
inc SKT.TCBCache+S.TCB.INLASTSEQNUM+1
bne .80
inc SKT.TCBCache+S.TCB.NEXTSEQ
inc SKT.TCBCache+S.TCB.INLASTSEQNUM
.80 jmp SKT.StoreTCB
.80 clc
rts
*--------------------------------------
* From SKT.Read
* In:
@ -859,19 +872,19 @@ SKT.GetDataFromSktIn
sbc ZPTmpPtr3+1
sta SKT.TCBCache+S.TCB.INUSED+1
lda SKT.TCBCache+S.TCB.ACKNUM+3
lda SKT.TCBCache+S.TCB.OUTACKNUM+3
clc
adc ZPTmpPtr3
sta SKT.TCBCache+S.TCB.ACKNUM+3
sta SKT.TCBCache+S.TCB.OUTACKNUM+3
lda SKT.TCBCache+S.TCB.ACKNUM+2
lda SKT.TCBCache+S.TCB.OUTACKNUM+2
adc ZPTmpPtr3+1
sta SKT.TCBCache+S.TCB.ACKNUM+2
sta SKT.TCBCache+S.TCB.OUTACKNUM+2
bcc .80
inc SKT.TCBCache+S.TCB.ACKNUM+1
inc SKT.TCBCache+S.TCB.OUTACKNUM+1
bne .80
inc SKT.TCBCache+S.TCB.ACKNUM
inc SKT.TCBCache+S.TCB.OUTACKNUM
.80 jsr SKT.StoreTCB
@ -977,13 +990,13 @@ SKT.AddDataToSktOut
adc ZPDataInLen+1
sta SKT.TCBCache+S.TCB.OUTUSED+1
lda SKT.TCBCache+S.TCB.TOSEND
lda SKT.TCBCache+S.TCB.OUTTOSEND
clc
adc ZPDataInLen
sta SKT.TCBCache+S.TCB.TOSEND
lda SKT.TCBCache+S.TCB.TOSEND+1
sta SKT.TCBCache+S.TCB.OUTTOSEND
lda SKT.TCBCache+S.TCB.OUTTOSEND+1
adc ZPDataInLen+1
sta SKT.TCBCache+S.TCB.TOSEND+1
sta SKT.TCBCache+S.TCB.OUTTOSEND+1
jsr SKT.StoreTCB
rts
*--------------------------------------
@ -1000,11 +1013,11 @@ SKT.GetDataFromSktOut
lda ZPTmpPtr1
clc
adc SKT.TCBCache+S.TCB.NEXTOUTTAIL
adc SKT.TCBCache+S.TCB.OUTTAILNEXT
sta ZPTmpPtr2 Make ZPTmpPtr2=base+nexttail
lda ZPTmpPtr1+1
adc SKT.TCBCache+S.TCB.NEXTOUTTAIL+1
adc SKT.TCBCache+S.TCB.OUTTAILNEXT+1
sta ZPTmpPtr2+1
lda ZPDataOutLen
@ -1035,13 +1048,13 @@ SKT.GetDataFromSktOut
bne .4
inc ZPTmpPtr2+1
.4 inc SKT.TCBCache+S.TCB.NEXTOUTTAIL
.4 inc SKT.TCBCache+S.TCB.OUTTAILNEXT
bne .1
inc SKT.TCBCache+S.TCB.NEXTOUTTAIL+1
lda SKT.TCBCache+S.TCB.NEXTOUTTAIL+1
inc SKT.TCBCache+S.TCB.OUTTAILNEXT+1
lda SKT.TCBCache+S.TCB.OUTTAILNEXT+1
cmp /K.TCP.WSIZE
bne .1
stz SKT.TCBCache+S.TCB.NEXTOUTTAIL+1
stz SKT.TCBCache+S.TCB.OUTTAILNEXT+1
lda ZPTmpPtr1 Dst Ptr=Buffer Base
sta ZPTmpPtr2
@ -1049,13 +1062,13 @@ SKT.GetDataFromSktOut
sta ZPTmpPtr2+1
bra .1
.8 lda SKT.TCBCache+S.TCB.TOSEND
.8 lda SKT.TCBCache+S.TCB.OUTTOSEND
sec
sbc ZPDataOutLen
sta SKT.TCBCache+S.TCB.TOSEND
lda SKT.TCBCache+S.TCB.TOSEND+1
sta SKT.TCBCache+S.TCB.OUTTOSEND
lda SKT.TCBCache+S.TCB.OUTTOSEND+1
sbc ZPDataOutLen+1
sta SKT.TCBCache+S.TCB.TOSEND+1
sta SKT.TCBCache+S.TCB.OUTTOSEND+1
clc
rts
@ -1065,17 +1078,17 @@ SKT.GetDataFromSktOut
* Dst : hOutMem/OUTTAIL
*--------------------------------------
SKT.AckDataToSktOut
ldy #S.TCP.ACK.NUMBER+3 Get new ACK number from FrameIn...
ldy #S.TCP.ACKNUM+3 Get new ACK number from FrameIn...
ldx #3 Substract old ACK from socket
sec
.1 lda (ZPFrameInPtr),y
pha
sbc SKT.TCBCache+S.TCB.SEQNUM,x
sbc SKT.TCBCache+S.TCB.OUTSEQNUM,x
sta TmpDWord,x
pla ....and Set SEQ = new SEQ
sta SKT.TCBCache+S.TCB.SEQNUM,x
sta SKT.TCBCache+S.TCB.OUTSEQNUM,x
dey
dex
bpl .1
@ -1134,7 +1147,7 @@ SKT.NewTCB >PUSHWI S.TCB
ldx #3
.2 lda A2osX.TIMER16,x
sta SKT.TCBCache+S.TCB.SEQNUM,x
sta SKT.TCBCache+S.TCB.OUTNEXTSEQ,x
dex
bpl .2

View File

@ -100,7 +100,7 @@ TCP.IN.JMP.LISTEN
>PUSHW L.SKT.Template
jsr SKT.New.Listen Assign SEQNUM
jsr SKT.New.Listen Assign OUTNEXTSEQ
bcs .99
sty .1+1
@ -116,15 +116,15 @@ TCP.IN.JMP.LISTEN
.2 lda #$ff
sta ZPPtrSKT+1
ldy #S.TCP.SEQ.NUMBER+3 Get Remote SEQ
ldy #S.TCP.SEQNUM+3 Get Remote SEQ
ldx #3
sec
.3 lda (ZPFrameInPtr),y Set ACK=SEQ+1 for new socket...
.3 lda (ZPFrameInPtr),y Set OUTACK=SEQ+1 for new socket...
adc #0
sta SKT.TCBCache+S.TCB.ACKNUM,x
sta SKT.TCBCache+S.TCB.NEXTSEQ,x
sta SKT.TCBCache+S.TCB.INLASTSEQNUM,x
sta SKT.TCBCache+S.TCB.OUTACKNUM,x
dey
dex
bpl .3
@ -134,7 +134,7 @@ TCP.IN.JMP.LISTEN
jsr ARP.AddFromFrameInPtr
lda #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK
jsr TCP.OUT.SendOpt Send SYN.ACK
jsr TCP.OUT.SendOptA SYN recieved, Send SYN.ACK
bcs .9
ldy #S.SOCKET.TCP.STATUS
@ -158,13 +158,13 @@ TCP.IN.JMP.SYNSENT
jsr SKT.GetTCB
ldx #3
ldy #S.TCP.ACK.NUMBER+3
ldy #S.TCP.ACKNUM+3
sec Check if ACK=my SEQ+1
sec Check if ACK=OUTNEXTSEQ+1
.1 lda SKT.TCBCache+S.TCB.ACKNUM,x
.1 lda SKT.TCBCache+S.TCB.OUTNEXTSEQ,x
adc #0
sta SKT.TCBCache+S.TCB.ACKNUM,x
sta SKT.TCBCache+S.TCB.OUTNEXTSEQ,x
eor (ZPFrameInPtr),y
bne .8
dey
@ -172,7 +172,7 @@ TCP.IN.JMP.SYNSENT
bpl .1
lda #S.TCP.OPTIONS.ACK
jsr TCP.OUT.SendOpt
jsr TCP.OUT.SendOptA SYN.ACK recieved, Send, ACK
bcs .9
ldy #S.SOCKET.TCP.STATUS
@ -191,13 +191,14 @@ TCP.IN.JMP.SYNRCVD
jsr SKT.GetTCB
ldx #3
ldy #S.TCP.ACK.NUMBER+3
ldy #S.TCP.ACKNUM+3
sec
.1 lda SKT.TCBCache+S.TCB.SEQNUM,x Check if ACK=my SEQ+1
.1 lda SKT.TCBCache+S.TCB.OUTNEXTSEQ,x Check if ACK=OUTNEXTSEQ+1
adc #0
sta SKT.TCBCache+S.TCB.SEQNUM,x
sta SKT.TCBCache+S.TCB.OUTSEQNUM,x setup SEQNUM
sta SKT.TCBCache+S.TCB.OUTNEXTSEQ,x ...and update NEXTSEQ
eor (ZPFrameInPtr),y
bne .8
dey
@ -232,6 +233,9 @@ TCP.IN.JMP.ESTBLSH
beq .2 No data, ...
jsr SKT.AddDataToSktIn yes, queue data if there is room for....
bcs .2
jsr SKT.StoreTCB success, update socket
.2 ldy #S.TCP.OPTIONS
lda (ZPFrameInPtr),y
@ -288,7 +292,7 @@ TCP.IN.JMP.FINWT1
ora #S.TCP.OPTIONS.ACK
sta (ZPPtrSKT),y
jsr TCP.OUT
jsr TCP.OUT FINWT1, Ack the FIN
bcs .9
ldy #S.SOCKET.TCP.STATUS
@ -309,7 +313,7 @@ TCP.IN.JMP.FINWT2
ora #S.TCP.OPTIONS.ACK
sta (ZPPtrSKT),y
jsr TCP.OUT
jsr TCP.OUT ACK the FIN
bcs .9
ldy #S.SOCKET.TCP.STATUS
@ -387,8 +391,8 @@ TCP.IN.SetDataInPtrAndLen
*--------------------------------------
TCP.OUT jsr SKT.GetTCB
TCP.OUT.I lda SKT.TCBCache+S.TCB.TOSEND+1
ldy SKT.TCBCache+S.TCB.TOSEND
TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTTOSEND+1
ldy SKT.TCBCache+S.TCB.OUTTOSEND
bne .1
@ -399,7 +403,7 @@ TCP.OUT.I lda SKT.TCBCache+S.TCB.TOSEND+1
ldy #S.SOCKET.TCP.OPTIONS
lda (ZPPtrSKT),y
bne TCP.OUT.SendOpt a least an option...
bne TCP.OUT.SendOptA a least an option...
clc No, data, no flag....exit
rts
@ -409,7 +413,7 @@ TCP.OUT.I lda SKT.TCBCache+S.TCB.TOSEND+1
pla
bcc .2 no....keep data len
>LDYAI K.TCP.MSS yes get only MSS
>LDYAI K.TCP.MSS yes send only MSS
.2 jsr TCP.NewFrame
bcs TCP.OUT.9
@ -418,62 +422,63 @@ TCP.OUT.I lda SKT.TCBCache+S.TCB.TOSEND+1
ldy #S.SOCKET.TCP.OPTIONS
lda (ZPPtrSKT),y
jsr TCP.OUT.Send
jsr TCP.OUT.SendOptA.1
bcs TCP.OUT.9
lda SKT.TCBCache+S.TCB.SEQNUM+3
lda SKT.TCBCache+S.TCB.OUTNEXTSEQ+3
clc
adc ZPDataOutLen
sta SKT.TCBCache+S.TCB.SEQNUM+3
sta SKT.TCBCache+S.TCB.OUTNEXTSEQ+3
lda SKT.TCBCache+S.TCB.SEQNUM+2
lda SKT.TCBCache+S.TCB.OUTNEXTSEQ+2
adc ZPDataOutLen+1
sta SKT.TCBCache+S.TCB.SEQNUM+2
sta SKT.TCBCache+S.TCB.OUTNEXTSEQ+2
bcc .80
inc SKT.TCBCache+S.TCB.SEQNUM+1
inc SKT.TCBCache+S.TCB.OUTNEXTSEQ+1
bne .80
inc SKT.TCBCache+S.TCB.SEQNUM
inc SKT.TCBCache+S.TCB.OUTNEXTSEQ
.80 jmp SKT.StoreTCB
TCP.OUT.9 rts
*--------------------------------------
TCP.OUT.SendOpt sta .1+1
TCP.OUT.SendOptA
sta .1+1
>LDYAI 0
jsr TCP.NewFrame
bcs TCP.OUT.9
.1 lda #$ff
TCP.OUT.Send ldy #S.TCP.OPTIONS
TCP.OUT.SendOptA.1
ldy #S.TCP.OPTIONS
sta (ZPFrameOutPtr),y
and #S.TCP.OPTIONS.ACK
beq .11
ldx #3
ldy #S.TCP.ACK.NUMBER+3
ldy #S.TCP.ACKNUM+3
.10 lda SKT.TCBCache+S.TCB.ACKNUM,x
.10 lda SKT.TCBCache+S.TCB.OUTACKNUM,x
sta (ZPFrameOutPtr),y
dey
dex
bpl .10
bra .1
.11 ldy #S.TCP.ACK.NUMBER
.11 ldy #S.TCP.ACKNUM
lda #0
.12 sta (ZPFrameOutPtr),y
iny
cpy #S.TCP.ACK.NUMBER+4
cpy #S.TCP.ACKNUM+4
bne .12
.1 ldx #3
ldy #S.TCP.SEQ.NUMBER+3
ldy #S.TCP.SEQNUM+3
.2 lda SKT.TCBCache+S.TCB.SEQNUM,x
.2 lda SKT.TCBCache+S.TCB.OUTNEXTSEQ,x
sta (ZPFrameOutPtr),y
dey
dex

View File

@ -110,8 +110,9 @@ L.TCP.IN.JMP .DA TCP.IN.JMP.CLOSED
.DA TCP.IN.JMP.TIMEWT
.DA 0
*--------------------------------------
LIB.LOAD lda bFirstLoad
LIB.LOAD ldx bFirstLoad
bne .8
sta NODE.SSOCK+S.NODE.HANDLER
jsr ARP.CLEAR
jsr DNS.CLEAR
@ -299,6 +300,14 @@ HST.DecStr .BS 4
HST.IP .BS 5
IP.ID .BS 2
IP.CHECKSUM .BS 4
NODE.SSOCK .BS 1 S.NODE.HANDLER
.DA #S.NODE.T.SSOCK
.BS 1 S.NODE.SSOCK.HSKT
.DA #0 S.NODE.SSOCK.OPEN
.DA #0 S.NODE.SSOCK.CLOSE
.DA LIBTCPIP.SKT.GetCA
.DA LIBTCPIP.SKT.PutC
.DA #0 S.NODE.SSOCK.STATUS
*--------------------------------------
MAN
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S

View File

@ -58,7 +58,7 @@ A2osX.PrtDrv.GetParam
*--------------------------------------
A2osX.PrtDrv.GetDev
txa
asl
lsr
sta A2osX.PrtDrv.Go.Cmd
tax
lda A2osX.PrtDrv.Cnt,x

View File

@ -154,7 +154,8 @@ K.MkNodYA jsr K.GetDevByNameYA Ptr1=NAME
* A=hSocket
* ## OUT:
* CC = OK, CS = ERROR
* A = hFILE
* X = hFILE
* Y,A = pFILE
*\--------------------------------------
K.MkNodA sta .1+1
>PUSHWI S.NODE.SSOCK
@ -172,7 +173,7 @@ K.MkNodA sta .1+1
.1 lda #$ff
sta (ZPPtr1),y
txa
>LDYA ZPPtr1
.9 rts
*/--------------------------------------
* # MKFIFO

View File

@ -274,7 +274,7 @@ DevMgrInit stz ZPPtr1
bra .7
.3 inc
beq .7 $ff, Disk II 13 Sect, ingnore
beq .7 $ff, Disk II 13 Sect, ignore
ldy #7
lda (ZPPtr1),y
@ -338,6 +338,9 @@ DevMgrInit.SP ldy #$ff
sta .3+2
sta DEV.HEADER+S.DEV.ROM.JMP+1
>LDYAI A2osX.PrtDrv
>STYA DEV.HEADER+S.DEV.DRV.JMP
.1 jsr $ffff Self Modified
.DA #0 Status
.DA SP.CTRL.STATUS
@ -345,8 +348,7 @@ DevMgrInit.SP ldy #$ff
lda SP.CTRL.STATUS.DATA
beq .9 no device
.2 lda #'1'
sta DEV.HEADER+S.DEV.DEVID
.2 lda #1
sta SP.DEV.STATUS.DEVID
.3 jsr $ffff Self Modified
@ -358,7 +360,8 @@ DevMgrInit.SP ldy #$ff
jsr DevMgrInit.AddDev
.7 inc DEV.HEADER+S.DEV.DEVID
.7 inc SP.DEV.STATUS.DEVID
inc DEV.HEADER+S.DEV.DEVID
dec SP.CTRL.STATUS.DATA
bne .3

View File

@ -1,6 +1,6 @@
PR#3
PREFIX /A2OSX.BUILD
NEW
LOMEM $A00
INC 1
AUTO 6
*--------------------------------------
@ -10,7 +10,7 @@ AUTO 6
* out :
* A = hMem To loaded LIB
*--------------------------------------
K.LoadLibYA >STYA K.LoadLib.Name SAVE /A2OSX.SRC/LIBname for K.FileSearch
K.LoadLibYA >STYA K.LoadLib.Name SAVE LIBname for K.FileSearch
>LDYAI ENV.LIB push ENVNAME=LIB
>SYSCALL GetEnvYA get value for ENV=LIB
bcs .99
@ -30,6 +30,7 @@ K.LoadLibYA >STYA K.LoadLib.Name SAVE /A2OSX.SRC/LIBname for K.FileSearch
stx K.LoadLib.hMem
>STYA LIB.Jump+1
txa Pass hLib to LibLoad
ldx #LIBMGR.LOAD
jsr LIB.Jump Call LIB.LOAD function

View File

@ -195,7 +195,8 @@ return a hFile for a given Socket
## OUT:
+ CC = OK, CS = ERROR
+ A = hFILE
+ X = hFILE
+ Y,A = pFILE
# MKFIFO
return a S.FILE to a new FIFO
@ -455,26 +456,26 @@ And return, if found, the full path to it.
# ChTyp
## In:
+ PUSHB = TYPE ...
+ PUSHW = PATH ...FOpen)
+ PUSHB = TYPE
+ PUSHW = PATH
# ChMod
## In:
+ PUSHW = MODE ...
+ PUSHW = PATH ...FOpen)
+ PUSHW = MODE
+ PUSHW = PATH
# ChOwn
## In:
+ PUSHW = UID ...
+ PUSHW = PATH ...FOpen)
+ PUSHW = UID
+ PUSHW = PATH
# ChGrp
## In:
+ PUSHW = GID ...
+ PUSHW = PATH ...FOpen)
+ PUSHW = GID
+ PUSHW = PATH
# GetMem