Subversion Repositories HelenOS

Rev

Rev 2787 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2787 Rev 4692
Line 34... Line 34...
34
 
34
 
35
#ifndef LIBC_FIBRIL_H_
35
#ifndef LIBC_FIBRIL_H_
36
#define LIBC_FIBRIL_H_
36
#define LIBC_FIBRIL_H_
37
 
37
 
38
#include <libarch/fibril.h>
38
#include <libarch/fibril.h>
39
#include <libadt/list.h>
39
#include <adt/list.h>
40
#include <libarch/tls.h>
40
#include <libarch/tls.h>
41
 
41
 
42
#ifndef context_set
42
#ifndef context_set
43
#define context_set(c, _pc, stack, size, ptls)          \
43
#define context_set(c, _pc, stack, size, ptls) \
44
    (c)->pc = (sysarg_t) (_pc);             \
44
    (c)->pc = (sysarg_t) (_pc); \
45
    (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA;     \
45
    (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
46
        (c)->tls = (sysarg_t) (ptls);
46
    (c)->tls = (sysarg_t) (ptls);
47
#endif /* context_set */
47
#endif /* context_set */
48
 
48
 
49
#define FIBRIL_SERIALIZED   1
49
#define FIBRIL_SERIALIZED   1
-
 
50
#define FIBRIL_WRITER       2
50
 
51
 
51
typedef enum {
52
typedef enum {
52
    FIBRIL_PREEMPT,
53
    FIBRIL_PREEMPT,
53
    FIBRIL_TO_MANAGER,
54
    FIBRIL_TO_MANAGER,
54
    FIBRIL_FROM_MANAGER,
55
    FIBRIL_FROM_MANAGER,
Line 69... Line 70...
69
    int retval;
70
    int retval;
70
    int flags;
71
    int flags;
71
};
72
};
72
typedef struct fibril fibril_t;
73
typedef struct fibril fibril_t;
73
 
74
 
-
 
75
/** Fibril-local variable specifier */
-
 
76
#define fibril_local __thread
-
 
77
 
74
extern int context_save(context_t *c);
78
extern int context_save(context_t *c) __attribute__ ((returns_twice));
75
extern void context_restore(context_t *c) __attribute__ ((noreturn));
79
extern void context_restore(context_t *c) __attribute__ ((noreturn));
76
 
80
 
77
extern fid_t fibril_create(int (*func)(void *), void *arg);
81
extern fid_t fibril_create(int (*func)(void *), void *arg);
78
extern fibril_t *fibril_setup(void);
82
extern fibril_t *fibril_setup(void);
79
extern void fibril_teardown(fibril_t *f);
83
extern void fibril_teardown(fibril_t *f);