Changeset b366a6f4 in mainline for kernel/generic/src
- Timestamp:
- 2011-06-24T15:58:01Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7250d2c
- Parents:
- ee2fa30a
- Location:
- kernel/generic/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/console.c
ree2fa30a rb366a6f4 87 87 }; 88 88 89 static void stdout_write(outdev_t *, wchar_t , bool);89 static void stdout_write(outdev_t *, wchar_t); 90 90 static void stdout_redraw(outdev_t *); 91 91 … … 95 95 }; 96 96 97 /** Silence output */98 bool silent= false;97 /** Override kernel console lockout */ 98 bool console_override = false; 99 99 100 100 /** Standard input and output character devices */ … … 122 122 } 123 123 124 static void stdout_write(outdev_t *dev, wchar_t ch , bool silent)124 static void stdout_write(outdev_t *dev, wchar_t ch) 125 125 { 126 126 list_foreach(dev->list, cur) { 127 127 outdev_t *sink = list_get_instance(cur, outdev_t, link); 128 128 if ((sink) && (sink->op->write)) 129 sink->op->write(sink, ch , silent);129 sink->op->write(sink, ch); 130 130 } 131 131 } … … 156 156 klog_parea.frames = SIZE2FRAMES(sizeof(klog)); 157 157 klog_parea.unpriv = false; 158 klog_parea.mapped = false; 158 159 ddi_parea_register(&klog_parea); 159 160 … … 167 168 void grab_console(void) 168 169 { 169 bool prev = silent;170 171 silent = false;170 bool prev = console_override; 171 172 console_override = true; 172 173 if ((stdout) && (stdout->op->redraw)) 173 174 stdout->op->redraw(stdout); 174 175 175 if ((stdin) && ( prev)) {176 if ((stdin) && (!prev)) { 176 177 /* 177 178 * Force the console to print the prompt. … … 183 184 void release_console(void) 184 185 { 185 // FIXME arch_release_console 186 silent = true; 187 } 188 189 /** Tell kernel to get keyboard/console access again */ 190 sysarg_t sys_debug_enable_console(void) 186 console_override = false; 187 } 188 189 /** Activate kernel console override */ 190 sysarg_t sys_debug_activate_console(void) 191 191 { 192 192 #ifdef CONFIG_KCONSOLE … … 196 196 return false; 197 197 #endif 198 }199 200 /** Tell kernel to relinquish keyboard/console access */201 sysarg_t sys_debug_disable_console(void)202 {203 release_console();204 return true;205 198 } 206 199 … … 289 282 */ 290 283 spinlock_unlock(&klog_lock); 291 stdout->op->write(stdout, tmp , silent);284 stdout->op->write(stdout, tmp); 292 285 spinlock_lock(&klog_lock); 293 286 } … … 317 310 * it should be no longer buffered. 318 311 */ 319 stdout->op->write(stdout, ch , silent);312 stdout->op->write(stdout, ch); 320 313 } else { 321 314 /* -
kernel/generic/src/ddi/ddi.c
ree2fa30a rb366a6f4 122 122 backend_data.frames = pages; 123 123 124 /* Find the zone of the physical memory */ 124 /* 125 * Check if the memory region is explicitly enabled 126 * for mapping by any parea structure. 127 */ 128 129 mutex_lock(&parea_lock); 130 btree_node_t *nodep; 131 parea_t *parea = (parea_t *) btree_search(&parea_btree, 132 (btree_key_t) pf, &nodep); 133 134 if ((parea != NULL) && (parea->frames >= pages)) { 135 if ((!priv) && (!parea->unpriv)) { 136 mutex_unlock(&parea_lock); 137 return EPERM; 138 } 139 140 goto map; 141 } 142 143 parea = NULL; 144 mutex_unlock(&parea_lock); 145 146 /* 147 * Check if the memory region is part of physical 148 * memory generally enabled for mapping. 149 */ 150 125 151 irq_spinlock_lock(&zones.lock, true); 126 152 size_t znum = find_zone(ADDR2PFN(pf), pages, 0); … … 153 179 } 154 180 155 if (zone_flags_available(zones.info[znum].flags)) {156 /*157 * Frames are part of physical memory, check158 * if the memory region is enabled for mapping.159 */160 irq_spinlock_unlock(&zones.lock, true);161 162 mutex_lock(&parea_lock);163 btree_node_t *nodep;164 parea_t *parea = (parea_t *) btree_search(&parea_btree,165 (btree_key_t) pf, &nodep);166 167 if ((!parea) || (parea->frames < pages)) {168 mutex_unlock(&parea_lock);169 return ENOENT;170 }171 172 if (!priv) {173 if (!parea->unpriv) {174 mutex_unlock(&parea_lock);175 return EPERM;176 }177 }178 179 mutex_unlock(&parea_lock);180 goto map;181 }182 183 181 irq_spinlock_unlock(&zones.lock, true); 184 182 return ENOENT; … … 188 186 AS_AREA_ATTR_NONE, &phys_backend, &backend_data)) { 189 187 /* 190 * The address space area could not have beencreated.188 * The address space area was not created. 191 189 * We report it using ENOMEM. 192 190 */ 191 192 if (parea != NULL) 193 mutex_unlock(&parea_lock); 194 193 195 return ENOMEM; 194 196 } … … 197 199 * Mapping is created on-demand during page fault. 198 200 */ 199 return 0; 201 202 if (parea != NULL) { 203 parea->mapped = true; 204 mutex_unlock(&parea_lock); 205 } 206 207 return EOK; 200 208 } 201 209 -
kernel/generic/src/ddi/irq.c
ree2fa30a rb366a6f4 275 275 { 276 276 /* 277 * If the kernel console is silenced, 278 * then try first the uspace handlers, 279 * eventually fall back to kernel handlers. 277 * If the kernel console override is on, 278 * then try first the kernel handlers 279 * and eventually fall back to uspace 280 * handlers. 280 281 * 281 * I f the kernel console is active,282 * then do it the other way around.282 * In the usual case the uspace handlers 283 * have precedence. 283 284 */ 284 if (silent) { 285 irq_t *irq = irq_dispatch_and_lock_uspace(inr); 285 286 if (console_override) { 287 irq_t *irq = irq_dispatch_and_lock_kernel(inr); 286 288 if (irq) 287 289 return irq; 288 290 289 return irq_dispatch_and_lock_ kernel(inr);290 } 291 292 irq_t *irq = irq_dispatch_and_lock_ kernel(inr);291 return irq_dispatch_and_lock_uspace(inr); 292 } 293 294 irq_t *irq = irq_dispatch_and_lock_uspace(inr); 293 295 if (irq) 294 296 return irq; 295 297 296 return irq_dispatch_and_lock_ uspace(inr);298 return irq_dispatch_and_lock_kernel(inr); 297 299 } 298 300 -
kernel/generic/src/debug/panic.c
ree2fa30a rb366a6f4 48 48 uintptr_t address, const char *fmt, ...) 49 49 { 50 va_list args; 51 52 silent = false; 50 console_override = true; 53 51 54 52 printf("\n%s Kernel panic ", BANNER_LEFT); … … 57 55 printf("due to "); 58 56 57 va_list args; 59 58 va_start(args, fmt); 60 59 if (cat == PANIC_ASSERT) { -
kernel/generic/src/lib/rd.c
ree2fa30a rb366a6f4 91 91 rd_parea.frames = SIZE2FRAMES(dsize); 92 92 rd_parea.unpriv = false; 93 rd_parea.mapped = false; 93 94 ddi_parea_register(&rd_parea); 94 95 -
kernel/generic/src/syscall/syscall.c
ree2fa30a rb366a6f4 186 186 (syshandler_t) sys_sysinfo_get_data, 187 187 188 /* Debug calls */ 189 (syshandler_t) sys_debug_enable_console, 190 (syshandler_t) sys_debug_disable_console 188 /* Kernel console syscalls. */ 189 (syshandler_t) sys_debug_activate_console 191 190 }; 192 191 -
kernel/generic/src/time/clock.c
ree2fa30a rb366a6f4 94 94 clock_parea.frames = 1; 95 95 clock_parea.unpriv = true; 96 clock_parea.mapped = false; 96 97 ddi_parea_register(&clock_parea); 97 98
Note:
See TracChangeset
for help on using the changeset viewer.