Fix argv[0] bug
This commit is contained in:
parent
0ce4e02cba
commit
958262e69d
@ -112,7 +112,7 @@ exec(
|
||||
uintptr_t heap = current_process->image.entry + current_process->image.size;
|
||||
alloc_frame(get_page(heap, 1, current_directory), 0, 1);
|
||||
char ** argv_ = (char **)heap;
|
||||
heap += sizeof(char *) * argc;
|
||||
heap += sizeof(char *) * (argc + 1);
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
alloc_frame(get_page(heap, 1, current_directory), 0, 1);
|
||||
argv_[i] = (char *)heap;
|
||||
|
@ -3,7 +3,7 @@
|
||||
int main(int argc, char * argv[]) {
|
||||
printf("argc = %d\n", argc);
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
printf("argv[%d]= %s\n", i, argv[i]);
|
||||
printf("%p argv[%d]= %s\n", argv[i], i, argv[i]);
|
||||
}
|
||||
printf("continuing until I hit a 0\n");
|
||||
int i = argc;
|
||||
|
Loading…
Reference in New Issue
Block a user