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/proc.h"
int irq_hook_id = -1;
/* Standard and AT keyboard. (PS/2 MCA implies AT throughout.) */
#define KEYBD 0x60 /* I/O port for keyboard data */
@ -363,7 +365,6 @@ tty_t *tp;
{
/* Initialize the keyboard driver. */
static int count = 0;
int irq_hook_id;
int i;
tp->tty_devread = kb_read; /* input function */
@ -381,7 +382,7 @@ tty_t *tp;
/* Set interrupt handler and enable keyboard IRQ. */
if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK)
server_panic("TTY", "Couldn't set keyboard IRQ policy", i);
server_panic("TTY", "Couldn't set keyboard IRQ policy", i);
if ((i=sys_irqenable(&irq_hook_id)) != OK)
server_panic("TTY", "Couldn't enable keyboard IRQs", i);
}

View file

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

View file

@ -66,6 +66,8 @@
#endif
#include "tty.h"
extern int irq_hook_id;
/* Address of a tty structure. */
#define tty_addr(line) (&tty_table[line])
@ -204,6 +206,11 @@ PUBLIC void main(void)
if (! stop++) {
cons_stop(); /* first switch to primary console */
} 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("MINIX will now be shutdown.\n");
sys_exit(0); /* then exit TTY */

View file

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