mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-14 13:29:02 +00:00
Kernel 0.9.1 : BugFix in Memory manager, memory leaks...
This commit is contained in:
parent
98c99b0ad2
commit
4cae83f359
Binary file not shown.
Binary file not shown.
@ -324,8 +324,7 @@ BlkCnt .BS 1
|
|||||||
BlkParams.Ptr .BS 2
|
BlkParams.Ptr .BS 2
|
||||||
BlkParams.Num .BS 2
|
BlkParams.Num .BS 2
|
||||||
hBuf .BS 1
|
hBuf .BS 1
|
||||||
DS.END
|
DS.END .ED
|
||||||
.ED
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
MAN
|
MAN
|
||||||
SAVE /A2OSX.SRC/BIN/FORMAT.S
|
SAVE /A2OSX.SRC/BIN/FORMAT.S
|
||||||
|
@ -24,9 +24,10 @@ CS.START cld
|
|||||||
.DA #$61 6502,Level 1 (65c02)
|
.DA #$61 6502,Level 1 (65c02)
|
||||||
.DA #1 BIN Layout Version 1
|
.DA #1 BIN Layout Version 1
|
||||||
.DA 0
|
.DA 0
|
||||||
.DA CS.END-CS.START Code Length To Relocate
|
.DA CS.END-CS.START CS
|
||||||
.DA 0 Data Segment to Allocate
|
.DA DS.END-DS.START DS
|
||||||
.DA 0
|
.DA #16 SS
|
||||||
|
.DA #6 ZP
|
||||||
.DA 0
|
.DA 0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Relocation Table
|
* Relocation Table
|
||||||
@ -60,7 +61,7 @@ L.DevName .DA DevName
|
|||||||
.DA 0
|
.DA 0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.INIT >LDYA L.LIBTCPIP
|
CS.INIT >LDYA L.LIBTCPIP
|
||||||
>SYSCALL LoadLibYA
|
>SYSCALL LoadLib.YA
|
||||||
bcs .9
|
bcs .9
|
||||||
sta hLIBTCPIP
|
sta hLIBTCPIP
|
||||||
clc
|
clc
|
||||||
@ -81,7 +82,7 @@ CS.RUN >LDYA L.MSG0
|
|||||||
jmp CS.RUN.DONE
|
jmp CS.RUN.DONE
|
||||||
|
|
||||||
CS.RUN.DUMPDEV sta DevID
|
CS.RUN.DUMPDEV sta DevID
|
||||||
>SYSCALL GetDevByIDA
|
>SYSCALL GetDevByID.A
|
||||||
>STYA ZPDevPtr
|
>STYA ZPDevPtr
|
||||||
>STYA NetDevJmp+1
|
>STYA NetDevJmp+1
|
||||||
|
|
||||||
@ -259,13 +260,13 @@ CS.QUIT lda hLIBTCPIP
|
|||||||
NetDevJmp jmp *
|
NetDevJmp jmp *
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.END
|
CS.END
|
||||||
LIBTCPIP >PSTR "libtcpip.o"
|
LIBTCPIP >CSTR "libtcpip.o"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
MSG0 >CSTR "TCP/IP Status : "
|
MSG0 >CSTR "TCP/IP Status : "
|
||||||
MSG0.L >CSTR "Loaded\r\n"
|
MSG0.L >CSTR "Loaded\r\n"
|
||||||
MSG0.NL >CSTR "Not Loaded\r\n"
|
MSG0.NL >CSTR "Not Loaded\r\n"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
MSG1.DEV >CSTR "\r\nDevice Configuration :\r\n DevID : $%h\r\n Device Type : %S\r\n Device Name : %S\r\n HW Address : %02h:%02h:%02h:%02h:%02h:%02h\r\n"
|
MSG1.DEV >CSTR "\r\nDevice Configuration :\r\n DevID : $%h\r\n Device Type : %S\r\n Device Name : %s\r\n HW Address : %02h:%02h:%02h:%02h:%02h:%02h\r\n"
|
||||||
MSG1.DEV.ARP >CSTR " ARP Offload : %d\r\n"
|
MSG1.DEV.ARP >CSTR " ARP Offload : %d\r\n"
|
||||||
MSG1.DEV.IP >CSTR " IP Offload : %d\r\n"
|
MSG1.DEV.IP >CSTR " IP Offload : %d\r\n"
|
||||||
MSG1.LINK >CSTR " Link Status : %s\r\n"
|
MSG1.LINK >CSTR " Link Status : %s\r\n"
|
||||||
@ -286,6 +287,12 @@ MSG2.HOSTNAME >CSTR " Hostname : %S.%S\r\n"
|
|||||||
hLIBTCPIP .BS 1
|
hLIBTCPIP .BS 1
|
||||||
DevID .BS 1
|
DevID .BS 1
|
||||||
DevName .BS 5
|
DevName .BS 5
|
||||||
|
*--------------------------------------
|
||||||
|
.DUMMY
|
||||||
|
.OR 0
|
||||||
|
DS.START
|
||||||
|
DS.END .ED
|
||||||
|
*--------------------------------------
|
||||||
MAN
|
MAN
|
||||||
SAVE /A2OSX.SRC/BIN/IPCONFIG.S
|
SAVE /A2OSX.SRC/BIN/IPCONFIG.S
|
||||||
ASM
|
ASM
|
||||||
|
@ -246,7 +246,7 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN+1
|
|||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
.11 tya
|
.11 tya
|
||||||
beq .2 Startig with 0...assume BIN
|
beq .2 Startig with 0...PrintHEX
|
||||||
|
|
||||||
>PUSHW ZPPTR2 String
|
>PUSHW ZPPTR2 String
|
||||||
tya Len
|
tya Len
|
||||||
@ -266,6 +266,7 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN+1
|
|||||||
.7 >SYSCALL GetMemPtr.A
|
.7 >SYSCALL GetMemPtr.A
|
||||||
>PUSHYA
|
>PUSHYA
|
||||||
>LDYA L.MSG1.BIN
|
>LDYA L.MSG1.BIN
|
||||||
|
|
||||||
.8 >SYSCALL PrintF.YA
|
.8 >SYSCALL PrintF.YA
|
||||||
|
|
||||||
>INC.G LINE.COUNT
|
>INC.G LINE.COUNT
|
||||||
@ -291,7 +292,7 @@ CS.END
|
|||||||
MSG0 >CSTR " # Flags PID REF PTR LEN BINPATH/DATA\r\n"
|
MSG0 >CSTR " # Flags PID REF PTR LEN BINPATH/DATA\r\n"
|
||||||
MSG1.INV >CSTR "\e[7m"
|
MSG1.INV >CSTR "\e[7m"
|
||||||
MSG1 >CSTR "%03d %s %03d %03d $%H %05D "
|
MSG1 >CSTR "%03d %s %03d %03d $%H %05D "
|
||||||
MSG1.BIN >CSTR "{BIN:%s}\e[0m\r\n"
|
MSG1.BIN >CSTR "{%s}\e[0m\r\n"
|
||||||
MSG1.STR >CSTR "[%03d:%s]\e[0m\r\n"
|
MSG1.STR >CSTR "[%03d:%s]\e[0m\r\n"
|
||||||
MSG1.HEX >CSTR "?HEX:%h%h.%h%h.%h%h.%h%h.%h%h.%h%h.%h%h.%h%h\e[0m\r\n"
|
MSG1.HEX >CSTR "?HEX:%h%h.%h%h.%h%h.%h%h.%h%h.%h%h.%h%h.%h%h\e[0m\r\n"
|
||||||
MSG2 >CSTR "\r\nAllocated hMem:%d, Total:%d\r\n"
|
MSG2 >CSTR "\r\nAllocated hMem:%d, Total:%d\r\n"
|
||||||
|
@ -22,7 +22,7 @@ CFG.Read >PUSHW L.HOSTNAME
|
|||||||
>PUSHW L.HOSTS
|
>PUSHW L.HOSTS
|
||||||
>LDYA L.MSG.CFG
|
>LDYA L.MSG.CFG
|
||||||
>SYSCALL PrintF.YA
|
>SYSCALL PrintF.YA
|
||||||
rts
|
|
||||||
jsr CFG.Read.HOSTS
|
jsr CFG.Read.HOSTS
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CFG.Read.Result bcc .1
|
CFG.Read.Result bcc .1
|
||||||
|
@ -34,26 +34,14 @@ MemMgr.ReqFlags .EQ ZPMEMMGR+6 store requested Flags
|
|||||||
*\--------------------------------------
|
*\--------------------------------------
|
||||||
K.GetMem >PULLB MemMgr.ReqFlags store requested flags
|
K.GetMem >PULLB MemMgr.ReqFlags store requested flags
|
||||||
|
|
||||||
clc
|
|
||||||
>PULLA get requested size LO
|
>PULLA get requested size LO
|
||||||
bit #$0F 16 bytes aligned ?
|
tay
|
||||||
beq .1 yes, request it
|
|
||||||
|
|
||||||
and #$F0 align on 16 bytes
|
|
||||||
adc #$10
|
|
||||||
|
|
||||||
.1 sta MemMgr.ReqSize
|
|
||||||
|
|
||||||
>PULLA get requested size HI
|
>PULLA get requested size HI
|
||||||
adc #0
|
|
||||||
sta MemMgr.ReqSize+1
|
sta MemMgr.ReqSize+1
|
||||||
|
|
||||||
bit MemMgr.ReqFlags S.MEM.F.AUX ?
|
bit MemMgr.ReqFlags S.MEM.F.AUX ?
|
||||||
bpl K.GetMem.I
|
bpl K.GetMem.I
|
||||||
|
|
||||||
and #S.MEM.F.AUX
|
|
||||||
beq .1
|
|
||||||
|
|
||||||
sta SETREADAUX Aux Mem requested,switch to AUX
|
sta SETREADAUX Aux Mem requested,switch to AUX
|
||||||
sta SETWRITEAUX
|
sta SETWRITEAUX
|
||||||
|
|
||||||
@ -62,7 +50,7 @@ K.GetMem >PULLB MemMgr.ReqFlags store requested flags
|
|||||||
sta CLRREADAUX
|
sta CLRREADAUX
|
||||||
sta CLRWRITEAUX
|
sta CLRWRITEAUX
|
||||||
|
|
||||||
.9 rts
|
rts
|
||||||
*/--------------------------------------
|
*/--------------------------------------
|
||||||
* # GetMem0.YA
|
* # GetMem0.YA
|
||||||
* ## In:
|
* ## In:
|
||||||
@ -74,7 +62,7 @@ K.GetMem >PULLB MemMgr.ReqFlags store requested flags
|
|||||||
* CS :
|
* CS :
|
||||||
* A = EC
|
* A = EC
|
||||||
*\--------------------------------------
|
*\--------------------------------------
|
||||||
K.GetMem0.YA ldx #S.MEM.F.INIT0
|
K.GetMem0.YA ldx #S.MEM.F.INIT0
|
||||||
stx MemMgr.ReqFlags
|
stx MemMgr.ReqFlags
|
||||||
.HS 2C bit abs
|
.HS 2C bit abs
|
||||||
*/--------------------------------------
|
*/--------------------------------------
|
||||||
@ -90,19 +78,20 @@ K.GetMem0.YA ldx #S.MEM.F.INIT0
|
|||||||
*\--------------------------------------
|
*\--------------------------------------
|
||||||
K.GetMem.YA stz MemMgr.ReqFlags
|
K.GetMem.YA stz MemMgr.ReqFlags
|
||||||
sta MemMgr.ReqSize+1
|
sta MemMgr.ReqSize+1
|
||||||
tya
|
|
||||||
|
K.GetMem.I tya
|
||||||
bit #$0F 16 bytes aligned ?
|
bit #$0F 16 bytes aligned ?
|
||||||
beq .1 yes, request it
|
beq .10 yes, request it
|
||||||
|
|
||||||
and #$F0 align on 16 bytes
|
and #$F0 align on 16 bytes
|
||||||
clc
|
clc
|
||||||
adc #$10
|
adc #$10
|
||||||
bcc .1
|
bcc .10
|
||||||
inc MemMgr.ReqSize+1
|
inc MemMgr.ReqSize+1
|
||||||
|
|
||||||
.1 sta MemMgr.ReqSize
|
.10 sta MemMgr.ReqSize
|
||||||
|
|
||||||
K.GetMem.I >LDYAI MemMgr.Table
|
>LDYAI MemMgr.Table
|
||||||
>STYA ZPMemMgrSPtr
|
>STYA ZPMemMgrSPtr
|
||||||
|
|
||||||
ldx #0 Current slot=0
|
ldx #0 Current slot=0
|
||||||
@ -325,24 +314,30 @@ K.FreeMem.A phy
|
|||||||
|
|
||||||
jsr K.GetMemByID.A X unmodified
|
jsr K.GetMemByID.A X unmodified
|
||||||
lda (ZPMemMgrSPtr)
|
lda (ZPMemMgrSPtr)
|
||||||
bmi .8
|
bmi .8 used, exit
|
||||||
|
|
||||||
ldy #S.MEM.LEN
|
.2 dec MemMgr.LastSlot free! get previous....
|
||||||
lda (ZPMemMgrSPtr),y give back LEN bytes
|
beq .3 empty list: go set MemMgr.Free=MemMgr.HiMem
|
||||||
clc
|
|
||||||
adc MemMgr.Free to MemMgr.Free
|
lda MemMgr.LastSlot
|
||||||
|
jsr K.GetMemByID.A X unmodified
|
||||||
|
lda (ZPMemMgrSPtr)
|
||||||
|
bpl .2 free again! loop
|
||||||
|
|
||||||
|
ldy #S.MEM.PTR
|
||||||
|
lda (ZPMemMgrSPtr),y set MemMgr.Free...
|
||||||
sta MemMgr.Free
|
sta MemMgr.Free
|
||||||
iny
|
iny
|
||||||
lda (ZPMemMgrSPtr),y
|
lda (ZPMemMgrSPtr),y
|
||||||
adc MemMgr.Free+1
|
|
||||||
sta MemMgr.Free+1
|
sta MemMgr.Free+1
|
||||||
|
|
||||||
dec MemMgr.LastSlot discard last slot
|
|
||||||
bne .1 no slot left, exit
|
|
||||||
|
|
||||||
.8 ply
|
.8 ply
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
.3 >LDYA MemMgr.HiMem
|
||||||
|
>STYA MemMgr.Free
|
||||||
|
bra .8
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.9 ply discard saved Y
|
.9 ply discard saved Y
|
||||||
|
|
||||||
@ -454,10 +449,11 @@ K.GetMemByID.A sta ZPMemMgrSPtr
|
|||||||
K.NewStr.YA >STYA .1+1
|
K.NewStr.YA >STYA .1+1
|
||||||
>STYA .4+1
|
>STYA .4+1
|
||||||
|
|
||||||
ldy #0
|
|
||||||
stz MemMgr.ReqFlags
|
stz MemMgr.ReqFlags
|
||||||
stz MemMgr.ReqSize+1
|
stz MemMgr.ReqSize+1
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
|
||||||
.1 lda $ffff,y
|
.1 lda $ffff,y
|
||||||
beq .2
|
beq .2
|
||||||
iny
|
iny
|
||||||
@ -466,13 +462,11 @@ K.NewStr.YA >STYA .1+1
|
|||||||
inc .1+2
|
inc .1+2
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
.2 iny
|
.2 iny Add one for ending 0
|
||||||
bne .3
|
bne .3
|
||||||
inc MemMgr.ReqSize+1
|
inc MemMgr.ReqSize+1
|
||||||
|
|
||||||
.3 sty MemMgr.ReqSize
|
.3 jsr K.GetMem.I
|
||||||
|
|
||||||
jsr K.GetMem.I
|
|
||||||
bcs .9
|
bcs .9
|
||||||
>STYA .5+1
|
>STYA .5+1
|
||||||
|
|
||||||
|
@ -76,6 +76,9 @@ PS.CreateChild ldx #0
|
|||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
.99 plx
|
||||||
|
rts
|
||||||
|
|
||||||
.3 inc CORE.PSCount
|
.3 inc CORE.PSCount
|
||||||
|
|
||||||
.31 phx save PS inex
|
.31 phx save PS inex
|
||||||
@ -100,6 +103,10 @@ PS.CreateChild ldx #0
|
|||||||
plx
|
plx
|
||||||
sta PS.Table.hMem,x
|
sta PS.Table.hMem,x
|
||||||
|
|
||||||
|
lda CORE.LastPSID Set Ownership
|
||||||
|
ldy #S.MEM.OWNERPID
|
||||||
|
sta (ZPMEMMGR),y
|
||||||
|
|
||||||
ldy #S.PS.PID
|
ldy #S.PS.PID
|
||||||
lda CORE.LastPSID
|
lda CORE.LastPSID
|
||||||
sta (ZPPtr3),y
|
sta (ZPPtr3),y
|
||||||
@ -108,7 +115,7 @@ PS.CreateChild ldx #0
|
|||||||
bit K.CreateProcess.Flags need to create ENV & Prefix ?
|
bit K.CreateProcess.Flags need to create ENV & Prefix ?
|
||||||
beq .6 no...
|
beq .6 no...
|
||||||
|
|
||||||
sta (ZPPtr3) Mark this PS with ENV flag
|
sta (ZPPtr3) Mark this PS with DUPENV flag
|
||||||
|
|
||||||
ldy #S.PS.hPREFIX copy hPREFIX...
|
ldy #S.PS.hPREFIX copy hPREFIX...
|
||||||
lda (pPs),y
|
lda (pPs),y
|
||||||
@ -116,7 +123,7 @@ PS.CreateChild ldx #0
|
|||||||
jsr K.NewStr.YA
|
jsr K.NewStr.YA
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
lda CORE.LastPSID Set this copy ownership
|
lda CORE.LastPSID Set Ownership
|
||||||
ldy #S.MEM.OWNERPID
|
ldy #S.MEM.OWNERPID
|
||||||
sta (ZPMEMMGR),y
|
sta (ZPMEMMGR),y
|
||||||
|
|
||||||
@ -171,9 +178,6 @@ PS.CreateChild ldx #0
|
|||||||
sta (pPs),y
|
sta (pPs),y
|
||||||
|
|
||||||
clc Exit with A=PSID
|
clc Exit with A=PSID
|
||||||
rts
|
|
||||||
|
|
||||||
.99 plx
|
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
PS.CmdLine2Args >STYA ZPPtr1
|
PS.CmdLine2Args >STYA ZPPtr1
|
||||||
@ -206,6 +210,10 @@ PS.CmdLine2Args >STYA ZPPtr1
|
|||||||
ldy #S.PS.hARGS
|
ldy #S.PS.hARGS
|
||||||
sta (ZPPtr3),y
|
sta (ZPPtr3),y
|
||||||
|
|
||||||
|
lda CORE.LastPSID Set Ownership
|
||||||
|
ldy #S.MEM.OWNERPID
|
||||||
|
sta (ZPMEMMGR),y
|
||||||
|
|
||||||
stz PS.CmdLine2Args.bInQuote
|
stz PS.CmdLine2Args.bInQuote
|
||||||
|
|
||||||
ldy #$ff
|
ldy #$ff
|
||||||
@ -299,6 +307,10 @@ PS.Init jsr BIN.Load.YA Y,A=filename full path
|
|||||||
ldy #S.PS.hDS
|
ldy #S.PS.hDS
|
||||||
sta (ZPPtr3),y save DS hMem in S.PS
|
sta (ZPPtr3),y save DS hMem in S.PS
|
||||||
|
|
||||||
|
lda CORE.LastPSID Set Ownership
|
||||||
|
ldy #S.MEM.OWNERPID
|
||||||
|
sta (ZPMEMMGR),y
|
||||||
|
|
||||||
.2 ldy #H.BIN.EXE.SS.SIZE
|
.2 ldy #H.BIN.EXE.SS.SIZE
|
||||||
lda (ZPPtr4),y Load SS.SIZE
|
lda (ZPPtr4),y Load SS.SIZE
|
||||||
ldy #S.PS.Context+4
|
ldy #S.PS.Context+4
|
||||||
@ -323,6 +335,10 @@ PS.Init jsr BIN.Load.YA Y,A=filename full path
|
|||||||
ldy #S.PS.hSS
|
ldy #S.PS.hSS
|
||||||
sta (ZPPtr3),y save SS hMem in S.PS
|
sta (ZPPtr3),y save SS hMem in S.PS
|
||||||
|
|
||||||
|
lda CORE.LastPSID Set Ownership
|
||||||
|
ldy #S.MEM.OWNERPID
|
||||||
|
sta (ZPMEMMGR),y
|
||||||
|
|
||||||
clc
|
clc
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user