Changeset fb13b44 in mainline


Ignore:
Timestamp:
2019-08-06T19:57:27Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
103939e
Parents:
d89b259
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-08-10 08:35:21)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-06 19:57:27)
Message:

Spawned tasks' phone is connected to spawning task

  • Only boot time tasks are connected to hardcoded NS task.
  • First connected phone of other tasks is connected to the task that spawned them (spawn parent).
  • Until further changes, effectively it changes nothing (NS was the ultimate spawn parent).

Conflicts:

kernel/generic/include/proc/program.h
kernel/generic/src/ipc/ipc.c
kernel/generic/src/proc/program.c
kernel/generic/src/proc/task.c

Location:
kernel/generic
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/proc/program.h

    rd89b259 rfb13b44  
    3838#include <typedefs.h>
    3939
     40struct answerbox;
    4041struct task;
    4142struct thread;
     
    5556extern void *program_loader;
    5657
    57 extern errno_t program_create(as_t *, uspace_addr_t, char *, program_t *);
     58extern errno_t program_create(as_t *, uspace_addr_t, char *, struct answerbox *,
     59        program_t *);
    5860extern errno_t program_create_from_image(void *, char *, program_t *);
    5961extern errno_t program_create_loader(program_t *, char *);
  • kernel/generic/include/proc/task.h

    rd89b259 rfb13b44  
    139139extern void task_init(void);
    140140extern void task_done(void);
    141 extern task_t *task_create(as_t *, const char *);
     141extern task_t *task_create(as_t *, const char *, answerbox_t *);
    142142extern void task_destroy(task_t *);
    143143extern void task_hold(task_t *);
  • kernel/generic/src/ipc/ipc.c

    rd89b259 rfb13b44  
    6565static void ipc_forget_call(call_t *);
    6666
    67 /** Answerbox that new tasks are automatically connected to */
     67/** Answerbox that is assigned to boot-time tasks */
    6868answerbox_t *ipc_box_0 = NULL;
    6969
  • kernel/generic/src/main/main.c

    rd89b259 rfb13b44  
    298298         * Create kernel task.
    299299         */
    300         task_t *kernel = task_create(AS_KERNEL, "kernel");
     300        task_t *kernel = task_create(AS_KERNEL, "kernel", NULL);
    301301        if (!kernel)
    302302                panic("Cannot create kernel task.");
  • kernel/generic/src/proc/program.c

    rd89b259 rfb13b44  
    6464 * @param entry_addr Program entry-point address in program address space.
    6565 * @param name       Name to set for the program's task.
     66 * @param answerbox  Answerbox where box 0 is connected to (may be NULL).
    6667 * @param prg        Buffer for storing program information.
    6768 *
     
    6970 *
    7071 */
    71 errno_t program_create(as_t *as, uspace_addr_t entry_addr, char *name, program_t *prg)
     72errno_t program_create(as_t *as, uspace_addr_t entry_addr, char *name,
     73        struct answerbox *answerbox, program_t *prg)
    7274{
    7375        uspace_arg_t *kernel_uarg = (uspace_arg_t *)
     
    7779
    7880        prg->loader_status = EOK;
    79         prg->task = task_create(as, name);
     81        prg->task = task_create(as, name, answerbox);
    8082        if (!prg->task) {
    8183                free(kernel_uarg);
     
    157159
    158160        return program_create(as, ((elf_header_t *) image_addr)->e_entry,
    159             name, prg);
     161            name, ipc_box_0, prg);
    160162}
    161163
     
    191193
    192194        return program_create(as, ((elf_header_t *) program_loader)->e_entry,
    193             name, prg);
     195            name, &TASK->answerbox, prg);
    194196}
    195197
  • kernel/generic/src/proc/task.c

    rd89b259 rfb13b44  
    190190/** Create new task with no threads.
    191191 *
    192  * @param as   Task's address space.
    193  * @param name Symbolic name (a copy is made).
     192 * @param as         Task's address space.
     193 * @param name       Symbolic name (a copy is made).
     194 * @param answerbox  (Optional) answerbox where box 0 is connected to.
    194195 *
    195196 * @return New task's structure.
    196197 *
    197198 */
    198 task_t *task_create(as_t *as, const char *name)
     199task_t *task_create(as_t *as, const char *name, answerbox_t *answerbox)
    199200{
    200201        task_t *task = (task_t *) slab_alloc(task_cache, FRAME_ATOMIC);
     
    234235#endif
    235236
    236         if ((ipc_box_0) &&
    237             (container_check(ipc_box_0->task->container, task->container))) {
     237        if ((answerbox) &&
     238            (container_check(answerbox->task->container, task->container))) {
    238239                cap_phone_handle_t phone_handle;
    239240                errno_t rc = phone_alloc(task, true, &phone_handle, NULL);
     
    247248                kobject_t *phone_obj = kobject_get(task, phone_handle,
    248249                    KOBJECT_TYPE_PHONE);
    249                 (void) ipc_phone_connect(phone_obj->phone, ipc_box_0);
     250                (void) ipc_phone_connect(phone_obj->phone, answerbox);
    250251        }
    251252
Note: See TracChangeset for help on using the changeset viewer.