Changeset b60c582 in mainline for kernel/genarch/src
- 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/genarch/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.