Changeset 6a44ee4 in mainline for kernel/generic/include


Ignore:
Timestamp:
2011-07-20T15:26:21Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
efcebe1
Parents:
25bef0ff (diff), a701812 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Location:
kernel/generic/include
Files:
1 added
20 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/adt/btree.h

    r25bef0ff r6a44ee4  
    8989typedef struct {
    9090        btree_node_t *root;     /**< B-tree root node pointer. */
    91         link_t leaf_head;       /**< Leaf-level list head. */
     91        list_t leaf_list;       /**< List of leaves. */
    9292} btree_t;
    9393
  • kernel/generic/include/adt/hash_table.h

    r25bef0ff r6a44ee4  
    6868/** Hash table structure. */
    6969typedef struct {
    70         link_t *entry;
     70        list_t *entry;
    7171        size_t entries;
    7272        size_t max_keys;
  • kernel/generic/include/adt/list.h

    r25bef0ff r6a44ee4  
    11/*
    22 * Copyright (c) 2001-2004 Jakub Jermar
     3 * Copyright (c) 2011 Jiri Svoboda
    34 * All rights reserved.
    45 *
     
    3940#include <trace.h>
    4041
    41 /** Doubly linked list head and link type. */
     42/** Doubly linked list link. */
    4243typedef struct link {
    4344        struct link *prev;  /**< Pointer to the previous item in the list. */
     
    4546} link_t;
    4647
     48/** Doubly linked list. */
     49typedef struct list {
     50        link_t head;  /**< List head. Does not have any data. */
     51} list_t;
     52
    4753/** Declare and initialize statically allocated list.
    4854 *
     
    5157 */
    5258#define LIST_INITIALIZE(name) \
    53         link_t name = { \
    54                 .prev = &name, \
    55                 .next = &name \
     59        list_t name = { \
     60                .head = { \
     61                        .prev = &(name).head, \
     62                        .next = &(name).head \
     63                } \
    5664        }
    5765
     
    6068
    6169#define list_foreach(list, iterator) \
    62         for (link_t *iterator = (list).next; \
    63             iterator != &(list); iterator = iterator->next)
     70        for (link_t *iterator = (list).head.next; \
     71            iterator != &(list).head; iterator = iterator->next)
     72
     73#define assert_link_not_used(link) \
     74        ASSERT((link)->prev == NULL && (link)->next == NULL)
    6475
    6576/** Initialize doubly-linked circular list link
     
    8091 * Initialize doubly-linked circular list.
    8192 *
    82  * @param list Pointer to link_t structure representing the list.
    83  *
    84  */
    85 NO_TRACE static inline void list_initialize(link_t *list)
    86 {
    87         list->prev = list;
    88         list->next = list;
     93 * @param list Pointer to list_t structure.
     94 *
     95 */
     96NO_TRACE static inline void list_initialize(list_t *list)
     97{
     98        list->head.prev = &list->head;
     99        list->head.next = &list->head;
     100}
     101
     102/** Insert item before another item in doubly-linked circular list.
     103 *
     104 */
     105static inline void list_insert_before(link_t *lnew, link_t *lold)
     106{
     107        lnew->next = lold;
     108        lnew->prev = lold->prev;
     109        lold->prev->next = lnew;
     110        lold->prev = lnew;
     111}
     112
     113/** Insert item after another item in doubly-linked circular list.
     114 *
     115 */
     116static inline void list_insert_after(link_t *lnew, link_t *lold)
     117{
     118        lnew->prev = lold;
     119        lnew->next = lold->next;
     120        lold->next->prev = lnew;
     121        lold->next = lnew;
    89122}
    90123
     
    94127 *
    95128 * @param link Pointer to link_t structure to be added.
    96  * @param list Pointer to link_t structure representing the list.
    97  *
    98  */
    99 NO_TRACE static inline void list_prepend(link_t *link, link_t *list)
    100 {
    101         link->next = list->next;
    102         link->prev = list;
    103         list->next->prev = link;
    104         list->next = link;
     129 * @param list Pointer to list_t structure.
     130 *
     131 */
     132NO_TRACE static inline void list_prepend(link_t *link, list_t *list)
     133{
     134        list_insert_after(link, &list->head);
    105135}
    106136
     
    110140 *
    111141 * @param link Pointer to link_t structure to be added.
    112  * @param list Pointer to link_t structure representing the list.
    113  *
    114  */
    115 NO_TRACE static inline void list_append(link_t *link, link_t *list)
    116 {
    117         link->prev = list->prev;
    118         link->next = list;
    119         list->prev->next = link;
    120         list->prev = link;
    121 }
    122 
    123 /** Insert item before another item in doubly-linked circular list.
    124  *
    125  */
    126 static inline void list_insert_before(link_t *link, link_t *list)
    127 {
    128         list_append(link, list);
    129 }
    130 
    131 /** Insert item after another item in doubly-linked circular list.
    132  *
    133  */
    134 static inline void list_insert_after(link_t *link, link_t *list)
    135 {
    136         list_prepend(list, link);
     142 * @param list Pointer to list_t structure.
     143 *
     144 */
     145NO_TRACE static inline void list_append(link_t *link, list_t *list)
     146{
     147        list_insert_before(link, &list->head);
    137148}
    138149
     
    156167 * Query emptiness of doubly-linked circular list.
    157168 *
    158  * @param list Pointer to link_t structure representing the list.
    159  *
    160  */
    161 NO_TRACE static inline int list_empty(link_t *list)
    162 {
    163         return (list->next == list);
    164 }
    165 
    166 /** Get head item of a list.
    167  *
    168  * @param list Pointer to link_t structure representing the list.
     169 * @param list Pointer to lins_t structure.
     170 *
     171 */
     172NO_TRACE static inline int list_empty(list_t *list)
     173{
     174        return (list->head.next == &list->head);
     175}
     176
     177/** Get first item in list.
     178 *
     179 * @param list Pointer to list_t structure.
    169180 *
    170181 * @return Head item of the list.
     
    172183 *
    173184 */
    174 static inline link_t *list_head(link_t *list)
    175 {
    176         return ((list->next == list) ? NULL : list->next);
     185static inline link_t *list_first(list_t *list)
     186{
     187        return ((list->head.next == &list->head) ? NULL : list->head.next);
     188}
     189
     190/** Get last item in list.
     191 *
     192 * @param list Pointer to list_t structure.
     193 *
     194 * @return Head item of the list.
     195 * @return NULL if the list is empty.
     196 *
     197 */
     198static inline link_t *list_last(list_t *list)
     199{
     200        return ((list->head.prev == &list->head) ? NULL : list->head.prev);
    177201}
    178202
     
    231255}
    232256
    233 /** Get n-th item of a list.
     257/** Get n-th item in a list.
    234258 *
    235259 * @param list Pointer to link_t structure representing the list.
     
    240264 *
    241265 */
    242 static inline link_t *list_nth(link_t *list, unsigned int n)
     266static inline link_t *list_nth(list_t *list, unsigned int n)
    243267{
    244268        unsigned int cnt = 0;
     
    254278}
    255279
    256 extern int list_member(const link_t *, const link_t *);
    257 extern void list_concat(link_t *, link_t *);
    258 extern unsigned int list_count(const link_t *);
     280extern int list_member(const link_t *, const list_t *);
     281extern void list_concat(list_t *, list_t *);
     282extern unsigned int list_count(const list_t *);
    259283
    260284#endif
  • kernel/generic/include/console/chardev.h

    r25bef0ff r6a44ee4  
    7373typedef struct {
    7474        /** Write character to output. */
    75         void (* write)(struct outdev *, wchar_t, bool);
     75        void (* write)(struct outdev *, wchar_t);
    7676       
    7777        /** Redraw any previously cached characters. */
     
    8888        /** Fields suitable for multiplexing. */
    8989        link_t link;
    90         link_t list;
     90        list_t list;
    9191       
    9292        /** Implementation of outdev operations. */
  • kernel/generic/include/console/console.h

    r25bef0ff r6a44ee4  
    7272extern void release_console(void);
    7373
    74 extern sysarg_t sys_debug_enable_console(void);
    75 extern sysarg_t sys_debug_disable_console(void);
     74extern sysarg_t sys_debug_activate_console(void);
    7675
    7776#endif /* KERN_CONSOLE_H_ */
  • kernel/generic/include/console/kconsole.h

    r25bef0ff r6a44ee4  
    9191
    9292SPINLOCK_EXTERN(cmd_lock);
    93 extern link_t cmd_head;
     93extern list_t cmd_list;
    9494
    9595extern void kconsole_init(void);
  • kernel/generic/include/cpu.h

    r25bef0ff r6a44ee4  
    5959       
    6060        IRQ_SPINLOCK_DECLARE(timeoutlock);
    61         link_t timeout_active_head;
     61        list_t timeout_active_list;
    6262       
    6363        /**
  • kernel/generic/include/ddi/ddi.h

    r25bef0ff r6a44ee4  
    4848        pfn_t frames;     /**< Number of frames in the area. */
    4949        bool unpriv;      /**< Allow mapping by unprivileged tasks. */
     50        bool mapped;      /**< Indicate whether the area is actually
     51                               mapped. */
    5052} parea_t;
    5153
  • kernel/generic/include/ddi/irq.h

    r25bef0ff r6a44ee4  
    7777         */
    7878        CMD_PIO_WRITE_A_32,
    79        
     79
     80        /** Read 1 byte from the memory space. */
     81        CMD_MEM_READ_8,
     82        /** Read 2 bytes from the memory space. */
     83        CMD_MEM_READ_16,
     84        /** Read 4 bytes from the memory space. */
     85        CMD_MEM_READ_32,
     86
     87        /** Write 1 byte to the memory space. */
     88        CMD_MEM_WRITE_8,
     89        /** Write 2 bytes to the memory space. */
     90        CMD_MEM_WRITE_16,
     91        /** Write 4 bytes to the memory space. */
     92        CMD_MEM_WRITE_32,
     93
     94        /** Write 1 byte from the source argument to the memory space. */
     95        CMD_MEM_WRITE_A_8,
     96        /** Write 2 bytes from the source argument to the memory space. */
     97        CMD_MEM_WRITE_A_16,
     98        /** Write 4 bytes from the source argument to the memory space. */
     99        CMD_MEM_WRITE_A_32,
     100
    80101        /**
    81102         * Perform a bit masking on the source argument
     
    203224        /** Notification configuration structure. */
    204225        ipc_notif_cfg_t notif_cfg;
     226
     227        as_t *driver_as;
    205228} irq_t;
    206229
  • kernel/generic/include/ipc/ipc.h

    r25bef0ff r6a44ee4  
    100100#define IPC_GET_ARG5(data)  ((data).args[5])
    101101
    102 /* Well known phone descriptors */
    103 #define PHONE_NS  0
    104 
    105102/* Forwarding flags. */
    106103#define IPC_FF_NONE  0
     
    117114
    118115/* Data transfer flags. */
    119 #define IPC_XF_NONE             0
     116#define IPC_XF_NONE  0
    120117
    121118/** Restrict the transfer size if necessary. */
    122 #define IPC_XF_RESTRICT         (1 << 0)
    123 
    124 /** Kernel IPC interfaces
    125  *
    126  */
    127 #define IPC_IF_KERNEL  0
    128 
    129 /** System-specific methods - only through special syscalls
    130  *
    131  * These methods have special behaviour. These methods also
    132  * have the implicit kernel interface 0.
    133  *
    134  */
    135 
    136 /** Clone connection.
    137  *
    138  * The calling task clones one of its phones for the callee.
    139  *
    140  * - ARG1 - The caller sets ARG1 to the phone of the cloned connection.
    141  *        - The callee gets the new phone from ARG1.
    142  *
    143  * - on answer, the callee acknowledges the new connection by sending EOK back
    144  *   or the kernel closes it
    145  *
    146  */
    147 #define IPC_M_CONNECTION_CLONE  1
    148 
    149 /** Protocol for CONNECT - ME
    150  *
    151  * Through this call, the recipient learns about the new cloned connection.
    152  *
    153  * - ARG5 - the kernel sets ARG5 to contain the hash of the used phone
    154  * - on asnwer, the callee acknowledges the new connection by sending EOK back
    155  *   or the kernel closes it
    156  *
    157  */
    158 #define IPC_M_CONNECT_ME  2
    159 
    160 /** Protocol for CONNECT - TO - ME
    161  *
    162  * Calling process asks the callee to create a callback connection,
    163  * so that it can start initiating new messages.
    164  *
    165  * The protocol for negotiating is:
    166  * - sys_connect_to_me - sends a message IPC_M_CONNECT_TO_ME
    167  * - recipient         - upon receipt tries to allocate new phone
    168  *                       - if it fails, responds with ELIMIT
    169  *                     - passes call to userspace. If userspace
    170  *                       responds with error, phone is deallocated and
    171  *                       error is sent back to caller. Otherwise
    172  *                       the call is accepted and the response is sent back.
    173  *                     - the hash of the client task is passed to userspace
    174  *                       (on the receiving side) as ARG4 of the call.
    175  *                     - the hash of the allocated phone is passed to userspace
    176  *                       (on the receiving side) as ARG5 of the call.
    177  *
    178  */
    179 #define IPC_M_CONNECT_TO_ME  3
    180 
    181 /** Protocol for CONNECT - ME - TO
    182  *
    183  * Calling process asks the callee to create for him a new connection.
    184  * E.g. the caller wants a name server to connect him to print server.
    185  *
    186  * The protocol for negotiating is:
    187  * - sys_connect_me_to - send a synchronous message to name server
    188  *                       indicating that it wants to be connected to some
    189  *                       service
    190  *                     - arg1/2/3 are user specified, arg5 contains
    191  *                       address of the phone that should be connected
    192  *                       (TODO: it leaks to userspace)
    193  *  - recipient        -  if ipc_answer == 0, then accept connection
    194  *                     -  otherwise connection refused
    195  *                     -  recepient may forward message.
    196  *
    197  */
    198 #define IPC_M_CONNECT_ME_TO  4
    199 
    200 /** This message is sent to answerbox when the phone is hung up
    201  *
    202  */
    203 #define IPC_M_PHONE_HUNGUP  5
    204 
    205 /** Send as_area over IPC.
    206  * - ARG1 - source as_area base address
    207  * - ARG2 - size of source as_area (filled automatically by kernel)
    208  * - ARG3 - flags of the as_area being sent
    209  *
    210  * on answer, the recipient must set:
    211  * - ARG1 - dst as_area base adress
    212  *
    213  */
    214 #define IPC_M_SHARE_OUT  6
    215 
    216 /** Receive as_area over IPC.
    217  * - ARG1 - destination as_area base address
    218  * - ARG2 - destination as_area size
    219  * - ARG3 - user defined argument
    220  *
    221  * on answer, the recipient must set:
    222  *
    223  * - ARG1 - source as_area base address
    224  * - ARG2 - flags that will be used for sharing
    225  *
    226  */
    227 #define IPC_M_SHARE_IN  7
    228 
    229 /** Send data to another address space over IPC.
    230  * - ARG1 - source address space virtual address
    231  * - ARG2 - size of data to be copied, may be overriden by the recipient
    232  *
    233  * on answer, the recipient must set:
    234  *
    235  * - ARG1 - final destination address space virtual address
    236  * - ARG2 - final size of data to be copied
    237  *
    238  */
    239 #define IPC_M_DATA_WRITE  8
    240 
    241 /** Receive data from another address space over IPC.
    242  * - ARG1 - destination virtual address in the source address space
    243  * - ARG2 - size of data to be received, may be cropped by the recipient
    244  *
    245  * on answer, the recipient must set:
    246  *
    247  * - ARG1 - source virtual address in the destination address space
    248  * - ARG2 - final size of data to be copied
    249  *
    250  */
    251 #define IPC_M_DATA_READ  9
    252 
    253 /** Debug the recipient.
    254  * - ARG1 - specifies the debug method (from udebug_method_t)
    255  * - other arguments are specific to the debug method
    256  *
    257  */
    258 #define IPC_M_DEBUG_ALL  10
    259 
    260 /* Well-known methods */
    261 #define IPC_M_LAST_SYSTEM  511
    262 #define IPC_M_PING         512
    263 
    264 /* User methods */
     119#define IPC_XF_RESTRICT  (1 << 0)
     120
     121/** User-defined IPC methods */
    265122#define IPC_FIRST_USER_METHOD  1024
    266123
     
    309166       
    310167        /** Phones connected to this answerbox. */
    311         link_t connected_phones;
     168        list_t connected_phones;
    312169        /** Received calls. */
    313         link_t calls;
    314         link_t dispatched_calls;  /* Should be hash table in the future */
     170        list_t calls;
     171        list_t dispatched_calls;  /* Should be hash table in the future */
    315172       
    316173        /** Answered calls. */
    317         link_t answers;
     174        list_t answers;
    318175       
    319176        IRQ_SPINLOCK_DECLARE(irq_lock);
    320177       
    321178        /** Notifications from IRQ handlers. */
    322         link_t irq_notifs;
     179        list_t irq_notifs;
    323180        /** IRQs with notifications to this answerbox. */
    324         link_t irq_head;
     181        list_t irq_list;
    325182} answerbox_t;
    326183
     
    386243extern void ipc_backsend_err(phone_t *, call_t *, sysarg_t);
    387244extern void ipc_answerbox_slam_phones(answerbox_t *, bool);
    388 extern void ipc_cleanup_call_list(link_t *);
     245extern void ipc_cleanup_call_list(list_t *);
    389246
    390247extern void ipc_print_task(task_id_t);
  • kernel/generic/include/mm/as.h

    r25bef0ff r6a44ee4  
    6565#include <arch/mm/as.h>
    6666#include <arch/mm/asid.h>
     67#include <arch/istate.h>
    6768#include <typedefs.h>
    6869#include <synch/spinlock.h>
     
    254255
    255256extern as_operations_t *as_operations;
    256 extern link_t inactive_as_with_asid_head;
     257extern list_t inactive_as_with_asid_list;
    257258
    258259extern void as_init(void);
  • kernel/generic/include/mm/buddy.h

    r25bef0ff r6a44ee4  
    7272        /** Maximal order of block which can be stored by buddy system. */
    7373        uint8_t max_order;
    74         link_t *order;
     74        list_t *order;
    7575        buddy_system_operations_t *op;
    7676        /** Pointer to be used by the implementation. */
  • kernel/generic/include/mm/page.h

    r25bef0ff r6a44ee4  
    3737
    3838#include <typedefs.h>
     39#include <proc/task.h>
    3940#include <mm/as.h>
    4041#include <arch/mm/page.h>
     
    6566extern uintptr_t hw_map(uintptr_t, size_t);
    6667
     68extern sysarg_t sys_page_find_mapping(uintptr_t, uintptr_t *);
     69
    6770#endif
    6871
  • kernel/generic/include/mm/slab.h

    r25bef0ff r6a44ee4  
    111111       
    112112        /* Slabs */
    113         link_t full_slabs;     /**< List of full slabs */
    114         link_t partial_slabs;  /**< List of partial slabs */
     113        list_t full_slabs;     /**< List of full slabs */
     114        list_t partial_slabs;  /**< List of partial slabs */
    115115        SPINLOCK_DECLARE(slablock);
    116116        /* Magazines */
    117         link_t magazines;  /**< List o full magazines */
     117        list_t magazines;  /**< List o full magazines */
    118118        SPINLOCK_DECLARE(maglock);
    119119       
  • kernel/generic/include/panic.h

    r25bef0ff r6a44ee4  
    6060struct istate;
    6161
    62 extern bool silent;
     62extern bool console_override;
    6363
    6464extern void panic_common(panic_category_t, struct istate *, int,
  • kernel/generic/include/proc/scheduler.h

    r25bef0ff r6a44ee4  
    4848typedef struct {
    4949        IRQ_SPINLOCK_DECLARE(lock);
    50         link_t rq_head;              /**< List of ready threads. */
    51         size_t n;                    /**< Number of threads in rq_ready. */
     50        list_t rq;                      /**< List of ready threads. */
     51        size_t n;                       /**< Number of threads in rq_ready. */
    5252} runq_t;
    5353
  • kernel/generic/include/proc/task.h

    r25bef0ff r6a44ee4  
    7373        char name[TASK_NAME_BUFLEN];
    7474        /** List of threads contained in this task. */
    75         link_t th_head;
     75        list_t threads;
    7676        /** Address space. */
    7777        as_t *as;
     
    9494        stats_ipc_t ipc_info;   /**< IPC statistics */
    9595        /** List of synchronous answerboxes. */
    96         link_t sync_box_head;
     96        list_t sync_boxes;
    9797       
    9898#ifdef CONFIG_UDEBUG
  • kernel/generic/include/proc/thread.h

    r25bef0ff r6a44ee4  
    156156        int fpu_context_engaged;
    157157       
     158        /* The thread will not be migrated if nomigrate is non-zero. */
     159        int nomigrate;
     160       
    158161        /** Thread's state. */
    159162        state_t state;
     
    245248extern bool thread_exists(thread_t *);
    246249
     250extern void thread_migration_disable(void);
     251extern void thread_migration_enable(void);
     252
    247253#ifdef CONFIG_UDEBUG
    248254extern void thread_stack_trace(thread_id_t);
     
    258264extern sysarg_t sys_thread_get_id(thread_id_t *);
    259265extern sysarg_t sys_thread_usleep(uint32_t);
     266extern sysarg_t sys_thread_udelay(uint32_t);
    260267
    261268#endif
  • kernel/generic/include/synch/waitq.h

    r25bef0ff r6a44ee4  
    6363       
    6464        /** List of sleeping threads for which there was no missed_wakeup. */
    65         link_t head;
     65        list_t sleepers;
    6666} waitq_t;
    6767
  • kernel/generic/include/syscall/syscall.h

    r25bef0ff r6a44ee4  
    4444        SYS_THREAD_GET_ID,
    4545        SYS_THREAD_USLEEP,
     46        SYS_THREAD_UDELAY,
    4647       
    4748        SYS_TASK_GET_ID,
     
    6061        SYS_AS_AREA_DESTROY,
    6162        SYS_AS_GET_UNMAPPED_AREA,
     63       
     64        SYS_PAGE_FIND_MAPPING,
    6265       
    6366        SYS_IPC_CALL_SYNC_FAST,
     
    9194        SYS_SYSINFO_GET_DATA,
    9295       
    93         SYS_DEBUG_ENABLE_CONSOLE,
    94         SYS_DEBUG_DISABLE_CONSOLE,
     96        SYS_DEBUG_ACTIVATE_CONSOLE,
    9597       
    9698        SYSCALL_END
Note: See TracChangeset for help on using the changeset viewer.