Rework shared headers
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "fs/littlefs/lfs.h"
|
#include "fs/littlefs/lfs.h"
|
||||||
#include "vfs/vfs.h"
|
#include "vfs/vfs.h"
|
||||||
#include "hdrs/errors.h"
|
#include "errors.h"
|
||||||
#include "kprintf.h"
|
#include "kprintf.h"
|
||||||
#include "dlmalloc/malloc.h"
|
#include "dlmalloc/malloc.h"
|
||||||
#include "hal/hal.h"
|
#include "hal/hal.h"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "pit.h"
|
#include "pit.h"
|
||||||
#include "proc/proc.h"
|
#include "proc/proc.h"
|
||||||
#include "syscall/syscall.h"
|
#include "syscall/syscall.h"
|
||||||
#include "hdrs/errors.h"
|
#include "errors.h"
|
||||||
|
|
||||||
void hal_intr_disable(void) {
|
void hal_intr_disable(void) {
|
||||||
asm volatile("cli");
|
asm volatile("cli");
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "util/util.h"
|
#include "util/util.h"
|
||||||
#include "kprintf.h"
|
#include "kprintf.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "hdrs/errors.h"
|
#include "errors.h"
|
||||||
#include "vfs/vfs.h"
|
#include "vfs/vfs.h"
|
||||||
#include "bootinfo/bootinfo.h"
|
#include "bootinfo/bootinfo.h"
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "hal/hal.h"
|
#include "hal/hal.h"
|
||||||
#include "spinlock/spinlock.h"
|
#include "spinlock/spinlock.h"
|
||||||
#include "bitmap/bitmap.h"
|
#include "bitmap/bitmap.h"
|
||||||
|
#include "vfs/vfs.h"
|
||||||
|
|
||||||
#define PROC_NAME_MAX 0x100
|
#define PROC_NAME_MAX 0x100
|
||||||
|
|
||||||
@ -12,6 +13,7 @@
|
|||||||
#define PROC_STACKSIZE (PROC_STACKBLOCKS * BITMAP_BLOCK_SIZE)
|
#define PROC_STACKSIZE (PROC_STACKBLOCKS * BITMAP_BLOCK_SIZE)
|
||||||
|
|
||||||
#define PROC_MAX 0x100 // max amount of processes
|
#define PROC_MAX 0x100 // max amount of processes
|
||||||
|
#define PROC_VFSHANDLES_MAX 0x80
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
IntrStackFrame trapframe;
|
IntrStackFrame trapframe;
|
||||||
@ -28,12 +30,17 @@ enum {
|
|||||||
|
|
||||||
typedef struct Proc {
|
typedef struct Proc {
|
||||||
struct Proc *next;
|
struct Proc *next;
|
||||||
|
|
||||||
uint64_t pid;
|
uint64_t pid;
|
||||||
char name[PROC_NAME_MAX];
|
char name[PROC_NAME_MAX];
|
||||||
|
|
||||||
ProcPlatformData platformdata;
|
ProcPlatformData platformdata;
|
||||||
uint8_t state;
|
uint8_t state;
|
||||||
VasRange *vas;
|
VasRange *vas;
|
||||||
|
|
||||||
bool kern;
|
bool kern;
|
||||||
|
|
||||||
|
VfsObj *vobjs[PROC_VFSHANDLES_MAX];
|
||||||
} Proc;
|
} Proc;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "spinlock/spinlock.h"
|
#include "spinlock/spinlock.h"
|
||||||
#include "hdrs/errors.h"
|
#include "errors.h"
|
||||||
#include "dlmalloc/malloc.h"
|
#include "dlmalloc/malloc.h"
|
||||||
#include "ramsd.h"
|
#include "ramsd.h"
|
||||||
#include "storedev.h"
|
#include "storedev.h"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "storedev.h"
|
#include "storedev.h"
|
||||||
#include "spinlock/spinlock.h"
|
#include "spinlock/spinlock.h"
|
||||||
#include "kprintf.h"
|
#include "kprintf.h"
|
||||||
#include "hdrs/errors.h"
|
#include "errors.h"
|
||||||
#include "dlmalloc/malloc.h"
|
#include "dlmalloc/malloc.h"
|
||||||
#include "ramsd.h"
|
#include "ramsd.h"
|
||||||
#include "util/util.h"
|
#include "util/util.h"
|
||||||
|
@ -2,23 +2,15 @@
|
|||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "proc/proc.h"
|
#include "proc/proc.h"
|
||||||
#include "spinlock/spinlock.h"
|
#include "spinlock/spinlock.h"
|
||||||
#include "hdrs/errors.h"
|
#include "errors.h"
|
||||||
#include "util/util.h"
|
#include "util/util.h"
|
||||||
|
#include "sysdefs/processctl.h"
|
||||||
|
|
||||||
#define PID_SELF_MAGIC 0x5E1F
|
#define PID_SELF_MAGIC 0x5E1F
|
||||||
|
|
||||||
enum {
|
|
||||||
PCTL_KILL = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
|
|
||||||
} ProcessCtl;
|
|
||||||
|
|
||||||
int32_t SYSCALL3(sys_processctl, pid1, cmd1, optsptr1) {
|
int32_t SYSCALL3(sys_processctl, pid1, cmd1, optsptr1) {
|
||||||
uint64_t pid = pid1;
|
uint64_t pid = pid1;
|
||||||
uint64_t cmd = cmd1;
|
uint64_t cmd = cmd1;
|
||||||
ProcessCtl *pctl = (ProcessCtl *)(void *)optsptr1;
|
|
||||||
int32_t ret = E_OK;
|
int32_t ret = E_OK;
|
||||||
|
|
||||||
spinlock_acquire(&PROCS.spinlock);
|
spinlock_acquire(&PROCS.spinlock);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "hdrs/errors.h"
|
#include "errors.h"
|
||||||
#include "kprintf.h"
|
#include "kprintf.h"
|
||||||
#include "processctl.h"
|
#include "processctl.h"
|
||||||
#include "hdrs/syscall.h"
|
#include "sysdefs/syscall.h"
|
||||||
|
|
||||||
int32_t SYSCALL1(sys_debugprint, string) {
|
int32_t SYSCALL1(sys_debugprint, string) {
|
||||||
char *p = (char *)string;
|
char *p = (char *)string;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "util/util.h"
|
#include "util/util.h"
|
||||||
#include "hshtb.h"
|
#include "hshtb.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "hdrs/errors.h"
|
#include "errors.h"
|
||||||
#include "fs/portlfs/portlfs.h"
|
#include "fs/portlfs/portlfs.h"
|
||||||
#include "storedev/storedev.h"
|
#include "storedev/storedev.h"
|
||||||
#include "baseimg/baseimg.h"
|
#include "baseimg/baseimg.h"
|
||||||
|
8
share/sysdefs/processctl.h
Normal file
8
share/sysdefs/processctl.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef SHARE_HDRS_PROCESSCTL_H_
|
||||||
|
#define SHARE_HDRS_PROCESSCTL_H_
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PCTL_KILL = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SHARE_HDRS_PROCESSCTL_H_
|
@ -4,6 +4,7 @@
|
|||||||
enum {
|
enum {
|
||||||
SYS_DEBUGPRINT = 1,
|
SYS_DEBUGPRINT = 1,
|
||||||
SYS_PROCESSCTL = 2,
|
SYS_PROCESSCTL = 2,
|
||||||
|
SYS_IOCTL = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHARE_HDRS_SYSCALL_H_
|
#endif // SHARE_HDRS_SYSCALL_H_
|
@ -11,7 +11,7 @@ SRCFILES := $(call GRABSRC, \
|
|||||||
system \
|
system \
|
||||||
)
|
)
|
||||||
|
|
||||||
CFLAGS += -isystem $(ROOT)/share/hdrs -isystem $(ROOT)/ulib -isystem $(ROOT)/std/include
|
CFLAGS += -isystem $(ROOT)/share -isystem $(ROOT)/ulib -isystem $(ROOT)/std/include
|
||||||
|
|
||||||
ASFILES := $(call GET_ASFILES, $(SRCFILES))
|
ASFILES := $(call GET_ASFILES, $(SRCFILES))
|
||||||
CFILES := $(call GET_CFILES, $(SRCFILES))
|
CFILES := $(call GET_CFILES, $(SRCFILES))
|
||||||
|
BIN
ulib/libulib.a
BIN
ulib/libulib.a
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <system/system.h>
|
#include <system/system.h>
|
||||||
#include <syscall/syscall.h>
|
#include <syscall/syscall.h>
|
||||||
#include <syscall.h>
|
#include <sysdefs/syscall.h>
|
||||||
|
|
||||||
void sys_debugprint(const char *string) {
|
void sys_debugprint(const char *string) {
|
||||||
syscall(SYS_DEBUGPRINT, (uint64_t)string, 0, 0, 0, 0, 0);
|
syscall(SYS_DEBUGPRINT, (uint64_t)string, 0, 0, 0, 0, 0);
|
||||||
|
Reference in New Issue
Block a user