Changeset 827d73f in mainline for kernel/generic/include


Ignore:
Timestamp:
2010-02-12T14:09:22Z (16 years ago)
Author:
Lukas Mejdrech <lukasmejdrech@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a70bda4
Parents:
918e9910 (diff), e70edd1 (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:

Merged the actual head

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

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/context.h

    r918e9910 r827d73f  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    3939#include <arch/context.h>
    4040
     41#define context_set_generic(ctx, _pc, stack, size) \
     42        (ctx)->pc = (uintptr_t) (_pc); \
     43        (ctx)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA;
    4144
    42 #ifndef context_set
    43 #define context_set(c, _pc, stack, size)        \
    44         (c)->pc = (uintptr_t) (_pc);            \
    45         (c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA;
    46 #endif /* context_set */
    47 
    48 extern int context_save_arch(context_t *c) __attribute__ ((returns_twice));
    49 extern void context_restore_arch(context_t *c) __attribute__ ((noreturn));
     45extern int context_save_arch(context_t *ctx) __attribute__((returns_twice));
     46extern void context_restore_arch(context_t *ctx) __attribute__((noreturn));
    5047
    5148/** Save register context.
     
    7370 * saved like that would therefore lead to a disaster.
    7471 *
    75  * @param c             Context structure.
     72 * @param ctx Context structure.
    7673 *
    77  * @return              context_save() returns 1, context_restore() returns 0.
     74 * @return context_save() returns 1, context_restore() returns 0.
     75 *
    7876 */
    79 #define context_save(c)   context_save_arch(c)
     77#define context_save(ctx)  context_save_arch(ctx)
    8078
    8179/** Restore register context.
     
    8886 * being return value.
    8987 *
    90  * @param c             Context structure.
     88 * @param ctx Context structure.
    9189 */
    92 static inline void context_restore(context_t *c)
     90static inline void context_restore(context_t *ctx)
    9391{
    94         context_restore_arch(c);
     92        context_restore_arch(ctx);
    9593}
    9694
  • kernel/generic/include/debug.h

    r918e9910 r827d73f  
    7575#       define LOG(format, ...) \
    7676                printf("%s() at %s:%u: " format "\n", __func__, __FILE__, \
    77                         __LINE__, ##__VA_ARGS__);
     77                    __LINE__, ##__VA_ARGS__);
    7878#else
    7979#       define LOG(format, ...)
     
    9292                { \
    9393                        printf("%s() at %s:%u: " #fnc "\n", __func__, __FILE__, \
    94                         __LINE__); \
     94                            __LINE__); \
    9595                        fnc; \
    9696                }
  • kernel/generic/include/func.h

    r918e9910 r827d73f  
    4141extern atomic_t haltstate;
    4242
    43 extern void halt(void);
     43extern void halt(void) __attribute__((noreturn));
    4444extern unative_t atoi(const char *text);
    4545extern void order(const uint64_t val, uint64_t *rv, char *suffix);
  • kernel/generic/include/interrupt.h

    r918e9910 r827d73f  
    4242#include <arch.h>
    4343#include <ddi/irq.h>
     44#include <stacktrace.h>
    4445
    4546typedef void (* iroutine)(int n, istate_t *istate);
    4647
    47 #define fault_if_from_uspace(istate, fmt, ...) \
    48 { \
    49         if (istate_from_uspace(istate)) { \
    50                 task_t *task = TASK; \
    51                 printf("Task %s (%" PRIu64 ") killed due to an exception at %p: ", task->name, task->taskid, istate_get_pc(istate)); \
    52                 printf(fmt "\n", ##__VA_ARGS__); \
    53                 task_kill(task->taskid); \
    54                 thread_exit(); \
    55         } \
    56 }
    57 
     48extern void fault_if_from_uspace(istate_t *istate, char *fmt, ...);
    5849extern iroutine exc_register(int n, const char *name, iroutine f);
    5950extern void exc_dispatch(int n, istate_t *t);
    6051void exc_init(void);
     52
     53extern void irq_initialize_arch(irq_t *irq);
    6154
    6255#endif
  • kernel/generic/include/ipc/event_types.h

    r918e9910 r827d73f  
    3737
    3838typedef enum event_type {
     39        /** New data available in kernel log */
    3940        EVENT_KLOG = 0,
     41        /** Returning from kernel console to userspace */
    4042        EVENT_KCONSOLE,
     43        /** A thread has faulted and will be terminated */
     44        EVENT_FAULT,
    4145        EVENT_END
    4246} event_type_t;
  • kernel/generic/include/macros.h

    r918e9910 r827d73f  
    8484#define STRING_ARG(arg)  #arg
    8585
    86 #define LOWER32(arg)  ((arg) & 0xffffffff)
    87 #define UPPER32(arg)  (((arg) >> 32) & 0xffffffff)
     86#define LOWER32(arg)  (((uint64_t) (arg)) & 0xffffffff)
     87#define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & 0xffffffff)
    8888
    8989#define MERGE_LOUP32(lo, up) \
  • kernel/generic/include/mm/as.h

    r918e9910 r827d73f  
    3636#define KERN_AS_H_
    3737
     38#ifdef KERNEL
     39#include <arch/types.h>
     40#else
     41#include <sys/types.h>
     42#endif
     43
    3844/** Address space area flags. */
    3945#define AS_AREA_READ            1
     
    4147#define AS_AREA_EXEC            4
    4248#define AS_AREA_CACHEABLE       8
     49
     50/** Address space area info exported to userspace. */
     51typedef struct {
     52        /** Starting address */
     53        uintptr_t start_addr;
     54
     55        /** Area size */
     56        size_t size;
     57
     58        /** Area flags */
     59        int flags;
     60} as_area_info_t;
    4361
    4462#ifdef KERNEL
     
    268286
    269287/* Introspection functions. */
     288extern void as_get_area_info(as_t *as, as_area_info_t **obuf, size_t *osize);
    270289extern void as_print(as_t *as);
    271290
  • kernel/generic/include/panic.h

    r918e9910 r827d73f  
    3636#define KERN_PANIC_H_
    3737
     38#include <stacktrace.h>
     39#include <print.h>
     40
    3841#ifdef CONFIG_DEBUG
    3942#       define panic(format, ...) \
    40                 panic_printf("Kernel panic in %s() at %s:%u: " format "\n", \
    41                 __func__, __FILE__, __LINE__, ##__VA_ARGS__);
     43                do { \
     44                        printf("Kernel panic in %s() at %s:%u.\n", \
     45                            __func__, __FILE__, __LINE__); \
     46                        stack_trace(); \
     47                        panic_printf("Panic message: " format "\n", \
     48                            ##__VA_ARGS__);\
     49                } while (0)
    4250#else
    4351#       define panic(format, ...) \
  • kernel/generic/include/symtab.h

    r918e9910 r827d73f  
    4545};
    4646
    47 extern int symtab_name_lookup(unative_t addr, char **name);
    48 extern char *symtab_fmt_name_lookup(unative_t addr);
    49 extern int symtab_addr_lookup(const char *name, uintptr_t *addr);
    50 extern void symtab_print_search(const char *name);
    51 extern int symtab_compl(char *input, size_t size);
     47extern int symtab_name_lookup(uintptr_t, char **, uintptr_t *);
     48extern char *symtab_fmt_name_lookup(uintptr_t);
     49extern int symtab_addr_lookup(const char *, uintptr_t *);
     50extern void symtab_print_search(const char *);
     51extern int symtab_compl(char *, size_t);
    5252
    5353#ifdef CONFIG_SYMTAB
  • kernel/generic/include/udebug/udebug.h

    r918e9910 r827d73f  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    8383UDEBUG_M_ARGS_READ,
    8484
     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 */
     94UDEBUG_M_REGS_READ,
     95
    8596/** Read the list of the debugged tasks's threads.
    8697 *
     
    97108UDEBUG_M_THREAD_READ,
    98109
     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 */
     121UDEBUG_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 */
     135UDEBUG_M_AREAS_READ,
     136
    99137/** Read the debugged tasks's memory.
    100138 *
     
    108146} udebug_method_t;
    109147
    110                                
     148
    111149typedef enum {
    112150        UDEBUG_EVENT_FINISHED = 1,      /**< Debuging session has finished */
     
    139177
    140178#include <synch/mutex.h>
     179#include <synch/condvar.h>
    141180#include <arch/interrupt.h>
    142181#include <atomic.h>
     
    181220        bool stoppable;         /**< thread is stoppable */
    182221        bool active;            /**< thread is in a debugging session */
     222        condvar_t active_cv;
    183223} udebug_thread_t;
    184224
     
    202242
    203243int udebug_task_cleanup(struct task *ta);
     244void udebug_thread_fault(void);
    204245
    205246#endif
  • kernel/generic/include/udebug/udebug_ops.h

    r918e9910 r827d73f  
    4545int udebug_stop(thread_t *t, call_t *call);
    4646
    47 int udebug_thread_read(void **buffer, size_t buf_size, size_t *n);
     47int udebug_thread_read(void **buffer, size_t buf_size, size_t *stored,
     48    size_t *needed);
     49int udebug_name_read(char **data, size_t *data_size);
    4850int udebug_args_read(thread_t *t, void **buffer);
     51
     52int udebug_regs_read(thread_t *t, void **buffer);
    4953
    5054int udebug_mem_read(unative_t uspace_addr, size_t n, void **buffer);
Note: See TracChangeset for help on using the changeset viewer.