Changeset c8cbd39 in mainline
- Timestamp:
- 2012-08-16T10:59:59Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 04da852
- Parents:
- 5882487
- Location:
- kernel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/include/multiboot/multiboot.h
r5882487 rc8cbd39 99 99 100 100 extern void multiboot_extract_command(char *, size_t, const char *); 101 extern void multiboot_extract_argument(char *, size_t, const char *); 101 102 extern void multiboot_info_parse(uint32_t, const multiboot_info_t *); 102 103 -
kernel/genarch/src/multiboot/multiboot.c
r5882487 rc8cbd39 71 71 } 72 72 73 /** Extract arguments from the multiboot module command line. 74 * 75 * @param buf Destination buffer (will be always NULL-terminated). 76 * @param size Size of destination buffer (in bytes). 77 * @param cmd_line Input string (the command line). 78 * 79 */ 80 void multiboot_extract_argument(char *buf, size_t size, const char *cmd_line) 81 { 82 /* Start after first space. */ 83 const char *start = str_chr(cmd_line, ' '); 84 if (start == NULL) { 85 str_cpy(buf, size, ""); 86 return; 87 } 88 89 const char *end = cmd_line + str_size(cmd_line); 90 91 /* Skip the space(s). */ 92 while (start != end) { 93 if (start[0] == ' ') 94 start++; 95 else 96 break; 97 } 98 99 str_ncpy(buf, size, start, (size_t) (end - start)); 100 } 101 73 102 static void multiboot_modules(uint32_t count, multiboot_module_t *mods) 74 103 { … … 84 113 multiboot_extract_command(init.tasks[init.cnt].name, 85 114 CONFIG_TASK_NAME_BUFLEN, MULTIBOOT_PTR(mods[i].string)); 86 } else 115 multiboot_extract_argument(init.tasks[init.cnt].arguments, 116 CONFIG_TASK_ARGUMENTS_BUFLEN, MULTIBOOT_PTR(mods[i].string)); 117 } else { 87 118 init.tasks[init.cnt].name[0] = 0; 119 init.tasks[init.cnt].arguments[0] = 0; 120 } 88 121 89 122 init.cnt++; -
kernel/genarch/src/multiboot/multiboot2.c
r5882487 rc8cbd39 49 49 multiboot_extract_command(init.tasks[init.cnt].name, 50 50 CONFIG_TASK_NAME_BUFLEN, module->string); 51 multiboot_extract_argument(init.tasks[init.cnt].arguments, 52 CONFIG_TASK_ARGUMENTS_BUFLEN, module->string); 51 53 52 54 init.cnt++; -
kernel/generic/include/config.h
r5882487 rc8cbd39 47 47 #define CONFIG_INIT_TASKS 32 48 48 #define CONFIG_TASK_NAME_BUFLEN 32 49 #define CONFIG_TASK_ARGUMENTS_BUFLEN 64 49 50 50 51 #ifndef __ASM__ … … 56 57 size_t size; 57 58 char name[CONFIG_TASK_NAME_BUFLEN]; 59 char arguments[CONFIG_TASK_ARGUMENTS_BUFLEN]; 58 60 } init_task_t; 59 61 -
kernel/generic/src/main/kinit.c
r5882487 rc8cbd39 69 69 #include <str.h> 70 70 #include <sysinfo/stats.h> 71 #include <sysinfo/sysinfo.h> 71 72 #include <align.h> 72 73 … … 179 180 program_t programs[CONFIG_INIT_TASKS]; 180 181 182 // FIXME: do not propagate arguments through sysinfo 183 // but pass them directly to the tasks 184 for (i = 0; i < init.cnt; i++) { 185 const char *arguments = init.tasks[i].arguments; 186 if (str_length(arguments) == 0) 187 continue; 188 if (str_length(init.tasks[i].name) == 0) 189 continue; 190 size_t arguments_size = str_size(arguments); 191 192 void *arguments_copy = malloc(arguments_size, 0); 193 if (arguments_copy == NULL) 194 continue; 195 memcpy(arguments_copy, arguments, arguments_size); 196 197 char item_name[CONFIG_TASK_NAME_BUFLEN + 15]; 198 snprintf(item_name, CONFIG_TASK_NAME_BUFLEN + 15, 199 "init_args.%s", init.tasks[i].name); 200 201 sysinfo_set_item_data(item_name, NULL, arguments_copy, arguments_size); 202 } 203 181 204 for (i = 0; i < init.cnt; i++) { 182 205 if (init.tasks[i].paddr % FRAME_SIZE) {
Note:
See TracChangeset
for help on using the changeset viewer.