Changeset da1bafb in mainline for kernel/generic/src/console
- Timestamp:
- 2010-05-24T18:57:31Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0095368
- Parents:
- 666f492
- Location:
- kernel/generic/src/console
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/chardev.c
r666f492 rda1bafb 52 52 indev->name = name; 53 53 waitq_initialize(&indev->wq); 54 spinlock_initialize(&indev->lock, "indev");54 irq_spinlock_initialize(&indev->lock, "chardev.indev.lock"); 55 55 indev->counter = 0; 56 56 indev->index = 0; … … 68 68 ASSERT(indev); 69 69 70 spinlock_lock(&indev->lock);70 irq_spinlock_lock(&indev->lock, true); 71 71 if (indev->counter == INDEV_BUFLEN - 1) { 72 72 /* Buffer full */ 73 spinlock_unlock(&indev->lock);73 irq_spinlock_unlock(&indev->lock, true); 74 74 return; 75 75 } … … 81 81 indev->index = indev->index % INDEV_BUFLEN; 82 82 waitq_wakeup(&indev->wq, WAKEUP_FIRST); 83 spinlock_unlock(&indev->lock);83 irq_spinlock_unlock(&indev->lock, true); 84 84 } 85 85 … … 114 114 115 115 waitq_sleep(&indev->wq); 116 ipl_t ipl = interrupts_disable(); 117 spinlock_lock(&indev->lock); 116 irq_spinlock_lock(&indev->lock, true); 118 117 wchar_t ch = indev->buffer[(indev->index - indev->counter) % INDEV_BUFLEN]; 119 118 indev->counter--; 120 spinlock_unlock(&indev->lock); 121 interrupts_restore(ipl); 119 irq_spinlock_unlock(&indev->lock, true); 122 120 123 121 return ch; … … 134 132 { 135 133 outdev->name = name; 136 spinlock_initialize(&outdev->lock, " outdev");134 spinlock_initialize(&outdev->lock, "chardev.outdev.lock"); 137 135 link_initialize(&outdev->link); 138 136 list_initialize(&outdev->list); -
kernel/generic/src/console/cmd.c
r666f492 rda1bafb 510 510 void cmd_initialize(cmd_info_t *cmd) 511 511 { 512 spinlock_initialize(&cmd->lock, "cmd ");512 spinlock_initialize(&cmd->lock, "cmd.lock"); 513 513 link_initialize(&cmd->link); 514 514 } … … 681 681 continue; 682 682 683 thread_t *t; 684 if ((t = thread_create((void (*)(void *)) cmd_call0, (void *) argv, TASK, THREAD_FLAG_WIRED, "call0", false))) { 685 spinlock_lock(&t->lock); 686 t->cpu = &cpus[i]; 687 spinlock_unlock(&t->lock); 688 printf("cpu%u: ", i); 689 thread_ready(t); 690 thread_join(t); 691 thread_detach(t); 683 thread_t *thread; 684 if ((thread = thread_create((void (*)(void *)) cmd_call0, 685 (void *) argv, TASK, THREAD_FLAG_WIRED, "call0", false))) { 686 irq_spinlock_lock(&thread->lock, true); 687 thread->cpu = &cpus[i]; 688 irq_spinlock_unlock(&thread->lock, true); 689 690 printf("cpu%" PRIs ": ", i); 691 692 thread_ready(thread); 693 thread_join(thread); 694 thread_detach(thread); 692 695 } else 693 printf("Unable to create thread for cpu% u\n", i);696 printf("Unable to create thread for cpu%" PRIs "\n", i); 694 697 } 695 698 … … 1049 1052 /* Update and read thread accounting 1050 1053 for benchmarking */ 1051 ipl_t ipl = interrupts_disable(); 1052 spinlock_lock(&TASK->lock); 1054 irq_spinlock_lock(&TASK->lock, true); 1053 1055 uint64_t ucycles0, kcycles0; 1054 1056 task_get_accounting(TASK, &ucycles0, &kcycles0); 1055 spinlock_unlock(&TASK->lock); 1056 interrupts_restore(ipl); 1057 irq_spinlock_unlock(&TASK->lock, true); 1057 1058 1058 1059 /* Execute the test */ … … 1061 1062 1062 1063 /* Update and read thread accounting */ 1063 uint64_t ucycles1, kcycles1; 1064 ipl = interrupts_disable(); 1065 spinlock_lock(&TASK->lock); 1064 uint64_t ucycles1, kcycles1; 1065 irq_spinlock_lock(&TASK->lock, true); 1066 1066 task_get_accounting(TASK, &ucycles1, &kcycles1); 1067 spinlock_unlock(&TASK->lock); 1068 interrupts_restore(ipl); 1067 irq_spinlock_unlock(&TASK->lock, true); 1069 1068 1070 1069 uint64_t ucycles, kcycles; … … 1072 1071 order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix); 1073 1072 order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix); 1074 1073 1075 1074 printf("Time: %" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles\n", 1076 1075 ucycles, usuffix, kcycles, ksuffix); 1077 1076 1078 1077 if (ret == NULL) { … … 1080 1079 return true; 1081 1080 } 1082 1081 1083 1082 printf("%s\n", ret); 1084 1083 return false; … … 1106 1105 /* Update and read thread accounting 1107 1106 for benchmarking */ 1108 ipl_t ipl = interrupts_disable(); 1109 spinlock_lock(&TASK->lock); 1107 irq_spinlock_lock(&TASK->lock, true); 1110 1108 uint64_t ucycles0, kcycles0; 1111 1109 task_get_accounting(TASK, &ucycles0, &kcycles0); 1112 spinlock_unlock(&TASK->lock); 1113 interrupts_restore(ipl); 1110 irq_spinlock_unlock(&TASK->lock, true); 1114 1111 1115 1112 /* Execute the test */ … … 1118 1115 1119 1116 /* Update and read thread accounting */ 1120 ipl = interrupts_disable(); 1121 spinlock_lock(&TASK->lock); 1117 irq_spinlock_lock(&TASK->lock, true); 1122 1118 uint64_t ucycles1, kcycles1; 1123 1119 task_get_accounting(TASK, &ucycles1, &kcycles1); 1124 spinlock_unlock(&TASK->lock); 1125 interrupts_restore(ipl); 1126 1120 irq_spinlock_unlock(&TASK->lock, true); 1121 1127 1122 if (ret != NULL) { 1128 1123 printf("%s\n", ret); … … 1135 1130 order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix); 1136 1131 printf("OK (%" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles)\n", 1137 1132 ucycles, usuffix, kcycles, ksuffix); 1138 1133 } 1139 1134 -
kernel/generic/src/console/console.c
r666f492 rda1bafb 62 62 /** Kernel log initialized */ 63 63 static bool klog_inited = false; 64 64 65 /** First kernel log characters */ 65 66 static size_t klog_start = 0; 67 66 68 /** Number of valid kernel log characters */ 67 69 static size_t klog_len = 0; 70 68 71 /** Number of stored (not printed) kernel log characters */ 69 72 static size_t klog_stored = 0; 73 70 74 /** Number of stored kernel log characters for uspace */ 71 75 static size_t klog_uspace = 0; … … 84 88 }; 85 89 86 static void stdout_write(outdev_t * dev, wchar_t ch, bool silent);87 static void stdout_redraw(outdev_t * dev);90 static void stdout_write(outdev_t *, wchar_t, bool); 91 static void stdout_redraw(outdev_t *); 88 92 89 93 static outdev_operations_t stdout_ops = { … … 174 178 stdout->op->redraw(stdout); 175 179 176 /* Force the console to print the prompt */ 177 if ((stdin) && (prev)) 180 if ((stdin) && (prev)) { 181 /* 182 * Force the console to print the prompt. 183 */ 178 184 indev_push_character(stdin, '\n'); 185 } 179 186 } 180 187
Note:
See TracChangeset
for help on using the changeset viewer.