summaryrefslogtreecommitdiff
path: root/sysroot/include/sys/asm
diff options
context:
space:
mode:
authorkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
committerkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
commit065da3509019b15dd0e678072e6be629e5330bef (patch)
tree69c934c9e786ac048b4fbe8f4c4c5571661521f4 /sysroot/include/sys/asm
parentd130fe27fa753be02ed76fd9b277aa3c3d928eb9 (diff)
downloadlibmcpu-0.4.0.tar.xz
Version 0.4.00.4.0
Diffstat (limited to 'sysroot/include/sys/asm')
-rw-r--r--sysroot/include/sys/asm/dirent.h23
-rw-r--r--sysroot/include/sys/asm/errno.h155
-rw-r--r--sysroot/include/sys/asm/fcntl.h50
-rw-r--r--sysroot/include/sys/asm/mpu-errno.h42
-rw-r--r--sysroot/include/sys/asm/select.h18
-rw-r--r--sysroot/include/sys/asm/stat.h34
-rw-r--r--sysroot/include/sys/asm/syscall.h47
-rw-r--r--sysroot/include/sys/asm/time.h22
-rw-r--r--sysroot/include/sys/asm/types.h16
-rw-r--r--sysroot/include/sys/asm/unistd.h23
10 files changed, 430 insertions, 0 deletions
diff --git a/sysroot/include/sys/asm/dirent.h b/sysroot/include/sys/asm/dirent.h
new file mode 100644
index 0000000..d761bf6
--- /dev/null
+++ b/sysroot/include/sys/asm/dirent.h
@@ -0,0 +1,23 @@
+
+#ifndef __MCPU_SYS_ASM_DIRENT_H
+#define __MCPU_SYS_ASM_DIRENT_H
+
+/* Fixed external MCPU assembler ABI corresponding to struct __cpu_dirent. */
+#define __MCPU_DIRENT_SIZE 288
+#define __MCPU_DIRENT_D_INO 0
+#define __MCPU_DIRENT_D_OFF 8
+#define __MCPU_DIRENT_D_RECLEN 16
+#define __MCPU_DIRENT_D_TYPE 24
+#define __MCPU_DIRENT_D_NAME 32
+#define __MCPU_DIRENT_NAME_SIZE 256
+
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+
+#endif /* __MCPU_SYS_ASM_DIRENT_H */
diff --git a/sysroot/include/sys/asm/errno.h b/sysroot/include/sys/asm/errno.h
new file mode 100644
index 0000000..f018923
--- /dev/null
+++ b/sysroot/include/sys/asm/errno.h
@@ -0,0 +1,155 @@
+
+#ifndef __MCPU_SYS_ASM_ERRNO_H
+#define __MCPU_SYS_ASM_ERRNO_H
+
+/*
+ * Stable MCPU system-call error numbers.
+ *
+ * These are MCPU ABI values. They are not HOST errno numbers even when
+ * the numeric values happen to coincide on a particular HOST system.
+ */
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Argument list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain */
+#define ERANGE 34 /* Math result not representable */
+#define EDEADLK 35 /* Resource deadlock would occur */
+#define ENAMETOOLONG 36 /* File name too long */
+#define ENOLCK 37 /* No record locks available */
+#define ENOSYS 38 /* Invalid system call number */
+#define ENOTEMPTY 39 /* Directory not empty */
+#define ELOOP 40 /* Too many symbolic links encountered */
+
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+
+#define ENOMSG 42 /* No message of desired type */
+#define EIDRM 43 /* Identifier removed */
+#define ECHRNG 44 /* Channel number out of range */
+#define EL2NSYNC 45 /* Level 2 not synchronized */
+#define EL3HLT 46 /* Level 3 halted */
+#define EL3RST 47 /* Level 3 reset */
+#define ELNRNG 48 /* Link number out of range */
+#define EUNATCH 49 /* Protocol driver not attached */
+#define ENOCSI 50 /* No CSI structure available */
+#define EL2HLT 51 /* Level 2 halted */
+#define EBADE 52 /* Invalid exchange */
+#define EBADR 53 /* Invalid request descriptor */
+#define EXFULL 54 /* Exchange full */
+#define ENOANO 55 /* No anode */
+#define EBADRQC 56 /* Invalid request code */
+#define EBADSLT 57 /* Invalid slot */
+
+#define EDEADLOCK EDEADLK /* File locking deadlock */
+
+#define EBFONT 59 /* Bad font file format */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* No data available */
+#define ETIME 62 /* Timer expired */
+#define ENOSR 63 /* Out of streams resources */
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* Object is remote */
+#define ENOLINK 67 /* Link has been severed */
+#define EADV 68 /* Advertise error */
+#define ESRMNT 69 /* Srmount error */
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+#define EMULTIHOP 72 /* Multihop attempted */
+#define EDOTDOT 73 /* RFS specific error */
+#define EBADMSG 74 /* Not a data message */
+#define EOVERFLOW 75 /* Value too large for defined data type */
+#define ENOTUNIQ 76 /* Name not unique on network */
+#define EBADFD 77 /* File descriptor in bad state */
+#define EREMCHG 78 /* Remote address changed */
+#define ELIBACC 79 /* Cannot access a needed shared library */
+#define ELIBBAD 80 /* Accessing a corrupted shared library */
+#define ELIBSCN 81 /* .lib section in a.out corrupted */
+#define ELIBMAX 82 /* Too many shared libraries */
+#define ELIBEXEC 83 /* Cannot exec a shared library directly */
+#define EILSEQ 84 /* Illegal byte sequence */
+#define ERESTART 85 /* Interrupted syscall should be restarted */
+#define ESTRPIPE 86 /* Streams pipe error */
+#define EUSERS 87 /* Too many users */
+#define ENOTSOCK 88 /* Socket operation on non-socket */
+#define EDESTADDRREQ 89 /* Destination address required */
+#define EMSGSIZE 90 /* Message too long */
+#define EPROTOTYPE 91 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 92 /* Protocol not available */
+#define EPROTONOSUPPORT 93 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
+#define EOPNOTSUPP 95 /* Operation not supported */
+#define EPFNOSUPPORT 96 /* Protocol family not supported */
+#define EAFNOSUPPORT 97 /* Address family not supported */
+#define EADDRINUSE 98 /* Address already in use */
+#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
+#define ENETDOWN 100 /* Network is down */
+#define ENETUNREACH 101 /* Network is unreachable */
+#define ENETRESET 102 /* Network dropped connection because of reset */
+#define ECONNABORTED 103 /* Software caused connection abort */
+#define ECONNRESET 104 /* Connection reset by peer */
+#define ENOBUFS 105 /* No buffer space available */
+#define EISCONN 106 /* Transport endpoint is already connected */
+#define ENOTCONN 107 /* Transport endpoint is not connected */
+#define ESHUTDOWN 108 /* Cannot send after endpoint shutdown */
+#define ETOOMANYREFS 109 /* Too many references */
+#define ETIMEDOUT 110 /* Connection timed out */
+#define ECONNREFUSED 111 /* Connection refused */
+#define EHOSTDOWN 112 /* Host is down */
+#define EHOSTUNREACH 113 /* No route to host */
+#define EALREADY 114 /* Operation already in progress */
+#define EINPROGRESS 115 /* Operation now in progress */
+#define ESTALE 116 /* Stale file handle */
+#define EUCLEAN 117 /* Structure needs cleaning */
+#define ENOTNAM 118 /* Not a XENIX named type file */
+#define ENAVAIL 119 /* No XENIX semaphores available */
+#define EISNAM 120 /* Is a named type file */
+#define EREMOTEIO 121 /* Remote I/O error */
+#define EDQUOT 122 /* Quota exceeded */
+#define ENOMEDIUM 123 /* No medium found */
+#define EMEDIUMTYPE 124 /* Wrong medium type */
+#define ECANCELED 125 /* Operation canceled */
+#define ENOKEY 126 /* Required key not available */
+#define EKEYEXPIRED 127 /* Key has expired */
+#define EKEYREVOKED 128 /* Key has been revoked */
+#define EKEYREJECTED 129 /* Key was rejected by service */
+#define EOWNERDEAD 130 /* Owner died */
+#define ENOTRECOVERABLE 131 /* State not recoverable */
+#define ERFKILL 132 /* Operation not possible due to RF-kill */
+#define EHWPOISON 133 /* Memory page has hardware error */
+#define EFTYPE 134 /* Wrong file type for intended operation */
+
+#define ENOTSUP EOPNOTSUPP /* Operation not supported */
+
+#define EUNKNOWN 4095 /* Unknown or unmapped HOST error */
+
+#endif /* __MCPU_SYS_ASM_ERRNO_H */
diff --git a/sysroot/include/sys/asm/fcntl.h b/sysroot/include/sys/asm/fcntl.h
new file mode 100644
index 0000000..921c3b7
--- /dev/null
+++ b/sysroot/include/sys/asm/fcntl.h
@@ -0,0 +1,50 @@
+
+#ifndef __MCPU_SYS_ASM_FCNTL_H
+#define __MCPU_SYS_ASM_FCNTL_H
+
+/* MCPU open(2) ABI flags. They are guest values, not HOST O_* values. */
+#define O_ACCMODE 00000003
+#define O_RDONLY 00000000
+#define O_WRONLY 00000001
+#define O_RDWR 00000002
+#define O_CREAT 00000100
+#define O_EXCL 00000200
+#define O_NOCTTY 00000400
+#define O_TRUNC 00001000
+#define O_APPEND 00002000
+#define O_NONBLOCK 00004000
+
+/* MCPU pipe2(2) descriptor-creation flag. */
+#define O_CLOEXEC 02000000
+
+/* MCPU fcntl(2) commands. These are guest ABI values. */
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+/* Guest descriptor flags. */
+#define FD_CLOEXEC 1
+
+/* MCPU permission/mode bits used by open/creat/mkdir/chmod/fchmod. */
+#define S_ISUID 00004000
+#define S_ISGID 00002000
+#define S_ISVTX 00001000
+
+#define S_IRWXU 00000700
+#define S_IRUSR 00000400
+#define S_IWUSR 00000200
+#define S_IXUSR 00000100
+
+#define S_IRWXG 00000070
+#define S_IRGRP 00000040
+#define S_IWGRP 00000020
+#define S_IXGRP 00000010
+
+#define S_IRWXO 00000007
+#define S_IROTH 00000004
+#define S_IWOTH 00000002
+#define S_IXOTH 00000001
+
+#endif /* __MCPU_SYS_ASM_FCNTL_H */
diff --git a/sysroot/include/sys/asm/mpu-errno.h b/sysroot/include/sys/asm/mpu-errno.h
new file mode 100644
index 0000000..3f42751
--- /dev/null
+++ b/sysroot/include/sys/asm/mpu-errno.h
@@ -0,0 +1,42 @@
+
+#ifndef __MCPU_SYS_ASM_MPU_ERRNO_H
+#define __MCPU_SYS_ASM_MPU_ERRNO_H
+
+/*
+ * MPU -- Math Processor Unit error numbers.
+ *
+ * These values describe the error-state registers of the MCPU mathematical
+ * coprocessor and intentionally preserve the LibMPU 1.0.25 names and values.
+ */
+#define __EUNKNOWN__ 0 /* Unknown error type */
+
+/* Integer error types. */
+#define __I_ESIZE__ 1 /* Invalid size of operand(s) */
+#define __I_ESHIFT__ 2 /* Invalid number of shifts */
+#define __I_ENUMBER__ 3 /* Invalid number */
+#define __I_ERADIX__ 4 /* Invalid radix */
+#define __I_MAX_ERRNO 5
+
+/* Real error types. */
+#define __R_ESIZE__ 1 /* Invalid size of operand(s) */
+#define __R_ETRUNC__ 2 /* Invalid number of TRUNC bits */
+#define __R_MAX_ERRNO 3
+
+/* Complex error types. */
+#define __C_EDIVZEROBYZERO__ 1 /* Complex division by zero */
+#define __C_ELOGOFZERO__ 2 /* LOG of zero magnitude */
+#define __C_EPOWOFZERO__ 3 /* POW of zero magnitude */
+#define __C_MAX_ERRNO 4
+
+/* Math error types. */
+#define __DOMAIN__ 1 /* Argument domain error */
+#define __SING__ 2 /* Argument singularity */
+#define __OVERFLOW__ 3 /* Overflow range error */
+#define __UNDERFLOW__ 4 /* Underflow range error */
+#define __TLOSS__ 5 /* Total loss of precision */
+#define __PLOSS__ 6 /* Partial loss of precision */
+#define __INVALID__ 7 /* Invalid operation */
+#define __INEXACT__ 8 /* Inexact result */
+#define __M_MAX_ERRNO 9
+
+#endif /* __MCPU_SYS_ASM_MPU_ERRNO_H */
diff --git a/sysroot/include/sys/asm/select.h b/sysroot/include/sys/asm/select.h
new file mode 100644
index 0000000..2e3c8d1
--- /dev/null
+++ b/sysroot/include/sys/asm/select.h
@@ -0,0 +1,18 @@
+
+#ifndef __MCPU_SYS_ASM_SELECT_H
+#define __MCPU_SYS_ASM_SELECT_H
+
+#include <sys/asm/time.h>
+
+/* MCPU select(2) descriptor-set ABI. The set covers all 256 guest fd values. */
+#define __MCPU_FD_SETSIZE 256
+#define __MCPU_FD_SET_WORDS 4
+#define __MCPU_FD_SET_SIZE 32
+
+/* A set is four target-order u64 words. Bit n selects guest fd n. */
+#define __MCPU_FD_SET_WORD0 0
+#define __MCPU_FD_SET_WORD1 8
+#define __MCPU_FD_SET_WORD2 16
+#define __MCPU_FD_SET_WORD3 24
+
+#endif /* __MCPU_SYS_ASM_SELECT_H */
diff --git a/sysroot/include/sys/asm/stat.h b/sysroot/include/sys/asm/stat.h
new file mode 100644
index 0000000..dd83d94
--- /dev/null
+++ b/sysroot/include/sys/asm/stat.h
@@ -0,0 +1,34 @@
+
+#ifndef __MCPU_SYS_ASM_STAT_H
+#define __MCPU_SYS_ASM_STAT_H
+
+/* Fixed external MCPU assembler ABI layout corresponding to struct __cpu_stat. */
+#define __MCPU_STAT_SIZE 128
+#define __MCPU_STAT_ST_DEV 0
+#define __MCPU_STAT_ST_INO 8
+#define __MCPU_STAT_ST_MODE 16
+#define __MCPU_STAT_ST_NLINK 24
+#define __MCPU_STAT_ST_UID 32
+#define __MCPU_STAT_ST_GID 40
+#define __MCPU_STAT_ST_RDEV 48
+#define __MCPU_STAT_ST_SIZE 56
+#define __MCPU_STAT_ST_BLKSIZE 64
+#define __MCPU_STAT_ST_BLOCKS 72
+#define __MCPU_STAT_ST_ATIME_SEC 80
+#define __MCPU_STAT_ST_ATIME_NSEC 88
+#define __MCPU_STAT_ST_MTIME_SEC 96
+#define __MCPU_STAT_ST_MTIME_NSEC 104
+#define __MCPU_STAT_ST_CTIME_SEC 112
+#define __MCPU_STAT_ST_CTIME_NSEC 120
+
+/* MCPU st_mode file-type bits. */
+#define S_IFMT 000170000
+#define S_IFIFO 000010000
+#define S_IFCHR 000020000
+#define S_IFDIR 000040000
+#define S_IFBLK 000060000
+#define S_IFREG 000100000
+#define S_IFLNK 000120000
+#define S_IFSOCK 000140000
+
+#endif /* __MCPU_SYS_ASM_STAT_H */
diff --git a/sysroot/include/sys/asm/syscall.h b/sysroot/include/sys/asm/syscall.h
new file mode 100644
index 0000000..9d5d630
--- /dev/null
+++ b/sysroot/include/sys/asm/syscall.h
@@ -0,0 +1,47 @@
+
+#ifndef __MCPU_SYS_ASM_SYSCALL_H
+#define __MCPU_SYS_ASM_SYSCALL_H
+
+/* MCPU system call numbers. */
+#define __NR_brk 10
+#define __NR_gettimeofday 0x01c
+#define __NR_clock_getres 0x021
+#define __NR_clock_gettime 0x022
+#define __NR_nanosleep 0x030
+#define __NR_clock_nanosleep 0x031
+
+#define __NR_read 0x100
+#define __NR_write 0x101
+#define __NR_lseek 0x102
+#define __NR_open 0x103
+#define __NR_creat 0x104
+#define __NR_close 0x105
+#define __NR_link 0x106
+#define __NR_unlink 0x107
+#define __NR_chdir 0x108
+#define __NR_mkdir 0x109
+#define __NR_chmod 0x10b
+#define __NR_chown 0x10c
+#define __NR_access 0x10f
+#define __NR_rename 0x111
+#define __NR_rmdir 0x112
+#define __NR_symlink 0x113
+#define __NR_readlink 0x114
+
+#define __NR_stat 0x115
+#define __NR_fstat 0x116
+#define __NR_lstat 0x117
+#define __NR_fcntl 0x119
+#define __NR_pipe2 0x11a
+#define __NR_getdents 0x11d
+#define __NR_select 0x11e
+#define __NR_fsync 0x120
+#define __NR_truncate 0x121
+#define __NR_ftruncate 0x122
+#define __NR_fchmod 0x123
+#define __NR_fchown 0x124
+#define __NR_fchdir 0x125
+#define __NR_dup 0x126
+#define __NR_dup2 0x127
+
+#endif /* __MCPU_SYS_ASM_SYSCALL_H */
diff --git a/sysroot/include/sys/asm/time.h b/sysroot/include/sys/asm/time.h
new file mode 100644
index 0000000..38932d5
--- /dev/null
+++ b/sysroot/include/sys/asm/time.h
@@ -0,0 +1,22 @@
+
+#ifndef __MCPU_SYS_ASM_TIME_H
+#define __MCPU_SYS_ASM_TIME_H
+
+/* HOST-independent MCPU clock IDs. */
+#define CLOCK_REALTIME 0
+#define CLOCK_MONOTONIC 1
+
+/* MCPU clock_nanosleep(2) flag. */
+#define TIMER_ABSTIME 1
+
+/* Fixed MCPU timeval ABI: two signed 64-bit fields. */
+#define __MCPU_TIMEVAL_SIZE 16
+#define __MCPU_TIMEVAL_TV_SEC 0
+#define __MCPU_TIMEVAL_TV_USEC 8
+
+/* Fixed MCPU timespec ABI: two signed 64-bit fields. */
+#define __MCPU_TIMESPEC_SIZE 16
+#define __MCPU_TIMESPEC_TV_SEC 0
+#define __MCPU_TIMESPEC_TV_NSEC 8
+
+#endif /* __MCPU_SYS_ASM_TIME_H */
diff --git a/sysroot/include/sys/asm/types.h b/sysroot/include/sys/asm/types.h
new file mode 100644
index 0000000..7866f0f
--- /dev/null
+++ b/sysroot/include/sys/asm/types.h
@@ -0,0 +1,16 @@
+
+#ifndef __MCPU_SYS_ASM_TYPES_H
+#define __MCPU_SYS_ASM_TYPES_H
+
+/* Scalar widths of the descriptor-I/O syscall ABI. */
+#define __MCPU_FD_BITS 32
+#define __MCPU_SIZE_BITS 64
+#define __MCPU_SSIZE_BITS 64
+#define __MCPU_OFF_BITS 64
+#define __MCPU_MODE_BITS 32
+#define __MCPU_UID_BITS 64
+#define __MCPU_GID_BITS 64
+#define __MCPU_ID_NO_CHANGE -1
+#define __MCPU_PTR_BITS 64
+
+#endif /* __MCPU_SYS_ASM_TYPES_H */
diff --git a/sysroot/include/sys/asm/unistd.h b/sysroot/include/sys/asm/unistd.h
new file mode 100644
index 0000000..4ff629c
--- /dev/null
+++ b/sysroot/include/sys/asm/unistd.h
@@ -0,0 +1,23 @@
+
+#ifndef __MCPU_SYS_ASM_UNISTD_H
+#define __MCPU_SYS_ASM_UNISTD_H
+
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+/* pipe2(2) writes two u64 guest descriptors to this fixed output array. */
+#define __MCPU_PIPEFD_SIZE 16
+#define __MCPU_PIPEFD_READ 0
+#define __MCPU_PIPEFD_WRITE 8
+
+#define F_OK 0
+#define X_OK 1
+#define W_OK 2
+#define R_OK 4
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#endif /* __MCPU_SYS_ASM_UNISTD_H */