diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/isa/i8042.c | 6 | ||||
-rw-r--r-- | sys/fs/initramfs.c | 6 | ||||
-rw-r--r-- | sys/include/sys/limits.h | 1 | ||||
-rw-r--r-- | sys/include/sys/vnode.h | 24 | ||||
-rw-r--r-- | sys/kern/exec_elf64.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_descrip.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_sched.c | 19 | ||||
-rw-r--r-- | sys/kern/vfs_lookup.c | 4 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 6 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 2 | ||||
-rw-r--r-- | sys/vm/vm_vnode.c | 2 |
11 files changed, 56 insertions, 18 deletions
diff --git a/sys/arch/amd64/isa/i8042.c b/sys/arch/amd64/isa/i8042.c index 69d9f92..cde70ff 100644 --- a/sys/arch/amd64/isa/i8042.c +++ b/sys/arch/amd64/isa/i8042.c @@ -33,6 +33,7 @@ #include <sys/syslog.h> #include <sys/spinlock.h> #include <sys/param.h> +#include <sys/ascii.h> #include <sys/proc.h> #include <sys/reboot.h> #include <sys/queue.h> @@ -75,7 +76,7 @@ static int i8042_kb_getc(uint8_t sc, char *chr); static void i8042_drain(void); static char keytab[] = { - '\0', '\0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + '\0', '\x1B', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', '\0', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', '\0', '\\', 'z', 'x', 'c', 'v', @@ -276,6 +277,9 @@ i8042_kb_getc(uint8_t sc, char *chr) bool release = ISSET(sc, BIT(7)); switch (sc) { + case 0x76: + *chr = ASCII_ESC; + return 0; /* Caps lock [press] */ case 0x3A: /* diff --git a/sys/fs/initramfs.c b/sys/fs/initramfs.c index c41deb4..beb2e84 100644 --- a/sys/fs/initramfs.c +++ b/sys/fs/initramfs.c @@ -61,12 +61,16 @@ struct initramfs_node { * @magic: Header magic ("OMAR") * @len: Length of the file * @namelen: Length of the filename + * @rev: OMAR revision + * @mode: File permissions */ struct __packed omar_hdr { char magic[4]; uint8_t type; uint8_t namelen; uint32_t len; + uint8_t rev; + uint32_t mode; }; static volatile struct limine_module_request mod_req = { @@ -140,7 +144,7 @@ initramfs_get_file(const char *path, struct initramfs_node *res) p += hdr->namelen; if (strcmp(namebuf, path) == 0) { - node.mode = 0700; + node.mode = hdr->mode; node.size = hdr->len; node.data = (void *)p; *res = node; diff --git a/sys/include/sys/limits.h b/sys/include/sys/limits.h index f56958e..5b97b68 100644 --- a/sys/include/sys/limits.h +++ b/sys/include/sys/limits.h @@ -31,6 +31,7 @@ #define _SYS_LIMITS_H_ #define PATH_MAX 1024 +#define NAME_MAX 256 #define SSIZE_MAX 32767 #define ARG_MAX 4096 #define CHAR_BIT 8 diff --git a/sys/include/sys/vnode.h b/sys/include/sys/vnode.h index b135433..3402b02 100644 --- a/sys/include/sys/vnode.h +++ b/sys/include/sys/vnode.h @@ -92,6 +92,16 @@ struct vop_create_args { struct vnode **vpp; /* Result vnode */ }; +struct vop_getattr_args { + struct vnode *vp; /* Target vnode */ + struct vattr *res; /* Result vattr */ +}; + +struct vop_readdir_args { + struct vnode *vp; /* Target vnode */ + struct sio_txn *sio; /* SIO data to read into */ +}; + /* * A field in this structure is unavailable * if it has a value of VNOVAL. @@ -101,14 +111,10 @@ struct vattr { size_t size; }; -struct vop_getattr_args { - struct vnode *vp; - struct vattr *res; -}; - struct vops { int(*lookup)(struct vop_lookup_args *args); int(*getattr)(struct vop_getattr_args *args); + int(*readdir)(struct vop_readdir_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,19 +123,21 @@ struct vops { extern struct vnode *g_root_vnode; +/* Vnode cache operations */ int vfs_vcache_type(void); int vfs_vcache_migrate(int newtype); - int vfs_vcache_enter(struct vnode *vp); struct vnode *vfs_recycle_vnode(void); +/* Vnode operations */ int vfs_alloc_vnode(struct vnode **res, int type); int vfs_release_vnode(struct vnode *vp); -int vfs_vop_lookup(struct vnode *vp, struct vop_lookup_args *args); +/* Vnode operation wrappers */ +int vfs_vop_lookup(struct vop_lookup_args *args); +int vfs_vop_getattr(struct vop_getattr_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 */ #endif /* !_SYS_VNODE_H_ */ diff --git a/sys/kern/exec_elf64.c b/sys/kern/exec_elf64.c index 9706e77..8dc87dc 100644 --- a/sys/kern/exec_elf64.c +++ b/sys/kern/exec_elf64.c @@ -112,7 +112,7 @@ elf_get_file(const char *pathname, struct elf_file *res) getattr_args.res = &vattr; getattr_args.vp = vp; - status = vfs_vop_getattr(vp, &getattr_args); + status = vfs_vop_getattr(&getattr_args); if (status != 0) goto done; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 0fb026f..b5ff144 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -351,7 +351,7 @@ fd_seek(int fildes, off_t offset, int whence) getattr_args.vp = tmp->vp; getattr_args.res = &attr; - if ((vfs_vop_getattr(tmp->vp, &getattr_args)) < 0) { + if ((vfs_vop_getattr(&getattr_args)) < 0) { return -EPIPE; } diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 30036c0..774ba71 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -258,8 +258,27 @@ sched_enter(void) void sched_yield(void) { + struct proc *td; + struct cpu_info *ci = this_cpu(); + + if ((td = ci->curtd) == NULL) { + return; + } + + td->rested = true; + + /* FIXME: Hang yielding when waited on */ + if (ISSET(td->flags, PROC_WAITED)) { + return; + } + + ci->curtd = NULL; md_inton(); sched_oneshot(false); + + md_hlt(); + md_intoff(); + ci->curtd = td; } void diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index d88c447..7320102 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -181,7 +181,7 @@ namei_mp_search(struct mount *mp, const char *path, struct nameidata *ndp) lookup_args.dirvp = vp; lookup_args.vpp = &vp; - status = vfs_vop_lookup(vp, &lookup_args); + status = vfs_vop_lookup(&lookup_args); dynfree(name); if (status != 0) { @@ -234,7 +234,7 @@ namei(struct nameidata *ndp) lookup_args.name = path; lookup_args.dirvp = g_root_vnode; lookup_args.vpp = &vp; - status = vfs_vop_lookup(lookup_args.dirvp, &lookup_args); + status = vfs_vop_lookup(&lookup_args); /* Did we find it in the root */ if (status == 0) { diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index da0a4f9..69417d0 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -141,8 +141,9 @@ vfs_release_vnode(struct vnode *vp) } int -vfs_vop_lookup(struct vnode *vp, struct vop_lookup_args *args) +vfs_vop_lookup(struct vop_lookup_args *args) { + const struct vnode *vp = args->dirvp; const struct vops *vops = vp->vops; if (vops == NULL) @@ -180,8 +181,9 @@ vfs_vop_write(struct vnode *vp, struct sio_txn *sio) } int -vfs_vop_getattr(struct vnode *vp, struct vop_getattr_args *args) +vfs_vop_getattr(struct vop_getattr_args *args) { + const struct vnode *vp = args->vp; const struct vops *vops = vp->vops; if (vops == NULL) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 0d51331..d15ecf1 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -68,7 +68,7 @@ vfs_dostat(const char *path, struct stat *sbuf) vp = nd.vp; gattr.vp = vp; gattr.res = &attr; - error = vfs_vop_getattr(vp, &gattr); + error = vfs_vop_getattr(&gattr); if (error != 0) { return error; diff --git a/sys/vm/vm_vnode.c b/sys/vm/vm_vnode.c index 27defc9..777b382 100644 --- a/sys/vm/vm_vnode.c +++ b/sys/vm/vm_vnode.c @@ -73,7 +73,7 @@ vn_io(struct vnode *vp, struct vm_page **pgs, unsigned int npages, int rw) args.res = &vattr; c = MAX(vattr.size / DEFAULT_PAGESIZE, 1); - if ((err = vfs_vop_getattr(vp, &args)) != 0) { + if ((err = vfs_vop_getattr(&args)) != 0) { return err; } |