From: Philip Homburg Date: Mon, 10 Jul 2006 12:37:39 +0000 (+0000) Subject: Changed to use sys_readbios to get screen parameters. Added safecopy version X-Git-Tag: v3.1.3~262 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/examples/outline.c?a=commitdiff_plain;h=ee09d504039432aab47f08c53aa39bf947ce5296;p=minix.git Changed to use sys_readbios to get screen parameters. Added safecopy version to get log messages. --- diff --git a/drivers/tty/console.c b/drivers/tty/console.c index 57984be33..37ad0d436 100644 --- a/drivers/tty/console.c +++ b/drivers/tty/console.c @@ -938,14 +938,14 @@ tty_t *tp; if (! vdu_initialized++) { /* How about error checking? What to do on failure??? */ - s=sys_vircopy(SELF, BIOS_SEG, (vir_bytes) VDU_SCREEN_COLS_ADDR, - SELF, D, (vir_bytes) &bios_columns, VDU_SCREEN_COLS_SIZE); - s=sys_vircopy(SELF, BIOS_SEG, (vir_bytes) VDU_CRT_BASE_ADDR, - SELF, D, (vir_bytes) &bios_crtbase, VDU_CRT_BASE_SIZE); - s=sys_vircopy(SELF, BIOS_SEG, (vir_bytes) VDU_SCREEN_ROWS_ADDR, - SELF, D, (vir_bytes) &bios_rows, VDU_SCREEN_ROWS_SIZE); - s=sys_vircopy(SELF, BIOS_SEG, (vir_bytes) VDU_FONTLINES_ADDR, - SELF, D, (vir_bytes) &bios_fontlines, VDU_FONTLINES_SIZE); + s=sys_readbios(VDU_SCREEN_COLS_ADDR, &bios_columns, + VDU_SCREEN_COLS_SIZE); + s=sys_readbios(VDU_CRT_BASE_ADDR, &bios_crtbase, + VDU_CRT_BASE_SIZE); + s=sys_readbios( VDU_SCREEN_ROWS_ADDR, &bios_rows, + VDU_SCREEN_ROWS_SIZE); + s=sys_readbios(VDU_FONTLINES_ADDR, &bios_fontlines, + VDU_FONTLINES_SIZE); vid_port = bios_crtbase; scr_width = bios_columns; @@ -1130,6 +1130,26 @@ message *m_ptr; /* pointer to request message */ send(m_ptr->m_source, m_ptr); } +/*===========================================================================* + * do_get_kmess_s * + *===========================================================================*/ +PUBLIC void do_get_kmess_s(m_ptr) +message *m_ptr; /* pointer to request message */ +{ +/* Provide the log device with debug output */ + cp_grant_id_t gid; + int r; + + gid = m_ptr->GETKM_GRANT; + r= OK; + if (sys_safecopyto(m_ptr->m_source, gid, 0, (vir_bytes)&kmess, sizeof(kmess), + D) != OK) { + r = EFAULT; + } + m_ptr->m_type = r; + send(m_ptr->m_source, m_ptr); +} + /*===========================================================================* * cons_putk * *===========================================================================*/ diff --git a/drivers/tty/tty.c b/drivers/tty/tty.c index 2934deadc..7af69877e 100644 --- a/drivers/tty/tty.c +++ b/drivers/tty/tty.c @@ -221,6 +221,9 @@ PUBLIC void main(void) case GET_KMESS: do_get_kmess(&tty_mess); continue; + case GET_KMESS_S: + do_get_kmess_s(&tty_mess); + continue; case FKEY_CONTROL: /* (un)register a fkey observer */ do_fkey_ctl(&tty_mess); continue; diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h index a3fba614f..67a7e9349 100644 --- a/drivers/tty/tty.h +++ b/drivers/tty/tty.h @@ -173,6 +173,7 @@ _PROTOTYPE( void cons_stop, (void) ); _PROTOTYPE( void do_new_kmess, (message *m) ); _PROTOTYPE( void do_diagnostics, (message *m, int safe) ); _PROTOTYPE( void do_get_kmess, (message *m) ); +_PROTOTYPE( void do_get_kmess_s, (message *m) ); _PROTOTYPE( void scr_init, (struct tty *tp) ); _PROTOTYPE( void toggle_scroll, (void) ); _PROTOTYPE( int con_loadfont, (message *m) );