.dsy:it.
Show 150 posts per page

.dsy:it. (http://www.dsy.it/forum/)
- Sistemi operativi I (http://www.dsy.it/forum/forumdisplay.php?forumid=269)
-- Effetto tasto F8 (http://www.dsy.it/forum/showthread.php?threadid=31283)


Posted by =kimi= on 26-06-2007 14:03:

Effetto tasto F8

ciao ragazzi,
volevo sapere se c'era qualcuno disponibile a spiegare i passi che bisogna fare su minix per poter modificare il tasto f8, cioè quando lo si preme per esempio compare una scritta.


Posted by n3o on 26-06-2007 18:07:

Devi modificare solo un paio di file:

in /usr/src/servers/is/dmp.c

code:
#define NHOOKS 18 struct hook_entry { int key; void (*function)(void); char *name; } hooks[NHOOKS] = { { F1, proctab_dmp, "Kernel process table" }, { F2, memmap_dmp, "Process memory maps" }, { F3, image_dmp, "System image" }, { F4, privileges_dmp, "Process privileges" }, { F5, monparams_dmp, "Boot monitor parameters" }, { F6, irqtab_dmp, "IRQ hooks and policies" }, { F7, kmessages_dmp, "Kernel messages" }, { F9, sched_dmp, "Scheduling queues" }, { F10, kenv_dmp, "Kernel parameters" }, ....


Modifichi
#define NHOOKS 18 in #define NHOOKS 19
Aggiungi la seguente riga nela struttura degli HOOKS:
code:
.... { F6, irqtab_dmp, "IRQ hooks and policies" }, { F7, kmessages_dmp, "Kernel messages" }, { F8, hw_dmp, "Print a nice message!" }, { F9, sched_dmp, "Scheduling queues" }, { F10, kenv_dmp, "Kernel parameters" }, ....


In fondo al file aggiungi la funzione hw_dmp :
code:
PUBLIC void hw_dmp(void) { printf ("Hello World !!!\n"); }


Infine in /usr/src/servers/is/proto.h

code:
/* Function prototypes. */ /* main.c */ _PROTOTYPE( int main, (int argc, char **argv) ); /* dmp.c */ _PROTOTYPE( int do_fkey_pressed, (message *m) ); _PROTOTYPE( void mapping_dmp, (void) ); ....


Aggiungi un prototipo nel gruppo dmp.c

code:
/* Function prototypes. */ /* main.c */ _PROTOTYPE( int main, (int argc, char **argv) ); /* dmp.c */ _PROTOTYPE( int do_fkey_pressed, (message *m) ); _PROTOTYPE( void mapping_dmp, (void) ); _PROTOTYPE( void hw_dmp, (void) ); ....


Spostati in /usr/src/tools

make image
make services (fondamentale!)
make hdboot
reboot

That's all folks!!!

__________________
The answer is blowing in the wind...


Posted by =kimi= on 26-06-2007 19:09:

grazie mille,
invece per quanto riguarda la modifica nel kernel,quando inseriamo una nuova syscall con parametri a cosa devo stare attento??? puoi darmi anche li delle dritte???


Posted by n3o on 27-06-2007 13:46:

Questa è decisamente più complicata...


  1. In /usr/src/include/minix/call_nr.h
    Aumenta di uno il numero di syscall NCALLS e aggiungi una syscall alla fine seguendo lo schema delle precedenti, es:
    #define GREETINGS 95 /* to PM */
  2. In /usr/src/servers/fs/table.c aggiungi alla fine dei prototipi la riga:
    no_sys, /* 95 = greetings */
  3. In /usr/src/servers/pm/table.c aggiungi alla fine dei prototipi la riga:
    do_greetings, /* 95 = greetings */
  4. In /usr/src/servers/pm/misc.c aggiungi la syscall vera e propria alla fine del file:
    code:
    PUBLIC void do_greetings (void) { printf ("Hi %s, %d greeting%s for you !!!\n", m_in.m3_ca1, m_in.m3_i1, m_in.m3_i1 == 1 ? "" : "s"); }
    m_in è il messaggio in ingresso, guarda sul libro per la composizione dei vari messaggi...
  5. In /usr/src/servers/pm/proto.h
    Aggiungi il prototipo della funzione appena creata sotto la sezione misc.c:
    _PROTOTYPE( void do_greetings, (void) );
  6. A questo punto ricompila tutto con make image e make hdboot poi fai uno shutdown e crea un file di test del tipo:
    code:
    #include <lib.h> #include <string.h> #include <unistd.h> int main (void) { message m; m.m3_i1 = 5 strcpy (m.m3_ca1, "Pippo Pluto"); // Max 13 caratteri + '\0' _syscall (PM_PROC_NR, GREETINGS, &m); return (0); }

    Questo test dovrebbe stamparti:
    # Hi Pippo Pluto, 5 greetings for you !!!

Si potrebbe creare anche un wrapper nelle librerie per evitare di scrivere manualmente i messaggi ma introdurrebbe altre operazioni che probabilmente non servono all'esame...

E anche questa volta è tutto!

__________________
The answer is blowing in the wind...


Posted by liver82 on 18-07-2007 21:54:

Scusa ma il file di test dove va messo?
Grazie mille!!!


Posted by n3o on 18-07-2007 22:03:

è un programmino che puoi mettere dove vuoi (io l'ho messo nella mia home) :D
Scrittura: elvis test.c (o elle, io ho scaricato vim..)
Compilazione: cc test.c -o test
Esecuzione: ./test

__________________
The answer is blowing in the wind...


Posted by marbliss on 12-07-2008 02:02:

Ciao, ho seguito passo per passo tutto quello che c'è da fare per far stampare "Hello World" quando si preme F8 ma non mi funziona. Ricompila il kernel senza errori, ma premendo F8 non succede niente!! Qualcuno mi può aiutare a capire come mai? Grazie a chi risponde


Posted by cimax86 on 12-07-2008 11:50:

controlla di aver fatto giusta la punteggiatura. a me molti errori di compilazione erano su quello.


All times are GMT. The time now is 09:08.
Show all 8 posts from this thread on one page

Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.