fix: pS permettant de visualiser l'ensemble de tâches et processus, corrections asm.h
This commit is contained in:
parent
6776594ece
commit
c894b99170
|
@ -40,19 +40,19 @@
|
|||
# define irqendslave() asm("movb $0x20,%al; \
|
||||
outb %al,$0xA0;")
|
||||
|
||||
# define lidt(idtr) asm ("lidtl %0"::"m" (*idtr))
|
||||
# define lidt(idtr) asm ("lidtl %0"::"m" (idtr))
|
||||
|
||||
# define lgdt(gdtr) asm ("lgdtl %0"::"m" (*gdtr))
|
||||
# define lgdt(gdtr) asm ("lgdtl %0"::"m" (gdtr))
|
||||
|
||||
# define lldt(ldtr) asm ("lldtl %0"::"m" (*ldtr))
|
||||
# define lldt(ldtr) asm ("lldtl %0"::"m" (ldtr))
|
||||
|
||||
# define ltr(tss) asm volatile ("ltr %%ax":: "a" (tss))
|
||||
|
||||
# define sidt(idtr) asm ("sidtl %0"::"m" (*idtr))
|
||||
# define sidt(idtr) asm ("sidtl %0"::"m" (idtr))
|
||||
|
||||
# define sgdt(gdtr) asm ("sgdtl %0"::"m" (*gdtr))
|
||||
# define sgdt(gdtr) asm ("sgdtl %0"::"m" (gdtr))
|
||||
|
||||
# define sldt(ldtr) asm ("sldtl %0"::"m" (*ldtr))
|
||||
# define sldt(ldtr) asm ("sldtl %0"::"m" (ldtr))
|
||||
|
||||
# define str(tss) asm volatile ("str %%ax;\
|
||||
mov %%ax,%0":: "m" (tss))
|
||||
|
|
|
@ -295,10 +295,10 @@ void show_cpu(regs * stack)
|
|||
getdestype(tss), getdessize(tss), getdesbit3(tss),
|
||||
getdesbit2(tss), getdesbit1(tss), getdesalign(tss));
|
||||
struct gdtr gdtreg;
|
||||
sgdt(&gdtreg);
|
||||
sgdt(gdtreg);
|
||||
printf("GDT= %Y %Y\r\n", gdtreg.base, gdtreg.limite);
|
||||
struct idtr idtreg;
|
||||
sidt(&idtreg);
|
||||
sidt(idtreg);
|
||||
printf("IDT= %Y %Y\r\n", idtreg.base, idtreg.limite);
|
||||
printf("CR0=%Y CR2=%Y CR3=%Y CR4=%Y\r\n", stack->cr0, stack->cr2,
|
||||
stack->cr3, stack->cr4);
|
||||
|
|
|
@ -41,7 +41,7 @@ void initgdt(u32 offset)
|
|||
/* recopie de la GDT a son adresse */
|
||||
memcpy(&gdt, (u8 *) gdtreg.base, gdtreg.limite, 1);
|
||||
/* chargement du registre GDT */
|
||||
lgdt(&gdtreg);
|
||||
lgdt(gdtreg);
|
||||
/* initialisation des segments */
|
||||
initselectors(offset);
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ void initidt(void)
|
|||
/* recopie de la IDT a son adresse */
|
||||
memcpy(&idt, (u8 *) idtreg.base, idtreg.limite, 1);
|
||||
/* chargement du registre IDTR */
|
||||
lidt(&idtreg);
|
||||
lidt(idtreg);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -602,7 +602,6 @@ void malloc_init(void)
|
|||
kernelcurrentheap = KERNEL_HEAP + PAGESIZE;
|
||||
chunk->size = PAGESIZE;
|
||||
chunk->used = 0;
|
||||
//virtual_range_new_kernel(kernelcurrentheap, chunk->size, PAGE_NOFLAG);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@ void initprocesses(void)
|
|||
if (aprocess==NULL) return NULL;
|
||||
aprocess->pid = pid;
|
||||
aprocess->result = 0;
|
||||
aprocess->pdd = NULL;
|
||||
aprocess->status = PROCESS_STATUS_RUN;
|
||||
aprocess->iskernel = true;
|
||||
TAILQ_INIT(&aprocess->task_head);
|
||||
|
@ -487,11 +488,12 @@ pid_t createprocess(u8 *src, bool kerneltask)
|
|||
{
|
||||
cli();
|
||||
tid_t previous = current;
|
||||
process* oldprocess=findcurrentprocess();
|
||||
current.pid = getfreepid();
|
||||
current.number = 0;
|
||||
process* new=findcurrentprocess();
|
||||
if (new==NULL) return NULL;
|
||||
//new->pid = current.pid;
|
||||
new->parent=oldprocess->pid;
|
||||
new->pdd = virtual_pd_create();
|
||||
TAILQ_INIT(&new->page_head);
|
||||
TAILQ_INIT(&new->task_head);
|
||||
|
|
22
lib/shell.c
22
lib/shell.c
|
@ -92,16 +92,30 @@ int test(void)
|
|||
/*******************************************************************************/
|
||||
/* Afiche les processus */
|
||||
|
||||
static u8* processstatus[] = {"LIBRE","PRET ","EXEC.","PAUSE"};
|
||||
static u8* taskstatus[] = {"PRET ","EXEC.","PAUSE"};
|
||||
|
||||
/*******************************************************************************/
|
||||
/* Affiche les tâches et processus */
|
||||
|
||||
int ps()
|
||||
{
|
||||
print("Processus en memoire\r\n[ PID | Status |\r\n");
|
||||
print("*** Processus en memoire\r\n| PID | Parent|Status|K|P.| Pages|\r\n");
|
||||
process* aprocess=findprocess((pid_t)1);
|
||||
while(true)
|
||||
{
|
||||
printf("|%Y|%Y|\r\n",(u32)aprocess->pid,aprocess->status);
|
||||
printf("|%Y|%Y| %s|%c|%hh u|%Y|\r\n",(u32)aprocess->pid,(u32)aprocess->parent,processstatus[aprocess->status],(aprocess->iskernel?'X':' '),aprocess->priority,(u32)aprocess->pdd);
|
||||
aprocess=getnextprocess(aprocess,PROCESS_STATUS_ALL);
|
||||
if (aprocess==NULL || aprocess->pid==(pid_t)1) break;
|
||||
}
|
||||
print("\r\n\r\n*** Taches en memoire\r\n| TID | PID |Status| CS | EIP | SS | ESP |\r\n");
|
||||
task* atask=findtask(maketid(1,1));
|
||||
while(true)
|
||||
{
|
||||
printf("|%Y|%Y| %s|%hY|%Y|%hY|%Y|\r\n",(u32)atask->tid.number,(u32)atask->tid.pid,taskstatus[atask->status],atask->dump.cs,atask->dump.eip,atask->dump.ss,atask->dump.esp);
|
||||
atask=getnexttask(atask,TASK_STATUS_ALL);
|
||||
if (atask==NULL || atask->tid.number==1) break;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
|
@ -649,7 +663,7 @@ int showidt()
|
|||
u32 index, i = 0;
|
||||
idtdes *desc;
|
||||
struct idtr idtreg;
|
||||
sidt(&idtreg);
|
||||
sidt(idtreg);
|
||||
printf("Information sur l'IDT\r\nAdresse:%X Limite:%hX\r\n",
|
||||
idtreg.base, (u32) idtreg.limite);
|
||||
desc = idtreg.base;
|
||||
|
@ -700,7 +714,7 @@ int showgdt()
|
|||
{
|
||||
u32 index;
|
||||
struct gdtr gdtreg;
|
||||
sgdt(&gdtreg);
|
||||
sgdt(gdtreg);
|
||||
printf("Information sur la GDT\r\nAdresse:%X Limite:%hX\r\n",
|
||||
gdtreg.base, gdtreg.limite);
|
||||
for (index = 0; index < gdtreg.limite; index += sizeof(gdtdes))
|
||||
|
|
Loading…
Reference in New Issue