Basic VM and other minor improvements.

Not complete, probably not fully debugged or optimized.
This commit is contained in:
Ben Gras
2008-11-19 12:26:10 +00:00
parent c888305e21
commit c078ec0331
273 changed files with 10814 additions and 4305 deletions

View File

@@ -84,6 +84,7 @@
#include "../../servers/pm/mproc.h"
#include "../../servers/vfs/fproc.h"
#include "../../servers/vfs/const.h"
#include "../../servers/mfs/const.h"
/*----- ps's local stuff below this line ------*/
@@ -109,7 +110,9 @@ size_t n_ttyinfo; /* Number of tty info slots */
/* Number of tasks and processes and addresses of the main process tables. */
int nr_tasks, nr_procs;
#if 0
vir_bytes proc_addr, mproc_addr, fproc_addr;
#endif
extern int errno;
/* Process tables of the kernel, MM, and FS. */
@@ -315,10 +318,14 @@ char *argv[];
if ((memfd = open(MEM_PATH, O_RDONLY)) == -1) err(MEM_PATH);
if (gettynames() == -1) err("Can't get tty names");
#if 0
getsysinfo(PM_PROC_NR, SI_PROC_ADDR, &mproc_addr);
getsysinfo(FS_PROC_NR, SI_PROC_ADDR, &fproc_addr);
#endif
getsysinfo(PM_PROC_NR, SI_KINFO, &kinfo);
#if 0
proc_addr = kinfo.proc_addr;
#endif
nr_tasks = kinfo.nr_tasks;
nr_procs = kinfo.nr_procs;
@@ -329,6 +336,7 @@ char *argv[];
if (ps_proc == NULL || ps_mproc == NULL || ps_fproc == NULL)
err("Out of memory");
#if 0
/* Get kernel process table */
if (addrread(kmemfd, (phys_clicks) 0,
proc_addr, (char *) ps_proc,
@@ -347,6 +355,17 @@ char *argv[];
nr_procs * sizeof(ps_fproc[0]))
!= nr_procs * sizeof(ps_fproc[0]))
err("Can't get fs proc table from /dev/mem");
#else
if(getsysinfo(PM_PROC_NR, SI_KPROC_TAB, ps_proc) < 0) {
fprintf(stderr, "getsysinfo() for SI_KPROC_TAB failed.\n");
exit(1);
}
if(getsysinfo(PM_PROC_NR, SI_PROC_TAB, ps_mproc) < 0) {
fprintf(stderr, "getsysinfo() for SI_PROC_TAB failed.\n");
exit(1);
}
#endif
/* We need to know where INIT hangs out. */
for (i = FS_PROC_NR; i < nr_procs; i++) {
@@ -479,8 +498,13 @@ int endpoints;
bufp->ps_flags = ps_proc[p_ki].p_rts_flags;
if (p_nr >= low_user) {
#if 0
bufp->ps_dev = ps_fproc[p_nr].fp_tty;
bufp->ps_ftask = ps_fproc[p_nr].fp_task;
#else
bufp->ps_dev = 0;
bufp->ps_ftask = 0;
#endif
} else {
bufp->ps_dev = 0;
bufp->ps_ftask = 0;
@@ -511,9 +535,11 @@ int endpoints;
bufp->ps_state = T_STATE; /* stopped (traced) */
else if (ps_proc[p_ki].p_rts_flags == 0)
bufp->ps_state = R_STATE; /* in run-queue */
#if 0
else if (ps_mproc[p_nr].mp_flags & (WAITING | PAUSED | SIGSUSPENDED) ||
ps_fproc[p_nr].fp_suspended == SUSPENDED)
bufp->ps_state = S_STATE; /* sleeping */
#endif
else
bufp->ps_state = W_STATE; /* a short wait */
} else { /* tasks are simple */