Add support for access, chdir and fchdir in knight-posix (needs testing)

This commit is contained in:
Jeremiah Orians 2020-01-18 10:14:51 -05:00
parent aeafd837e7
commit 7b86089f95
No known key found for this signature in database
GPG Key ID: 5410E91C14959E87
3 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,24 @@
/* Copyright (C) 2020 Jeremiah Orians
* This file is part of M2-Planet.
*
* M2-Planet is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* M2-Planet is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
*/
int access(char* pathname, int mode)
{
asm("LOAD R0 R14 0"
"LOAD R1 R14 4"
"ACCESS");
}

View File

@ -0,0 +1,28 @@
/* Copyright (C) 2020 Jeremiah Orians
* This file is part of M2-Planet.
*
* M2-Planet is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* M2-Planet is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
*/
int chdir(char* path)
{
asm("LOAD R0 R14 0"
"CHDIR");
}
int fchdir(int fd)
{
asm("LOAD R0 R14 0"
"FCHDIR");
}

View File

@ -242,8 +242,11 @@ DEFINE JUMP 3C00
DEFINE FOPEN 42000002
DEFINE FCLOSE 42000003
DEFINE FSEEK 42000008
DEFINE ACCESS 42000015
DEFINE EXIT 4200003C
DEFINE UNAME 4200003F
DEFINE CHDIR 42000050
DEFINE FCHDIR 42000051
DEFINE CHMOD 4200005A
DEFINE FGETC 42100100
DEFINE FPUTC 42100200