added code to un-register tty's interrupt at exit time; fixed compiler

warnings
This commit is contained in:
Ben Gras 2005-05-12 16:03:43 +00:00
parent fbe1641bd3
commit fad180960f
4 changed files with 19 additions and 10 deletions

View File

@ -18,6 +18,8 @@
#include "../../kernel/kernel.h" #include "../../kernel/kernel.h"
#include "../../kernel/proc.h" #include "../../kernel/proc.h"
int irq_hook_id = -1;
/* Standard and AT keyboard. (PS/2 MCA implies AT throughout.) */ /* Standard and AT keyboard. (PS/2 MCA implies AT throughout.) */
#define KEYBD 0x60 /* I/O port for keyboard data */ #define KEYBD 0x60 /* I/O port for keyboard data */
@ -363,7 +365,6 @@ tty_t *tp;
{ {
/* Initialize the keyboard driver. */ /* Initialize the keyboard driver. */
static int count = 0; static int count = 0;
int irq_hook_id;
int i; int i;
tp->tty_devread = kb_read; /* input function */ tp->tty_devread = kb_read; /* input function */

View File

@ -100,7 +100,7 @@ message *m_ptr;
if (numap_local(m_ptr->PROC_NR, (vir_bytes) m_ptr->ADDRESS, if (numap_local(m_ptr->PROC_NR, (vir_bytes) m_ptr->ADDRESS,
m_ptr->COUNT) == 0) { m_ptr->COUNT) == 0) {
#else #else
if ((r = sys_umap(m_ptr->PROC_NR, D, m_ptr->ADDRESS, if ((r = sys_umap(m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
m_ptr->COUNT, &p)) != OK) { m_ptr->COUNT, &p)) != OK) {
#endif #endif
break; break;
@ -142,7 +142,7 @@ message *m_ptr;
m_ptr->COUNT) == 0) { m_ptr->COUNT) == 0) {
r = EFAULT; r = EFAULT;
#else #else
if ((r = sys_umap(m_ptr->PROC_NR, D, m_ptr->ADDRESS, if ((r = sys_umap(m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
m_ptr->COUNT, &p)) != OK) { m_ptr->COUNT, &p)) != OK) {
#endif #endif
break; break;
@ -234,8 +234,8 @@ tty_t *tp;
user_phys = proc_vir2phys(proc_addr(tp->tty_outproc), tp->tty_out_vir); user_phys = proc_vir2phys(proc_addr(tp->tty_outproc), tp->tty_out_vir);
phys_copy(user_phys, vir2phys(pp->ohead), (phys_bytes) count); phys_copy(user_phys, vir2phys(pp->ohead), (phys_bytes) count);
#else #else
if((s = sys_vircopy(tp->tty_outproc, D, tp->tty_out_vir, if((s = sys_vircopy(tp->tty_outproc, D, (vir_bytes) tp->tty_out_vir,
SELF, D, pp->ohead, (phys_bytes) count)) != OK) { SELF, D, (vir_bytes) pp->ohead, (phys_bytes) count)) != OK) {
printf("pty tty%d: copy failed (error %d)\n", s); printf("pty tty%d: copy failed (error %d)\n", s);
break; break;
} }
@ -314,8 +314,8 @@ pty_t *pp;
user_phys = proc_vir2phys(proc_addr(pp->rdproc), pp->rdvir); user_phys = proc_vir2phys(proc_addr(pp->rdproc), pp->rdvir);
phys_copy(vir2phys(pp->otail), user_phys, (phys_bytes) count); phys_copy(vir2phys(pp->otail), user_phys, (phys_bytes) count);
#endif #endif
if((s = sys_vircopy(SELF, D, pp->otail, if((s = sys_vircopy(SELF, D, (vir_bytes)pp->otail,
pp->rdproc, D, pp->rdvir, (phys_bytes) count)) != OK) { (vir_bytes) pp->rdproc, D, (vir_bytes) pp->rdvir, (phys_bytes) count)) != OK) {
printf("pty tty%d: copy failed (error %d)\n", s); printf("pty tty%d: copy failed (error %d)\n", s);
break; break;
} }
@ -376,8 +376,8 @@ tty_t *tp;
user_phys = proc_vir2phys(proc_addr(pp->wrproc), pp->wrvir); user_phys = proc_vir2phys(proc_addr(pp->wrproc), pp->wrvir);
phys_copy(user_phys, vir2phys(&c), 1L); phys_copy(user_phys, vir2phys(&c), 1L);
#endif #endif
if((s = sys_vircopy(pp->wrproc, D, pp->wrvir, if((s = sys_vircopy(pp->wrproc, D, (vir_bytes) pp->wrvir,
SELF, D, &c, (phys_bytes) 1)) != OK) { SELF, D, (vir_bytes) &c, (phys_bytes) 1)) != OK) {
printf("pty: copy failed (error %d)\n", s); printf("pty: copy failed (error %d)\n", s);
break; break;
} }

View File

@ -66,6 +66,8 @@
#endif #endif
#include "tty.h" #include "tty.h"
extern int irq_hook_id;
/* Address of a tty structure. */ /* Address of a tty structure. */
#define tty_addr(line) (&tty_table[line]) #define tty_addr(line) (&tty_table[line])
@ -204,6 +206,11 @@ PUBLIC void main(void)
if (! stop++) { if (! stop++) {
cons_stop(); /* first switch to primary console */ cons_stop(); /* first switch to primary console */
} else { } else {
if(irq_hook_id != -1) {
int r;
r = sys_irqdisable(&irq_hook_id);
r = sys_irqrmpolicy(KEYBOARD_IRQ, &irq_hook_id);
}
printf("[DONE]\n"); printf("[DONE]\n");
printf("MINIX will now be shutdown.\n"); printf("MINIX will now be shutdown.\n");
sys_exit(0); /* then exit TTY */ sys_exit(0); /* then exit TTY */

View File

@ -75,6 +75,7 @@ typedef struct tty {
/* Memory allocated in tty.c, so extern here. */ /* Memory allocated in tty.c, so extern here. */
extern tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS]; extern tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS];
extern int ccurrent; /* currently visible console */ extern int ccurrent; /* currently visible console */
extern int irq_hook_id; /* hook id for keyboard irq */
/* Values for the fields. */ /* Values for the fields. */
#define NOT_ESCAPED 0 /* previous character is not LNEXT (^V) */ #define NOT_ESCAPED 0 /* previous character is not LNEXT (^V) */