Changeset cf2af94 in mainline for kernel/generic/include


Ignore:
Timestamp:
2011-02-09T11:46:47Z (15 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cb15135a
Parents:
a49c4002 (diff), 0b37882 (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

Local modifications:

  • change pipefs and ext2 to build again (use async_* calls instead of ipc_*)
Location:
kernel/generic/include
Files:
29 edited

Legend:

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

    ra49c4002 rcf2af94  
    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/console/console.h

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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/ddi/ddi.h

    ra49c4002 rcf2af94  
    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_interrupt_enable(int irq, int enable);
     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/*
     
    6161extern int ddi_iospace_enable_arch(task_t *, uintptr_t, size_t);
    6262
    63 
    6463#endif
    6564
  • kernel/generic/include/ddi/device.h

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    6060extern void fault_if_from_uspace(istate_t *, const char *, ...)
    6161    PRINTF_ATTRIBUTE(2, 3);
     62extern istate_t *istate_get(thread_t *);
    6263extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t);
    6364extern void exc_dispatch(unsigned int, istate_t *);
  • kernel/generic/include/ipc/event.h

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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/** Kernel IPC interfaces
     119 *
     120 */
     121#define IPC_IF_KERNEL  0
     122
    122123/** System-specific methods - only through special syscalls
    123  * These methods have special behaviour
     124 *
     125 * These methods have special behaviour. These methods also
     126 * have the implicit kernel interface 0.
    124127 *
    125128 */
     
    162165 *                       error is sent back to caller. Otherwise
    163166 *                       the call is accepted and the response is sent back.
    164  *                     - the allocated phoneid is passed to userspace
     167 *                     - the hash of the client task is passed to userspace
     168 *                       (on the receiving side) as ARG4 of the call.
     169 *                     - the hash of the allocated phone is passed to userspace
    165170 *                       (on the receiving side) as ARG5 of the call.
    166171 *
     
    315320
    316321typedef struct {
    317         unative_t args[IPC_CALL_LEN];
     322        sysarg_t args[IPC_CALL_LEN];
     323        /** Task which made or forwarded the call with IPC_FF_ROUTE_FROM_ME. */
     324        struct task *task;
     325        /** Phone which made or last masqueraded this call. */
    318326        phone_t *phone;
    319327} ipc_data_t;
     
    330338         * The caller box is different from sender->answerbox
    331339         * for synchronous calls.
    332          *
    333340         */
    334341        answerbox_t *callerbox;
    335342       
    336343        /** Private data to internal IPC. */
    337         unative_t priv;
     344        sysarg_t priv;
    338345       
    339346        /** Data passed from/to userspace. */
     
    347354         * cases, we must keep it aside so that the answer is processed
    348355         * correctly.
    349          *
    350356         */
    351357        phone_t *caller_phone;
     
    372378
    373379extern void ipc_cleanup(void);
    374 extern void ipc_backsend_err(phone_t *, call_t *, unative_t);
     380extern void ipc_backsend_err(phone_t *, call_t *, sysarg_t);
    375381extern void ipc_answerbox_slam_phones(answerbox_t *, bool);
    376382extern void ipc_cleanup_call_list(link_t *);
  • kernel/generic/include/ipc/ipcrsc.h

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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/mm/as.h

    ra49c4002 rcf2af94  
    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       
     
    199201typedef struct {
    200202        mutex_t lock;
     203       
    201204        /** Containing address space. */
    202205        as_t *as;
    203206       
    204         /**
    205          * Flags related to the memory represented by the address space area.
    206          */
     207        /** Memory flags. */
    207208        unsigned int flags;
    208209       
    209         /** Attributes related to the address space area itself. */
     210        /** Address space area attributes. */
    210211        unsigned int attributes;
    211         /** Size of this area in multiples of PAGE_SIZE. */
     212       
     213        /** Number of pages in the area. */
    212214        size_t pages;
     215       
     216        /** Number of resident pages in the area. */
     217        size_t resident;
     218       
    213219        /** Base address of this area. */
    214220        uintptr_t base;
     221       
    215222        /** Map of used space. */
    216223        btree_t used_space;
    217224       
    218225        /**
    219          * If the address space area has been shared, this pointer will
    220          * reference the share info structure.
     226         * If the address space area is shared. this is
     227         * a reference to the share info structure.
    221228         */
    222229        share_info_t *sh_info;
     
    261268extern bool as_area_check_access(as_area_t *, pf_access_t);
    262269extern size_t as_area_get_size(uintptr_t);
    263 extern int used_space_insert(as_area_t *, uintptr_t, size_t);
    264 extern int used_space_remove(as_area_t *, uintptr_t, size_t);
    265 
     270extern bool used_space_insert(as_area_t *, uintptr_t, size_t);
     271extern bool used_space_remove(as_area_t *, uintptr_t, size_t);
    266272
    267273/* Interface to be implemented by architectures. */
     
    303309
    304310/* Address space area related syscalls. */
    305 extern unative_t sys_as_area_create(uintptr_t, size_t, unsigned int);
    306 extern unative_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
    307 extern unative_t sys_as_area_change_flags(uintptr_t, unsigned int);
    308 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);
    309316
    310317/* Introspection functions. */
  • kernel/generic/include/mm/frame.h

    ra49c4002 rcf2af94  
    144144
    145145#define IS_BUDDY_ORDER_OK(index, order) \
    146     ((~(((unative_t) -1) << (order)) & (index)) == 0)
     146    ((~(((sysarg_t) -1) << (order)) & (index)) == 0)
    147147#define IS_BUDDY_LEFT_BLOCK(zone, frame) \
    148148    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0)
  • kernel/generic/include/proc/program.h

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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)
     68#define CAP_IO_MANAGER  (1 << 2)
    7069
    7170/**
    7271 * CAP_IRQ_REG entitles its holder to register IRQ handlers.
    7372 */
    74 #define CAP_IRQ_REG             (1<<3)
     73#define CAP_IRQ_REG  (1 << 3)
    7574
    7675typedef uint32_t cap_t;
    7776
    78 extern unative_t sys_cap_grant(sysarg64_t *uspace_taskid_arg, cap_t caps);
    79 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__ */
    8090
    8191#endif
  • kernel/generic/include/synch/futex.h

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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/syscall/syscall.h

    ra49c4002 rcf2af94  
    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_INTERRUPT_ENABLE,
     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

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    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

    ra49c4002 rcf2af94  
    7373typedef volatile uint32_t ioport32_t;
    7474
     75#ifdef __32_BITS__
     76
     77/** Explicit 64-bit arguments passed to syscalls. */
     78typedef uint64_t sysarg64_t;
     79
     80#endif /* __32_BITS__ */
     81
    7582#endif
    7683
  • kernel/generic/include/udebug/udebug.h

    ra49c4002 rcf2af94  
    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_ops.h

    ra49c4002 rcf2af94  
    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.