2019-10-11 13:06:33 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
2020-02-14 07:21:56 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # GetPWUID
|
|
|
|
|
* ## C
|
2020-02-17 16:55:02 +00:00
|
|
|
|
* `int getpwuid(short int uid, S.PW *passwd);`
|
2020-02-14 07:21:56 +00:00
|
|
|
|
* ## ASM
|
2020-02-17 16:55:02 +00:00
|
|
|
|
* `PUSHB uid`
|
2020-02-14 07:21:56 +00:00
|
|
|
|
* `>PUSHW passwd`
|
|
|
|
|
* `>SYSCALL getpwuid`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
*\--------------------------------------
|
2023-11-12 13:20:15 +00:00
|
|
|
|
K.GetPWUID .EQ JMP.X1A
|
2022-10-09 21:22:46 +00:00
|
|
|
|
* >PULLW FORPNT
|
|
|
|
|
* >PULLA UID
|
2023-11-12 13:20:15 +00:00
|
|
|
|
* jmp JMP.X
|
2020-03-13 07:15:58 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # GetGRGID
|
|
|
|
|
* ## C
|
|
|
|
|
* `int getgrgid(short int gid, S.GRP *group);`
|
|
|
|
|
* ## ASM
|
|
|
|
|
* `>PUSHB gid`
|
|
|
|
|
* `>PUSHW group`
|
|
|
|
|
* `>SYSCALL getpwname`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
*\--------------------------------------
|
2023-11-12 13:20:15 +00:00
|
|
|
|
K.GetGRGID .EQ JMP.X1A
|
2022-10-09 21:22:46 +00:00
|
|
|
|
* >PULLW FORPNT
|
|
|
|
|
* >PULLA GID
|
2023-11-12 13:20:15 +00:00
|
|
|
|
* jmp JMP.X
|
2020-08-02 12:19:43 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # CloseSession
|
|
|
|
|
* ## C
|
|
|
|
|
* `int closesession(short int hSID);`
|
|
|
|
|
* ## ASM
|
|
|
|
|
* `>PUSHB hSID`
|
|
|
|
|
* `>SYSCALL CloseSession`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
*\--------------------------------------
|
2023-11-12 13:20:15 +00:00
|
|
|
|
K.CloseSession .EQ JMP.X
|
2020-02-14 07:21:56 +00:00
|
|
|
|
*/--------------------------------------
|
2020-07-09 15:13:30 +00:00
|
|
|
|
* # OpenSession
|
|
|
|
|
* ## C
|
|
|
|
|
* `short int hSID opensession(const char *name, const char *passwd);`
|
|
|
|
|
* ## ASM
|
|
|
|
|
* `>PUSHW name`
|
|
|
|
|
* `>PUSHW passwd`
|
|
|
|
|
* `>SYSCALL OpenSession`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
*\--------------------------------------
|
2023-11-12 13:20:15 +00:00
|
|
|
|
K.OpenSession .EQ JMP.X2
|
2021-05-09 12:39:40 +00:00
|
|
|
|
|
2020-07-09 15:13:30 +00:00
|
|
|
|
* >PULLW FORPNT passwd
|
|
|
|
|
* >PULLW TXTPTR name
|
2020-09-10 10:43:37 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
* jmp JMP.X
|
2020-07-09 15:13:30 +00:00
|
|
|
|
*/--------------------------------------
|
2020-02-14 07:21:56 +00:00
|
|
|
|
* # GetPWName
|
|
|
|
|
* ## C
|
2020-02-17 16:55:02 +00:00
|
|
|
|
* `int getpwname(const char* name, S.PW *passwd);`
|
2020-02-14 07:21:56 +00:00
|
|
|
|
* ## ASM
|
2020-02-17 16:55:02 +00:00
|
|
|
|
* `>PUSHW name`
|
2020-02-14 07:21:56 +00:00
|
|
|
|
* `>PUSHW passwd`
|
|
|
|
|
* `>SYSCALL getpwname`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
*\--------------------------------------
|
2023-11-12 13:20:15 +00:00
|
|
|
|
K.GetPWName .EQ JMP.X2
|
2021-05-09 12:39:40 +00:00
|
|
|
|
|
|
|
|
|
* >PULLW FORPNT
|
|
|
|
|
* >PULLW TXTPTR
|
2023-11-12 13:20:15 +00:00
|
|
|
|
* jmp JMP.X
|
2020-03-13 07:15:58 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # GetGRName
|
|
|
|
|
* ## C
|
|
|
|
|
* `int getgrgid(const char* name, S.GRP *group);`
|
|
|
|
|
* ## ASM
|
|
|
|
|
* `>PUSHW name`
|
|
|
|
|
* `>PUSHW group`
|
|
|
|
|
* `>SYSCALL getpwname`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
*\--------------------------------------
|
2023-11-12 13:20:15 +00:00
|
|
|
|
K.GetGRName .EQ JMP.X2
|
2020-09-10 10:43:37 +00:00
|
|
|
|
|
2021-05-09 12:39:40 +00:00
|
|
|
|
* >PULLW FORPNT
|
|
|
|
|
* >PULLW TXTPTR
|
2023-11-12 13:20:15 +00:00
|
|
|
|
* jmp JMP.X
|
2020-02-14 07:21:56 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # PutPW
|
|
|
|
|
* ## C
|
2020-07-09 15:13:30 +00:00
|
|
|
|
* `int putpw(S.PW* passwd);`
|
2020-02-14 07:21:56 +00:00
|
|
|
|
* ## ASM
|
2020-02-17 16:55:02 +00:00
|
|
|
|
* `>PUSHW passwd`
|
2020-02-14 07:21:56 +00:00
|
|
|
|
* `>SYSCALL putpw`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
*\--------------------------------------
|
2020-07-09 15:13:30 +00:00
|
|
|
|
K.PutPW
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # PutGR
|
|
|
|
|
* ## C
|
|
|
|
|
* `int putgr(S.GRP *group);`
|
|
|
|
|
* ## ASM
|
|
|
|
|
* `>PUSHW group`
|
|
|
|
|
* `>SYSCALL putgr`
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.PutGR >PULLW TXTPTR
|
2020-09-10 10:43:37 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
jsr JMP.X
|
2020-07-09 15:13:30 +00:00
|
|
|
|
bcc PWD.FlushFiles
|
2020-09-10 06:28:51 +00:00
|
|
|
|
|
2021-05-04 17:31:21 +00:00
|
|
|
|
rts
|
2020-02-14 07:21:56 +00:00
|
|
|
|
*--------------------------------------
|
2020-07-09 15:13:30 +00:00
|
|
|
|
PWD.FlushFiles
|
2020-03-12 16:44:11 +00:00
|
|
|
|
>LDYA PWD.UsrDBSize
|
|
|
|
|
ldx PWD.hUsrDB
|
2020-07-09 15:13:30 +00:00
|
|
|
|
clc
|
|
|
|
|
jsr PWD.Flush
|
2021-05-04 17:31:21 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
rts
|
2020-07-09 15:13:30 +00:00
|
|
|
|
|
2021-05-04 17:31:21 +00:00
|
|
|
|
.1 >LDYA PWD.GrpDBSize
|
2020-07-09 15:13:30 +00:00
|
|
|
|
ldx PWD.hGrpDB
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
PWD.Flush >STYA PWD.FileSize
|
|
|
|
|
>LDYAI PWD.ETCPASSWD
|
|
|
|
|
bcc .10
|
2020-09-10 10:43:37 +00:00
|
|
|
|
|
2020-07-09 15:13:30 +00:00
|
|
|
|
>LDYAI PWD.ETCGROUP
|
2020-09-10 10:43:37 +00:00
|
|
|
|
|
2020-07-09 15:13:30 +00:00
|
|
|
|
.10 >STYA PWD.FileName
|
2020-09-10 10:43:37 +00:00
|
|
|
|
|
2020-07-09 15:13:30 +00:00
|
|
|
|
>LDYA PWD.FileSize
|
2020-09-10 06:28:51 +00:00
|
|
|
|
|
2020-07-09 15:13:30 +00:00
|
|
|
|
jsr MEM.CopyToMain X = src Aux hMem
|
2019-10-11 13:06:33 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
stx .8+1
|
|
|
|
|
|
2020-07-09 15:13:30 +00:00
|
|
|
|
>PUSHW PWD.FileName
|
2019-10-11 13:06:33 +00:00
|
|
|
|
>PUSHBI O.WRONLY+O.CREATE
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHBI S.FI.T.TXT
|
|
|
|
|
>PUSHWZ Aux type
|
|
|
|
|
>SYSCALL2 FOpen
|
2019-10-11 13:06:33 +00:00
|
|
|
|
bcc .1
|
2020-09-10 10:43:37 +00:00
|
|
|
|
|
2019-10-11 13:06:33 +00:00
|
|
|
|
pha
|
|
|
|
|
jsr .8
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
.1 sta .7+1
|
|
|
|
|
|
2021-05-14 20:58:20 +00:00
|
|
|
|
>PUSHA
|
2019-10-11 13:06:33 +00:00
|
|
|
|
lda .8+1
|
|
|
|
|
jsr K.getmemptr
|
|
|
|
|
>PUSHYA
|
2021-05-14 20:58:20 +00:00
|
|
|
|
>PUSHW PWD.FileSize
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>SYSCALL2 FWrite
|
2019-10-11 13:06:33 +00:00
|
|
|
|
bcc .7
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
jsr .7
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.7 lda #$ff SELF MODIFIED
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>SYSCALL2 fclose
|
|
|
|
|
|
2019-10-11 13:06:33 +00:00
|
|
|
|
.8 lda #$ff
|
|
|
|
|
jmp K.freemem SELF MODIFIED
|
|
|
|
|
*--------------------------------------
|
2020-03-12 16:44:11 +00:00
|
|
|
|
PWD.ETCPASSWD .AZ "${ROOT}etc/passwd"
|
|
|
|
|
PWD.hUsrDB .BS 1
|
|
|
|
|
PWD.UsrDBSize .BS 2
|
|
|
|
|
PWD.ETCGROUP .AZ "${ROOT}etc/group"
|
|
|
|
|
PWD.hGrpDB .BS 1
|
|
|
|
|
PWD.GrpDBSize .BS 2
|
2020-07-09 15:13:30 +00:00
|
|
|
|
PWD.FileSize .BS 2
|
|
|
|
|
PWD.FileName .BS 2
|
2019-10-11 13:06:33 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-07-08 15:26:23 +00:00
|
|
|
|
SAVE usr/src/sys/kernel.s.pwd
|
|
|
|
|
LOAD usr/src/sys/kernel.s
|
2019-10-11 13:06:33 +00:00
|
|
|
|
ASM
|