Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Commit

Permalink
unite parti
Browse files Browse the repository at this point in the history
  • Loading branch information
specialfish9 committed Jul 16, 2022
1 parent cb09f79 commit 473a242
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 29 deletions.
12 changes: 3 additions & 9 deletions src/init_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "pandos_types.h"
#include "syscalls.h"
#include "utils.h"
#include "sys_support.h"
#include "vm_support.h"
#include <umps3/umps/cp0.h>
#include <umps3/umps/libumps.h>
Expand All @@ -12,8 +13,7 @@

extern void tlb_exc_handler(void);

// TODO tmp gabrieele e yonas
static void exc_handler(void);
extern void support_exec_handler(void);

static int semaforo_a_cazzo = 0;

Expand Down Expand Up @@ -47,7 +47,7 @@ inline void instantiator_proc(void)

context_t context[2];
context[0].pc = (memaddr)tlb_exc_handler;
context[1].pc = (memaddr)exc_handler;
context[1].pc = (memaddr)support_exec_handler;
/* Timer enabled, interupts on and kernel mode */
context[0].status = STATUS_TE | STATUS_IM_MASK | STATUS_KUc | STATUS_IEp;
context[1].status = STATUS_TE | STATUS_IM_MASK | STATUS_KUc | STATUS_IEp;
Expand Down Expand Up @@ -85,9 +85,3 @@ inline void init_page_table(pteEntry_t *tbl, const int asid)
tbl[i].pte_entryLO = ENTRYLO_DIRTY | ENTRYLO_GLOBAL;
}
}

void exc_handler(void)
{
log("idk", "YYYe");
PANIC();
}
1 change: 0 additions & 1 deletion src/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ void exception_handler(void)

cause = CAUSE_GET_EXCCODE(getCAUSE());

if (cause != 0 && cause != 8)
LOGi("ex", cause);

if (act_proc != NULL) {
Expand Down
30 changes: 13 additions & 17 deletions src/sys_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
#include <umps3/umps/cp0.h>
#include "pandos_const.h"

/* TODO Trovare altrernativa */
#define PRINTCHR 2
void support_syscall_handler(support_t* act_proc_sup);

#define LOG(s) log("SS", s)
#define LOGi(s, i) logi("SS", s, i)

static void support_syscall_handler(support_t* act_proc_sup);

/*
unsigned int retValue = SYSCALL (GETTOD, 0, 0, 0);
GETTOD=1
Expand Down Expand Up @@ -136,26 +142,16 @@ inline int read_from_terminal(unsigned int virtAddr, unsigned int asid){ //
return i;
}








void support_handler(void){
void support_exec_handler(void){
support_t* act_proc_sup = (support_t*)SYSCALL(GETSUPPORTPTR,0,0,0);
unsigned int cause = CAUSE_GET_EXCCODE(act_proc_sup->sup_exceptState[GENERALEXCEPT].cause);
if(cause == EXC_SYS){
support_syscall_handler(act_proc_sup);
}else{ //TODO verificare che questo sia sempre una trap
support_trap_handler();
}else {
support_trap_handler(act_proc_sup);
}





//se exc è syscall > 0
//support_syscall_handler(act_proc_sup) / se è = 0 ci entra lo stesso probabilmente e va nel caso default
//altrimenti se exc è trap
Expand All @@ -165,7 +161,7 @@ void support_handler(void){


void support_syscall_handler(support_t* act_proc_sup){
unsigned int arg1, arg2, arg3;
unsigned int arg1, arg2, arg3; /* FIXEM sicuri che arg3 non venga mai usato ????*/

if(act_proc_sup == NULL){ //TODO forse questo controllo va tolto / va messo nel support_handler() perchè viene già fatto a priori dalla passup or die quindi è ridondante
//LOG("Error on get support");
Expand Down Expand Up @@ -197,7 +193,8 @@ void support_syscall_handler(support_t* act_proc_sup){
ret=read_from_terminal(arg1, act_proc_sup->sup_asid);
}
default:{
//PANIC o qualcosa del genere
LOGi("Unknow syscall ", number);
PANIC();
}
}

Expand All @@ -215,7 +212,6 @@ void support_syscall_handler(support_t* act_proc_sup){

void support_trap_handler(support_t* act_proc_sup){

if(act_proc_sup.)
//se il processo tiene mutua esclusione su un semaforo mutex del livello supporto (es. swap pool sem)
//rilascia la risorsa (NSYS4 / verhogen?)
//ammazza il processo (SYS2)
Expand Down
10 changes: 9 additions & 1 deletion src/sys_support.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
#ifndef SYSSUPPORT_H
#define SYSSUPPORT_H

#include "pandos_types.h"

/* TODO fare static */
extern unsigned int get_TOD(void);
extern void terminate(void);
extern int write_to_printer(unsigned int virtAddr, int len, unsigned int asid);
extern int write_to_terminal(unsigned int virtAddr, int len, unsigned int asid);
extern void support_trap_handler(support_t* act_proc_sup);
extern int read_from_terminal(unsigned int virtAddr, unsigned int asid);




extern void support_trap_handler(support_t* act_proc_sup);

extern void support_exec_handler(void);

#endif

5 changes: 5 additions & 0 deletions src/vm_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ typedef struct {
pteEntry_t *pg_tbl_entry;
} swppl_entry_t;

int swp_pl_sem;

static swppl_entry_t swppl_tbl[SWAP_POOL_SIZE];

/*
Expand All @@ -42,6 +44,9 @@ inline void init_supp_structures(void)
{
size_tt i;

/* Inizializza il semaforo di mutua esclusione della swap pool a 1 */
swp_pl_sem = 1;

/* Imposta tutti i frame della swap pool come 'liberi' */
for (i = 0; i < SWAP_POOL_SIZE; i++)
swppl_tbl[i].asid = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/vm_support.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef VM_SUPPORT
#define VM_SUPPORT

extern int swp_pl_sem = 1;
extern int swp_pl_sem;

extern void init_supp_structures(void);

Expand Down

0 comments on commit 473a242

Please sign in to comment.