Added draw menu, vars and additional functions needed for it

Added some functionality to the procdump to show the current console and parent pids of processes for debugging
Added var to clearconsole that enables the internal lock if one wasnt prelocked before hand
Fixed issue where race conditions would stop the title from drawing by drawing it to the buffer too
Fixed issue where the maze function was spamming the conswrite and cons lock by changing it to send an entire line instead of 1 char at a time
This commit is contained in:
iDunnoDev
2022-12-23 00:48:57 +00:00
committed by iDunnoDev
parent 662e3795a7
commit c23d669858
5 changed files with 366 additions and 84 deletions

14
proc.c
View File

@ -522,6 +522,8 @@ void procdump(void) {
char *state;
uint pc[10];
cprintf("Listing Processes\nPid(Parent) State Name(console)\n");
cprintf("-------------------------------\n");
for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) {
if (p->state == UNUSED) {
continue;
@ -532,10 +534,18 @@ void procdump(void) {
else {
state = "???";
}
cprintf("%d %s %s", p->pid, state, p->name);
int parentpid = 0;
if (p->parent != 0x0)
{
parentpid = p->parent->pid;
}
cprintf("%d(%d) %s %s(%d)", p->pid, parentpid, state, p->name, getconsoleindex(p->consoleptr));
if (p->state == SLEEPING) {
getcallerpcs((uint*)p->context->ebp + 2, pc);
for (i = 0; i < 10 && pc[i] != 0; i++) {
// was 10
for (i = 0; i < 5 && pc[i] != 0; i++) {
cprintf(" %p", pc[i]);
}
}