Kernel 0.93

This commit is contained in:
Rémy GIBERT 2019-04-17 07:22:23 +01:00
parent 2232b123ed
commit 7df7823042
6 changed files with 86 additions and 27 deletions

View File

@ -19,11 +19,13 @@ PASS.MAX .EQ 64
ZS.START
ZPPWPtr .BS 2
ZPhPW .BS 1
ZPStrPtr .BS 2
ZPhStr .BS 1
ZPbStrSecret .BS 1
ZPStrLen .BS 1
ZPStrMax .BS 1
ArgCount .BS 1
ArgUsername .BS 1
ZPStrPtr .BS 2
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -52,6 +54,7 @@ L.MSG.ROOTPWD1 .DA MSG.ROOTPWD1
L.MSG.ROOTPWD2 .DA MSG.ROOTPWD2
L.MSG.MISMATCH .DA MSG.MISMATCH
L.MSG.BS .DA MSG.BS
L.MSG.CRLF .DA MSG.CRLF
.DA 0
*--------------------------------------
* Called once at process creation
@ -87,23 +90,20 @@ CS.RUN >LDYAI S.PW
jmp CS.RUN.ROOT
.1
.1 jsr CS.RUN.CheckArg
bcs .99
>PUSHBI 0
>LDYA L.MSG.USAGE
>SYSCALL printf
.8 lda #0
sec
rts
.9 lda #E.SYN
lda #E.SYN
sec
.99 rts
*--------------------------------------
CS.RUN.ROOT ldy #0
.1 lda ROOT.PW,y
.1 lda PW.ROOT,y
sta (pData),y PW
iny
cpy #S.PW
@ -161,7 +161,6 @@ CS.RUN.ROOT ldy #0
*--------------------------------------
CS.RUN.GetStr stz ZPStrLen
.1 >SYSCALL getchar
bcs .9
@ -207,10 +206,59 @@ CS.RUN.GetStr stz ZPStrLen
lda #0
sta (ZPStrPtr),y
clc
>PUSHBI 0
>LDYA L.MSG.CRLF
>SYSCALL printf
.9 rts
*--------------------------------------
CS.RUN.CheckArg
.1 inc ArgCount
lda ArgCount
>SYSCALL ArgV
bcs .8
>STYA ZPStrPtr
lda (ZPStrPtr)
cmp #'-'
bne .4
ldy #1
lda (ZPStrPtr),y
ldx OptionList
.2 cmp OptionList,x
beq .3
dex
bne .2
lda #E.SYN
sec
rts
.3 ldy OptionVars-1,x
lda #$80
sta (pData),y
bra .1
.4 lda ArgUsername
bne .9
ldy #$ff
.5 iny
lda (ZPStrPtr),y
sta
lda ArgCount
sta ArgUsername
bra .1
.9 lda #E.SYN
sec
rts
*--------------------------------------
* Called if option S.PS.F.EVENT enabled in Header
* Timer Event : every 10th seconds
*--------------------------------------
@ -240,6 +288,8 @@ CS.QUIT lda ZPhStr
*--------------------------------------
CS.END
*--------------------------------------
OptionList >PSTR "CDPScdps"
*--------------------------------------
* Initialized DATA
*--------------------------------------
LIBCRYPT .AZ "libcrypt"
@ -256,7 +306,7 @@ MSG.ROOTPWD2 .AZ "\r\nPlease retype ROOT password : "
MSG.MISMATCH .AZ "\r\nPasswords mismatch...\r\n"
MSG.BS .DA #C.BS,#C.SPACE,#C.BS,#0
*--------------------------------------
ROOT.PW .AS "ROOT"
PW.ROOT .AS "ROOT"
.BS 17-4
.BS 33 PASSWD
.DA #0 UID
@ -268,6 +318,16 @@ ROOT.PW .AS "ROOT"
.AS "${ROOT}BIN/SH"
.BS 65-13
*--------------------------------------
PW.DEFAULT .BS 17 NAME
.BS 33 PASSWD
.DA #0 UID
.DA #0 GID
.BS 65 GECOS
.AS "${ROOT}USR/"
.BS 65-11
.AS "${ROOT}BIN/SH"
.BS 65-13
*--------------------------------------
* Per Process DATA segment
*--------------------------------------
.DUMMY

