Rev 41 | Rev 43 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 41 | Rev 42 | ||
|---|---|---|---|
| Line 889... | Line 889... | ||
| 889 | ((bootargs_entry_t *) bootargs_buffer.bytes)->argc = (uint8_t) exe_cmdline->count; |
889 | ((bootargs_entry_t *) bootargs_buffer.bytes)->argc = (uint8_t) exe_cmdline->count; |
| 890 | ((bootargs_entry_t *) bootargs_buffer.bytes)->envc = (uint8_t) exe_env->count; |
890 | ((bootargs_entry_t *) bootargs_buffer.bytes)->envc = (uint8_t) exe_env->count; |
| 891 | ((bootargs_entry_t *) bootargs_buffer.bytes)->shdr_addr = WILL_BE_FILLED_LATER; // same value as startup_header.image_paddr (which is not set yet) (TODO: support 64-bit shdr_addr offsets -- see comment in bootargs_entry_t struct) |
891 | ((bootargs_entry_t *) bootargs_buffer.bytes)->shdr_addr = WILL_BE_FILLED_LATER; // same value as startup_header.image_paddr (which is not set yet) (TODO: support 64-bit shdr_addr offsets -- see comment in bootargs_entry_t struct) |
| 892 | for (array_index = 0; array_index < exe_cmdline->count; array_index++) |
892 | for (array_index = 0; array_index < exe_cmdline->count; array_index++) |
| 893 | ASSERT_WITH_ERRNO (Buffer_Append (&bootargs_buffer, exe_cmdline->args[array_index], strlen (exe_cmdline->args[array_index]) + 1)); // append string including NUL terminator |
893 | ASSERT_WITH_ERRNO (Buffer_Append (&bootargs_buffer, exe_cmdline->args[array_index], strlen (exe_cmdline->args[array_index]) + 1)); // append string including NUL terminator |
| - | 894 | for (array_index = 0; array_index < global_envp.count; array_index++) |
|
| - | 895 | ASSERT_WITH_ERRNO (Buffer_Append (&bootargs_buffer, global_envp.args[array_index], strlen (global_envp.args[array_index]) + 1)); // append string including NUL terminator |
|
| 894 | for (array_index = 0; array_index < exe_env->count; array_index++) |
896 | for (array_index = 0; array_index < exe_env->count; array_index++) |
| 895 | ASSERT_WITH_ERRNO (Buffer_Append (&bootargs_buffer, exe_env->args[array_index], strlen (exe_env->args[array_index]) + 1)); // append string including NUL terminator |
897 | ASSERT_WITH_ERRNO (Buffer_Append (&bootargs_buffer, exe_env->args[array_index], strlen (exe_env->args[array_index]) + 1)); // append string including NUL terminator |
| 896 | ((bootargs_entry_t *) bootargs_buffer.bytes)->size_hi = (uint8_t) ((bootargs_buffer.size >> 8) & 0xff); |
898 | ((bootargs_entry_t *) bootargs_buffer.bytes)->size_hi = (uint8_t) ((bootargs_buffer.size >> 8) & 0xff); |
| 897 | ((bootargs_entry_t *) bootargs_buffer.bytes)->size_lo = (uint8_t) ((bootargs_buffer.size >> 0) & 0xff); |
899 | ((bootargs_entry_t *) bootargs_buffer.bytes)->size_lo = (uint8_t) ((bootargs_buffer.size >> 0) & 0xff); |
| 898 | *bootargs_offset = (size_t) exeargs_location - (size_t) out_buffer->bytes; // compute the boot args offset |
900 | *bootargs_offset = (size_t) exeargs_location - (size_t) out_buffer->bytes; // compute the boot args offset |
| Line 1152... | Line 1154... | ||
| 1152 | { |
1154 | { |
| 1153 | startup_argv.args = line_argv.args; // relocate these pointers to the right place |
1155 | startup_argv.args = line_argv.args; // relocate these pointers to the right place |
| 1154 | startup_argv.count = line_argv.count; |
1156 | startup_argv.count = line_argv.count; |
| 1155 | startup_envp.args = line_envp.args; // relocate these pointers to the right place |
1157 | startup_envp.args = line_envp.args; // relocate these pointers to the right place |
| 1156 | startup_envp.count = line_envp.count; |
1158 | startup_envp.count = line_envp.count; |
| 1157 | for (array_index = 0; array_index < global_envp.count; array_index++) |
- | |
| 1158 | STRINGARRAY_PUSH (&startup_envp, global_envp.args[array_index]); // concatenate the global environment to the executable environment |
- | |
| 1159 | } |
1159 | } |
| 1160 | else |
1160 | else |
| 1161 | { |
1161 | { |
| 1162 | STRINGARRAY_FREE (&procnto_argv); // if procnto's argv was already assigned, free the previous array as we'll be replacing it with a new one |
1162 | STRINGARRAY_FREE (&procnto_argv); // if procnto's argv was already assigned, free the previous array as we'll be replacing it with a new one |
| 1163 | procnto_argv.args = line_argv.args; // relocate these pointers to the right place |
1163 | procnto_argv.args = line_argv.args; // relocate these pointers to the right place |
| 1164 | procnto_argv.count = line_argv.count; |
1164 | procnto_argv.count = line_argv.count; |
| 1165 | STRINGARRAY_FREE (&procnto_envp); // if procnto's envp was already assigned, free the previous array as we'll be replacing it with a new one |
1165 | STRINGARRAY_FREE (&procnto_envp); // if procnto's envp was already assigned, free the previous array as we'll be replacing it with a new one |
| 1166 | procnto_envp.args = line_envp.args; // relocate these pointers to the right place |
1166 | procnto_envp.args = line_envp.args; // relocate these pointers to the right place |
| 1167 | procnto_envp.count = line_envp.count; |
1167 | procnto_envp.count = line_envp.count; |
| 1168 | for (array_index = 0; array_index < global_envp.count; array_index++) |
- | |
| 1169 | STRINGARRAY_PUSH (&procnto_envp, global_envp.args[array_index]); // concatenate the global environment to the executable environment |
- | |
| 1170 | } |
1168 | } |
| 1171 | line_argv.args = NULL; // void the line_argv array so as to not free it as we stole its args pointers |
1169 | line_argv.args = NULL; // void the line_argv array so as to not free it as we stole its args pointers |
| 1172 | line_argv.count = 0; |
1170 | line_argv.count = 0; |
| 1173 | line_envp.args = NULL; // void the line_envp array so as to not free it as we stole its args pointers |
1171 | line_envp.args = NULL; // void the line_envp array so as to not free it as we stole its args pointers |
| 1174 | line_envp.count = 0; |
1172 | line_envp.count = 0; |