diff --git a/sys/i386/trap.c b/sys/i386/trap.c index 1a67afb..3e4333e 100644 --- a/sys/i386/trap.c +++ b/sys/i386/trap.c @@ -116,6 +116,7 @@ kprintf("\n "); kprintf("%08lx ", get_seg_long(ss, stack++)); } + while(1) asm("nop"); } diff --git a/sys/include/net/arch/cc.h b/sys/include/net/arch/cc.h index 01dfe86..e910ab9 100644 --- a/sys/include/net/arch/cc.h +++ b/sys/include/net/arch/cc.h @@ -8,8 +8,11 @@ #define PACK_STRUCT_BEGIN #define PACK_STRUCT_END +#define LWIP_ERR_T int +/* #ifdef LWIP_ERR_T typedef uint8_t err_t; #endif +*/ #endif diff --git a/sys/include/net/arch/sys_arch.h b/sys/include/net/arch/sys_arch.h index c94add4..f228e5a 100644 --- a/sys/include/net/arch/sys_arch.h +++ b/sys/include/net/arch/sys_arch.h @@ -2,6 +2,7 @@ #define __ARCH_SYS_ARCH_H__ #include +#include #define SYS_MBOX_NULL NULL #define SYS_SEM_NULL NULL diff --git a/sys/include/sys/_types.h b/sys/include/sys/_types.h index 7990e5e..1363079 100644 --- a/sys/include/sys/_types.h +++ b/sys/include/sys/_types.h @@ -75,6 +75,9 @@ typedef __int64_t __int_least64_t; typedef int ___wchar_t; +typedef long __suseconds_t; /* microseconds (signed) */ +typedef __int32_t __pid_t; /* process [group] */ + #if !defined(__clang__) || !defined(__cplusplus) typedef __uint_least16_t __char16_t; typedef __uint_least32_t __char32_t; diff --git a/sys/include/sys/descrip.h b/sys/include/sys/descrip.h index 84cd2a6..6d39371 100644 --- a/sys/include/sys/descrip.h +++ b/sys/include/sys/descrip.h @@ -115,12 +115,6 @@ }; #ifdef _BALLS -/* TEMP */ -struct __timespec { - __time_t tv_sec; /* seconds */ - long tv_nsec; /* and nanoseconds */ -}; - struct stat { __dev_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ diff --git a/sys/include/sys/select.h b/sys/include/sys/select.h index 887a0c6..ce0d6e9 100644 --- a/sys/include/sys/select.h +++ b/sys/include/sys/select.h @@ -31,6 +31,8 @@ #include #include +#include +#include #include diff --git a/sys/include/sys/signal.h b/sys/include/sys/signal.h index 2e0b908..0ffe9b8 100644 --- a/sys/include/sys/signal.h +++ b/sys/include/sys/signal.h @@ -43,6 +43,52 @@ #define SIG_UNBLOCK 2 /* unblock specified signal set */ #define SIG_SETMASK 3 /* set specified signal set */ +union sigval { + /* Members as suggested by Annex C of POSIX 1003.1b. */ + int sival_int; + void *sival_ptr; + /* 6.0 compatibility */ + int sigval_int; + void *sigval_ptr; +}; + +typedef struct __siginfo { + int si_signo; /* signal number */ + int si_errno; /* errno association */ + /* + * Cause of signal, one of the SI_ macros or signal-specific + * values, i.e. one of the FPE_... values for SIGFPE. This + * value is equivalent to the second argument to an old-style + * FreeBSD signal handler. + */ + int si_code; /* signal code */ + __pid_t si_pid; /* sending process */ + __uid_t si_uid; /* sender's ruid */ + int si_status; /* exit value */ + void *si_addr; /* faulting instruction */ + union sigval si_value; /* signal value */ + union { + struct { + int _trapno;/* machine specific trap code */ + } _fault; + struct { + int _timerid; + int _overrun; + } _timer; + struct { + int _mqd; + } _mesgq; + struct { + long _band; /* band event for SIGPOLL */ + } _poll; /* was this ever used ? */ + struct { + long __spare1__; + int __spare2__[7]; + } __spare__; + } _reason; +} siginfo_t; + + // Signal vector "template" used in sigaction call. struct sigaction { union { @@ -56,5 +102,4 @@ #define sa_handler __sigaction_u.__sa_handler #define sa_sigaction __sigaction_u.__sa_sigaction - #endif /* END _SYS_SIGNAL_H */ diff --git a/sys/include/sys/types.h b/sys/include/sys/types.h index 4411c50..70d5723 100644 --- a/sys/include/sys/types.h +++ b/sys/include/sys/types.h @@ -171,4 +171,10 @@ /* Combine two `digits' to make a single two-digit number. */ #define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b)) + +#ifndef _MODE_T_DECLARED +typedef __mode_t mode_t; /* permissions */ +#define _MODE_T_DECLARED +#endif + #endif /* END _SYS_TYPES_H */ diff --git a/sys/include/ubixos/errno.h b/sys/include/ubixos/errno.h index 93bce50..04aa285 100644 --- a/sys/include/ubixos/errno.h +++ b/sys/include/ubixos/errno.h @@ -33,6 +33,7 @@ extern "C" { #endif +#define ENOERR 0 /* No Error */ #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ @@ -165,6 +166,10 @@ extern int errno; #endif +#ifndef err_t +typedef int err_t; +#endif + #ifdef __cplusplus } #endif diff --git a/sys/include/ubixos/sem.h b/sys/include/ubixos/sem.h index 44694b5..7afd3de 100644 --- a/sys/include/ubixos/sem.h +++ b/sys/include/ubixos/sem.h @@ -30,6 +30,7 @@ #define _UBIXOS_SEM_H #include +#include #include struct sys_sem { @@ -47,11 +48,11 @@ int sem_post(semID_t id); int sem_wait(semID_t id); int sem_trywait(semID_t id); -int sem_timedwait(semID_t id, const struct timespec); -err_t sem_init(sys_sem_t **, uint8_t); +int sem_timedwait(semID_t id, const struct timespec *); +int sem_init(sys_sem_t **, uint8_t); int sem_open(semID_t *id, const char *name, int oflag, mode_t mode, unsigned int value); int sem_unlink(const char *name); int sem_getvalue(semID_t id, int *val); -err_t sem_destroy(sys_sem_t **); +int sem_destroy(sys_sem_t **); #endif /* END _UBIXOS_SEM_H */ diff --git a/sys/include/ubixos/time.h b/sys/include/ubixos/time.h index 7ce4ead..d9ab30d 100644 --- a/sys/include/ubixos/time.h +++ b/sys/include/ubixos/time.h @@ -26,10 +26,11 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _TIME_H -#define _TIME_H +#ifndef _UBIXOS_TIME_H +#define _UBIXOS_TIME_H #include +#include #include typedef long suseconds_t; @@ -41,15 +42,6 @@ #define DAY (24*HOUR) #define YEAR (365*DAY) -#ifndef _TIME_T_DECLARED -typedef __time_t time_t; -#define _TIME_T_DECLARED -#endif - -struct timespec { - time_t tv_sec; /* seconds */ - long tv_nsec; /* and nanoseconds */ -}; struct timeStruct { int sec; @@ -65,11 +57,6 @@ int tz_dsttime; /* type of dst correction */ }; -struct timeval { - long tv_sec; /* seconds (XXX should be time_t) */ - suseconds_t tv_usec; /* and microseconds */ -}; - int gettimeofday(struct timeval *tp, struct timezone *tzp); int time_init(); diff --git a/sys/include/ubixos/ubthread.h b/sys/include/ubixos/ubthread.h index deb7125..26a07f4 100644 --- a/sys/include/ubixos/ubthread.h +++ b/sys/include/ubixos/ubthread.h @@ -33,10 +33,6 @@ #include #include -#ifndef ETIMEDOUT -#define ETIMEDOUT -1 -#endif - #define LOCKED 1 #define UNLOCKED 0 diff --git a/sys/kernel/Makefile b/sys/kernel/Makefile index 0ced24d..93b8aec 100644 --- a/sys/kernel/Makefile +++ b/sys/kernel/Makefile @@ -6,7 +6,7 @@ include ../Makefile.incl # Objects -OBJS = vfs_calls.o tty.o kern_sig.o pipe.o descrip.o kern_sysctl.o gen_calls.o endtask.o ld.o time.o elf.o ubthread.o vitals.o access.o syscall.o syscall_posix.o syscalls_posix.o execve.o +OBJS = sem.o vfs_calls.o tty.o kern_sig.o pipe.o descrip.o kern_sysctl.o gen_calls.o endtask.o ld.o time.o elf.o ubthread.o vitals.o access.o syscall.o syscall_posix.o syscalls_posix.o execve.o #OBJS += ../${_ARCH}/schedyield.o ../${_ARCH}/kpanic.o ../${_ARCH}/timer.o ../${_ARCH}/spinlock.o ../${_ARCH}/exec.o ../${_ARCH}/sys_call_new.o ../${_ARCH}/sys_call.o ../${_ARCH}/bioscall.o ../${_ARCH}/fork.o ../${_ARCH}/syscall.o ../${_ARCH}/systemtask.o ../${_ARCH}/sched.o ../${_ARCH}/cpu.o # ap-boot.o smp.o vitals.o(obsolete) diff --git a/sys/kernel/sem.c b/sys/kernel/sem.c index 94d0b1c..a3a9c53 100644 --- a/sys/kernel/sem.c +++ b/sys/kernel/sem.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include int sem_close(semID_t id) { return(0); @@ -47,11 +49,11 @@ return(0); } -int sem_timedwait(semID_t id, const struct timespec) { +int sem_timedwait(semID_t id, const struct timespec *ts) { return(0); } -err_t sys_init(sys_sem_t **sem, uint8_t count) { +err_t sem_init(sys_sem_t **sem, uint8_t count) { sys_sem_t *newSem = 0x0; if (*sem != 0) { @@ -66,7 +68,7 @@ *sem = newSem; - return (ERR_OK); + return (ENOERR); } int sem_open(semID_t *id, const char *name, int oflag, mode_t mode, unsigned int value) { @@ -93,6 +95,6 @@ kfree(sem); *sem = 0x0; - return (ERR_OK); + return (ENOERR); } diff --git a/sys/net/core/init.c b/sys/net/core/init.c index 09ef246..20c7be8 100644 --- a/sys/net/core/init.c +++ b/sys/net/core/init.c @@ -31,6 +31,8 @@ #include "net/opt.h" +#include + #include "net/init.h" #include "net/stats.h" #include "net/sys.h" diff --git a/sys/net/net/init.c b/sys/net/net/init.c index 56139b5..87f1827 100644 --- a/sys/net/net/init.c +++ b/sys/net/net/init.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/sys/net/net/sys_arch.c b/sys/net/net/sys_arch.c index 462f465..323d013 100644 --- a/sys/net/net/sys_arch.c +++ b/sys/net/net/sys_arch.c @@ -195,10 +195,15 @@ if ((mb != NULL) && (*mb != SYS_MBOX_NULL)) { struct sys_mbox *mbox = *mb; sys_arch_sem_wait(&mbox->lock, 0); - +/* sys_sem_free_internal(mbox->full); sys_sem_free_internal(mbox->empty); sys_sem_free_internal(mbox->lock); +*/ + sem_destroy(mbox->full); + sem_destroy(mbox->empty); + sem_destroy(mbox->lock); + mbox->full = mbox->empty = mbox->lock = NULL; kfree(mbox); *mb = 0x0; diff --git a/sys/vmm/paging.c b/sys/vmm/paging.c index e90005c..d2bc534 100644 --- a/sys/vmm/paging.c +++ b/sys/vmm/paging.c @@ -571,28 +571,25 @@ uint32_t *pageDir = 0x0; pageDir = (uint32_t *) PD_BASE_ADDR; - - /* - #ifdef DEBUG - */ - //MrOlsen 2018kprintf("CVS: [0x%X]\n", addr); - /* - #endif - */ +kprintf ("PDE*PS: 0x%X", (PD_ENTRIES * PAGE_SIZE)); for (x = (addr / (PD_ENTRIES * PAGE_SIZE)); x < PD_INDEX(VMM_USER_END); x++) { if ((pageDir[x] & PAGE_PRESENT) == PAGE_PRESENT) { pageTableSrc = (uint32_t *) (PT_BASE_ADDR + (PAGE_SIZE * x)); +kprintf("\nx: 0x%X, PAGE_SIZE: 0x%X, pTS: 0x%X\n", x, PAGE_SIZE, pageTableSrc); +//while(1) asm("nop"); for (y = 0; y < PAGE_SIZE; y++) { if ((pageTableSrc[y] & PAGE_PRESENT) == PAGE_PRESENT) { +kprintf("pTS[0]: 0x%X", pageTableSrc[0]); if ((pageTableSrc[y] & PAGE_COW) == PAGE_COW) { - +kprintf("[aCC.E: %i(0x%X)]", y, pageTableSrc[y]); adjustCowCounter(((uint32_t) pageTableSrc[y] & 0xFFFFF000), -1); +kprintf("[aCC.X: %i(0x%X)]", y, pageTableSrc[y]); pageTableSrc[y] = 0x0; } @@ -610,6 +607,8 @@ } } +while(1) asm("nop"); + asm( "movl %cr3,%eax\n" "movl %eax,%cr3\n"