Changeset b60c582 in mainline
- Timestamp:
- 2009-04-03T08:02:30Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2398ee9
- Parents:
- 9be1d58
- Location:
- kernel
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/arm32.c
r9be1d58 rb60c582 63 63 init.tasks[i].addr = bootinfo->tasks[i].addr; 64 64 init.tasks[i].size = bootinfo->tasks[i].size; 65 str ncpy(init.tasks[i].name, bootinfo->tasks[i].name,65 str_ncpy(init.tasks[i].name, bootinfo->tasks[i].name, 66 66 CONFIG_TASK_NAME_BUFLEN); 67 67 } -
kernel/arch/arm32/src/asm.S
r9be1d58 rb60c582 31 31 32 32 .global memsetb 33 .global memsetw 33 34 .global memcpy 34 35 .global memcpy_from_uspace … … 39 40 memsetb: 40 41 b _memsetb 42 43 memsetw: 44 b _memsetw 41 45 42 46 memcpy: -
kernel/arch/ia64/src/cpu/cpu.c
r9be1d58 rb60c582 56 56 *((uint64_t *) &vendor[0 * sizeof(uint64_t)]) = CPU->arch.cpuid0; 57 57 *((uint64_t *) &vendor[1 * sizeof(uint64_t)]) = CPU->arch.cpuid1; 58 vendor[sizeof(vendor) - 1] = '\0';58 vendor[sizeof(vendor) - 1] = 0; 59 59 60 60 switch(m->arch.cpuid3.family) { -
kernel/arch/ia64/src/ia64.c
r9be1d58 rb60c582 88 88 VRN_MASK; 89 89 init.tasks[i].size = bootinfo->taskmap.tasks[i].size; 90 str ncpy(init.tasks[i].name, bootinfo->taskmap.tasks[i].name,90 str_ncpy(init.tasks[i].name, bootinfo->taskmap.tasks[i].name, 91 91 CONFIG_TASK_NAME_BUFLEN); 92 92 } -
kernel/arch/ia64/src/interrupt.c
r9be1d58 rb60c582 55 55 #include <mm/tlb.h> 56 56 #include <symtab.h> 57 #include <putchar.h> 57 58 58 59 #define VECTORS_64_BUNDLE 20 -
kernel/arch/ia64/src/ski/ski.c
r9be1d58 rb60c582 42 42 #include <arch/asm.h> 43 43 #include <arch/drivers/kbd.h> 44 #include <string.h> 44 45 #include <arch.h> 45 46 … … 49 50 static bool kbd_disabled; 50 51 52 static void ski_do_putchar(const wchar_t ch) 53 { 54 asm volatile ( 55 "mov r15 = %[cmd]\n" 56 "mov r32 = %[ch]\n" /* r32 is in0 */ 57 "break 0x80000\n" /* modifies r8 */ 58 : 59 : [cmd] "i" (SKI_PUTCHAR), [ch] "r" (ch) 60 : "r15", "in0", "r8" 61 ); 62 } 63 51 64 /** Display character on debug console 52 65 * … … 57 70 * @param ch Character to be printed. 58 71 */ 59 static void ski_putchar(outdev_t *d, const charch, bool silent)72 static void ski_putchar(outdev_t *d, const wchar_t ch, bool silent) 60 73 { 61 74 if (!silent) { 62 asm volatile ( 63 "mov r15 = %0\n" 64 "mov r32 = %1\n" /* r32 is in0 */ 65 "break 0x80000\n" /* modifies r8 */ 66 : 67 : "i" (SKI_PUTCHAR), "r" (ch) 68 : "r15", "in0", "r8" 69 ); 70 71 if (ch == '\n') 72 ski_putchar(d, '\r', false); 75 if (ascii_check(ch)) { 76 if (ch == '\n') 77 ski_do_putchar('\r'); 78 79 ski_do_putchar(ch); 80 } else 81 ski_do_putchar(invalch); 73 82 } 74 83 } -
kernel/arch/mips32/src/asm.S
r9be1d58 rb60c582 61 61 memsetb: 62 62 j _memsetb 63 nop 64 65 66 .global memsetw 67 memsetw: 68 j _memsetw 63 69 nop 64 70 -
kernel/arch/mips32/src/mips32.c
r9be1d58 rb60c582 92 92 init.tasks[i].addr = bootinfo->tasks[i].addr; 93 93 init.tasks[i].size = bootinfo->tasks[i].size; 94 str ncpy(init.tasks[i].name, bootinfo->tasks[i].name,94 str_ncpy(init.tasks[i].name, bootinfo->tasks[i].name, 95 95 CONFIG_TASK_NAME_BUFLEN); 96 96 } -
kernel/arch/ppc32/src/asm.S
r9be1d58 rb60c582 35 35 .global iret_syscall 36 36 .global memsetb 37 .global memsetw 37 38 .global memcpy 38 39 .global memcpy_from_uspace … … 202 203 203 204 rfi 204 205 205 206 memsetb: 206 207 b _memsetb 208 209 memsetw: 210 b _memsetw 207 211 208 212 memcpy: -
kernel/arch/ppc32/src/ppc32.c
r9be1d58 rb60c582 62 62 init.tasks[i].addr = PA2KA(bootinfo.taskmap.tasks[i].addr); 63 63 init.tasks[i].size = bootinfo.taskmap.tasks[i].size; 64 str ncpy(init.tasks[i].name, bootinfo.taskmap.tasks[i].name,64 str_ncpy(init.tasks[i].name, bootinfo.taskmap.tasks[i].name, 65 65 CONFIG_TASK_NAME_BUFLEN); 66 66 } -
kernel/arch/sparc64/include/drivers/sgcn.h
r9be1d58 rb60c582 39 39 #include <console/chardev.h> 40 40 41 /* number of bytes in the TOC magic, including the terminating '\0'*/41 /* number of bytes in the TOC magic, including the NULL-terminator */ 42 42 #define TOC_MAGIC_BYTES 8 43 43 44 /* number of bytes in the TOC key, including the terminating '\0'*/44 /* number of bytes in the TOC key, including the NULL-terminator */ 45 45 #define TOC_KEY_SIZE 8 46 46 … … 48 48 #define MAX_TOC_ENTRIES 32 49 49 50 /* number of bytes in the SGCN buffer magic, including the terminating '\0'*/50 /* number of bytes in the SGCN buffer magic, including the NULL-terminator */ 51 51 #define SGCN_MAGIC_BYTES 4 52 52 -
kernel/arch/sparc64/src/console.c
r9be1d58 rb60c582 119 119 prop = ofw_tree_getprop(aliases, "def-cn"); 120 120 121 if ((!prop) || (!prop->value) || (str cmp(prop->value, "/sgcn") != 0)) {121 if ((!prop) || (!prop->value) || (str_cmp(prop->value, "/sgcn") != 0)) { 122 122 standard_console_init(aliases); 123 123 } else { -
kernel/arch/sparc64/src/drivers/kbd.c
r9be1d58 rb60c582 87 87 * Determine keyboard serial controller type. 88 88 */ 89 if (str cmp(name, "zs") == 0)89 if (str_cmp(name, "zs") == 0) 90 90 kbd_type = KBD_Z8530; 91 else if (str cmp(name, "su") == 0)91 else if (str_cmp(name, "su") == 0) 92 92 kbd_type = KBD_NS16550; 93 93 -
kernel/arch/sparc64/src/drivers/pci.c
r9be1d58 rb60c582 184 184 * First, verify this is a PCI node. 185 185 */ 186 ASSERT(str cmp(ofw_tree_node_name(node), "pci") == 0);186 ASSERT(str_cmp(ofw_tree_node_name(node), "pci") == 0); 187 187 188 188 /* … … 193 193 return NULL; 194 194 195 if (str cmp(prop->value, "SUNW,sabre") == 0) {195 if (str_cmp(prop->value, "SUNW,sabre") == 0) { 196 196 /* 197 197 * PCI controller Sabre. … … 199 199 */ 200 200 return pci_sabre_init(node); 201 } else if (str cmp(prop->value, "SUNW,psycho") == 0) {201 } else if (str_cmp(prop->value, "SUNW,psycho") == 0) { 202 202 /* 203 203 * PCI controller Psycho. -
kernel/arch/sparc64/src/drivers/scr.c
r9be1d58 rb60c582 64 64 name = ofw_tree_node_name(node); 65 65 66 if (str cmp(name, "SUNW,m64B") == 0)66 if (str_cmp(name, "SUNW,m64B") == 0) 67 67 scr_type = SCR_ATYFB; 68 else if (str cmp(name, "SUNW,XVR-100") == 0)68 else if (str_cmp(name, "SUNW,XVR-100") == 0) 69 69 scr_type = SCR_XVR; 70 else if (str cmp(name, "SUNW,ffb") == 0)70 else if (str_cmp(name, "SUNW,ffb") == 0) 71 71 scr_type = SCR_FFB; 72 else if (str cmp(name, "cgsix") == 0)72 else if (str_cmp(name, "cgsix") == 0) 73 73 scr_type = SCR_CGSIX; 74 74 -
kernel/arch/sparc64/src/drivers/sgcn.c
r9be1d58 rb60c582 208 208 init_sram_begin(); 209 209 210 ASSERT(str cmp(SRAM_TOC->magic, SRAM_TOC_MAGIC) == 0);210 ASSERT(str_cmp(SRAM_TOC->magic, SRAM_TOC_MAGIC) == 0); 211 211 212 212 /* lookup TOC entry with the correct key */ 213 213 uint32_t i; 214 214 for (i = 0; i < MAX_TOC_ENTRIES; i++) { 215 if (str cmp(SRAM_TOC->keys[i].key, CONSOLE_KEY) == 0)215 if (str_cmp(SRAM_TOC->keys[i].key, CONSOLE_KEY) == 0) 216 216 break; 217 217 } -
kernel/arch/sparc64/src/mm/page.c
r9be1d58 rb60c582 63 63 uintptr_t hw_map(uintptr_t physaddr, size_t size) 64 64 { 65 return PA2KA(physaddr); 65 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) 66 panic("Unable to map physical memory %p (%d bytes).", physaddr, size) 67 68 uintptr_t virtaddr = PA2KA(last_frame); 69 pfn_t i; 70 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) { 71 uintptr_t addr = PFN2ADDR(i); 72 page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, PAGE_NOT_CACHEABLE | PAGE_WRITE); 73 } 74 75 last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); 76 77 return virtaddr; 66 78 } 67 79 -
kernel/arch/sparc64/src/sparc64.c
r9be1d58 rb60c582 62 62 init.tasks[i].addr = (uintptr_t) bootinfo.taskmap.tasks[i].addr; 63 63 init.tasks[i].size = bootinfo.taskmap.tasks[i].size; 64 str ncpy(init.tasks[i].name, bootinfo.taskmap.tasks[i].name,64 str_ncpy(init.tasks[i].name, bootinfo.taskmap.tasks[i].name, 65 65 CONFIG_TASK_NAME_BUFLEN); 66 66 } -
kernel/genarch/src/drivers/dsrln/dsrlnout.c
r9be1d58 rb60c582 41 41 #include <console/console.h> 42 42 #include <sysinfo/sysinfo.h> 43 #include <string.h> 43 44 44 45 static ioport8_t *dsrlnout_base; 45 46 46 static void dsrlnout_putchar(outdev_t *dev __attribute__((unused)), const charch, bool silent)47 static void dsrlnout_putchar(outdev_t *dev __attribute__((unused)), const wchar_t ch, bool silent) 47 48 { 48 if (!silent) 49 pio_write_8(dsrlnout_base, ch); 49 if (!silent) { 50 if (ascii_check(ch)) 51 pio_write_8(dsrlnout_base, ch); 52 else 53 pio_write_8(dsrlnout_base, invalch); 54 } 50 55 } 51 56 -
kernel/genarch/src/multiboot/multiboot.c
r9be1d58 rb60c582 42 42 /** Extract command name from the multiboot module command line. 43 43 * 44 * @param buf Destination buffer (will always null-terminate).45 * @param n Size of destination buffer.44 * @param buf Destination buffer (will always NULL-terminate). 45 * @param sz Size of destination buffer (in bytes). 46 46 * @param cmd_line Input string (the command line). 47 47 * 48 48 */ 49 static void extract_command(char *buf, size_t n, const char *cmd_line)49 static void extract_command(char *buf, size_t sz, const char *cmd_line) 50 50 { 51 const char *start, *end, *cp;52 size_t max_len;53 54 51 /* Find the first space. */ 55 end = strchr(cmd_line, ' ');52 const char *end = str_chr(cmd_line, ' '); 56 53 if (end == NULL) 57 54 end = cmd_line + str_size(cmd_line); … … 61 58 * next character. Otherwise, place start at beginning of buffer. 62 59 */ 63 cp = end; 64 start = buf; 60 const char *cp = end; 61 const char *start = buf; 62 65 63 while (cp != start) { 66 64 if (*cp == '/') { … … 68 66 break; 69 67 } 70 --cp;68 cp--; 71 69 } 72 70 73 /* Copy the command and null-terminate the string. */ 74 max_len = min(n - 1, (size_t) (end - start)); 75 strncpy(buf, start, max_len + 1); 76 buf[max_len] = '\0'; 71 /* Copy the command. */ 72 str_ncpy(buf, start, min(sz, (size_t) (end - start) + 1)); 77 73 } 78 74 … … 88 84 { 89 85 uint32_t flags; 90 multiboot_mod_t *mods;91 uint32_t i;92 86 93 87 if (signature == MULTIBOOT_LOADER_MAGIC) … … 99 93 100 94 /* Copy module information. */ 101 95 uint32_t i; 102 96 if ((flags & MBINFO_FLAGS_MODS) != 0) { 103 97 init.cnt = min(mi->mods_count, CONFIG_INIT_TASKS); 104 mods = (multiboot_mod_t *) MULTIBOOT_PTR(mi->mods_addr); 98 multiboot_mod_t *mods 99 = (multiboot_mod_t *) MULTIBOOT_PTR(mi->mods_addr); 105 100 106 101 for (i = 0; i < init.cnt; i++) { … … 114 109 MULTIBOOT_PTR(mods[i].string)); 115 110 } else 116 init.tasks[i].name[0] = '\0';111 init.tasks[i].name[0] = 0; 117 112 } 118 113 } else … … 121 116 /* Copy memory map. */ 122 117 123 int32_t mmap_length;124 multiboot_mmap_t *mme;125 uint32_t size;126 127 118 if ((flags & MBINFO_FLAGS_MMAP) != 0) { 128 mmap_length = mi->mmap_length;129 m me = MULTIBOOT_PTR(mi->mmap_addr);119 int32_t mmap_length = mi->mmap_length; 120 multiboot_mmap_t *mme = MULTIBOOT_PTR(mi->mmap_addr); 130 121 e820counter = 0; 131 122 … … 135 126 136 127 /* Compute address of next structure. */ 137 size = sizeof(mme->size) + mme->size;128 uint32_t size = sizeof(mme->size) + mme->size; 138 129 mme = ((void *) mme) + size; 139 130 mmap_length -= size; -
kernel/genarch/src/ofw/ebus.c
r9be1d58 rb60c582 128 128 return false; 129 129 130 if (str cmp(ofw_tree_node_name(controller), "pci") != 0) {130 if (str_cmp(ofw_tree_node_name(controller), "pci") != 0) { 131 131 /* 132 132 * This is not a PCI node. -
kernel/genarch/src/ofw/fhc.c
r9be1d58 rb60c582 67 67 return true; 68 68 } 69 if (str cmp(ofw_tree_node_name(node->parent), "central") != 0)69 if (str_cmp(ofw_tree_node_name(node->parent), "central") != 0) 70 70 panic("Unexpected parent node: %s.", ofw_tree_node_name(node->parent)); 71 71 -
kernel/genarch/src/ofw/ofw_tree.c
r9be1d58 rb60c582 67 67 68 68 for (i = 0; i < node->properties; i++) { 69 if (str cmp(node->property[i].name, name) == 0)69 if (str_cmp(node->property[i].name, name) == 0) 70 70 return &node->property[i]; 71 71 } … … 110 110 */ 111 111 for (cur = node->child; cur; cur = cur->peer) { 112 if (str cmp(cur->da_name, name) == 0)112 if (str_cmp(cur->da_name, name) == 0) 113 113 return cur; 114 114 } … … 122 122 */ 123 123 for (cur = node->child; cur; cur = cur->peer) { 124 if (str cmp(ofw_tree_node_name(cur), name) == 0)124 if (str_cmp(ofw_tree_node_name(cur), name) == 0) 125 125 return cur; 126 126 } … … 147 147 if (!prop || !prop->value) 148 148 continue; 149 if (str cmp(prop->value, name) == 0)149 if (str_cmp(prop->value, name) == 0) 150 150 return cur; 151 151 } … … 204 204 if (!prop || !prop->value) 205 205 continue; 206 if (str cmp(prop->value, name) == 0)206 if (str_cmp(prop->value, name) == 0) 207 207 return cur; 208 208 } … … 230 230 if (!prop || !prop->value) 231 231 continue; 232 if (str cmp(prop->value, name) == 0)232 if (str_cmp(prop->value, name) == 0) 233 233 return cur; 234 234 } … … 253 253 return NULL; 254 254 255 for (i = 1; i < str_size(path) && node; i = j + 1) { 256 for (j = i; j < str_size(path) && path[j] != '/'; j++) 257 ; 258 if (i == j) /* skip extra slashes */ 255 for (i = 1; (i < str_size(path)) && (node); i = j + 1) { 256 for (j = i; (j < str_size(path)) && (path[j] != '/'); j++); 257 258 /* Skip extra slashes */ 259 if (i == j) 259 260 continue; 260 261 261 262 memcpy(buf, &path[i], j - i); 262 buf[j - i] = '\0';263 buf[j - i] = 0; 263 264 node = ofw_tree_find_child(node, buf); 264 265 } -
kernel/genarch/src/ofw/pci.c
r9be1d58 rb60c582 59 59 prop = ofw_tree_getprop(node, "ranges"); 60 60 if (!prop) { 61 if (str cmp(ofw_tree_node_name(node->parent), "pci") == 0)61 if (str_cmp(ofw_tree_node_name(node->parent), "pci") == 0) 62 62 return ofw_pci_apply_ranges(node->parent, reg, pa); 63 63 return false; -
kernel/generic/src/main/kinit.c
r9be1d58 rb60c582 187 187 188 188 name = init.tasks[i].name; 189 if (name[0] == '\0')189 if (name[0] == 0) 190 190 name = "<unknown>"; 191 191 192 192 ASSERT(TASK_NAME_BUFLEN >= INIT_PREFIX_LEN); 193 str ncpy(namebuf, INIT_PREFIX, TASK_NAME_BUFLEN);194 str ncpy(namebuf + INIT_PREFIX_LEN, name,193 str_ncpy(namebuf, INIT_PREFIX, TASK_NAME_BUFLEN); 194 str_ncpy(namebuf + INIT_PREFIX_LEN, name, 195 195 TASK_NAME_BUFLEN - INIT_PREFIX_LEN); 196 196 -
kernel/generic/src/proc/program.c
r9be1d58 rb60c582 214 214 return (unative_t) rc; 215 215 216 namebuf[name_len] = '\0';216 namebuf[name_len] = 0; 217 217 218 218 /* Spawn the new task. */ -
kernel/generic/src/proc/task.c
r9be1d58 rb60c582 152 152 153 153 memcpy(ta->name, name, TASK_NAME_BUFLEN); 154 ta->name[TASK_NAME_BUFLEN - 1] = '\0';154 ta->name[TASK_NAME_BUFLEN - 1] = 0; 155 155 156 156 atomic_set(&ta->refcount, 0); … … 274 274 return (unative_t) rc; 275 275 276 namebuf[name_len] = '\0';277 str ncpy(TASK->name, namebuf, TASK_NAME_BUFLEN);276 namebuf[name_len] = 0; 277 str_ncpy(TASK->name, namebuf, TASK_NAME_BUFLEN); 278 278 279 279 return EOK; -
kernel/generic/src/proc/thread.c
r9be1d58 rb60c582 317 317 318 318 memcpy(t->name, name, THREAD_NAME_BUFLEN); 319 t->name[THREAD_NAME_BUFLEN - 1] = '\0';319 t->name[THREAD_NAME_BUFLEN - 1] = 0; 320 320 321 321 t->thread_code = func; … … 724 724 return (unative_t) rc; 725 725 726 namebuf[name_len] = '\0';726 namebuf[name_len] = 0; 727 727 728 728 /* -
kernel/generic/src/synch/spinlock.c
r9be1d58 rb60c582 33 33 /** 34 34 * @file 35 * @brief 35 * @brief Spinlocks. 36 36 */ 37 37 38 38 #include <synch/spinlock.h> 39 39 #include <atomic.h>
Note:
See TracChangeset
for help on using the changeset viewer.