- Timestamp:
- 2006-09-22T21:44:54Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5d684e4
- Parents:
- 16529d5
- Location:
- boot
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc64/loader/main.c
r16529d5 r28ecadb 66 66 bootinfo.screen.scanline = bootinfo.screen.scanline*bpp2align[bootinfo.screen.bpp >> 3]; 67 67 68 if (!ofw_keyboard(&bootinfo.keyboard))69 printf("Error: unable to get keyboard properties\n");70 71 68 if (!ofw_cpu(&bootinfo.cpu)) 72 69 printf("Error: unable to get cpu properties\n"); … … 76 73 printf(" memory: %dM\n", bootinfo.memmap.total>>20); 77 74 printf(" screen at %P, resolution %dx%d, %d bpp (scanline %d bytes)\n", (uintptr_t) bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline); 78 printf(" keyboard at %P (size %d bytes)\n", (uintptr_t) bootinfo.keyboard.addr, bootinfo.keyboard.size);79 75 80 76 printf("\nMemory statistics\n"); -
boot/arch/sparc64/loader/main.h
r16529d5 r28ecadb 55 55 memmap_t memmap; 56 56 screen_t screen; 57 keyboard_t keyboard;58 57 cpu_t cpu; 59 58 ballocs_t ballocs; -
boot/arch/sparc64/loader/ofwarch.c
r16529d5 r28ecadb 96 96 for (; node != 0 && node != -1; node = ofw_get_peer_node(node)) { 97 97 if (ofw_get_property(node, "device_type", type_name, sizeof(type_name)) > 0) { 98 if (str ncmp(type_name, "cpu", 3) == 0) {98 if (strcmp(type_name, "cpu") == 0) { 99 99 uint32_t mhz; 100 100 -
boot/genarch/ofw_tree.c
r16529d5 r28ecadb 48 48 static void * ofw_tree_space_alloc(size_t size) 49 49 { 50 return balloc(size, size); 50 char *addr; 51 52 /* 53 * What we do here is a nasty hack :-) 54 * Problem: string property values that are allocated via this 55 * function typically do not contain the trailing '\0'. This 56 * is very uncomfortable for kernel, which is supposed to deal 57 * with the properties. 58 * Solution: when allocating space via this function, we always 59 * allocate space for the extra '\0' character that we store 60 * behind the requested memory. 61 */ 62 addr = balloc(size + 1, size); 63 if (addr) 64 addr[size] = '\0'; 65 return addr; 51 66 } 52 67 … … 154 169 break; 155 170 156 strncpy(current_node->property[i].name, name, sizeof(name)); 171 memcpy(current_node->property[i].name, name, OFW_TREE_PROPERTY_MAX_NAMELEN); 172 current_node->property[i].name[OFW_TREE_PROPERTY_MAX_NAMELEN] = '\0'; 157 173 158 174 size = ofw_get_proplen(current, name); -
boot/generic/string.c
r16529d5 r28ecadb 58 58 * Do a char-by-char comparison of two NULL terminated strings. 59 59 * The strings are considered equal iff they consist of the same 60 * characters on the minimum of their lengths. 61 * 62 * @param src First string to compare. 63 * @param dst Second string to compare. 64 * 65 * @return 0 if the strings are equal, -1 if first is smaller, 1 if second smaller. 66 * 67 */ 68 int strcmp(const char *src, const char *dst) 69 { 70 for (; *src && *dst; src++, dst++) { 71 if (*src < *dst) 72 return -1; 73 if (*src > *dst) 74 return 1; 75 } 76 if (*src == *dst) 77 return 0; 78 if (!*src) 79 return -1; 80 return 1; 81 } 82 83 84 /** Compare two NULL terminated strings 85 * 86 * Do a char-by-char comparison of two NULL terminated strings. 87 * The strings are considered equal iff they consist of the same 60 88 * characters on the minimum of their lengths and specified maximal 61 89 * length. … … 72 100 int i; 73 101 74 i = 0; 75 for (;*src && *dst && i < len;src++,dst++,i++) { 102 for (i = 0; *src && *dst && i < len; src++, dst++, i++) { 76 103 if (*src < *dst) 77 104 return -1; -
boot/generic/string.h
r16529d5 r28ecadb 39 39 40 40 extern size_t strlen(const char *str); 41 extern int strcmp(const char *src, const char *dst); 41 42 extern int strncmp(const char *src, const char *dst, size_t len); 42 43 extern void strncpy(char *dest, const char *src, size_t len);
Note:
See TracChangeset
for help on using the changeset viewer.