Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset deacd722 in mainline


Ignore:
Timestamp:
2018-11-09T22:03:24Z (3 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master
Children:
b389f95
Parents:
90efa3b
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-08 18:00:23)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-09 22:03:24)
Message:

Allow thread_create_arch() to fail

Location:
kernel
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/abs32le/src/proc/thread.c

    r90efa3b rdeacd722  
    3535#include <proc/thread.h>
    3636
    37 void thread_create_arch(thread_t *t)
     37errno_t thread_create_arch(thread_t *t, thread_flags_t flags)
    3838{
     39        return EOK;
    3940}
    4041
  • kernel/arch/amd64/src/proc/thread.c

    r90efa3b rdeacd722  
    4242 *
    4343 */
    44 void thread_create_arch(thread_t *thread)
     44errno_t thread_create_arch(thread_t *thread, thread_flags_t flags)
    4545{
    4646        /*
     
    4949        thread->arch.kstack_rsp =
    5050            (uintptr_t) &thread->kstack[PAGE_SIZE - sizeof(istate_t)];
     51        return EOK;
    5152}
    5253
  • kernel/arch/arm32/include/arch/proc/thread.h

    r90efa3b rdeacd722  
    4242#define thr_constructor_arch(t)
    4343#define thr_destructor_arch(t)
    44 #define thread_create_arch(t)
     44#define thread_create_arch(t, flags) (EOK)
    4545
    4646#endif
  • kernel/arch/ia32/src/proc/thread.c

    r90efa3b rdeacd722  
    3939 * @param t Thread to be initialized.
    4040 */
    41 void thread_create_arch(thread_t *t)
     41errno_t thread_create_arch(thread_t *t, thread_flags_t flags)
    4242{
     43        return EOK;
    4344}
    4445
  • kernel/arch/ia64/include/arch/proc/thread.h

    r90efa3b rdeacd722  
    4141#define thr_constructor_arch(t)
    4242#define thr_destructor_arch(t)
    43 #define thread_create_arch(t)
     43#define thread_create_arch(t, flags) (EOK)
    4444
    4545#endif
  • kernel/arch/mips32/include/arch/proc/thread.h

    r90efa3b rdeacd722  
    4141#define thr_constructor_arch(t)
    4242#define thr_destructor_arch(t)
    43 #define thread_create_arch(t)
     43#define thread_create_arch(t, flags) (EOK)
    4444
    4545#endif
  • kernel/arch/ppc32/include/arch/proc/thread.h

    r90efa3b rdeacd722  
    4141#define thr_constructor_arch(t)
    4242#define thr_destructor_arch(t)
    43 #define thread_create_arch(t)
     43#define thread_create_arch(t, flags) (EOK)
    4444
    4545#endif
  • kernel/arch/riscv64/src/proc/thread.c

    r90efa3b rdeacd722  
    3535#include <proc/thread.h>
    3636
    37 void thread_create_arch(thread_t *t)
     37errno_t thread_create_arch(thread_t *t, thread_flags_t flags)
    3838{
     39        return EOK;
    3940}
    4041
  • kernel/arch/sparc64/src/proc/thread.c

    r90efa3b rdeacd722  
    6262}
    6363
    64 void thread_create_arch(thread_t *t)
     64errno_t thread_create_arch(thread_t *t, thread_flags_t flags)
    6565{
    66         if ((t->uspace) && (!t->arch.uspace_window_buffer)) {
     66        if ((flags & THREAD_FLAG_USPACE) && (!t->arch.uspace_window_buffer)) {
    6767                /*
    6868                 * The thread needs userspace window buffer and the object
    6969                 * returned from the slab allocator doesn't have any.
    7070                 */
    71                 t->arch.uspace_window_buffer = slab_alloc(uwb_cache, 0);
     71                t->arch.uspace_window_buffer = slab_alloc(uwb_cache, FRAME_ATOMIC);
     72                if (!t->arch.uspace_window_buffer)
     73                        return ENOMEM;
    7274        } else {
    7375                uintptr_t uw_buf = (uintptr_t) t->arch.uspace_window_buffer;
     
    8082                    UWB_ALIGNMENT);
    8183        }
     84        return EOK;
    8285}
    8386
  • kernel/generic/include/proc/thread.h

    r90efa3b rdeacd722  
    225225
    226226#ifndef thread_create_arch
    227 extern void thread_create_arch(thread_t *);
     227extern errno_t thread_create_arch(thread_t *, thread_flags_t);
    228228#endif
    229229
  • kernel/generic/src/proc/thread.c

    r90efa3b rdeacd722  
    346346                return NULL;
    347347
     348        if (thread_create_arch(thread, flags) != EOK) {
     349                slab_free(thread_cache, thread);
     350                return NULL;
     351        }
     352
    348353        /* Not needed, but good for debugging */
    349354        memsetb(thread->kstack, STACK_SIZE, 0);
     
    407412        udebug_thread_initialize(&thread->udebug);
    408413#endif
    409 
    410         /* Might depend on previous initialization */
    411         thread_create_arch(thread);
    412414
    413415        if ((flags & THREAD_FLAG_NOATTACH) != THREAD_FLAG_NOATTACH)
Note: See TracChangeset for help on using the changeset viewer.