Changeset 89c57b6 in mainline for kernel/generic/include


Ignore:
Timestamp:
2011-04-13T14:45:41Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88634420
Parents:
cefb126 (diff), 17279ead (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
48 edited
1 moved

Legend:

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

    rcefb126 r89c57b6  
    3434
    3535#ifndef KERN_AVLTREE_H_
    36 #define KERN_AVLTREE_H_ 
     36#define KERN_AVLTREE_H_
    3737
    3838#include <typedefs.h>
     39#include <trace.h>
    3940
    4041/**
     
    110111 * @param t AVL tree.
    111112 */
    112 static inline void avltree_create(avltree_t *t)
     113NO_TRACE static inline void avltree_create(avltree_t *t)
    113114{
    114115        t->root = NULL;
     
    120121 * @param node Node which is initialized.
    121122 */
    122 static inline void avltree_node_initialize(avltree_node_t *node)
     123NO_TRACE static inline void avltree_node_initialize(avltree_node_t *node)
    123124{
    124125        node->key = 0;
  • kernel/generic/include/adt/hash_table.h

    rcefb126 r89c57b6  
    4848         * @return Index into hash table.
    4949         */
    50         size_t (* hash)(unative_t key[]);
     50        size_t (* hash)(sysarg_t key[]);
    5151       
    5252        /** Hash table item comparison function.
     
    5757         * @return true if the keys match, false otherwise.
    5858         */
    59         bool (*compare)(unative_t key[], size_t keys, link_t *item);
     59        bool (*compare)(sysarg_t key[], size_t keys, link_t *item);
    6060
    6161        /** Hash table item removal callback.
     
    7979extern void hash_table_create(hash_table_t *h, size_t m, size_t max_keys,
    8080    hash_table_operations_t *op);
    81 extern void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item);
    82 extern link_t *hash_table_find(hash_table_t *h, unative_t key[]);
    83 extern void hash_table_remove(hash_table_t *h, unative_t key[], size_t keys);
     81extern void hash_table_insert(hash_table_t *h, sysarg_t key[], link_t *item);
     82extern link_t *hash_table_find(hash_table_t *h, sysarg_t key[]);
     83extern void hash_table_remove(hash_table_t *h, sysarg_t key[], size_t keys);
    8484
    8585#endif
  • kernel/generic/include/adt/list.h

    rcefb126 r89c57b6  
    3737
    3838#include <typedefs.h>
     39#include <trace.h>
    3940
    4041/** Doubly linked list head and link type. */
     
    5758 * @param link Pointer to link_t structure to be initialized.
    5859 */
    59 static inline void link_initialize(link_t *link)
     60NO_TRACE static inline void link_initialize(link_t *link)
    6061{
    6162        link->prev = NULL;
     
    6970 * @param head Pointer to link_t structure representing head of the list.
    7071 */
    71 static inline void list_initialize(link_t *head)
     72NO_TRACE static inline void list_initialize(link_t *head)
    7273{
    7374        head->prev = head;
     
    8283 * @param head Pointer to link_t structure representing head of the list.
    8384 */
    84 static inline void list_prepend(link_t *link, link_t *head)
     85NO_TRACE static inline void list_prepend(link_t *link, link_t *head)
    8586{
    8687        link->next = head->next;
     
    9798 * @param head Pointer to link_t structure representing head of the list.
    9899 */
    99 static inline void list_append(link_t *link, link_t *head)
     100NO_TRACE static inline void list_append(link_t *link, link_t *head)
    100101{
    101102        link->prev = head->prev;
     
    112113 *              contained in.
    113114 */
    114 static inline void list_remove(link_t *link)
     115NO_TRACE static inline void list_remove(link_t *link)
    115116{
    116117        link->next->prev = link->prev;
     
    125126 * @param head Pointer to link_t structure representing head of the list.
    126127 */
    127 static inline bool list_empty(link_t *head)
     128NO_TRACE static inline bool list_empty(link_t *head)
    128129{
    129130        return head->next == head ? true : false;
     
    143144 *              headless) list.
    144145 */
    145 static inline void headless_list_split_or_concat(link_t *part1, link_t *part2)
     146NO_TRACE static inline void headless_list_split_or_concat(link_t *part1, link_t *part2)
    146147{
    147148        link_t *hlp;
     
    164165 *              headless list.
    165166 */
    166 static inline void headless_list_split(link_t *part1, link_t *part2)
     167NO_TRACE static inline void headless_list_split(link_t *part1, link_t *part2)
    167168{
    168169        headless_list_split_or_concat(part1, part2);
     
    176177 * @param part2 Pointer to link_t structure leading the second headless list.
    177178 */
    178 static inline void headless_list_concat(link_t *part1, link_t *part2)
     179NO_TRACE static inline void headless_list_concat(link_t *part1, link_t *part2)
    179180{
    180181        headless_list_split_or_concat(part1, part2);
  • kernel/generic/include/atomic.h

    rcefb126 r89c57b6  
    4040#include <verify.h>
    4141
    42 ATOMIC static inline void atomic_set(atomic_t *val, atomic_count_t i)
     42NO_TRACE ATOMIC static inline void atomic_set(atomic_t *val, atomic_count_t i)
    4343    WRITES(&val->count)
    4444    REQUIRES_EXTENT_MUTABLE(val)
     
    4747}
    4848
    49 ATOMIC static inline atomic_count_t atomic_get(atomic_t *val)
     49NO_TRACE ATOMIC static inline atomic_count_t atomic_get(atomic_t *val)
    5050    REQUIRES_EXTENT_MUTABLE(val)
    5151{
  • kernel/generic/include/bitops.h

    rcefb126 r89c57b6  
    3636#define KERN_BITOPS_H_
    3737
     38#include <trace.h>
     39
    3840#ifdef __32_BITS__
    3941        #define fnzb(arg)  fnzb32(arg)
     
    4951 *
    5052 */
    51 static inline uint8_t fnzb32(uint32_t arg)
     53NO_TRACE static inline uint8_t fnzb32(uint32_t arg)
    5254{
    5355        uint8_t n = 0;
     
    8486 *
    8587 */
    86 static inline uint8_t fnzb64(uint64_t arg)
     88NO_TRACE static inline uint8_t fnzb64(uint64_t arg)
    8789{
    8890        uint8_t n = 0;
  • kernel/generic/include/config.h

    rcefb126 r89c57b6  
    6666
    6767typedef struct {
    68         size_t cpu_count;            /**< Number of processors detected. */
     68        unsigned int cpu_count;      /**< Number of processors detected. */
    6969        volatile size_t cpu_active;  /**< Number of processors that are up and running. */
    7070       
  • kernel/generic/include/console/console.h

    rcefb126 r89c57b6  
    6767extern wchar_t getc(indev_t *indev);
    6868extern size_t gets(indev_t *indev, char *buf, size_t buflen);
    69 extern unative_t sys_klog(int fd, const void *buf, size_t size);
     69extern sysarg_t sys_klog(int fd, const void *buf, size_t size);
    7070
    7171extern void grab_console(void);
    7272extern void release_console(void);
    7373
    74 extern unative_t sys_debug_enable_console(void);
    75 extern unative_t sys_debug_disable_console(void);
     74extern sysarg_t sys_debug_enable_console(void);
     75extern sysarg_t sys_debug_disable_console(void);
    7676
    7777#endif /* KERN_CONSOLE_H_ */
  • kernel/generic/include/console/kconsole.h

    rcefb126 r89c57b6  
    6262        size_t len;
    6363        /** Integer value. */
    64         unative_t intval;
     64        sysarg_t intval;
    6565        /** Resulting type of variable arg */
    6666        cmd_arg_type_t vartype;
  • kernel/generic/include/context.h

    rcefb126 r89c57b6  
    3737
    3838#include <typedefs.h>
     39#include <trace.h>
    3940#include <arch/context.h>
    4041
     
    8990 *
    9091 */
    91 static inline void __attribute__((no_instrument_function))
    92     context_restore(context_t *ctx)
     92NO_TRACE static inline void context_restore(context_t *ctx)
    9393{
    9494        context_restore_arch(ctx);
  • kernel/generic/include/cpu.h

    rcefb126 r89c57b6  
    8383         * Processor ID assigned by kernel.
    8484         */
    85         size_t id;
     85        unsigned int id;
    8686       
    8787        bool active;
  • kernel/generic/include/ddi/ddi.h

    rcefb126 r89c57b6  
    4343/** Structure representing contiguous physical memory area. */
    4444typedef struct {
    45         uintptr_t pbase;    /**< Physical base of the area. */
    46         pfn_t frames;       /**< Number of frames in the area. */
     45        link_t link;      /**< Linked list link */
    4746       
    48         link_t link;        /**< Linked list link */
     47        uintptr_t pbase;  /**< Physical base of the area. */
     48        pfn_t frames;     /**< Number of frames in the area. */
     49        bool unpriv;      /**< Allow mapping by unprivileged tasks. */
    4950} parea_t;
    5051
     
    5253extern void ddi_parea_register(parea_t *);
    5354
    54 extern unative_t sys_physmem_map(unative_t, unative_t, unative_t, unative_t);
    55 extern unative_t sys_iospace_enable(ddi_ioarg_t *);
    56 extern unative_t sys_preempt_control(int);
     55extern sysarg_t sys_physmem_map(sysarg_t, sysarg_t, sysarg_t, sysarg_t);
     56extern sysarg_t sys_iospace_enable(ddi_ioarg_t *);
    5757
    5858/*
  • kernel/generic/include/ddi/device.h

    rcefb126 r89c57b6  
    3939
    4040extern devno_t device_assign_devno(void);
    41 extern unative_t sys_device_assign_devno(void);
     41extern sysarg_t sys_device_assign_devno(void);
    4242
    4343#endif
  • kernel/generic/include/ddi/irq.h

    rcefb126 r89c57b6  
    5454        /** Read 4 bytes from the I/O space. */
    5555        CMD_PIO_READ_32,
     56       
    5657        /** Write 1 byte to the I/O space. */
    5758        CMD_PIO_WRITE_8,
     
    6263       
    6364        /**
    64          * Perform a bit test on the source argument and store the result into
    65          * the destination argument.
     65         * Write 1 byte from the source argument
     66         * to the I/O space.
     67         */
     68        CMD_PIO_WRITE_A_8,
     69        /**
     70         * Write 2 bytes from the source argument
     71         * to the I/O space.
     72         */
     73        CMD_PIO_WRITE_A_16,
     74        /**
     75         * Write 4 bytes from the source argument
     76         * to the I/O space.
     77         */
     78        CMD_PIO_WRITE_A_32,
     79       
     80        /**
     81         * Perform a bit masking on the source argument
     82         * and store the result into the destination argument.
    6683         */
    6784        CMD_BTEST,
    6885       
    6986        /**
    70          * Predicate the execution of the following N commands by the boolean
    71          * value of the source argument.
     87         * Predicate the execution of the following
     88         * N commands by the boolean value of the source
     89         * argument.
    7290         */
    7391        CMD_PREDICATE,
     
    7593        /** Accept the interrupt. */
    7694        CMD_ACCEPT,
     95       
    7796        /** Decline the interrupt. */
    7897        CMD_DECLINE,
     
    122141        /** Answerbox for notifications. */
    123142        answerbox_t *answerbox;
    124         /** Method to be used for the notification. */
    125         unative_t method;
     143        /** Interface and method to be used for the notification. */
     144        sysarg_t imethod;
    126145        /** Arguments that will be sent if the IRQ is claimed. */
    127146        uint32_t scratch[IPC_CALL_LEN];
     
    189208extern hash_table_t irq_uspace_hash_table;
    190209
     210extern inr_t last_inr;
     211
    191212extern void irq_init(size_t, size_t);
    192213extern void irq_initialize(irq_t *);
  • kernel/generic/include/debug.h

    rcefb126 r89c57b6  
    5555        do { \
    5656                if (!(expr)) \
    57                         panic_assert("%s", #expr); \
     57                        panic_assert("%s() at %s:%u:\n%s", \
     58                            __func__, __FILE__, __LINE__, #expr); \
    5859        } while (0)
    5960
     
    7273        do { \
    7374                if (!(expr)) \
    74                         panic_assert("%s, %s", #expr, msg); \
     75                        panic_assert("%s() at %s:%u:\n%s, %s", \
     76                            __func__, __FILE__, __LINE__, #expr, msg); \
    7577        } while (0)
    7678
  • kernel/generic/include/interrupt.h

    rcefb126 r89c57b6  
    3737
    3838#include <arch/interrupt.h>
     39#include <print.h>
    3940#include <typedefs.h>
    4041#include <proc/task.h>
     
    5758extern exc_table_t exc_table[];
    5859
    59 extern void fault_if_from_uspace(istate_t *, const char *, ...);
     60extern void fault_if_from_uspace(istate_t *, const char *, ...)
     61    PRINTF_ATTRIBUTE(2, 3);
     62extern istate_t *istate_get(thread_t *);
    6063extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t);
    6164extern void exc_dispatch(unsigned int, istate_t *);
  • kernel/generic/include/ipc/event.h

    rcefb126 r89c57b6  
    4747        /** Answerbox for notifications. */
    4848        answerbox_t *answerbox;
    49         /** Method to be used for the notification. */
    50         unative_t method;
     49        /** Interface and method to be used for the notification. */
     50        sysarg_t imethod;
    5151        /** Counter. */
    5252        size_t counter;
     
    5454
    5555extern void event_init(void);
    56 extern unative_t sys_event_subscribe(unative_t, unative_t);
     56extern sysarg_t sys_event_subscribe(sysarg_t, sysarg_t);
    5757extern bool event_is_subscribed(event_type_t);
    5858extern void event_cleanup_answerbox(answerbox_t *);
     
    7171        event_notify((e), (a1), (a2), (a3), (a4), (a5))
    7272
    73 extern void event_notify(event_type_t, unative_t, unative_t, unative_t,
    74     unative_t, unative_t);
     73extern void event_notify(event_type_t, sysarg_t, sysarg_t, sysarg_t,
     74    sysarg_t, sysarg_t);
    7575
    7676#endif
  • kernel/generic/include/ipc/event_types.h

    rcefb126 r89c57b6  
    4141        /** Returning from kernel console to userspace */
    4242        EVENT_KCONSOLE,
    43         /** A thread has faulted and will be terminated */
     43        /** A task/thread has faulted and will be terminated */
    4444        EVENT_FAULT,
    4545        EVENT_END
  • kernel/generic/include/ipc/ipc.h

    rcefb126 r89c57b6  
    4343#define IPC_CALL_LEN  6
    4444
    45 /** Maximum active async calls per thread */
    46 #ifdef CONFIG_DEBUG
    47         #define IPC_MAX_ASYNC_CALLS  4
    48 #else
    49         #define IPC_MAX_ASYNC_CALLS  4000
    50 #endif
     45/** Maximum active async calls per phone */
     46#define IPC_MAX_ASYNC_CALLS  4
    5147
    5248/* Flags for calls */
     
    8884/* Macros for manipulating calling data */
    8985#define IPC_SET_RETVAL(data, retval)  ((data).args[0] = (retval))
    90 #define IPC_SET_METHOD(data, val)     ((data).args[0] = (val))
     86#define IPC_SET_IMETHOD(data, val)    ((data).args[0] = (val))
    9187#define IPC_SET_ARG1(data, val)       ((data).args[1] = (val))
    9288#define IPC_SET_ARG2(data, val)       ((data).args[2] = (val))
     
    9591#define IPC_SET_ARG5(data, val)       ((data).args[5] = (val))
    9692
    97 #define IPC_GET_METHOD(data)  ((data).args[0])
    98 #define IPC_GET_RETVAL(data)  ((data).args[0])
     93#define IPC_GET_IMETHOD(data)  ((data).args[0])
     94#define IPC_GET_RETVAL(data)   ((data).args[0])
    9995
    10096#define IPC_GET_ARG1(data)  ((data).args[1])
     
    120116#define IPC_FF_ROUTE_FROM_ME  (1 << 0)
    121117
     118/* Data transfer flags. */
     119#define IPC_XF_NONE             0
     120
     121/** 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
    122129/** System-specific methods - only through special syscalls
    123  * These methods have special behaviour
     130 *
     131 * These methods have special behaviour. These methods also
     132 * have the implicit kernel interface 0.
    124133 *
    125134 */
     
    162171 *                       error is sent back to caller. Otherwise
    163172 *                       the call is accepted and the response is sent back.
    164  *                     - the allocated phoneid is passed to userspace
     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
    165176 *                       (on the receiving side) as ARG5 of the call.
    166177 *
     
    315326
    316327typedef struct {
    317         unative_t args[IPC_CALL_LEN];
     328        sysarg_t args[IPC_CALL_LEN];
     329        /** Task which made or forwarded the call with IPC_FF_ROUTE_FROM_ME. */
     330        struct task *task;
     331        /** Phone which made or last masqueraded this call. */
    318332        phone_t *phone;
    319333} ipc_data_t;
     
    330344         * The caller box is different from sender->answerbox
    331345         * for synchronous calls.
    332          *
    333346         */
    334347        answerbox_t *callerbox;
    335348       
    336349        /** Private data to internal IPC. */
    337         unative_t priv;
     350        sysarg_t priv;
    338351       
    339352        /** Data passed from/to userspace. */
     
    347360         * cases, we must keep it aside so that the answer is processed
    348361         * correctly.
    349          *
    350362         */
    351363        phone_t *caller_phone;
     
    372384
    373385extern void ipc_cleanup(void);
    374 extern void ipc_backsend_err(phone_t *, call_t *, unative_t);
     386extern void ipc_backsend_err(phone_t *, call_t *, sysarg_t);
    375387extern void ipc_answerbox_slam_phones(answerbox_t *, bool);
    376388extern void ipc_cleanup_call_list(link_t *);
  • kernel/generic/include/ipc/ipcrsc.h

    rcefb126 r89c57b6  
    3939#include <ipc/ipc.h>
    4040
    41 extern call_t * get_call(unative_t callid);
     41extern call_t * get_call(sysarg_t callid);
    4242extern int phone_alloc(task_t *t);
    4343extern void phone_connect(int phoneid, answerbox_t *box);
  • kernel/generic/include/ipc/irq.h

    rcefb126 r89c57b6  
    4444#include <adt/list.h>
    4545
    46 extern int ipc_irq_register(answerbox_t *, inr_t, devno_t, unative_t,
     46extern int ipc_irq_register(answerbox_t *, inr_t, devno_t, sysarg_t,
    4747    irq_code_t *);
    4848
     
    7575        ipc_irq_send_msg((irq), (a1), (a2), (a3), (a4), (a5))
    7676
    77 extern void ipc_irq_send_msg(irq_t *, unative_t, unative_t, unative_t, unative_t,
    78     unative_t);
     77extern void ipc_irq_send_msg(irq_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     78    sysarg_t);
    7979
    8080#endif
  • kernel/generic/include/ipc/sysipc.h

    rcefb126 r89c57b6  
    4040#include <typedefs.h>
    4141
    42 extern unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method,
    43     unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data);
    44 extern unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question,
    45     ipc_data_t *reply);
    46 extern unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method,
    47     unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4);
    48 extern unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data);
    49 extern unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval,
    50     unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4);
    51 extern unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data);
    52 extern unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
    53     unsigned int nonblocking);
    54 extern unative_t sys_ipc_poke(void);
    55 extern unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid,
    56     unative_t method, unative_t arg1, unative_t arg2, unsigned int mode);
    57 extern unative_t sys_ipc_forward_slow(unative_t callid, unative_t phoneid,
    58     ipc_data_t *data, unsigned int mode);
    59 extern unative_t sys_ipc_hangup(unative_t phoneid);
    60 extern unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method,
    61     irq_code_t *ucode);
    62 extern unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno);
    63 extern unative_t sys_ipc_connect_kbox(sysarg64_t *task_id);
     42extern sysarg_t sys_ipc_call_sync_fast(sysarg_t, sysarg_t, sysarg_t,
     43    sysarg_t, sysarg_t, ipc_data_t *);
     44extern sysarg_t sys_ipc_call_sync_slow(sysarg_t, ipc_data_t *, ipc_data_t *);
     45extern sysarg_t sys_ipc_call_async_fast(sysarg_t, sysarg_t, sysarg_t,
     46    sysarg_t, sysarg_t, sysarg_t);
     47extern sysarg_t sys_ipc_call_async_slow(sysarg_t, ipc_data_t *);
     48extern sysarg_t sys_ipc_answer_fast(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     49    sysarg_t, sysarg_t);
     50extern sysarg_t sys_ipc_answer_slow(sysarg_t, ipc_data_t *);
     51extern sysarg_t sys_ipc_wait_for_call(ipc_data_t *, uint32_t, unsigned int);
     52extern sysarg_t sys_ipc_poke(void);
     53extern sysarg_t sys_ipc_forward_fast(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     54    sysarg_t, unsigned int);
     55extern sysarg_t sys_ipc_forward_slow(sysarg_t, sysarg_t, ipc_data_t *,
     56    unsigned int);
     57extern sysarg_t sys_ipc_hangup(sysarg_t);
     58extern sysarg_t sys_register_irq(inr_t, devno_t, sysarg_t, irq_code_t *);
     59extern sysarg_t sys_unregister_irq(inr_t, devno_t);
     60
     61#ifdef __32_BITS__
     62
     63extern sysarg_t sys_ipc_connect_kbox(sysarg64_t *);
     64
     65#endif  /* __32_BITS__ */
     66
     67#ifdef __64_BITS__
     68
     69extern sysarg_t sys_ipc_connect_kbox(sysarg_t);
     70
     71#endif  /* __64_BITS__ */
    6472
    6573#endif
  • kernel/generic/include/lib/memfnc.h

    rcefb126 r89c57b6  
    11/*
    2  * Copyright (c) 2006 Jakub Jermar
     2 * Copyright (c) 2011 Martin Decky
    33 * All rights reserved.
    44 *
     
    3030 * @{
    3131 */
    32 
    33 /**
    34  * @file
    35  * @brief       Wrapper for explicit 64-bit arguments passed to syscalls.
     32/** @file
    3633 */
    3734
    38 #ifndef KERN_SYSARG64_H_
    39 #define KERN_SYSARG64_H_
     35#ifndef KERN_LIB_MEMFNC_H_
     36#define KERN_LIB_MEMFNC_H_
    4037
    41 typedef struct {
    42         unsigned long long value;
    43 } sysarg64_t;
     38#include <typedefs.h>
     39
     40extern void *memset(void *, int, size_t);
     41extern void *memcpy(void *, const void *, size_t);
    4442
    4543#endif
  • kernel/generic/include/macros.h

    rcefb126 r89c57b6  
    3939
    4040#include <typedefs.h>
     41#include <trace.h>
    4142
    4243/** Return true if the intervals overlap.
     
    4647 * @param s2  Start address of the second interval.
    4748 * @param sz2 Size of the second interval.
     49 *
    4850 */
    49 static inline int __attribute__((no_instrument_function))
    50     overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, size_t sz2)
     51NO_TRACE static inline int overlaps(uint64_t s1, uint64_t sz1, uint64_t s2,
     52    uint64_t sz2)
    5153{
    52         uintptr_t e1 = s1 + sz1;
    53         uintptr_t e2 = s2 + sz2;
     54        uint64_t e1 = s1 + sz1;
     55        uint64_t e2 = s2 + sz2;
    5456       
    5557        return ((s1 < e2) && (s2 < e1));
     58}
     59
     60/** Return true if the second interval is within the first interval.
     61 *
     62 * @param s1  Start address of the first interval.
     63 * @param sz1 Size of the first interval.
     64 * @param s2  Start address of the second interval.
     65 * @param sz2 Size of the second interval.
     66 *
     67 */
     68NO_TRACE static inline int iswithin(uint64_t s1, uint64_t sz1, uint64_t s2,
     69    uint64_t sz2)
     70{
     71        uint64_t e1 = s1 + sz1;
     72        uint64_t e2 = s2 + sz2;
     73       
     74        return ((s1 <= s2) && (e1 >= e2));
    5675}
    5776
     
    7392
    7493/* Compute overlapping of physical addresses */
    75 #define PA_overlaps(x, szx, y, szy) \
     94#define PA_OVERLAPS(x, szx, y, szy) \
    7695        overlaps(KA2PA((x)), (szx), KA2PA((y)), (szy))
    7796
     
    85104#define STRING_ARG(arg)  #arg
    86105
    87 #define LOWER32(arg)  (((uint64_t) (arg)) & 0xffffffff)
    88 #define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & 0xffffffff)
     106#define LOWER32(arg)  (((uint64_t) (arg)) & UINT32_C(0xffffffff))
     107#define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & UINT32_C(0xffffffff))
    89108
    90109#define MERGE_LOUP32(lo, up) \
    91         ((((uint64_t) (lo)) & 0xffffffff) \
    92             | ((((uint64_t) (up)) & 0xffffffff) << 32))
     110        ((((uint64_t) (lo)) & UINT32_C(0xffffffff)) \
     111            | ((((uint64_t) (up)) & UINT32_C(0xffffffff)) << 32))
    93112
    94113/** Pseudorandom generator
  • kernel/generic/include/main/main.h

    rcefb126 r89c57b6  
    3232/** @file
    3333 */
    34  
     34
    3535#ifndef KERN_MAIN_H_
    3636#define KERN_MAIN_H_
  • kernel/generic/include/main/version.h

    rcefb126 r89c57b6  
    4242/** @}
    4343 */
    44 
  • kernel/generic/include/memstr.h

    rcefb126 r89c57b6  
    3737
    3838#include <typedefs.h>
    39 #include <arch/memstr.h>
    4039
    41 /*
    42  * Architecture independent variants.
    43  */
    44 extern void *_memcpy(void *dst, const void *src, size_t cnt);
    45 extern void _memsetb(void *dst, size_t cnt, uint8_t x);
    46 extern void _memsetw(void *dst, size_t cnt, uint16_t x);
    47 extern void *memmove(void *dst, const void *src, size_t cnt);
     40#define memset(dst, val, cnt)  __builtin_memset((dst), (val), (cnt))
     41#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
     42
     43extern void memsetb(void *, size_t, uint8_t);
     44extern void memsetw(void *, size_t, uint16_t);
     45extern void *memmove(void *, const void *, size_t);
    4846
    4947#endif
  • kernel/generic/include/mm/as.h

    rcefb126 r89c57b6  
    115115       
    116116        /**
    117          * Number of processors on wich is this address space active.
    118          * Protected by asidlock.
     117         * Number of processors on which this
     118         * address space is active. Protected by
     119         * asidlock.
    119120         */
    120121        size_t cpu_refcount;
    121122       
    122         /**
    123          * Address space identifier.
    124          * Constant on architectures that do not support ASIDs.
    125          * Protected by asidlock.
     123        /** Address space identifier.
     124         *
     125         * Constant on architectures that do not
     126         * support ASIDs. Protected by asidlock.
     127         *
    126128         */
    127129        asid_t asid;
    128130       
    129         /** Number of references (i.e tasks that reference this as). */
     131        /** Number of references (i.e. tasks that reference this as). */
    130132        atomic_t refcount;
    131133       
     
    171173        PF_ACCESS_READ,
    172174        PF_ACCESS_WRITE,
    173         PF_ACCESS_EXEC
     175        PF_ACCESS_EXEC,
     176        PF_ACCESS_UNKNOWN
    174177} pf_access_t;
    175178
     
    198201typedef struct {
    199202        mutex_t lock;
     203       
    200204        /** Containing address space. */
    201205        as_t *as;
    202206       
    203         /**
    204          * Flags related to the memory represented by the address space area.
    205          */
     207        /** Memory flags. */
    206208        unsigned int flags;
    207209       
    208         /** Attributes related to the address space area itself. */
     210        /** Address space area attributes. */
    209211        unsigned int attributes;
    210         /** Size of this area in multiples of PAGE_SIZE. */
     212       
     213        /** Number of pages in the area. */
    211214        size_t pages;
     215       
     216        /** Number of resident pages in the area. */
     217        size_t resident;
     218       
    212219        /** Base address of this area. */
    213220        uintptr_t base;
     221       
    214222        /** Map of used space. */
    215223        btree_t used_space;
    216224       
    217225        /**
    218          * If the address space area has been shared, this pointer will
    219          * reference the share info structure.
     226         * If the address space area is shared. this is
     227         * a reference to the share info structure.
    220228         */
    221229        share_info_t *sh_info;
     
    260268extern bool as_area_check_access(as_area_t *, pf_access_t);
    261269extern size_t as_area_get_size(uintptr_t);
    262 extern int used_space_insert(as_area_t *, uintptr_t, size_t);
    263 extern int used_space_remove(as_area_t *, uintptr_t, size_t);
    264 
     270extern bool used_space_insert(as_area_t *, uintptr_t, size_t);
     271extern bool used_space_remove(as_area_t *, uintptr_t, size_t);
    265272
    266273/* Interface to be implemented by architectures. */
     
    302309
    303310/* Address space area related syscalls. */
    304 extern unative_t sys_as_area_create(uintptr_t, size_t, unsigned int);
    305 extern unative_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
    306 extern unative_t sys_as_area_change_flags(uintptr_t, unsigned int);
    307 extern unative_t sys_as_area_destroy(uintptr_t);
     311extern sysarg_t sys_as_area_create(uintptr_t, size_t, unsigned int);
     312extern sysarg_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
     313extern sysarg_t sys_as_area_change_flags(uintptr_t, unsigned int);
     314extern sysarg_t sys_as_area_destroy(uintptr_t);
     315extern sysarg_t sys_as_get_unmapped_area(uintptr_t, size_t);
    308316
    309317/* Introspection functions. */
  • kernel/generic/include/mm/frame.h

    rcefb126 r89c57b6  
    3838
    3939#include <typedefs.h>
     40#include <trace.h>
    4041#include <adt/list.h>
    4142#include <mm/buddy.h>
     
    115116extern zones_t zones;
    116117
    117 static inline uintptr_t PFN2ADDR(pfn_t frame)
     118NO_TRACE static inline uintptr_t PFN2ADDR(pfn_t frame)
    118119{
    119120        return (uintptr_t) (frame << FRAME_WIDTH);
    120121}
    121122
    122 static inline pfn_t ADDR2PFN(uintptr_t addr)
     123NO_TRACE static inline pfn_t ADDR2PFN(uintptr_t addr)
    123124{
    124125        return (pfn_t) (addr >> FRAME_WIDTH);
    125126}
    126127
    127 static inline size_t SIZE2FRAMES(size_t size)
     128NO_TRACE static inline size_t SIZE2FRAMES(size_t size)
    128129{
    129130        if (!size)
     
    132133}
    133134
    134 static inline size_t FRAMES2SIZE(size_t frames)
     135NO_TRACE static inline size_t FRAMES2SIZE(size_t frames)
    135136{
    136137        return (size_t) (frames << FRAME_WIDTH);
    137138}
    138139
    139 static inline bool zone_flags_available(zone_flags_t flags)
     140NO_TRACE static inline bool zone_flags_available(zone_flags_t flags)
    140141{
    141142        return ((flags & (ZONE_RESERVED | ZONE_FIRMWARE)) == 0);
     
    143144
    144145#define IS_BUDDY_ORDER_OK(index, order) \
    145     ((~(((unative_t) -1) << (order)) & (index)) == 0)
     146    ((~(((sysarg_t) -1) << (order)) & (index)) == 0)
    146147#define IS_BUDDY_LEFT_BLOCK(zone, frame) \
    147148    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0)
     
    166167extern void frame_set_parent(pfn_t, void *, size_t);
    167168extern void frame_mark_unavailable(pfn_t, size_t);
    168 extern uintptr_t zone_conf_size(size_t);
     169extern size_t zone_conf_size(size_t);
    169170extern bool zone_merge(size_t, size_t);
    170171extern void zone_merge_all(void);
  • kernel/generic/include/mm/slab.h

    rcefb126 r89c57b6  
    126126extern void slab_cache_destroy(slab_cache_t *);
    127127
    128 extern void * slab_alloc(slab_cache_t *, unsigned int);
     128extern void *slab_alloc(slab_cache_t *, unsigned int)
     129    __attribute__((malloc));
    129130extern void slab_free(slab_cache_t *, void *);
    130131extern size_t slab_reclaim(unsigned int);
     
    138139
    139140/* malloc support */
    140 extern void *malloc(size_t, unsigned int);
     141extern void *malloc(size_t, unsigned int)
     142    __attribute__((malloc));
    141143extern void *realloc(void *, size_t, unsigned int);
    142144extern void free(void *);
  • kernel/generic/include/panic.h

    rcefb126 r89c57b6  
    3737
    3838#include <typedefs.h>
     39#include <print.h>
    3940
    4041#define panic(fmt, ...) \
     
    6263
    6364extern void panic_common(panic_category_t, struct istate *, int,
    64     uintptr_t, const char *, ...) __attribute__ ((noreturn));
     65    uintptr_t, const char *, ...) __attribute__ ((noreturn))
     66    PRINTF_ATTRIBUTE(5, 6);
    6567
    6668#endif
  • kernel/generic/include/print.h

    rcefb126 r89c57b6  
    3939#include <stdarg.h>
    4040
     41#ifndef NVERIFY_PRINTF
     42
     43#define PRINTF_ATTRIBUTE(start, end) \
     44        __attribute__((format(gnu_printf, start, end)))
     45
     46#else /* NVERIFY_PRINTF */
     47
     48#define PRINTF_ATTRIBUTE(start, end)
     49
     50#endif /* NVERIFY_PRINTF */
     51
    4152#define EOF  (-1)
    4253
    4354extern int puts(const char *s);
    44 extern int printf(const char *fmt, ...);
    45 extern int snprintf(char *str, size_t size, const char *fmt, ...);
     55extern int printf(const char *fmt, ...)
     56    PRINTF_ATTRIBUTE(1, 2);
     57extern int snprintf(char *str, size_t size, const char *fmt, ...)
     58    PRINTF_ATTRIBUTE(3, 4);
    4659
    4760extern int vprintf(const char *fmt, va_list ap);
  • kernel/generic/include/proc/program.h

    rcefb126 r89c57b6  
    5959extern void program_ready(program_t *);
    6060
    61 extern unative_t sys_program_spawn_loader(char *, size_t);
     61extern sysarg_t sys_program_spawn_loader(char *, size_t);
    6262
    6363#endif
  • kernel/generic/include/proc/task.h

    rcefb126 r89c57b6  
    9393        phone_t phones[IPC_MAX_PHONES];
    9494        stats_ipc_t ipc_info;   /**< IPC statistics */
    95         /**
    96          * Active asynchronous messages. It is used for limiting uspace to
    97          * certain extent.
    98          */
    99         atomic_t active_calls;
    10095        /** List of synchronous answerboxes. */
    10196        link_t sync_box_head;
     
    136131extern task_t *task_find_by_id(task_id_t);
    137132extern int task_kill(task_id_t);
     133extern void task_kill_self(bool) __attribute__((noreturn));
    138134extern void task_get_accounting(task_t *, uint64_t *, uint64_t *);
    139135extern void task_print_list(bool);
     
    150146#endif
    151147
    152 extern unative_t sys_task_get_id(task_id_t *);
    153 extern unative_t sys_task_set_name(const char *, size_t);
     148#ifdef __32_BITS__
     149extern sysarg_t sys_task_get_id(sysarg64_t *);
     150#endif
     151
     152#ifdef __64_BITS__
     153extern sysarg_t sys_task_get_id(void);
     154#endif
     155
     156extern sysarg_t sys_task_set_name(const char *, size_t);
     157extern sysarg_t sys_task_kill(task_id_t *);
     158extern sysarg_t sys_task_exit(sysarg_t);
    154159
    155160#endif
  • kernel/generic/include/proc/thread.h

    rcefb126 r89c57b6  
    9191       
    9292        /** Function implementing the thread. */
    93         void (* thread_code)(void *);
     93        void (*thread_code)(void *);
    9494        /** Argument passed to thread_code() function. */
    9595        void *thread_arg;
    9696       
    9797        /**
    98          * From here, the stored context is restored when the thread is
    99          * scheduled.
     98         * From here, the stored context is restored
     99         * when the thread is scheduled.
    100100         */
    101101        context_t saved_context;
    102         /**
    103          * From here, the stored timeout context is restored when sleep times
    104          * out.
     102       
     103        /**
     104         * From here, the stored timeout context
     105         * is restored when sleep times out.
    105106         */
    106107        context_t sleep_timeout_context;
    107         /**
    108          * From here, the stored interruption context is restored when sleep is
    109          * interrupted.
     108       
     109        /**
     110         * From here, the stored interruption context
     111         * is restored when sleep is interrupted.
    110112         */
    111113        context_t sleep_interruption_context;
     
    125127         */
    126128        bool in_copy_from_uspace;
     129       
    127130        /**
    128131         * True if this thread is executing copy_to_uspace().
     
    187190       
    188191#ifdef CONFIG_UDEBUG
     192        /**
     193         * If true, the scheduler will print a stack trace
     194         * to the kernel console upon scheduling this thread.
     195         */
     196        bool btrace;
     197       
    189198        /** Debugging stuff */
    190199        udebug_thread_t udebug;
     
    237246extern bool thread_exists(thread_t *);
    238247
     248#ifdef CONFIG_UDEBUG
     249extern void thread_stack_trace(thread_id_t);
     250#endif
     251
    239252/** Fpu context slab cache. */
    240253extern slab_cache_t *fpu_context_slab;
    241254
    242255/* Thread syscall prototypes. */
    243 extern unative_t sys_thread_create(uspace_arg_t *, char *, size_t,
     256extern sysarg_t sys_thread_create(uspace_arg_t *, char *, size_t,
    244257    thread_id_t *);
    245 extern unative_t sys_thread_exit(int);
    246 extern unative_t sys_thread_get_id(thread_id_t *);
    247 extern unative_t sys_thread_usleep(uint32_t);
     258extern sysarg_t sys_thread_exit(int);
     259extern sysarg_t sys_thread_get_id(thread_id_t *);
     260extern sysarg_t sys_thread_usleep(uint32_t);
    248261
    249262#endif
  • kernel/generic/include/security/cap.h

    rcefb126 r89c57b6  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    3535/**
    3636 * @file
    37  * @brief       Capabilities definitions.
     37 * @brief Capabilities definitions.
    3838 *
    3939 * Capabilities represent virtual rights that entitle their
     
    4848#define __CAP_H__
    4949
    50 #include <syscall/sysarg64.h>
    5150#include <typedefs.h>
    5251
     
    5554 * privilege to/from other tasks.
    5655 */
    57 #define CAP_CAP                 (1<<0)
     56#define CAP_CAP  (1 << 0)
    5857
    5958/**
     
    6160 * to other tasks.
    6261 */
    63 #define CAP_MEM_MANAGER         (1<<1)
     62#define CAP_MEM_MANAGER  (1 << 1)
    6463
    6564/**
     
    6766 * to other tasks.
    6867 */
    69 #define CAP_IO_MANAGER          (1<<2)
    70 
    71 /**
    72  * CAP_PREEMPT_CONTROL allows its holder to disable/enable preemption.
    73  */
    74 #define CAP_PREEMPT_CONTROL     (1<<3)
     68#define CAP_IO_MANAGER  (1 << 2)
    7569
    7670/**
    7771 * CAP_IRQ_REG entitles its holder to register IRQ handlers.
    7872 */
    79 #define CAP_IRQ_REG             (1<<4)
     73#define CAP_IRQ_REG  (1 << 3)
    8074
    8175typedef uint32_t cap_t;
    8276
    83 extern unative_t sys_cap_grant(sysarg64_t *uspace_taskid_arg, cap_t caps);
    84 extern unative_t sys_cap_revoke(sysarg64_t *uspace_taskid_arg, cap_t caps);
     77#ifdef __32_BITS__
     78
     79extern sysarg_t sys_cap_grant(sysarg64_t *, cap_t);
     80extern sysarg_t sys_cap_revoke(sysarg64_t *, cap_t);
     81
     82#endif  /* __32_BITS__ */
     83
     84#ifdef __64_BITS__
     85
     86extern sysarg_t sys_cap_grant(sysarg_t, cap_t);
     87extern sysarg_t sys_cap_revoke(sysarg_t, cap_t);
     88
     89#endif  /* __64_BITS__ */
    8590
    8691#endif
  • kernel/generic/include/smp/smp.h

    rcefb126 r89c57b6  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    4141
    4242#ifdef CONFIG_SMP
     43
    4344extern void smp_init(void);
    4445extern void kmp(void *arg);
    45 #else
     46
     47#else /* CONFIG_SMP */
     48
    4649#define smp_init()
     50
    4751#endif /* CONFIG_SMP */
    4852
  • kernel/generic/include/stacktrace.h

    rcefb126 r89c57b6  
    4242
    4343typedef struct {
    44         bool (* frame_pointer_validate)(uintptr_t);
    45         bool (* frame_pointer_prev)(uintptr_t, uintptr_t *);
    46         bool (* return_address_get)(uintptr_t, uintptr_t *);
     44        uintptr_t fp;
     45        uintptr_t pc;
     46        struct istate *istate;
     47} stack_trace_context_t;
     48
     49typedef struct {
     50        bool (* stack_trace_context_validate)(stack_trace_context_t *);
     51        bool (* frame_pointer_prev)(stack_trace_context_t *, uintptr_t *);
     52        bool (* return_address_get)(stack_trace_context_t *, uintptr_t *);
    4753        bool (* symbol_resolve)(uintptr_t, const char **, uintptr_t *);
    4854} stack_trace_ops_t;
     
    5359extern void stack_trace(void);
    5460extern void stack_trace_istate(struct istate *);
    55 extern void stack_trace_fp_pc(stack_trace_ops_t *, uintptr_t, uintptr_t);
     61extern void stack_trace_ctx(stack_trace_ops_t *, stack_trace_context_t *);
    5662
    5763/*
     
    6167extern uintptr_t program_counter_get(void);
    6268
    63 extern bool kernel_frame_pointer_validate(uintptr_t);
    64 extern bool kernel_frame_pointer_prev(uintptr_t, uintptr_t *);
    65 extern bool kernel_return_address_get(uintptr_t, uintptr_t *);
     69extern bool kernel_stack_trace_context_validate(stack_trace_context_t *);
     70extern bool kernel_frame_pointer_prev(stack_trace_context_t *, uintptr_t *);
     71extern bool kernel_return_address_get(stack_trace_context_t *, uintptr_t *);
    6672
    67 extern bool uspace_frame_pointer_validate(uintptr_t);
    68 extern bool uspace_frame_pointer_prev(uintptr_t, uintptr_t *);
    69 extern bool uspace_return_address_get(uintptr_t, uintptr_t *);
     73extern bool uspace_stack_trace_context_validate(stack_trace_context_t *);
     74extern bool uspace_frame_pointer_prev(stack_trace_context_t *, uintptr_t *);
     75extern bool uspace_return_address_get(stack_trace_context_t *, uintptr_t *);
    7076
    7177#endif
  • kernel/generic/include/stdint.h

    rcefb126 r89c57b6  
    3636#define KERN_STDINT_H_
    3737
    38 #define INT8_MIN  (0x80)
    39 #define INT8_MAX  (0x7F)
     38#define INT8_MIN  INT8_C(0x80)
     39#define INT8_MAX  INT8_C(0x7F)
    4040
    41 #define UINT8_MIN  (0u)
    42 #define UINT8_MAX  (0xFFu)
     41#define UINT8_MIN  UINT8_C(0)
     42#define UINT8_MAX  UINT8_C(0xFF)
    4343
    44 #define INT16_MIN  (0x8000)
    45 #define INT16_MAX  (0x7FFF)
     44#define INT16_MIN  INT16_C(0x8000)
     45#define INT16_MAX  INT16_C(0x7FFF)
    4646
    47 #define UINT16_MIN  (0u)
    48 #define UINT16_MAX  (0xFFFFu)
     47#define UINT16_MIN  UINT16_C(0)
     48#define UINT16_MAX  UINT16_C(0xFFFF)
    4949
    50 #define INT32_MIN  (0x80000000l)
    51 #define INT32_MAX  (0x7FFFFFFFl)
     50#define INT32_MIN  INT32_C(0x80000000)
     51#define INT32_MAX  INT32_C(0x7FFFFFFF)
    5252
    53 #define UINT32_MIN  (0ul)
    54 #define UINT32_MAX  (0xFFFFFFFFul)
     53#define UINT32_MIN  UINT32_C(0)
     54#define UINT32_MAX  UINT32_C(0xFFFFFFFF)
    5555
    56 #define INT64_MIN  (0x8000000000000000ll)
    57 #define INT64_MAX  (0x7FFFFFFFFFFFFFFFll)
     56#define INT64_MIN  INT64_C(0x8000000000000000)
     57#define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
    5858
    59 #define UINT64_MIN  (0ull)
    60 #define UINT64_MAX  (0xFFFFFFFFFFFFFFFFull)
     59#define UINT64_MIN  UINT64_C(0)
     60#define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
    6161
    6262#endif
  • kernel/generic/include/synch/futex.h

    rcefb126 r89c57b6  
    5252
    5353extern void futex_init(void);
    54 extern unative_t sys_futex_sleep(uintptr_t);
    55 extern unative_t sys_futex_wakeup(uintptr_t);
     54extern sysarg_t sys_futex_sleep(uintptr_t);
     55extern sysarg_t sys_futex_wakeup(uintptr_t);
    5656
    5757extern void futex_cleanup(void);
  • kernel/generic/include/synch/smc.h

    rcefb126 r89c57b6  
    3636#define KERN_SMC_H_
    3737
    38 extern unative_t sys_smc_coherence(uintptr_t va, size_t size);
     38extern sysarg_t sys_smc_coherence(uintptr_t va, size_t size);
    3939
    4040#endif
  • kernel/generic/include/synch/spinlock.h

    rcefb126 r89c57b6  
    124124 *
    125125 */
    126 static inline void spinlock_unlock_nondebug(spinlock_t *lock)
     126NO_TRACE static inline void spinlock_unlock_nondebug(spinlock_t *lock)
    127127{
    128128        /*
     
    146146        if ((pname)++ > (value)) { \
    147147                (pname) = 0; \
    148                 printf("Deadlock probe %s: exceeded threshold %u\n", \
     148                printf("Deadlock probe %s: exceeded threshold %u\n" \
    149149                    "cpu%u: function=%s, line=%u\n", \
    150150                    #pname, (value), CPU->id, __func__, __LINE__); \
  • kernel/generic/include/syscall/syscall.h

    rcefb126 r89c57b6  
    3838typedef enum {
    3939        SYS_KLOG = 0,
    40         SYS_TLS_SET = 1, /* Hardcoded in AMD64, IA32 uspace - fibril.S */
     40        SYS_TLS_SET = 1,  /* Hardcoded for AMD64, IA-32 (fibril.S in uspace) */
    4141       
    4242        SYS_THREAD_CREATE,
     
    4747        SYS_TASK_GET_ID,
    4848        SYS_TASK_SET_NAME,
     49        SYS_TASK_KILL,
     50        SYS_TASK_EXIT,
    4951        SYS_PROGRAM_SPAWN_LOADER,
    5052       
     
    5759        SYS_AS_AREA_CHANGE_FLAGS,
    5860        SYS_AS_AREA_DESTROY,
     61        SYS_AS_GET_UNMAPPED_AREA,
    5962       
    6063        SYS_IPC_CALL_SYNC_FAST,
     
    6972        SYS_IPC_POKE,
    7073        SYS_IPC_HANGUP,
    71         SYS_IPC_REGISTER_IRQ,
    72         SYS_IPC_UNREGISTER_IRQ,
     74        SYS_IPC_CONNECT_KBOX,
    7375       
    7476        SYS_EVENT_SUBSCRIBE,
     
    8082        SYS_PHYSMEM_MAP,
    8183        SYS_IOSPACE_ENABLE,
    82         SYS_PREEMPT_CONTROL,
     84        SYS_REGISTER_IRQ,
     85        SYS_UNREGISTER_IRQ,
    8386       
    8487        SYS_SYSINFO_GET_TAG,
     
    9093        SYS_DEBUG_DISABLE_CONSOLE,
    9194       
    92         SYS_IPC_CONNECT_KBOX,
    9395        SYSCALL_END
    9496} syscall_t;
     
    98100#include <typedefs.h>
    99101
    100 typedef unative_t (*syshandler_t)(unative_t, unative_t, unative_t, unative_t,
    101     unative_t, unative_t);
     102typedef sysarg_t (*syshandler_t)(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     103    sysarg_t, sysarg_t);
    102104
    103105extern syshandler_t syscall_table[SYSCALL_END];
    104 extern unative_t syscall_handler(unative_t, unative_t, unative_t, unative_t,
    105     unative_t, unative_t, unative_t);
    106 extern unative_t sys_tls_set(unative_t);
     106extern sysarg_t syscall_handler(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     107    sysarg_t, sysarg_t, sysarg_t);
     108extern sysarg_t sys_tls_set(sysarg_t);
    107109
    108110#endif
  • kernel/generic/include/sysinfo/abi.h

    rcefb126 r89c57b6  
    6666 */
    6767typedef struct {
    68         size_t id;               /**< CPU ID as stored by kernel */
     68        unsigned int id;         /**< CPU ID as stored by kernel */
    6969        bool active;             /**< CPU is activate */
    7070        uint16_t frequency_mhz;  /**< Frequency in MHz */
     
    104104        char name[TASK_NAME_BUFLEN];  /**< Task name (in kernel) */
    105105        size_t virtmem;               /**< Size of VAS (bytes) */
     106        size_t resmem;                /**< Size of resident (used) memory (bytes) */
    106107        size_t threads;               /**< Number of threads */
    107108        uint64_t ucycles;             /**< Number of CPU cycles in user space */
  • kernel/generic/include/sysinfo/sysinfo.h

    rcefb126 r89c57b6  
    6565
    6666/** Gerated numeric value function */
    67 typedef unative_t (*sysinfo_fn_val_t)(struct sysinfo_item *);
     67typedef sysarg_t (*sysinfo_fn_val_t)(struct sysinfo_item *);
    6868
    6969/** Generated binary data function */
     
    8282 */
    8383typedef union {
    84         unative_t val;              /**< Constant numberic value */
     84        sysarg_t val;               /**< Constant numberic value */
    8585        sysinfo_fn_val_t fn_val;    /**< Generated numeric value function */
    8686        sysinfo_fn_data_t fn_data;  /**< Generated binary data function */
     
    9999        sysinfo_item_val_type_t tag;  /**< Return value type */
    100100        union {
    101                 unative_t val;            /**< Numberic value */
     101                sysarg_t val;             /**< Numberic value */
    102102                sysinfo_data_t data;      /**< Binary data */
    103103        };
     
    130130} sysinfo_item_t;
    131131
    132 extern void sysinfo_set_item_val(const char *, sysinfo_item_t **, unative_t);
     132extern void sysinfo_set_item_val(const char *, sysinfo_item_t **, sysarg_t);
    133133extern void sysinfo_set_item_data(const char *, sysinfo_item_t **, void *,
    134134    size_t);
     
    145145extern void sysinfo_dump(sysinfo_item_t *);
    146146
    147 extern unative_t sys_sysinfo_get_tag(void *, size_t);
    148 extern unative_t sys_sysinfo_get_value(void *, size_t, void *);
    149 extern unative_t sys_sysinfo_get_data_size(void *, size_t, void *);
    150 extern unative_t sys_sysinfo_get_data(void *, size_t, void *, size_t);
     147extern sysarg_t sys_sysinfo_get_tag(void *, size_t);
     148extern sysarg_t sys_sysinfo_get_value(void *, size_t, void *);
     149extern sysarg_t sys_sysinfo_get_data_size(void *, size_t, void *);
     150extern sysarg_t sys_sysinfo_get_data(void *, size_t, void *, size_t, size_t *);
    151151
    152152#endif
  • kernel/generic/include/time/clock.h

    rcefb126 r89c57b6  
    4242/** Uptime structure */
    4343typedef struct {
    44         unative_t seconds1;
    45         unative_t useconds;
    46         unative_t seconds2;
     44        sysarg_t seconds1;
     45        sysarg_t useconds;
     46        sysarg_t seconds2;
    4747} uptime_t;
    4848
  • kernel/generic/include/typedefs.h

    rcefb126 r89c57b6  
    4040#include <arch/types.h>
    4141
    42 #define NULL  0
     42#define NULL  ((void *) 0)
    4343
    4444#define false  0
     
    6969typedef int32_t devno_t;
    7070
    71 typedef int32_t wchar_t;
    72 
    7371typedef volatile uint8_t ioport8_t;
    7472typedef volatile uint16_t ioport16_t;
    7573typedef volatile uint32_t ioport32_t;
     74
     75#ifdef __32_BITS__
     76
     77/** Explicit 64-bit arguments passed to syscalls. */
     78typedef uint64_t sysarg64_t;
     79
     80#endif /* __32_BITS__ */
    7681
    7782#endif
  • kernel/generic/include/udebug/udebug.h

    rcefb126 r89c57b6  
    3636#define KERN_UDEBUG_H_
    3737
     38#define UDEBUG_EVMASK(event)  (1 << ((event) - 1))
     39
     40typedef enum { /* udebug_method_t */
     41       
     42        /** Start debugging the recipient.
     43         *
     44         * Causes all threads in the receiving task to stop. When they
     45         * are all stoped, an answer with retval 0 is generated.
     46         *
     47         */
     48        UDEBUG_M_BEGIN = 1,
     49       
     50        /** Finish debugging the recipient.
     51         *
     52         * Answers all pending GO and GUARD messages.
     53         *
     54         */
     55        UDEBUG_M_END,
     56       
     57        /** Set which events should be captured. */
     58        UDEBUG_M_SET_EVMASK,
     59       
     60        /** Make sure the debugged task is still there.
     61         *
     62         * This message is answered when the debugged task dies
     63         * or the debugging session ends.
     64         *
     65         */
     66        UDEBUG_M_GUARD,
     67       
     68        /** Run a thread until a debugging event occurs.
     69         *
     70         * This message is answered when the thread stops
     71         * in a debugging event.
     72         *
     73         * - ARG2 - id of the thread to run
     74         *
     75         */
     76        UDEBUG_M_GO,
     77       
     78        /** Stop a thread being debugged.
     79         *
     80         * Creates a special STOP event in the thread, causing
     81         * it to answer a pending GO message (if any).
     82         *
     83         */
     84        UDEBUG_M_STOP,
     85       
     86        /** Read arguments of a syscall.
     87         *
     88         * - ARG2 - thread identification
     89         * - ARG3 - destination address in the caller's address space
     90         *
     91         */
     92        UDEBUG_M_ARGS_READ,
     93       
     94        /** Read thread's userspace register state (istate_t).
     95         *
     96         * - ARG2 - thread identification
     97         * - ARG3 - destination address in the caller's address space
     98         *
     99         * or, on error, retval will be
     100         * - ENOENT - thread does not exist
     101         * - EBUSY - register state not available
     102         */
     103        UDEBUG_M_REGS_READ,
     104       
     105        /** Read the list of the debugged tasks's threads.
     106         *
     107         * - ARG2 - destination address in the caller's address space
     108         * - ARG3 - size of receiving buffer in bytes
     109         *
     110         * The kernel fills the buffer with a series of sysarg_t values
     111         * (thread ids). On answer, the kernel will set:
     112         *
     113         * - ARG2 - number of bytes that were actually copied
     114         * - ARG3 - number of bytes of the complete data
     115         *
     116         */
     117        UDEBUG_M_THREAD_READ,
     118       
     119        /** Read the name of the debugged task.
     120         *
     121         * - ARG2 - destination address in the caller's address space
     122         * - ARG3 - size of receiving buffer in bytes
     123         *
     124         * The kernel fills the buffer with a non-terminated string.
     125         *
     126         * - ARG2 - number of bytes that were actually copied
     127         * - ARG3 - number of bytes of the complete data
     128         *
     129         */
     130        UDEBUG_M_NAME_READ,
     131       
     132        /** Read the list of the debugged task's address space areas.
     133         *
     134         * - ARG2 - destination address in the caller's address space
     135         * - ARG3 - size of receiving buffer in bytes
     136         *
     137         * The kernel fills the buffer with a series of as_area_info_t structures.
     138         * Upon answer, the kernel will set:
     139         *
     140         * - ARG2 - number of bytes that were actually copied
     141         * - ARG3 - number of bytes of the complete data
     142         *
     143         */
     144        UDEBUG_M_AREAS_READ,
     145       
     146        /** Read the debugged tasks's memory.
     147         *
     148         * - ARG2 - destination address in the caller's address space
     149         * - ARG3 - source address in the recipient's address space
     150         * - ARG4 - size of receiving buffer in bytes
     151         *
     152         */
     153        UDEBUG_M_MEM_READ
     154} udebug_method_t;
     155
     156typedef enum {
     157        UDEBUG_EVENT_FINISHED = 1,  /**< Debuging session has finished */
     158        UDEBUG_EVENT_STOP,          /**< Stopped on DEBUG_STOP request */
     159        UDEBUG_EVENT_SYSCALL_B,     /**< Before beginning syscall execution */
     160        UDEBUG_EVENT_SYSCALL_E,     /**< After finishing syscall execution */
     161        UDEBUG_EVENT_THREAD_B,      /**< The task created a new thread */
     162        UDEBUG_EVENT_THREAD_E       /**< A thread exited */
     163} udebug_event_t;
     164
     165typedef enum {
     166        UDEBUG_EM_FINISHED = UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED),
     167        UDEBUG_EM_STOP = UDEBUG_EVMASK(UDEBUG_EVENT_STOP),
     168        UDEBUG_EM_SYSCALL_B = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B),
     169        UDEBUG_EM_SYSCALL_E = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E),
     170        UDEBUG_EM_THREAD_B = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B),
     171        UDEBUG_EM_THREAD_E = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E),
     172        UDEBUG_EM_ALL =
     173            (UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED) |
     174            UDEBUG_EVMASK(UDEBUG_EVENT_STOP) |
     175            UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B) |
     176            UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E) |
     177            UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B) |
     178            UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E))
     179} udebug_evmask_t;
     180
     181#ifdef KERNEL
     182
    38183#include <ipc/ipc.h>
    39 
    40 typedef enum { /* udebug_method_t */
    41 
    42 /** Start debugging the recipient.
    43  * Causes all threads in the receiving task to stop. When they
    44  * are all stoped, an answer with retval 0 is generated.
    45  */
    46 UDEBUG_M_BEGIN = 1,
    47 
    48 /** Finish debugging the recipient.
    49  * Answers all pending GO and GUARD messages.
    50  */
    51 UDEBUG_M_END,
    52 
    53 /** Set which events should be captured.
    54  */
    55 UDEBUG_M_SET_EVMASK,
    56 
    57 /** Make sure the debugged task is still there.
    58  * This message is answered when the debugged task dies
    59  * or the debugging session ends.
    60  */
    61 UDEBUG_M_GUARD,
    62 
    63 /** Run a thread until a debugging event occurs.
    64  * This message is answered when the thread stops
    65  * in a debugging event.
    66  *
    67  * - ARG2 - id of the thread to run
    68  */
    69 UDEBUG_M_GO,
    70 
    71 /** Stop a thread being debugged.
    72  * Creates a special STOP event in the thread, causing
    73  * it to answer a pending GO message (if any).
    74  */
    75 UDEBUG_M_STOP,
    76 
    77 /** Read arguments of a syscall.
    78  *
    79  * - ARG2 - thread identification
    80  * - ARG3 - destination address in the caller's address space
    81  *
    82  */
    83 UDEBUG_M_ARGS_READ,
    84 
    85 /** Read thread's userspace register state (istate_t).
    86  *
    87  * - ARG2 - thread identification
    88  * - ARG3 - destination address in the caller's address space
    89  *
    90  * or, on error, retval will be
    91  * - ENOENT - thread does not exist
    92  * - EBUSY - register state not available
    93  */
    94 UDEBUG_M_REGS_READ,
    95 
    96 /** Read the list of the debugged tasks's threads.
    97  *
    98  * - ARG2 - destination address in the caller's address space
    99  * - ARG3 - size of receiving buffer in bytes
    100  *
    101  * The kernel fills the buffer with a series of sysarg_t values
    102  * (thread ids). On answer, the kernel will set:
    103  *
    104  * - ARG2 - number of bytes that were actually copied
    105  * - ARG3 - number of bytes of the complete data
    106  *
    107  */
    108 UDEBUG_M_THREAD_READ,
    109 
    110 /** Read the name of the debugged task.
    111  *
    112  * - ARG2 - destination address in the caller's address space
    113  * - ARG3 - size of receiving buffer in bytes
    114  *
    115  * The kernel fills the buffer with a non-terminated string.
    116  *
    117  * - ARG2 - number of bytes that were actually copied
    118  * - ARG3 - number of bytes of the complete data
    119  *
    120  */
    121 UDEBUG_M_NAME_READ,
    122 
    123 /** Read the list of the debugged task's address space areas.
    124  *
    125  * - ARG2 - destination address in the caller's address space
    126  * - ARG3 - size of receiving buffer in bytes
    127  *
    128  * The kernel fills the buffer with a series of as_area_info_t structures.
    129  * Upon answer, the kernel will set:
    130  *
    131  * - ARG2 - number of bytes that were actually copied
    132  * - ARG3 - number of bytes of the complete data
    133  *
    134  */
    135 UDEBUG_M_AREAS_READ,
    136 
    137 /** Read the debugged tasks's memory.
    138  *
    139  * - ARG2 - destination address in the caller's address space
    140  * - ARG3 - source address in the recipient's address space
    141  * - ARG4 - size of receiving buffer in bytes
    142  *
    143  */
    144 UDEBUG_M_MEM_READ,
    145 
    146 } udebug_method_t;
    147 
    148 
    149 typedef enum {
    150         UDEBUG_EVENT_FINISHED = 1,      /**< Debuging session has finished */
    151         UDEBUG_EVENT_STOP,              /**< Stopped on DEBUG_STOP request */
    152         UDEBUG_EVENT_SYSCALL_B,         /**< Before beginning syscall execution */
    153         UDEBUG_EVENT_SYSCALL_E,         /**< After finishing syscall execution */
    154         UDEBUG_EVENT_THREAD_B,          /**< The task created a new thread */
    155         UDEBUG_EVENT_THREAD_E           /**< A thread exited */
    156 } udebug_event_t;
    157 
    158 #define UDEBUG_EVMASK(event) (1 << ((event) - 1))
    159 
    160 typedef enum {
    161         UDEBUG_EM_FINISHED      = UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED),
    162         UDEBUG_EM_STOP          = UDEBUG_EVMASK(UDEBUG_EVENT_STOP),
    163         UDEBUG_EM_SYSCALL_B     = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B),
    164         UDEBUG_EM_SYSCALL_E     = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E),
    165         UDEBUG_EM_THREAD_B      = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B),
    166         UDEBUG_EM_THREAD_E      = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E),
    167         UDEBUG_EM_ALL           =
    168                 UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED) |
    169                 UDEBUG_EVMASK(UDEBUG_EVENT_STOP) |
    170                 UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B) |
    171                 UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E) |
    172                 UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B) |
    173                 UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E)
    174 } udebug_evmask_t;
    175 
    176 #ifdef KERNEL
    177 
    178184#include <synch/mutex.h>
    179185#include <synch/condvar.h>
     
    196202        mutex_t lock;
    197203        char *lock_owner;
    198 
     204       
    199205        udebug_task_state_t dt_state;
    200206        call_t *begin_call;
     
    209215        /** Synchronize debug ops on this thread / access to this structure. */
    210216        mutex_t lock;
    211 
     217       
    212218        waitq_t go_wq;
    213219        call_t *go_call;
    214         unative_t syscall_args[6];
     220        sysarg_t syscall_args[6];
    215221        istate_t *uspace_state;
    216 
     222       
    217223        /** What type of event are we stopped in or 0 if none. */
    218224        udebug_event_t cur_event;
    219         bool go;                /**< thread is GO */
    220         bool stoppable;         /**< thread is stoppable */
    221         bool active;            /**< thread is in a debugging session */
     225        bool go;         /**< Thread is GO */
     226        bool stoppable;  /**< Thread is stoppable */
     227        bool active;     /**< Thread is in a debugging session */
    222228        condvar_t active_cv;
    223229} udebug_thread_t;
     
    226232struct thread;
    227233
    228 void udebug_task_init(udebug_task_t *ut);
    229 void udebug_thread_initialize(udebug_thread_t *ut);
    230 
    231 void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3,
    232     unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc,
    233     bool end_variant);
    234 
    235 void udebug_thread_b_event_attach(struct thread *t, struct task *ta);
     234void udebug_task_init(udebug_task_t *);
     235void udebug_thread_initialize(udebug_thread_t *);
     236
     237void udebug_syscall_event(sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     238    sysarg_t, sysarg_t, sysarg_t, bool);
     239
     240void udebug_thread_b_event_attach(struct thread *, struct task *);
    236241void udebug_thread_e_event(void);
    237242
     
    241246void udebug_before_thread_runs(void);
    242247
    243 int udebug_task_cleanup(struct task *ta);
     248int udebug_task_cleanup(struct task *);
    244249void udebug_thread_fault(void);
    245250
  • kernel/generic/include/udebug/udebug_ipc.h

    rcefb126 r89c57b6  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    4141void udebug_call_receive(call_t *call);
    4242
    43 
    4443#endif
    4544
  • kernel/generic/include/udebug/udebug_ops.h

    rcefb126 r89c57b6  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    5252int udebug_regs_read(thread_t *t, void **buffer);
    5353
    54 int udebug_mem_read(unative_t uspace_addr, size_t n, void **buffer);
     54int udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer);
    5555
    5656#endif
Note: See TracChangeset for help on using the changeset viewer.