Subversion Repositories HelenOS

Rev

Rev 4153 | Rev 4581 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4153 Rev 4263
Line 51... Line 51...
51
#include <sys/types.h>
51
#include <sys/types.h>
52
#include <ipc/ipc.h>
52
#include <ipc/ipc.h>
53
#include <ipc/services.h>
53
#include <ipc/services.h>
54
#include <ipc/loader.h>
54
#include <ipc/loader.h>
55
#include <loader/pcb.h>
55
#include <loader/pcb.h>
-
 
56
#include <console.h>
56
#include <errno.h>
57
#include <errno.h>
57
#include <async.h>
58
#include <async.h>
58
#include <as.h>
59
#include <as.h>
59
 
60
 
60
#include <elf.h>
61
#include <elf.h>
Line 175... Line 176...
175
        ipc_answer_0(rid, ENOMEM);
176
        ipc_answer_0(rid, ENOMEM);
176
        return;
177
        return;
177
    }
178
    }
178
   
179
   
179
    ipc_data_write_finalize(callid, arg_buf, buf_len);
180
    ipc_data_write_finalize(callid, arg_buf, buf_len);
180
    ipc_answer_0(rid, EOK);
-
 
181
   
181
   
182
    arg_buf[buf_len] = '\0';
182
    arg_buf[buf_len] = '\0';
183
   
183
   
184
    /*
184
    /*
185
     * Count number of arguments
185
     * Count number of arguments
Line 195... Line 195...
195
    /* Allocate argv */
195
    /* Allocate argv */
196
    argv = malloc((n + 1) * sizeof(char *));
196
    argv = malloc((n + 1) * sizeof(char *));
197
   
197
   
198
    if (argv == NULL) {
198
    if (argv == NULL) {
199
        free(arg_buf);
199
        free(arg_buf);
200
        ipc_answer_0(callid, ENOMEM);
-
 
201
        ipc_answer_0(rid, ENOMEM);
200
        ipc_answer_0(rid, ENOMEM);
202
        return;
201
        return;
203
    }
202
    }
204
   
203
 
205
    /*
204
    /*
206
     * Fill argv with argument pointers
205
     * Fill argv with argument pointers
207
     */
206
     */
208
    p = arg_buf;
207
    p = arg_buf;
209
    n = 0;
208
    n = 0;
Line 215... Line 214...
215
        ++n;
214
        ++n;
216
    }
215
    }
217
   
216
   
218
    argc = n;
217
    argc = n;
219
    argv[n] = NULL;
218
    argv[n] = NULL;
-
 
219
 
-
 
220
    ipc_answer_0(rid, EOK);
220
}
221
}
221
 
222
 
222
/** Load the previously selected program.
223
/** Load the previously selected program.
223
 *
224
 *
224
 * @param rid
225
 * @param rid
Line 280... Line 281...
280
   
281
   
281
    if (is_dyn_linked == true) {
282
    if (is_dyn_linked == true) {
282
        /* Dynamically linked program */
283
        /* Dynamically linked program */
283
        DPRINTF("Run ELF interpreter.\n");
284
        DPRINTF("Run ELF interpreter.\n");
284
        DPRINTF("Entry point: 0x%lx\n", interp_info.entry);
285
        DPRINTF("Entry point: 0x%lx\n", interp_info.entry);
285
        close_console();
286
        console_close();
286
       
287
       
287
        ipc_answer_0(rid, EOK);
288
        ipc_answer_0(rid, EOK);
288
        elf_run(&interp_info, &pcb);
289
        elf_run(&interp_info, &pcb);
289
    } else {
290
    } else {
290
        /* Statically linked program */
291
        /* Statically linked program */
291
        close_console();
292
        console_close();
292
        ipc_answer_0(rid, EOK);
293
        ipc_answer_0(rid, EOK);
293
        elf_run(&prog_info, &pcb);
294
        elf_run(&prog_info, &pcb);
294
    }
295
    }
295
 
296
 
296
    /* Not reached */
297
    /* Not reached */