mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-29 17:50:18 +00:00
Kernel version 0.9 : TCP, bugfix in SEQ & ACK (#1)
This commit is contained in:
parent
b4f18d1aec
commit
7d61543721
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.DEV.po
BIN
A2OSX.DEV.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
@ -178,10 +178,12 @@ S.TCB.INUSED .EQ 8
|
|||||||
S.TCB.OUTUSED .EQ 10
|
S.TCB.OUTUSED .EQ 10
|
||||||
S.TCB.INFREE .EQ 12
|
S.TCB.INFREE .EQ 12
|
||||||
S.TCB.OUTFREE .EQ 14
|
S.TCB.OUTFREE .EQ 14
|
||||||
S.TCB.SEQNUM .EQ 16
|
S.TCB.SEQNUM .EQ 16 Send:SEQ not yet ACKed
|
||||||
S.TCB.ACKNUM .EQ 20
|
S.TCB.ACKNUM .EQ 20 Rcvd:Last ACK recieved from remote
|
||||||
|
S.TCB.NEXTSEQ .EQ 24 Send:Next SEQ to use when sending more data
|
||||||
|
S.TCB.LASTSEQ .EQ 28 Rcvd:Last SEQ accepted data from remote
|
||||||
*
|
*
|
||||||
S.TCB .EQ 24
|
S.TCB .EQ 32
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.ETH.FRAMELEN .EQ 0
|
S.ETH.FRAMELEN .EQ 0
|
||||||
S.ETH.DSTMAC .EQ 2
|
S.ETH.DSTMAC .EQ 2
|
||||||
|
@ -630,6 +630,16 @@ SKT.AddDataToSktIn
|
|||||||
sbc ZPDataInLen+1
|
sbc ZPDataInLen+1
|
||||||
bcc .9 Not enough room in Q
|
bcc .9 Not enough room in Q
|
||||||
|
|
||||||
|
ldy #S.TCP.SEQ.NUMBER+3
|
||||||
|
ldx #3
|
||||||
|
|
||||||
|
.10 lda (ZPFrameInPtr),y
|
||||||
|
eor SKT.TCBCache+S.TCB.LASTSEQ,x
|
||||||
|
bne .9
|
||||||
|
dey
|
||||||
|
dex
|
||||||
|
bpl .10
|
||||||
|
|
||||||
ldy #S.SOCKET.SQ.hInMem
|
ldy #S.SOCKET.SQ.hInMem
|
||||||
lda (ZPPtrSKT),y
|
lda (ZPPtrSKT),y
|
||||||
>SYSCALL GetMemPtrA
|
>SYSCALL GetMemPtrA
|
||||||
@ -707,7 +717,21 @@ SKT.AddDataToSktIn
|
|||||||
adc ZPDataInLen+1
|
adc ZPDataInLen+1
|
||||||
sta SKT.TCBCache+S.TCB.INUSED+1
|
sta SKT.TCBCache+S.TCB.INUSED+1
|
||||||
|
|
||||||
jmp SKT.StoreTCB
|
clc
|
||||||
|
|
||||||
|
lda SKT.TCBCache+S.TCB.LASTSEQ+3
|
||||||
|
adc ZPDataInLen
|
||||||
|
sta SKT.TCBCache+S.TCB.LASTSEQ+3
|
||||||
|
|
||||||
|
lda SKT.TCBCache+S.TCB.LASTSEQ+2
|
||||||
|
adc ZPDataInLen+1
|
||||||
|
sta SKT.TCBCache+S.TCB.LASTSEQ+2
|
||||||
|
bcc .80
|
||||||
|
inc SKT.TCBCache+S.TCB.LASTSEQ+1
|
||||||
|
bne .80
|
||||||
|
inc SKT.TCBCache+S.TCB.NEXTSEQ
|
||||||
|
|
||||||
|
.80 jmp SKT.StoreTCB
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* From SKT.Read
|
* From SKT.Read
|
||||||
* In:
|
* In:
|
||||||
@ -873,8 +897,6 @@ SKT.GetDataFromSktIn
|
|||||||
SKT.AddDataToSktOut
|
SKT.AddDataToSktOut
|
||||||
jsr SKT.GetTCB
|
jsr SKT.GetTCB
|
||||||
|
|
||||||
* >DEBUG
|
|
||||||
|
|
||||||
ldx SKT.TCBCache+S.TCB.OUTFREE
|
ldx SKT.TCBCache+S.TCB.OUTFREE
|
||||||
cpx ZPDataInLen
|
cpx ZPDataInLen
|
||||||
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
||||||
@ -1031,16 +1053,16 @@ SKT.GetDataFromSktOut
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
SKT.AckDataToSktOut
|
SKT.AckDataToSktOut
|
||||||
ldy #S.TCP.ACK.NUMBER+3 Get new ACK number from FrameIn...
|
ldy #S.TCP.ACK.NUMBER+3 Get new ACK number from FrameIn...
|
||||||
ldx #3 Substract old SEQ from socket
|
ldx #3 Substract old ACK from socket
|
||||||
|
|
||||||
sec
|
sec
|
||||||
|
|
||||||
.1 lda (ZPFrameInPtr),y
|
.1 lda (ZPFrameInPtr),y
|
||||||
pha
|
pha
|
||||||
sbc SKT.TCBCache+S.TCB.SEQNUM,x
|
sbc SKT.TCBCache+S.TCB.ACKNUM,x
|
||||||
sta TmpDWord,x
|
sta TmpDWord,x
|
||||||
pla ....and Set SEQ = new ACK
|
pla ....and Set ACK = new ACK
|
||||||
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
sta SKT.TCBCache+S.TCB.ACKNUM,x
|
||||||
dey
|
dey
|
||||||
dex
|
dex
|
||||||
bpl .1
|
bpl .1
|
||||||
@ -1098,9 +1120,12 @@ SKT.NewTCB >PUSHWI S.TCB
|
|||||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||||
|
|
||||||
ldx #3
|
ldx #3
|
||||||
|
sec
|
||||||
|
|
||||||
.2 lda A2osX.TIMER16,x
|
.2 lda A2osX.TIMER16,x
|
||||||
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
||||||
|
adc #0
|
||||||
|
sta SKT.TCBCache+S.TCB.NEXTSEQ,x
|
||||||
dex
|
dex
|
||||||
bpl .2
|
bpl .2
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ TCP.IN.JMP.LISTEN
|
|||||||
|
|
||||||
>PUSHW L.SKT.Template
|
>PUSHW L.SKT.Template
|
||||||
|
|
||||||
jsr SKT.New.Listen
|
jsr SKT.New.Listen Assign SEQNUM
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
sty .1+1
|
sty .1+1
|
||||||
@ -116,7 +116,7 @@ TCP.IN.JMP.LISTEN
|
|||||||
.2 lda #$ff
|
.2 lda #$ff
|
||||||
sta ZPPtrSKT+1
|
sta ZPPtrSKT+1
|
||||||
|
|
||||||
ldy #S.TCP.SEQ.NUMBER+3
|
ldy #S.TCP.SEQ.NUMBER+3 Get Remote SEQ
|
||||||
ldx #3
|
ldx #3
|
||||||
|
|
||||||
sec
|
sec
|
||||||
@ -124,6 +124,7 @@ TCP.IN.JMP.LISTEN
|
|||||||
.3 lda (ZPFrameInPtr),y Set ACK=SEQ+1 for new socket...
|
.3 lda (ZPFrameInPtr),y Set ACK=SEQ+1 for new socket...
|
||||||
adc #0
|
adc #0
|
||||||
sta SKT.TCBCache+S.TCB.ACKNUM,x
|
sta SKT.TCBCache+S.TCB.ACKNUM,x
|
||||||
|
sta SKT.TCBCache+S.TCB.LASTSEQ,x
|
||||||
dey
|
dey
|
||||||
dex
|
dex
|
||||||
bpl .3
|
bpl .3
|
||||||
@ -133,7 +134,7 @@ TCP.IN.JMP.LISTEN
|
|||||||
jsr ARP.AddFromFrameInPtr
|
jsr ARP.AddFromFrameInPtr
|
||||||
|
|
||||||
lda #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK
|
lda #S.TCP.OPTIONS.SYN+S.TCP.OPTIONS.ACK
|
||||||
jsr TCP.OUT.SendOpt
|
jsr TCP.OUT.SendOpt Send SYN.ACK
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
ldy #S.SOCKET.TCP.STATUS
|
ldy #S.SOCKET.TCP.STATUS
|
||||||
@ -157,9 +158,9 @@ TCP.IN.JMP.SYNSENT
|
|||||||
jsr SKT.GetTCB
|
jsr SKT.GetTCB
|
||||||
|
|
||||||
ldx #3
|
ldx #3
|
||||||
ldy #S.TCP.SEQ.NUMBER+3
|
ldy #S.TCP.ACK.NUMBER+3
|
||||||
|
|
||||||
sec
|
sec Check if ACK=my SEQ+1
|
||||||
|
|
||||||
.1 lda SKT.TCBCache+S.TCB.ACKNUM,x
|
.1 lda SKT.TCBCache+S.TCB.ACKNUM,x
|
||||||
adc #0
|
adc #0
|
||||||
@ -192,11 +193,8 @@ TCP.IN.JMP.SYNRCVD
|
|||||||
ldx #3
|
ldx #3
|
||||||
ldy #S.TCP.ACK.NUMBER+3
|
ldy #S.TCP.ACK.NUMBER+3
|
||||||
|
|
||||||
sec
|
.1 lda SKT.TCBCache+S.TCB.NEXTSEQ,x Check if ACK=my SEQ+1
|
||||||
|
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
||||||
.1 lda SKT.TCBCache+S.TCB.SEQNUM,x
|
|
||||||
adc #0
|
|
||||||
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
|
||||||
eor (ZPFrameInPtr),y
|
eor (ZPFrameInPtr),y
|
||||||
bne .8
|
bne .8
|
||||||
dey
|
dey
|
||||||
@ -218,10 +216,11 @@ TCP.IN.JMP.ESTBLSH
|
|||||||
|
|
||||||
ldy #S.TCP.OPTIONS
|
ldy #S.TCP.OPTIONS
|
||||||
lda (ZPFrameInPtr),y
|
lda (ZPFrameInPtr),y
|
||||||
bit #S.TCP.OPTIONS.ACK Remote side ACKed data ?
|
and #S.TCP.OPTIONS.ACK Remote side ACKed data ?
|
||||||
beq .1
|
beq .1
|
||||||
|
|
||||||
jsr SKT.AckDataToSktOut (will call SKT.GetTCB) Yes, Discard sent data
|
jsr SKT.AckDataToSktOut Yes, Discard sent data
|
||||||
|
jsr SKT.StoreTCB and update SKT
|
||||||
|
|
||||||
.1 jsr TCP.IN.SetDataInPtrAndLen
|
.1 jsr TCP.IN.SetDataInPtrAndLen
|
||||||
|
|
||||||
@ -233,19 +232,22 @@ TCP.IN.JMP.ESTBLSH
|
|||||||
|
|
||||||
.2 ldy #S.TCP.OPTIONS
|
.2 ldy #S.TCP.OPTIONS
|
||||||
lda (ZPFrameInPtr),y
|
lda (ZPFrameInPtr),y
|
||||||
bit #S.TCP.OPTIONS.FIN
|
and #S.TCP.OPTIONS.FIN
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
ldy #S.TCP.OPTIONS
|
ldy #S.TCP.OPTIONS
|
||||||
lda (ZPFrameInPtr),y
|
lda (ZPPtrSKT),y
|
||||||
ora #S.TCP.OPTIONS.ACK ACK the FIN....
|
ora #S.TCP.OPTIONS.ACK ACK the FIN....
|
||||||
sta (ZPFrameInPtr),y
|
sta (ZPPtrSKT),y
|
||||||
|
|
||||||
|
jsr TCP.OUT.I SKT.GetTCB called, try to ACK the FIN
|
||||||
|
bcs .9
|
||||||
|
|
||||||
ldy #S.SOCKET.TCP.STATUS
|
ldy #S.SOCKET.TCP.STATUS
|
||||||
lda #S.SOCKET.TCP.STATUS.CLWAIT
|
lda #S.SOCKET.TCP.STATUS.CLWAIT
|
||||||
sta (ZPPtrSKT),y
|
sta (ZPPtrSKT),y
|
||||||
|
|
||||||
.8 jmp TCP.OUT.I SKT.GetTCB called try to ACK
|
.8 clc
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
TCP.IN.JMP.CLWAIT
|
TCP.IN.JMP.CLWAIT
|
||||||
@ -388,7 +390,7 @@ TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTUSED+1
|
|||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
tax
|
tax
|
||||||
bne .1 Y,A=0 : no data to send
|
beq .1 Y,A=0 : no data to send
|
||||||
|
|
||||||
ldy #S.SOCKET.TCP.OPTIONS
|
ldy #S.SOCKET.TCP.OPTIONS
|
||||||
lda (ZPPtrSKT),y
|
lda (ZPPtrSKT),y
|
||||||
@ -411,11 +413,8 @@ TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTUSED+1
|
|||||||
|
|
||||||
ldy #S.SOCKET.TCP.OPTIONS
|
ldy #S.SOCKET.TCP.OPTIONS
|
||||||
lda (ZPPtrSKT),y
|
lda (ZPPtrSKT),y
|
||||||
ora #S.TCP.OPTIONS.ACK
|
jsr TCP.OUT.Send
|
||||||
ldy #S.TCP.OPTIONS
|
|
||||||
sta (ZPFrameOutPtr),y
|
|
||||||
|
|
||||||
.7 jsr TCP.OUT.Send
|
|
||||||
bcs TCP.OUT.9
|
bcs TCP.OUT.9
|
||||||
jmp SKT.StoreTCB
|
jmp SKT.StoreTCB
|
||||||
TCP.OUT.9 rts
|
TCP.OUT.9 rts
|
||||||
@ -425,12 +424,11 @@ TCP.OUT.SendOpt sta .1+1
|
|||||||
jsr TCP.NewFrame
|
jsr TCP.NewFrame
|
||||||
bcs TCP.OUT.9
|
bcs TCP.OUT.9
|
||||||
|
|
||||||
ldy #S.TCP.OPTIONS
|
|
||||||
|
|
||||||
.1 lda #$ff
|
.1 lda #$ff
|
||||||
sta (ZPFrameOutPtr),y
|
|
||||||
|
|
||||||
TCP.OUT.Send ldx #7
|
TCP.OUT.Send ldy #S.TCP.OPTIONS
|
||||||
|
sta (ZPFrameOutPtr),y
|
||||||
|
ldx #7
|
||||||
ldy #S.TCP.SEQ.NUMBER+7
|
ldy #S.TCP.SEQ.NUMBER+7
|
||||||
|
|
||||||
.2 lda SKT.TCBCache+S.TCB.SEQNUM,x
|
.2 lda SKT.TCBCache+S.TCB.SEQNUM,x
|
||||||
|
Loading…
Reference in New Issue
Block a user