Changeset 516ff92 in mainline
- Timestamp:
- 2009-01-31T21:27:18Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4863e50b
- Parents:
- 96a2e45
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/include/machine.h
r96a2e45 r516ff92 103 103 104 104 105 #ifdef MACHINE_GXEMUL_TESTARM 106 #define machine_console_init(devno) gxemul_console_init(devno) 107 #define machine_grab_console gxemul_grab_console 108 #define machine_release_console gxemul_release_console 109 #define machine_hw_map_init gxemul_hw_map_init 110 #define machine_timer_irq_start gxemul_timer_irq_start 111 #define machine_cpu_halt gxemul_cpu_halt 112 #define machine_get_memory_size gxemul_get_memory_size 113 #define machine_debug_putc(ch) gxemul_debug_putc(ch) 114 #define machine_irq_exception(exc_no, istate) \ 115 gxemul_irq_exception(exc_no, istate) 116 #define machine_get_fb_address gxemul_get_fb_address 105 #ifdef MACHINE_GXEMUL_TESTARM 106 #define machine_console_init(devno) gxemul_console_init(devno) 107 #define machine_grab_console gxemul_grab_console 108 #define machine_release_console gxemul_release_console 109 #define machine_hw_map_init gxemul_hw_map_init 110 #define machine_timer_irq_start gxemul_timer_irq_start 111 #define machine_cpu_halt gxemul_cpu_halt 112 #define machine_get_memory_size gxemul_get_memory_size 113 #define machine_debug_putc(ch) gxemul_debug_putc(ch) 114 #define machine_irq_exception(exc_no, istate) gxemul_irq_exception(exc_no, istate) 115 #define machine_get_fb_address gxemul_get_fb_address 117 116 #endif 118 117 -
kernel/arch/arm32/src/drivers/gxemul.c
r96a2e45 r516ff92 134 134 * @param ch Characted to be printed. 135 135 */ 136 static void gxemul_write(chardev_t *dev, const char ch) 137 { 138 *((char *) gxemul_hw_map.videoram) = ch; 136 static void gxemul_write(chardev_t *dev, const char ch, bool silent) 137 { 138 if (!silent) 139 *((char *) gxemul_hw_map.videoram) = ch; 139 140 } 140 141 -
kernel/arch/ia32xen/src/drivers/xconsole.c
r96a2e45 r516ff92 56 56 } 57 57 58 void xen_putchar(chardev_t *d, const char ch )58 void xen_putchar(chardev_t *d, const char ch, bool silent) 59 59 { 60 if (start_info.console.domU.evtchn != 0) { 61 uint32_t cons = console_page.out_cons; 62 uint32_t prod = console_page.out_prod; 63 64 memory_barrier(); 65 66 if ((prod - cons) > sizeof(console_page.out)) 67 return; 68 69 if (ch == '\n') 70 console_page.out[MASK_INDEX(prod++, console_page.out)] = '\r'; 71 console_page.out[MASK_INDEX(prod++, console_page.out)] = ch; 72 73 write_barrier(); 74 75 console_page.out_prod = prod; 76 77 xen_notify_remote(start_info.console.domU.evtchn); 78 } else 79 xen_console_io(CONSOLE_IO_WRITE, 1, &ch); 60 if (!silent) { 61 if (start_info.console.domU.evtchn != 0) { 62 uint32_t cons = console_page.out_cons; 63 uint32_t prod = console_page.out_prod; 64 65 memory_barrier(); 66 67 if ((prod - cons) > sizeof(console_page.out)) 68 return; 69 70 if (ch == '\n') 71 console_page.out[MASK_INDEX(prod++, console_page.out)] = '\r'; 72 console_page.out[MASK_INDEX(prod++, console_page.out)] = ch; 73 74 write_barrier(); 75 76 console_page.out_prod = prod; 77 78 xen_notify_remote(start_info.console.domU.evtchn); 79 } else 80 xen_console_io(CONSOLE_IO_WRITE, 1, &ch); 81 } 80 82 } 81 83 -
kernel/arch/ia64/src/ia64.c
r96a2e45 r516ff92 255 255 #else 256 256 i8042_grab(); 257 #endif 258 #endif 257 #endif 258 #endif 259 259 } 260 260 -
kernel/arch/ia64/src/ski/ski.c
r96a2e45 r516ff92 57 57 static bool kbd_disabled; 58 58 59 static void ski_putchar(chardev_t *d, const char ch);60 static int32_t ski_getchar(void);61 62 59 /** Display character on debug console 63 60 * … … 68 65 * @param ch Character to be printed. 69 66 */ 70 void ski_putchar(chardev_t *d, const char ch) 71 { 72 asm volatile ( 73 "mov r15 = %0\n" 74 "mov r32 = %1\n" /* r32 is in0 */ 75 "break 0x80000\n" /* modifies r8 */ 76 : 77 : "i" (SKI_PUTCHAR), "r" (ch) 78 : "r15", "in0", "r8" 79 ); 80 81 if (ch == '\n') 82 ski_putchar(d, '\r'); 67 static void ski_putchar(chardev_t *d, const char ch, bool silent) 68 { 69 if (!silent) { 70 asm volatile ( 71 "mov r15 = %0\n" 72 "mov r32 = %1\n" /* r32 is in0 */ 73 "break 0x80000\n" /* modifies r8 */ 74 : 75 : "i" (SKI_PUTCHAR), "r" (ch) 76 : "r15", "in0", "r8" 77 ); 78 79 if (ch == '\n') 80 ski_putchar(d, '\r'); 81 } 83 82 } 84 83 … … 92 91 * @return ASCII code of pressed key or 0 if no key pressed. 93 92 */ 94 int32_t ski_getchar(void)93 static int32_t ski_getchar(void) 95 94 { 96 95 uint64_t ch; -
kernel/arch/mips32/src/drivers/msim.c
r96a2e45 r516ff92 27 27 */ 28 28 29 /** @addtogroup mips32 29 /** @addtogroup mips32 30 30 * @{ 31 31 */ … … 59 59 60 60 /** Putchar that works with MSIM & gxemul */ 61 void msim_write(chardev_t *dev, const char ch )61 void msim_write(chardev_t *dev, const char ch, bool silent) 62 62 { 63 *((char *) MSIM_VIDEORAM) = ch; 63 if (!silent) 64 *((char *) MSIM_VIDEORAM) = ch; 64 65 } 65 66 … … 81 82 { 82 83 char ch; 83 84 84 85 while (1) { 85 86 ch = *((volatile char *) MSIM_KBD_ADDRESS); … … 102 103 char ch = 0; 103 104 104 105 106 107 108 109 105 ch = *((char *) MSIM_KBD_ADDRESS); 106 if (ch =='\r') 107 ch = '\n'; 108 if (ch == 0x7f) 109 ch = '\b'; 110 chardev_push_character(&console, ch); 110 111 } 111 112 } -
kernel/arch/mips32/src/drivers/serial.c
r96a2e45 r516ff92 27 27 */ 28 28 29 /** @addtogroup mips32 29 /** @addtogroup mips32 30 30 * @{ 31 31 */ … … 47 47 static bool kb_enabled; 48 48 49 static void serial_write(chardev_t *d, const char ch )49 static void serial_write(chardev_t *d, const char ch, bool silent) 50 50 { 51 serial_t *sd = (serial_t *)d->data; 52 53 if (ch == '\n') 54 serial_write(d, '\r'); 55 /* Wait until transmit buffer empty */ 56 while (! (SERIAL_READ_LSR(sd->port) & (1<<TRANSMIT_EMPTY_BIT))) 57 ; 58 SERIAL_WRITE(sd->port, ch); 51 if (!silent) { 52 serial_t *sd = (serial_t *)d->data; 53 54 if (ch == '\n') 55 serial_write(d, '\r'); 56 57 /* Wait until transmit buffer empty */ 58 while (!(SERIAL_READ_LSR(sd->port) & (1 << TRANSMIT_EMPTY_BIT))); 59 SERIAL_WRITE(sd->port, ch); 60 } 59 61 } 60 62 … … 134 136 { 135 137 serial_t *sd = &sconf[0]; 136 137 138 138 139 chardev_initialize("serial_console", &console, &serial_ops); 139 140 console.data = sd; … … 146 147 serial_irq.handler = serial_irq_handler; 147 148 irq_register(&serial_irq); 148 149 149 150 /* I don't know why, but the serial interrupts simply 150 * don't work on simics 151 */ 151 don't work on simics */ 152 152 virtual_timer_fnc = &serial_handler; 153 153 -
kernel/arch/ppc32/src/ppc32.c
r96a2e45 r516ff92 148 148 149 149 /* Unreachable */ 150 for (;;) 151 ; 150 while (true); 152 151 } 153 152 -
kernel/arch/sparc64/src/drivers/sgcn.c
r96a2e45 r516ff92 296 296 * written straight away. 297 297 */ 298 static void sgcn_putchar(struct chardev * cd, const char c) 299 { 300 spinlock_lock(&sgcn_output_lock); 301 302 sgcn_do_putchar(c); 303 if (c == '\n') { 304 sgcn_do_putchar('\r'); 298 static void sgcn_putchar(struct chardev * cd, const char c, bool silent) 299 { 300 if (!silent) { 301 spinlock_lock(&sgcn_output_lock); 302 303 sgcn_do_putchar(c); 304 if (c == '\n') 305 sgcn_do_putchar('\r'); 306 307 spinlock_unlock(&sgcn_output_lock); 305 308 } 306 307 spinlock_unlock(&sgcn_output_lock);308 309 } 309 310 -
kernel/genarch/src/drivers/ega/ega.c
r96a2e45 r516ff92 63 63 static ioport_t ega_base; 64 64 65 static void ega_putchar(chardev_t *d, const char ch);66 67 65 chardev_t ega_console; 68 static chardev_operations_t ega_ops = {69 .write = ega_putchar70 };71 72 static void ega_move_cursor(void);73 74 void ega_init(ioport_t base, uintptr_t videoram_phys)75 {76 /* Initialize the software structure. */77 ega_base = base;78 79 backbuf = (uint8_t *) malloc(SCREEN * 2, 0);80 if (!backbuf)81 panic("Unable to allocate backbuffer.");82 83 videoram = (uint8_t *) hw_map(videoram_phys, SCREEN * 2);84 85 /* Clear the screen and set the cursor position. */86 memsetw(videoram, SCREEN, 0x0720);87 memsetw(backbuf, SCREEN, 0x0720);88 ega_move_cursor();89 90 chardev_initialize("ega_out", &ega_console, &ega_ops);91 stdout = &ega_console;92 93 ega_parea.pbase = videoram_phys;94 ega_parea.vbase = (uintptr_t) videoram;95 ega_parea.frames = 1;96 ega_parea.cacheable = false;97 ddi_parea_register(&ega_parea);98 99 sysinfo_set_item_val("fb", NULL, true);100 sysinfo_set_item_val("fb.kind", NULL, 2);101 sysinfo_set_item_val("fb.width", NULL, ROW);102 sysinfo_set_item_val("fb.height", NULL, ROWS);103 sysinfo_set_item_val("fb.blinking", NULL, true);104 sysinfo_set_item_val("fb.address.physical", NULL, videoram_phys);105 }106 107 static void ega_display_char(char ch)108 {109 videoram[ega_cursor * 2] = ch;110 backbuf[ega_cursor * 2] = ch;111 }112 66 113 67 /* … … 128 82 } 129 83 130 void ega_putchar(chardev_t *d __attribute__((unused)), const char ch) 84 static void ega_move_cursor(void) 85 { 86 outb(ega_base + EGA_INDEX_REG, 0xe); 87 outb(ega_base + EGA_DATA_REG, (uint8_t) ((ega_cursor >> 8) & 0xff)); 88 outb(ega_base + EGA_INDEX_REG, 0xf); 89 outb(ega_base + EGA_DATA_REG, (uint8_t) (ega_cursor & 0xff)); 90 } 91 92 static void ega_display_char(char ch, bool silent) 93 { 94 backbuf[ega_cursor * 2] = ch; 95 96 if (!silent) 97 videoram[ega_cursor * 2] = ch; 98 } 99 100 static void ega_putchar(chardev_t *d __attribute__((unused)), const char ch, bool silent) 131 101 { 132 102 ipl_t ipl; 133 103 134 104 ipl = interrupts_disable(); 135 105 spinlock_lock(&egalock); 136 106 137 107 switch (ch) { 138 108 case '\n': … … 147 117 break; 148 118 default: 149 ega_display_char(ch );119 ega_display_char(ch, silent); 150 120 ega_cursor++; 151 121 break; 152 122 } 153 123 ega_check_cursor(); 154 ega_move_cursor(); 155 124 125 if (!silent) 126 ega_move_cursor(); 127 156 128 spinlock_unlock(&egalock); 157 129 interrupts_restore(ipl); 158 130 } 159 131 160 void ega_move_cursor(void) 132 static chardev_operations_t ega_ops = { 133 .write = ega_putchar 134 }; 135 136 void ega_init(ioport_t base, uintptr_t videoram_phys) 161 137 { 162 outb(ega_base + EGA_INDEX_REG, 0xe); 163 outb(ega_base + EGA_DATA_REG, (uint8_t) ((ega_cursor >> 8) & 0xff)); 164 outb(ega_base + EGA_INDEX_REG, 0xf); 165 outb(ega_base + EGA_DATA_REG, (uint8_t) (ega_cursor & 0xff)); 138 /* Initialize the software structure. */ 139 ega_base = base; 140 141 backbuf = (uint8_t *) malloc(SCREEN * 2, 0); 142 if (!backbuf) 143 panic("Unable to allocate backbuffer."); 144 145 videoram = (uint8_t *) hw_map(videoram_phys, SCREEN * 2); 146 147 /* Clear the screen and set the cursor position. */ 148 memsetw(videoram, SCREEN, 0x0720); 149 memsetw(backbuf, SCREEN, 0x0720); 150 ega_move_cursor(); 151 152 chardev_initialize("ega_out", &ega_console, &ega_ops); 153 stdout = &ega_console; 154 155 ega_parea.pbase = videoram_phys; 156 ega_parea.vbase = (uintptr_t) videoram; 157 ega_parea.frames = 1; 158 ega_parea.cacheable = false; 159 ddi_parea_register(&ega_parea); 160 161 sysinfo_set_item_val("fb", NULL, true); 162 sysinfo_set_item_val("fb.kind", NULL, 2); 163 sysinfo_set_item_val("fb.width", NULL, ROW); 164 sysinfo_set_item_val("fb.height", NULL, ROWS); 165 sysinfo_set_item_val("fb.blinking", NULL, true); 166 sysinfo_set_item_val("fb.address.physical", NULL, videoram_phys); 166 167 } 167 168 -
kernel/genarch/src/fb/fb.c
r96a2e45 r516ff92 185 185 * 186 186 */ 187 static void logo_hide( void)187 static void logo_hide(bool silent) 188 188 { 189 189 ylogo = 0; 190 190 ytrim = yres; 191 191 rowtrim = rows; 192 fb_redraw(); 192 if (!silent) 193 fb_redraw(); 193 194 } 194 195 … … 197 198 * 198 199 */ 199 static void glyph_draw(uint8_t glyph, unsigned int col, unsigned int row )200 static void glyph_draw(uint8_t glyph, unsigned int col, unsigned int row, bool silent) 200 201 { 201 202 unsigned int x = COL2X(col); … … 204 205 205 206 if (y >= ytrim) 206 logo_hide( );207 logo_hide(silent); 207 208 208 209 backbuf[BB_POS(col, row)] = glyph; 209 210 210 for (yd = 0; yd < FONT_SCANLINES; yd++) 211 memcpy(&fb_addr[FB_POS(x, y + yd + ylogo)], 212 &glyphs[GLYPH_POS(glyph, yd)], glyphscanline); 211 if (!silent) { 212 for (yd = 0; yd < FONT_SCANLINES; yd++) 213 memcpy(&fb_addr[FB_POS(x, y + yd + ylogo)], 214 &glyphs[GLYPH_POS(glyph, yd)], glyphscanline); 215 } 213 216 } 214 217 … … 218 221 * 219 222 */ 220 static void screen_scroll( void)223 static void screen_scroll(bool silent) 221 224 { 222 225 if (ylogo > 0) { 223 logo_hide( );226 logo_hide(silent); 224 227 return; 225 228 } 226 229 227 unsigned int row; 228 229 for (row = 0; row < rows; row++) { 230 unsigned int y = ROW2Y(row); 231 unsigned int yd; 230 if (!silent) { 231 unsigned int row; 232 232 233 for ( yd = 0; yd < FONT_SCANLINES; yd++) {234 unsigned int x;235 unsigned int col;233 for (row = 0; row < rows; row++) { 234 unsigned int y = ROW2Y(row); 235 unsigned int yd; 236 236 237 for ( col = 0, x = 0; col < cols; col++,238 x += FONT_WIDTH) {239 u int8_t glyph;237 for (yd = 0; yd < FONT_SCANLINES; yd++) { 238 unsigned int x; 239 unsigned int col; 240 240 241 if (row < rows - 1) { 242 if (backbuf[BB_POS(col, row)] == 243 backbuf[BB_POS(col, row + 1)]) 244 continue; 241 for (col = 0, x = 0; col < cols; col++, 242 x += FONT_WIDTH) { 243 uint8_t glyph; 245 244 246 glyph = backbuf[BB_POS(col, row + 1)]; 247 } else 248 glyph = 0; 249 250 memcpy(&fb_addr[FB_POS(x, y + yd)], 251 &glyphs[GLYPH_POS(glyph, yd)], 252 glyphscanline); 245 if (row < rows - 1) { 246 if (backbuf[BB_POS(col, row)] == 247 backbuf[BB_POS(col, row + 1)]) 248 continue; 249 250 glyph = backbuf[BB_POS(col, row + 1)]; 251 } else 252 glyph = 0; 253 254 memcpy(&fb_addr[FB_POS(x, y + yd)], 255 &glyphs[GLYPH_POS(glyph, yd)], 256 glyphscanline); 257 } 253 258 } 254 259 } … … 260 265 261 266 262 static void cursor_put( void)263 { 264 glyph_draw(CURSOR, position % cols, position / cols );265 } 266 267 268 static void cursor_remove( void)269 { 270 glyph_draw(0, position % cols, position / cols );267 static void cursor_put(bool silent) 268 { 269 glyph_draw(CURSOR, position % cols, position / cols, silent); 270 } 271 272 273 static void cursor_remove(bool silent) 274 { 275 glyph_draw(0, position % cols, position / cols, silent); 271 276 } 272 277 … … 277 282 * 278 283 */ 279 static void fb_putchar(chardev_t *dev, char ch )284 static void fb_putchar(chardev_t *dev, char ch, bool silent) 280 285 { 281 286 spinlock_lock(&fb_lock); … … 283 288 switch (ch) { 284 289 case '\n': 285 cursor_remove( );290 cursor_remove(silent); 286 291 position += cols; 287 292 position -= position % cols; 288 293 break; 289 294 case '\r': 290 cursor_remove( );295 cursor_remove(silent); 291 296 position -= position % cols; 292 297 break; 293 298 case '\b': 294 cursor_remove( );299 cursor_remove(silent); 295 300 if (position % cols) 296 301 position--; 297 302 break; 298 303 case '\t': 299 cursor_remove( );304 cursor_remove(silent); 300 305 do { 301 306 glyph_draw((uint8_t) ' ', position % cols, 302 position / cols );307 position / cols, silent); 303 308 position++; 304 309 } while ((position % 8) && (position < cols * rows)); 305 310 break; 306 311 default: 307 glyph_draw((uint8_t) ch, position % cols, position / cols); 312 glyph_draw((uint8_t) ch, position % cols, 313 position / cols, silent); 308 314 position++; 309 315 } … … 311 317 if (position >= cols * rows) { 312 318 position -= cols; 313 screen_scroll( );314 } 315 316 cursor_put( );319 screen_scroll(silent); 320 } 321 322 cursor_put(silent); 317 323 318 324 spinlock_unlock(&fb_lock); -
kernel/generic/include/console/chardev.h
r96a2e45 r516ff92 51 51 void (* resume)(struct chardev *); 52 52 /** Write character to stream. */ 53 void (* write)(struct chardev *, char c );53 void (* write)(struct chardev *, char c, bool silent); 54 54 /** Read character directly from device, assume interrupts disabled. */ 55 55 char (* read)(struct chardev *); -
kernel/generic/include/console/console.h
r96a2e45 r516ff92 50 50 extern void putchar(char c); 51 51 52 extern void grab_console(void); 53 extern void release_console(void); 54 52 55 extern void arch_grab_console(void); 53 56 extern void arch_release_console(void); -
kernel/generic/include/syscall/syscall.h
r96a2e45 r516ff92 80 80 81 81 SYS_DEBUG_ENABLE_CONSOLE, 82 SYS_DEBUG_DISABLE_CONSOLE, 82 83 SYS_IPC_CONNECT_KBOX, 83 84 SYSCALL_END -
kernel/generic/src/console/cmd.c
r96a2e45 r516ff92 977 977 { 978 978 printf("The kernel will now relinquish the console.\n"); 979 arch_release_console();979 release_console(); 980 980 981 981 if ((kconsole_notify) && (kconsole_irq.notif_cfg.notify)) -
kernel/generic/src/console/console.c
r96a2e45 r516ff92 66 66 static size_t klog_uspace = 0; 67 67 68 /**< Silent output */ 69 static bool silent = false; 70 68 71 /**< Kernel log spinlock */ 69 72 SPINLOCK_INITIALIZE(klog_lock); … … 71 74 /** Physical memory area used for klog buffer */ 72 75 static parea_t klog_parea; 73 76 74 77 /* 75 78 * For now, we use 0 as INR. … … 143 146 klog_inited = true; 144 147 spinlock_unlock(&klog_lock); 148 } 149 150 void grab_console(void) 151 { 152 silent = false; 153 arch_grab_console(); 154 } 155 156 void release_console(void) 157 { 158 silent = true; 159 arch_release_console(); 145 160 } 146 161 … … 200 215 index_t index = 0; 201 216 char ch; 202 217 203 218 while (index < buflen) { 204 219 ch = _getc(chardev); … … 214 229 } 215 230 putchar(ch); 216 231 217 232 if (ch == '\n') { /* end of string => write 0, return */ 218 233 buf[index] = '\0'; … … 254 269 index_t i; 255 270 for (i = klog_len - klog_stored; i < klog_len; i++) 256 stdout->op->write(stdout, klog[(klog_start + i) % KLOG_SIZE] );271 stdout->op->write(stdout, klog[(klog_start + i) % KLOG_SIZE], silent); 257 272 klog_stored = 0; 258 273 } … … 266 281 267 282 if (stdout->op->write) 268 stdout->op->write(stdout, c );283 stdout->op->write(stdout, c, silent); 269 284 else { 270 285 /* The character is just in the kernel log */ -
kernel/generic/src/syscall/syscall.c
r96a2e45 r516ff92 93 93 { 94 94 #ifdef CONFIG_KCONSOLE 95 arch_grab_console();95 grab_console(); 96 96 return true; 97 97 #else 98 98 return false; 99 99 #endif 100 } 101 102 /** Tell kernel to relinquish keyboard/console access */ 103 static unative_t sys_debug_disable_console(void) 104 { 105 release_console(); 106 return true; 100 107 } 101 108 … … 185 192 /* Debug calls */ 186 193 (syshandler_t) sys_debug_enable_console, 187 194 (syshandler_t) sys_debug_disable_console, 195 188 196 (syshandler_t) sys_ipc_connect_kbox 189 197 }; -
uspace/srv/console/console.c
r96a2e45 r516ff92 501 501 502 502 /* Connect to keyboard driver */ 503 504 503 kbd_phone = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0, 0); 505 504 while (kbd_phone < 0) { … … 518 517 fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0, 0); 519 518 } 519 520 /* Disable kernel output to the console */ 521 __SYSCALL0(SYS_DEBUG_DISABLE_CONSOLE); 520 522 521 523 /* Initialize gcons */ … … 588 590 return 0; 589 591 } 590 592 591 593 /** @} 592 594 */
Note:
See TracChangeset
for help on using the changeset viewer.