Changeset aa85487 in mainline for kernel/generic
- Timestamp:
- 2010-03-07T15:11:56Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- aadf01e
- Parents:
- 2e99277 (diff), 137691a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel/generic
- Files:
-
- 33 edited
-
include/atomic.h (modified) (2 diffs)
-
include/bitops.h (modified) (1 diff)
-
include/console/chardev.h (modified) (3 diffs)
-
include/console/kconsole.h (modified) (1 diff)
-
include/cpu.h (modified) (1 diff)
-
include/errno.h (modified) (1 diff)
-
include/interrupt.h (modified) (1 diff)
-
include/lib/elf.h (modified) (1 diff)
-
include/mm/slab.h (modified) (2 diffs)
-
include/panic.h (modified) (1 diff)
-
include/proc/task.h (modified) (1 diff)
-
include/proc/thread.h (modified) (2 diffs)
-
include/stacktrace.h (modified) (1 diff)
-
include/symtab.h (modified) (1 diff)
-
include/synch/spinlock.h (modified) (2 diffs)
-
src/console/chardev.c (modified) (2 diffs)
-
src/console/cmd.c (modified) (2 diffs)
-
src/console/kconsole.c (modified) (2 diffs)
-
src/debug/stacktrace.c (modified) (2 diffs)
-
src/debug/symtab.c (modified) (3 diffs)
-
src/interrupt/interrupt.c (modified) (3 diffs)
-
src/lib/elf.c (modified) (4 diffs)
-
src/main/kinit.c (modified) (1 diff)
-
src/main/version.c (modified) (1 diff)
-
src/mm/as.c (modified) (3 diffs)
-
src/mm/backend_elf.c (modified) (2 diffs)
-
src/mm/slab.c (modified) (5 diffs)
-
src/proc/scheduler.c (modified) (1 diff)
-
src/proc/task.c (modified) (1 diff)
-
src/proc/thread.c (modified) (3 diffs)
-
src/synch/spinlock.c (modified) (1 diff)
-
src/sysinfo/sysinfo.c (modified) (4 diffs)
-
src/udebug/udebug_ops.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/atomic.h
r2e99277 raa85487 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 36 36 #define KERN_ATOMIC_H_ 37 37 38 #include <arch/types.h> 39 38 40 typedef struct atomic { 39 volatile longcount;41 volatile atomic_count_t count; 40 42 } atomic_t; 41 43 42 44 #include <arch/atomic.h> 43 45 44 static inline void atomic_set(atomic_t *val, longi)46 static inline void atomic_set(atomic_t *val, atomic_count_t i) 45 47 { 46 48 val->count = i; 47 49 } 48 50 49 static inline longatomic_get(atomic_t *val)51 static inline atomic_count_t atomic_get(atomic_t *val) 50 52 { 51 53 return val->count; -
kernel/generic/include/bitops.h
r2e99277 raa85487 65 65 } 66 66 67 if (arg >> 1) { 68 arg >>= 1; 67 if (arg >> 1) 69 68 n += 1; 70 }71 69 72 70 return n; -
kernel/generic/include/console/chardev.h
r2e99277 raa85487 53 53 /** Character input device. */ 54 54 typedef struct indev { 55 c har *name;55 const char *name; 56 56 waitq_t wq; 57 57 … … 81 81 /** Character output device. */ 82 82 typedef struct outdev { 83 c har *name;83 const char *name; 84 84 85 85 /** Protects everything below. */ … … 95 95 } outdev_t; 96 96 97 extern void indev_initialize(c har *name, indev_t *indev,97 extern void indev_initialize(const char *name, indev_t *indev, 98 98 indev_operations_t *op); 99 99 extern void indev_push_character(indev_t *indev, wchar_t ch); 100 100 extern wchar_t indev_pop_character(indev_t *indev); 101 101 102 extern void outdev_initialize(c har *name, outdev_t *outdev,102 extern void outdev_initialize(const char *name, outdev_t *outdev, 103 103 outdev_operations_t *op); 104 104 -
kernel/generic/include/console/kconsole.h
r2e99277 raa85487 94 94 extern void kconsole_notify_init(void); 95 95 extern bool kconsole_check_poll(void); 96 extern void kconsole(c har *prompt,char *msg, bool kcon);96 extern void kconsole(const char *prompt, const char *msg, bool kcon); 97 97 extern void kconsole_thread(void *data); 98 98 -
kernel/generic/include/cpu.h
r2e99277 raa85487 48 48 * There is one structure like this for every processor. 49 49 */ 50 typedef struct {50 typedef struct cpu { 51 51 SPINLOCK_DECLARE(lock); 52 52 -
kernel/generic/include/errno.h
r2e99277 raa85487 57 57 #define EADDRNOTAVAIL -12 /* Address not available. */ 58 58 #define ETIMEOUT -13 /* Timeout expired */ 59 //MH60 #ifndef EINVAL61 59 #define EINVAL -14 /* Invalid value */ 62 #endif63 #ifndef EBUSY64 60 #define EBUSY -15 /* Resource is busy */ 65 #endif66 61 #define EOVERFLOW -16 /* The result does not fit its size. */ 67 62 #define EINTR -17 /* Operation was interrupted. */ -
kernel/generic/include/interrupt.h
r2e99277 raa85487 46 46 typedef void (* iroutine)(int n, istate_t *istate); 47 47 48 extern void fault_if_from_uspace(istate_t *istate, c har *fmt, ...);48 extern void fault_if_from_uspace(istate_t *istate, const char *fmt, ...); 49 49 extern iroutine exc_register(int n, const char *name, iroutine f); 50 50 extern void exc_dispatch(int n, istate_t *t); -
kernel/generic/include/lib/elf.h
r2e99277 raa85487 338 338 #endif 339 339 340 extern c har *elf_error(unsigned int rc);340 extern const char *elf_error(unsigned int rc); 341 341 342 342 /* Interpreter string used to recognize the program loader */ -
kernel/generic/include/mm/slab.h
r2e99277 raa85487 86 86 87 87 typedef struct { 88 c har *name;88 const char *name; 89 89 90 90 link_t link; … … 123 123 } slab_cache_t; 124 124 125 extern slab_cache_t *slab_cache_create(c har *, size_t, size_t,125 extern slab_cache_t *slab_cache_create(const char *, size_t, size_t, 126 126 int (*)(void *, int), int (*)(void *), int); 127 127 extern void slab_cache_destroy(slab_cache_t *); -
kernel/generic/include/panic.h
r2e99277 raa85487 60 60 extern bool silent; 61 61 62 extern void panic_printf(c har *fmt, ...) __attribute__((noreturn));62 extern void panic_printf(const char *fmt, ...) __attribute__((noreturn)); 63 63 64 64 #endif -
kernel/generic/include/proc/task.h
r2e99277 raa85487 130 130 extern void task_init(void); 131 131 extern void task_done(void); 132 extern task_t *task_create(as_t *as, c har *name);132 extern task_t *task_create(as_t *as, const char *name); 133 133 extern void task_destroy(task_t *t); 134 134 extern task_t *task_find_by_id(task_id_t id); -
kernel/generic/include/proc/thread.h
r2e99277 raa85487 52 52 #define THREAD_NAME_BUFLEN 20 53 53 54 extern c har *thread_states[];54 extern const char *thread_states[]; 55 55 56 56 /* Thread flags */ … … 225 225 226 226 extern void thread_init(void); 227 extern thread_t *thread_create(void (*)(void *), void *, task_t *, int, char *,228 bool);227 extern thread_t *thread_create(void (*)(void *), void *, task_t *, int, 228 const char *, bool); 229 229 extern void thread_attach(thread_t *, task_t *); 230 230 extern void thread_ready(thread_t *); -
kernel/generic/include/stacktrace.h
r2e99277 raa85487 46 46 bool (* frame_pointer_prev)(uintptr_t, uintptr_t *); 47 47 bool (* return_address_get)(uintptr_t, uintptr_t *); 48 bool (* symbol_resolve)(uintptr_t, c har **, uintptr_t *);48 bool (* symbol_resolve)(uintptr_t, const char **, uintptr_t *); 49 49 } stack_trace_ops_t; 50 50 -
kernel/generic/include/symtab.h
r2e99277 raa85487 45 45 }; 46 46 47 extern int symtab_name_lookup(uintptr_t, c har **, uintptr_t *);48 extern c har *symtab_fmt_name_lookup(uintptr_t);47 extern int symtab_name_lookup(uintptr_t, const char **, uintptr_t *); 48 extern const char *symtab_fmt_name_lookup(uintptr_t); 49 49 extern int symtab_addr_lookup(const char *, uintptr_t *); 50 50 extern void symtab_print_search(const char *); -
kernel/generic/include/synch/spinlock.h
r2e99277 raa85487 48 48 49 49 #ifdef CONFIG_DEBUG_SPINLOCK 50 c har *name;50 const char *name; 51 51 #endif 52 52 } spinlock_t; … … 101 101 SPINLOCK_STATIC_INITIALIZE_NAME(lock_name, #lock_name) 102 102 103 extern void spinlock_initialize(spinlock_t *lock, c har *name);103 extern void spinlock_initialize(spinlock_t *lock, const char *name); 104 104 extern int spinlock_trylock(spinlock_t *lock); 105 105 extern void spinlock_lock_debug(spinlock_t *lock); -
kernel/generic/src/console/chardev.c
r2e99277 raa85487 47 47 * 48 48 */ 49 void indev_initialize(c har *name, indev_t *indev,49 void indev_initialize(const char *name, indev_t *indev, 50 50 indev_operations_t *op) 51 51 { … … 130 130 * 131 131 */ 132 void outdev_initialize(c har *name, outdev_t *outdev,132 void outdev_initialize(const char *name, outdev_t *outdev, 133 133 outdev_operations_t *op) 134 134 { -
kernel/generic/src/console/cmd.c
r2e99277 raa85487 1033 1033 /* Execute the test */ 1034 1034 test_quiet = false; 1035 c har *ret = test->entry();1035 const char *ret = test->entry(); 1036 1036 1037 1037 /* Update and read thread accounting */ … … 1086 1086 /* Execute the test */ 1087 1087 test_quiet = true; 1088 c har *ret = test->entry();1088 const char *ret = test->entry(); 1089 1089 1090 1090 /* Update and read thread accounting */ -
kernel/generic/src/console/kconsole.c
r2e99277 raa85487 224 224 printf("\n"); 225 225 pos = NULL; 226 while ( (hint = cmdtab_search_one(name, &pos))) {226 while (cmdtab_search_one(name, &pos)) { 227 227 cmd_info_t *hlp = list_get_instance(pos, cmd_info_t, link); 228 228 printf("%s (%s)\n", hlp->name, hlp->description); … … 643 643 * 644 644 */ 645 void kconsole(c har *prompt,char *msg, bool kcon)645 void kconsole(const char *prompt, const char *msg, bool kcon) 646 646 { 647 647 if (!stdin) { -
kernel/generic/src/debug/stacktrace.c
r2e99277 raa85487 44 44 { 45 45 int cnt = 0; 46 c har *symbol;46 const char *symbol; 47 47 uintptr_t offset; 48 48 49 49 while (cnt++ < STACK_FRAMES_MAX && ops->frame_pointer_validate(fp)) { 50 50 if (ops->symbol_resolve && … … 85 85 } 86 86 87 static bool kernel_symbol_resolve(uintptr_t addr, c har **sp, uintptr_t *op)87 static bool kernel_symbol_resolve(uintptr_t addr, const char **sp, uintptr_t *op) 88 88 { 89 89 return (symtab_name_lookup(addr, sp, op) == 0); -
kernel/generic/src/debug/symtab.c
r2e99277 raa85487 54 54 * 55 55 */ 56 int symtab_name_lookup(uintptr_t addr, c har **name, uintptr_t *offset)56 int symtab_name_lookup(uintptr_t addr, const char **name, uintptr_t *offset) 57 57 { 58 58 #ifdef CONFIG_SYMTAB … … 92 92 * 93 93 */ 94 c har *symtab_fmt_name_lookup(uintptr_t addr)95 { 96 c har *name;94 const char *symtab_fmt_name_lookup(uintptr_t addr) 95 { 96 const char *name; 97 97 int rc = symtab_name_lookup(addr, &name, NULL); 98 98 … … 239 239 printf("\n"); 240 240 pos = 0; 241 while ( (hint = symtab_search_one(name, &pos))) {241 while (symtab_search_one(name, &pos)) { 242 242 printf("%s\n", symbol_table[pos].symbol_name); 243 243 pos++; -
kernel/generic/src/interrupt/interrupt.c
r2e99277 raa85487 114 114 115 115 /** Terminate thread and task if exception came from userspace. */ 116 void fault_if_from_uspace(istate_t *istate, c har *fmt, ...)116 void fault_if_from_uspace(istate_t *istate, const char *fmt, ...) 117 117 { 118 118 task_t *task = TASK; … … 162 162 #if (IVT_ITEMS > 0) 163 163 unsigned int i; 164 char *symbol;165 164 166 165 spinlock_lock(&exctbl_lock); … … 177 176 178 177 for (i = 0; i < IVT_ITEMS; i++) { 179 symbol = symtab_fmt_name_lookup((unative_t) exc_table[i].f);178 const char *symbol = symtab_fmt_name_lookup((unative_t) exc_table[i].f); 180 179 181 180 #ifdef __32_BITS__ -
kernel/generic/src/lib/elf.c
r2e99277 raa85487 48 48 #include <arch.h> 49 49 50 static c har *error_codes[] = {50 static const char *error_codes[] = { 51 51 "no error", 52 52 "invalid image", … … 137 137 * @return NULL terminated description of error. 138 138 */ 139 c har *elf_error(unsigned int rc)139 const char *elf_error(unsigned int rc) 140 140 { 141 141 ASSERT(rc < sizeof(error_codes) / sizeof(char *)); … … 155 155 as_t *as, int flags) 156 156 { 157 char *interp;158 159 157 switch (entry->p_type) { 160 158 case PT_NULL: … … 165 163 case PT_DYNAMIC: 166 164 case PT_INTERP: 167 interp = (char *)elf + entry->p_offset; 168 /* FIXME */ 169 /*if (memcmp((uintptr_t)interp, (uintptr_t)ELF_INTERP_ZSTR, 165 // FIXME 166 /* 167 char *interp = (char *) elf + entry->p_offset; 168 if (memcmp((uintptr_t) interp, (uintptr_t) ELF_INTERP_ZSTR, 170 169 ELF_INTERP_ZLEN) != 0) { 171 170 return EE_UNSUPPORTED; 172 } */171 } */ 173 172 if ((flags & ELD_F_LOADER) == 0) { 174 173 return EE_LOADER; -
kernel/generic/src/main/kinit.c
r2e99277 raa85487 183 183 184 184 char namebuf[TASK_NAME_BUFLEN]; 185 char *name; 186 187 name = init.tasks[i].name; 185 186 const char *name = init.tasks[i].name; 188 187 if (name[0] == 0) 189 188 name = "<unknown>"; -
kernel/generic/src/main/version.c
r2e99277 raa85487 37 37 #include <macros.h> 38 38 39 char *project = "SPARTAN kernel";40 char *copyright = "Copyright (c) 2001-2009HelenOS project";41 char *release = STRING(RELEASE);42 char *name = STRING(NAME);43 char *arch = STRING(KARCH);39 static const char *project = "SPARTAN kernel"; 40 static const char *copyright = "Copyright (c) 2001-2010 HelenOS project"; 41 static const char *release = STRING(RELEASE); 42 static const char *name = STRING(NAME); 43 static const char *arch = STRING(KARCH); 44 44 45 45 #ifdef REVISION 46 char *revision = ", revision " STRING(REVISION);46 static const char *revision = ", revision " STRING(REVISION); 47 47 #else 48 char *revision = "";48 static const char *revision = ""; 49 49 #endif 50 50 51 51 #ifdef TIMESTAMP 52 char *timestamp = " on " STRING(TIMESTAMP);52 static const char *timestamp = " on " STRING(TIMESTAMP); 53 53 #else 54 char *timestamp = "";54 static const char *timestamp = ""; 55 55 #endif 56 56 -
kernel/generic/src/mm/as.c
r2e99277 raa85487 784 784 { 785 785 as_area_t *area; 786 uintptr_t base;787 786 link_t *cur; 788 787 ipl_t ipl; … … 813 812 return ENOTSUP; 814 813 } 815 816 base = area->base;817 814 818 815 /* … … 952 949 if (!THREAD) 953 950 return AS_PF_FAULT; 954 955 ASSERT(AS); 956 951 952 if (!AS) 953 return AS_PF_FAULT; 954 957 955 mutex_lock(&AS->lock); 958 area = find_area_and_lock(AS, page); 956 area = find_area_and_lock(AS, page); 959 957 if (!area) { 960 958 /* -
kernel/generic/src/mm/backend_elf.c
r2e99277 raa85487 232 232 void elf_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame) 233 233 { 234 elf_header_t *elf = area->backend_data.elf;235 234 elf_segment_header_t *entry = area->backend_data.segment; 236 uintptr_t base, start_anon; 237 size_t i; 235 uintptr_t start_anon; 238 236 239 237 ASSERT((page >= ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) && 240 238 (page < entry->p_vaddr + entry->p_memsz)); 241 i = (page - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >> PAGE_WIDTH;242 base = (uintptr_t) (((void *) elf) +243 ALIGN_DOWN(entry->p_offset, FRAME_SIZE));244 239 start_anon = entry->p_vaddr + entry->p_filesz; 245 240 … … 257 252 * lower part is backed by the ELF image and the upper is 258 253 * anonymous). In any case, a frame needs to be freed. 259 */ 254 */ 260 255 frame_free(frame); 261 256 } -
kernel/generic/src/mm/slab.c
r2e99277 raa85487 130 130 /** Caches for malloc */ 131 131 static slab_cache_t *malloc_caches[SLAB_MAX_MALLOC_W - SLAB_MIN_MALLOC_W + 1]; 132 static c har *malloc_names[] = {132 static const char *malloc_names[] = { 133 133 "malloc-16", 134 134 "malloc-32", … … 571 571 572 572 /** Initialize allocated memory as a slab cache */ 573 static void 574 _slab_cache_create(slab_cache_t *cache, char *name, size_t size, size_t align, 575 int (*constructor)(void *obj, int kmflag), int (*destructor)(void *obj), 576 int flags) 573 static void _slab_cache_create(slab_cache_t *cache, const char *name, 574 size_t size, size_t align, int (*constructor)(void *obj, int kmflag), 575 int (*destructor)(void *obj), int flags) 577 576 { 578 577 int pages; … … 631 630 632 631 /** Create slab cache */ 633 slab_cache_t * 634 slab_cache_create(char *name, size_t size, size_t align, 632 slab_cache_t *slab_cache_create(const char *name, size_t size, size_t align, 635 633 int (*constructor)(void *obj, int kmflag), int (*destructor)(void *obj), 636 634 int flags) … … 853 851 cache = list_get_instance(cur, slab_cache_t, link); 854 852 855 c har *name = cache->name;853 const char *name = cache->name; 856 854 uint8_t order = cache->order; 857 855 size_t size = cache->size; … … 896 894 NULL, NULL, SLAB_CACHE_MAGDEFERRED); 897 895 } 898 #ifdef CONFIG_DEBUG 896 #ifdef CONFIG_DEBUG 899 897 _slab_initialized = 1; 900 898 #endif -
kernel/generic/src/proc/scheduler.c
r2e99277 raa85487 542 542 { 543 543 thread_t *t; 544 int count, average, j, k = 0; 544 int count; 545 atomic_count_t average; 545 546 unsigned int i; 547 int j; 548 int k = 0; 546 549 ipl_t ipl; 547 550 -
kernel/generic/src/proc/task.c
r2e99277 raa85487 171 171 * 172 172 */ 173 task_t *task_create(as_t *as, c har *name)173 task_t *task_create(as_t *as, const char *name) 174 174 { 175 175 ipl_t ipl; -
kernel/generic/src/proc/thread.c
r2e99277 raa85487 76 76 77 77 /** Thread states */ 78 c har *thread_states[] = {78 const char *thread_states[] = { 79 79 "Invalid", 80 80 "Running", … … 264 264 265 265 atomic_inc(&nrdy); 266 // FIXME: Why is the avg value never read? 266 267 avg = atomic_get(&nrdy) / config.cpu_active; 267 268 atomic_inc(&cpu->nrdy); … … 288 289 */ 289 290 thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, 290 int flags, c har *name, bool uncounted)291 int flags, const char *name, bool uncounted) 291 292 { 292 293 thread_t *t; -
kernel/generic/src/synch/spinlock.c
r2e99277 raa85487 52 52 * 53 53 */ 54 void spinlock_initialize(spinlock_t *lock, c har *name)54 void spinlock_initialize(spinlock_t *lock, const char *name) 55 55 { 56 56 atomic_set(&lock->val, 0); -
kernel/generic/src/sysinfo/sysinfo.c
r2e99277 raa85487 46 46 return NULL; 47 47 48 while (subtree != NULL) {48 while (subtree != NULL) { 49 49 int i = 0; 50 50 char *a = (char *) name; … … 68 68 /* No matches try next */ 69 69 subtree = subtree->next; 70 i = 0;71 70 } 72 71 return NULL; … … 159 158 item->subinfo_type = SYSINFO_SUBINFO_NONE; 160 159 return item; 161 } else {160 } else 162 161 subtree = subtree->next; 163 i = 0;164 }165 162 } 166 163 … … 225 222 int i; 226 223 unative_t val = 0; 227 c har *vtype = NULL;224 const char *vtype = NULL; 228 225 229 226 -
kernel/generic/src/udebug/udebug_ops.c
r2e99277 raa85487 80 80 static int _thread_op_begin(thread_t *t, bool being_go) 81 81 { 82 task_id_t taskid;83 82 ipl_t ipl; 84 85 taskid = TASK->taskid;86 83 87 84 mutex_lock(&TASK->udebug.lock);
Note:
See TracChangeset
for help on using the changeset viewer.