View File

@ -50,7 +50,7 @@ CS.RUN >LDYA L.MSG0
ldx #1
stx USRID
.1 lda S.Table.hPW-1,x
.1 lda S.Table.hSession-1,x
beq .7
lda S.Table.hFile-1,x
@ -61,7 +61,7 @@ CS.RUN >LDYA L.MSG0
>PUSHYA
ldx USRID
lda S.Table.hPW-1,x
lda S.Table.hSession-1,x
>SYSCALL GetMemPtr
>STYA ZPPWPtr

View File

@ -21,7 +21,7 @@ PS.Table.Stats .EQ $13E0 K.PS.MAX
OF.Table.hPath .EQ $1400 K.OF.MAX
OF.Table.hFD .EQ $1420 K.OF.MAX
*--------------------------------------
S.Table.hPW .EQ $1440 K.USR.MAX
S.Table.hSession .EQ $1440 K.USR.MAX
S.Table.hFile .EQ $1450 K.USR.MAX
*--------------------------------------
A2osX.EndTables .EQ $1460

View File

@ -15,7 +15,6 @@ NEW
.OR ZPBIN
ZS.START
ZPUsrID .BS 1
ZPUsrPtr .BS 2
ZPShellPtr .BS 2
ZPRetryCnt .BS 1
@ -169,7 +168,7 @@ CS.RUN.NOAUTH >PUSHBI 0
CS.RUN.EXEC ldx #1
.1 lda S.Table.hPW-1,x
.1 lda S.Table.hSession-1,x
beq .2
inx
cpx #K.USR.MAX+1
@ -185,9 +184,9 @@ CS.RUN.EXEC ldx #1
ldy #S.PS.hSID
sta (pPS),y
txa
lda ZPhSID
ldx ZPUsrID
sta S.Table.hPW-1,x
sta S.Table.hSession-1,x
ldy #S.PS.hStdIn
lda (pPS),y
@ -204,8 +203,8 @@ CS.RUN.EXEC ldx #1
>SLEEP
ldx ZPUsrID
lda S.Table.hPW-1,x
stz S.Table.hPW-1,x
lda S.Table.hSession-1,x
stz S.Table.hSession-1,x
stz S.Table.hFILE-1,x
>SYSCALL freemem
@ -213,7 +212,7 @@ CS.RUN.EXEC ldx #1
*--------------------------------------
CS.RUN.SetRootSession
>LDYA L.SESSION.ROOT
>STYA ZPUsrPtr
>STYA ZPStrPtr
>LDYAI SESSION.ROOT.Size
>SYSCALL getmem
@ -223,10 +222,10 @@ CS.RUN.SetRootSession
ldy #SESSION.ROOT.Size-1
.2 lda (ZPUsrPtr),y
.1 lda (ZPStrPtr),y
sta (pSession),y
dey
bpl .2
bpl .1
* clc
.9 rts

View File

@ -395,7 +395,7 @@ CORE.PSSelect ldy #S.PS.ZP+ZPBIN.SIZE-1
ldy #S.PS.hSID
lda (pPs),y
tax
lda S.Table.hPW-1,x
lda S.Table.hSession-1,x
jsr K.GetmemPtr
>STYA pSession

View File

@ -336,7 +336,7 @@ MemMgrInit >LDYAI Mem.MHiMem
ldx #K.USR.MAX*2-1
.6 stz S.Table.hPW,x
.6 stz S.Table.hSession,x
dex
bpl .6
@ -1089,7 +1089,7 @@ PwdMgrInit >LDYAI MSG.PWD
.1 >LDYAI PwdMgr.ROOT.Size
jsr K.Getmem
>STYA pSession
stx S.Table.hPW
stx S.Table.hSession
ldy #PwdMgr.ROOT.Size-1