summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-03-14 12:02:36 -0400
committerIan Moffett <ian@osmora.org>2025-03-14 12:02:36 -0400
commit509942a2f0167032e96b5130aebf95dfa1d14c4c (patch)
tree4737ad5b9e6675cd17034e3e53d76784287fd415 /sys/include
parent6ceef43179c70852f001f1205ff92ebba4d0d4d7 (diff)
parentf7b53e3e49c428e7cee7ebe51ebcb261c9d4f02a (diff)
Merge branch 'expt'
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/dev/cons/cons.h3
-rw-r--r--sys/include/sys/cdefs.h1
-rw-r--r--sys/include/sys/driver.h1
-rw-r--r--sys/include/sys/fcntl.h5
-rw-r--r--sys/include/sys/filedesc.h2
-rw-r--r--sys/include/sys/mmio.h4
-rw-r--r--sys/include/sys/syscall.h1
-rw-r--r--sys/include/sys/termios.h53
-rw-r--r--sys/include/sys/vfs.h1
-rw-r--r--sys/include/sys/vnode.h2
-rw-r--r--sys/include/vm/vm_pager.h5
11 files changed, 75 insertions, 3 deletions
diff --git a/sys/include/dev/cons/cons.h b/sys/include/dev/cons/cons.h
index fe7eb6d..8e2c2c6 100644
--- a/sys/include/dev/cons/cons.h
+++ b/sys/include/dev/cons/cons.h
@@ -31,6 +31,7 @@
#define _DEV_CONS_H_
#include <sys/types.h>
+#include <sys/spinlock.h>
#include <dev/video/fbdev.h>
struct cons_char {
@@ -53,9 +54,11 @@ struct cons_screen {
uint32_t curs_col; /* Cursor col */
uint32_t curs_row; /* Cursor row */
struct cons_char last_chr;
+ struct spinlock lock;
};
void cons_init(void);
+void cons_expose(void);
int cons_putch(struct cons_screen *scr, char c);
extern struct cons_screen g_root_scr;
diff --git a/sys/include/sys/cdefs.h b/sys/include/sys/cdefs.h
index 4103896..37e15d7 100644
--- a/sys/include/sys/cdefs.h
+++ b/sys/include/sys/cdefs.h
@@ -42,6 +42,7 @@
#define __likely(exp) __builtin_expect(((exp) != 0), 1)
#define __unlikely(exp) __builtin_expect(((exp) != 0), 0)
#define __static_assert _Static_assert
+#define __barrier() __ASMV("" ::: "memory")
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
diff --git a/sys/include/sys/driver.h b/sys/include/sys/driver.h
index f88e286..05c40fa 100644
--- a/sys/include/sys/driver.h
+++ b/sys/include/sys/driver.h
@@ -55,4 +55,3 @@ extern char __drivers_init_end[];
}
#endif /* _KERNEL */
#endif /* !_SYS_DRIVER_H_ */
-
diff --git a/sys/include/sys/fcntl.h b/sys/include/sys/fcntl.h
index 7a62cdd..122a378 100644
--- a/sys/include/sys/fcntl.h
+++ b/sys/include/sys/fcntl.h
@@ -34,4 +34,9 @@
#define O_WRONLY 0x0001
#define O_RDWR 0x0002
+/* Makes seal checking easier */
+#if defined(_KERNEL)
+#define O_ALLOW_WR (O_RDWR | O_WRONLY)
+#endif
+
#endif /* !_SYS_FCTNL_H_ */
diff --git a/sys/include/sys/filedesc.h b/sys/include/sys/filedesc.h
index 9a6230a..a544811 100644
--- a/sys/include/sys/filedesc.h
+++ b/sys/include/sys/filedesc.h
@@ -39,12 +39,14 @@ struct filedesc {
off_t offset;
bool is_dir;
int refcnt;
+ int flags;
struct vnode *vp;
struct spinlock lock;
};
int fd_close(unsigned int fd);
int fd_read(unsigned int fd, void *buf, size_t count);
+int fd_write(unsigned int fd, void *buf, size_t count);
int fd_alloc(struct filedesc **fd_out);
int fd_open(const char *pathname, int flags);
diff --git a/sys/include/sys/mmio.h b/sys/include/sys/mmio.h
index cdc6a46..9f6e4e2 100644
--- a/sys/include/sys/mmio.h
+++ b/sys/include/sys/mmio.h
@@ -67,7 +67,7 @@
tmp += VM_HIGHER_HALF; \
} \
*(volatile TYPE *)tmp = val; \
- __ASMV("" ::: "memory"); \
+ __barrier(); \
}
/*
@@ -86,7 +86,7 @@
tmp += VM_HIGHER_HALF; \
} \
\
- __ASMV("" ::: "memory"); \
+ __barrier(); \
return *(volatile TYPE *)tmp; \
}
diff --git a/sys/include/sys/syscall.h b/sys/include/sys/syscall.h
index b724e8b..41d1e78 100644
--- a/sys/include/sys/syscall.h
+++ b/sys/include/sys/syscall.h
@@ -42,6 +42,7 @@
#define SYS_close 4
#define SYS_stat 5
#define SYS_sysctl 6
+#define SYS_write 7
#if defined(_KERNEL)
/* Syscall return value and arg type */
diff --git a/sys/include/sys/termios.h b/sys/include/sys/termios.h
new file mode 100644
index 0000000..27339f1
--- /dev/null
+++ b/sys/include/sys/termios.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2023-2025 Ian Marco Moffett and the Osmora Team.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Hyra nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _TERMIOS_H_
+#define _TERMIOS_H_
+
+/*
+ * c_iflag: Input flags
+ */
+#define ISTRIP 0x00000000
+#define ICRNL 0x00000001
+
+#define NCCS 20
+
+typedef unsigned int cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+struct termios {
+ tcflag_t c_iflag; /* Input flags */
+ tcflag_t c_oflag; /* Output flags */
+ tcflag_t c_cflag; /* Control flags */
+ tcflag_t c_lflag; /* Local flags */
+ cc_t c_cc[NCCS];
+};
+
+#endif /* _TERMIOS_H_ */
diff --git a/sys/include/sys/vfs.h b/sys/include/sys/vfs.h
index 61f6673..1ff722a 100644
--- a/sys/include/sys/vfs.h
+++ b/sys/include/sys/vfs.h
@@ -38,6 +38,7 @@
scret_t sys_open(struct syscall_args *scargs);
scret_t sys_close(struct syscall_args *args);
scret_t sys_read(struct syscall_args *scargs);
+scret_t sys_write(struct syscall_args *sargs);
scret_t sys_stat(struct syscall_args *scargs);
#endif /* _KERNEL */
diff --git a/sys/include/sys/vnode.h b/sys/include/sys/vnode.h
index 5cbaa15..33092f9 100644
--- a/sys/include/sys/vnode.h
+++ b/sys/include/sys/vnode.h
@@ -101,6 +101,7 @@ struct vops {
int(*lookup)(struct vop_lookup_args *args);
int(*getattr)(struct vop_getattr_args *args);
int(*read)(struct vnode *vp, struct sio_txn *sio);
+ int(*write)(struct vnode *vp, struct sio_txn *sio);
int(*reclaim)(struct vnode *vp);
};
@@ -117,6 +118,7 @@ int vfs_release_vnode(struct vnode *vp);
int vfs_vop_lookup(struct vnode *vp, struct vop_lookup_args *args);
int vfs_vop_read(struct vnode *vp, struct sio_txn *sio);
+int vfs_vop_write(struct vnode *vp, struct sio_txn *sio);
int vfs_vop_getattr(struct vnode *vp, struct vop_getattr_args *args);
#endif /* _KERNEL */
diff --git a/sys/include/vm/vm_pager.h b/sys/include/vm/vm_pager.h
index 1ba06d9..e0503e0 100644
--- a/sys/include/vm/vm_pager.h
+++ b/sys/include/vm/vm_pager.h
@@ -35,6 +35,11 @@
#include <vm/vm_obj.h>
struct vm_object;
+struct vm_pagerops;
+
+extern const struct vm_pagerops vm_vnops;
+extern const struct vm_pagerops vm_anonops;
+
/*
* Pager operations.