Changes in / [3f35634c:3da11f37] in mainline


Ignore:
Files:
2 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r3f35634c r3da11f37  
    3030#
    3131
    32 CSCOPE = cscope
    33 STANSE = stanse
    34 
    35 .PHONY: all config config_default distclean clean cscope stanse
     32.PHONY: all config config_default distclean clean cscope
    3633
    3734all: Makefile.config config.h config.defs
     
    3936        $(MAKE) -C uspace
    4037        $(MAKE) -C boot
    41 
    42 stanse: Makefile.config config.h config.defs
    43         $(MAKE) -C kernel clean
    44         $(MAKE) -C kernel EXTRA_TOOL=stanse
    45         $(STANSE) --checker ReachabilityChecker --checker ThreadChecker:contrib/$(STANSE)/ThreadChecker.xml --jobfile kernel/kernel.job
    46 
    47 cscope:
    48         find kernel boot uspace -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
    4938
    5039Makefile.config: config_default
     
    6150
    6251distclean: clean
    63         rm -f $(CSCOPE).out Makefile.config config.h config.defs tools/*.pyc
     52        rm -f Makefile.config config.h config.defs tools/*.pyc
    6453
    6554clean:
    66         $(MAKE) -C kernel clean
    67         $(MAKE) -C uspace clean
    68         $(MAKE) -C boot clean
     55        -$(MAKE) -C kernel clean
     56        -$(MAKE) -C uspace clean
     57        -$(MAKE) -C boot clean
     58
     59cscope:
     60        find kernel boot uspace -regex '^.*\.[chsS]$$' -print > srclist
     61        rm -f cscope.out
     62        cscope -bi srclist
  • contrib/bazaar/mbprotect/__init__.py

    r3f35634c r3da11f37  
    5252        return
    5353
    54     # First permitted case is appending changesets to main branch.Look for
    55     # old tip in new main branch.
     54    # Look for old tip in new main branch.
    5655    for revision_id in repo.iter_reverse_revision_history(params.new_revid):
    5756        if revision_id == params.old_revid:
    5857            return      # Found old tip
    5958
    60     # Another permitted case is backing out changesets. Look for new tip
    61     # in old branch.
    62     for revision_id in repo.iter_reverse_revision_history(params.old_revid):
    63         if revision_id == params.new_revid:
    64             return      # Found new tip
    65 
    66     # Trying to do something else. Reject the change.
     59    # Old tip was not found. Reject the change.
    6760    raise TipChangeRejected('Bad tip. Read http://trac.helenos.org/trac.fcgi/' +
    6861        'wiki/BazaarWorkflow')
  • kernel/Makefile

    r3f35634c r3da11f37  
    3333all: ../version ../Makefile.config ../config.h ../config.defs
    3434        -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    35         $(MAKE) -f Makefile.build EXTRA_TOOL=$(EXTRA_TOOL)
     35        $(MAKE) -f Makefile.build
    3636
    3737clean:
    38         rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld
     38        rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld
    3939        find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \;
    40         find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o.preproc' -follow -exec rm \{\} \;
  • kernel/Makefile.build

    r3f35634c r3da11f37  
    9191## Cross-platform assembly to start a symtab.data section
    9292#
    93 SYMTAB_SECTION = ".section symtab.data, \"a\", $(ATSIGN)progbits;"
     93SYMTAB_SECTION=".section symtab.data, \"a\", $(ATSIGN)progbits;"
    9494
    9595## Simple detection for the type of the host system
     
    110110ifeq ($(COMPILER),gcc_native)
    111111        CC = gcc
    112         GCC = gcc
     112        GCC = $(CC)
    113113        AS = $(BINUTILS_PREFIX)as
    114114        LD = $(BINUTILS_PREFIX)ld
     
    168168        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    169169endif
    170 
    171170
    172171## Generic kernel sources
     
    385384test/fpu/%.o: test/fpu/%.c $(DEPEND)
    386385        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@
    387 ifeq ($(EXTRA_TOOL),stanse)
    388         ../tools/jobfile.py $(JOB) $< $@ $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
    389 endif
    390386
    391387#
     
    394390%.o: %.c $(DEPEND)
    395391        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c $< -o $@
    396 ifeq ($(EXTRA_TOOL),stanse)
    397         ../tools/jobfile.py $(JOB) $< $@ $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS)
    398 endif
    399392
    400393$(REAL_MAP).o: $(REAL_MAP).bin
  • kernel/Makefile.common

    r3f35634c r3da11f37  
    3636BIN = kernel.bin
    3737MAP = kernel.map
    38 JOB = kernel.job
    3938MAP_PREV = $(MAP).prev
    4039DISASM = kernel.disasm
  • kernel/arch/amd64/include/mm/page.h

    r3f35634c r3da11f37  
    177177#define PFERR_CODE_ID           (1 << 4)
    178178
    179 /** Page Table Entry. */
    180 typedef struct {
    181         unsigned present : 1;
    182         unsigned writeable : 1;
    183         unsigned uaccessible : 1;
    184         unsigned page_write_through : 1;
    185         unsigned page_cache_disable : 1;
    186         unsigned accessed : 1;
    187         unsigned dirty : 1;
    188         unsigned unused: 1;
    189         unsigned global : 1;
    190         unsigned soft_valid : 1;                /**< Valid content even if present bit is cleared. */
    191         unsigned avl : 2;
    192         unsigned addr_12_31 : 30;
    193         unsigned addr_32_51 : 21;
    194         unsigned no_execute : 1;
    195 } __attribute__ ((packed)) pte_t;
    196 
    197179static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
    198180{
  • kernel/arch/amd64/include/types.h

    r3f35634c r3da11f37  
    8282#define PRIxn "llx"
    8383
     84/** Page Table Entry. */
     85typedef struct {
     86        unsigned present : 1;
     87        unsigned writeable : 1;
     88        unsigned uaccessible : 1;
     89        unsigned page_write_through : 1;
     90        unsigned page_cache_disable : 1;
     91        unsigned accessed : 1;
     92        unsigned dirty : 1;
     93        unsigned unused: 1;
     94        unsigned global : 1;
     95        unsigned soft_valid : 1;                /**< Valid content even if present bit is cleared. */
     96        unsigned avl : 2;
     97        unsigned addr_12_31 : 30;
     98        unsigned addr_32_51 : 21;
     99        unsigned no_execute : 1;
     100} __attribute__ ((packed)) pte_t;
     101
    84102#endif
    85103
  • kernel/arch/arm32/include/mm/page.h

    r3f35634c r3da11f37  
    7575/* Get PTE address accessors for each level. */
    7676#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
    77         ((pte_t *) ((((pte_t *)(ptl0))[(i)].l0).coarse_table_addr << 10))
     77        ((pte_t *) ((((pte_level0_t *)(ptl0))[(i)]).coarse_table_addr << 10))
    7878#define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
    7979        (ptl1)
     
    8181        (ptl2)
    8282#define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
    83         ((uintptr_t) ((((pte_t *)(ptl3))[(i)].l1).frame_base_addr << 12))
     83        ((uintptr_t) ((((pte_level1_t *)(ptl3))[(i)]).frame_base_addr << 12))
    8484
    8585/* Set PTE address accessors for each level. */
    8686#define SET_PTL0_ADDRESS_ARCH(ptl0) \
    87         (set_ptl0_addr((pte_t *) (ptl0)))
     87        (set_ptl0_addr((pte_level0_t *) (ptl0)))
    8888#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
    89         (((pte_t *) (ptl0))[(i)].l0.coarse_table_addr = (a) >> 10)
     89        (((pte_level0_t *) (ptl0))[(i)].coarse_table_addr = (a) >> 10)
    9090#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
    9191#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
    9292#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
    93         (((pte_t *) (ptl3))[(i)].l1.frame_base_addr = (a) >> 12)
     93        (((pte_level1_t *) (ptl3))[(i)].frame_base_addr = (a) >> 12)
    9494
    9595/* Get PTE flags accessors for each level. */
    9696#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
    97         get_pt_level0_flags((pte_t *) (ptl0), (size_t) (i))
     97        get_pt_level0_flags((pte_level0_t *) (ptl0), (size_t) (i))
    9898#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
    9999        PAGE_PRESENT
     
    101101        PAGE_PRESENT
    102102#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
    103         get_pt_level1_flags((pte_t *) (ptl3), (size_t) (i))
     103        get_pt_level1_flags((pte_level1_t *) (ptl3), (size_t) (i))
    104104
    105105/* Set PTE flags accessors for each level. */
    106106#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
    107         set_pt_level0_flags((pte_t *) (ptl0), (size_t) (i), (x))
     107        set_pt_level0_flags((pte_level0_t *) (ptl0), (size_t) (i), (x))
    108108#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
    109109#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
    110110#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
    111         set_pt_level1_flags((pte_t *) (ptl3), (size_t) (i), (x))
     111        set_pt_level1_flags((pte_level1_t *) (ptl3), (size_t) (i), (x))
    112112
    113113/* Macros for querying the last-level PTE entries. */
     
    115115        (*((uint32_t *) (pte)) != 0)
    116116#define PTE_PRESENT_ARCH(pte) \
    117         (((pte_t *) (pte))->l0.descriptor_type != 0)
     117        (((pte_level0_t *) (pte))->descriptor_type != 0)
    118118#define PTE_GET_FRAME_ARCH(pte) \
    119         (((pte_t *) (pte))->l1.frame_base_addr << FRAME_WIDTH)
     119        (((pte_level1_t *) (pte))->frame_base_addr << FRAME_WIDTH)
    120120#define PTE_WRITABLE_ARCH(pte) \
    121         (((pte_t *) (pte))->l1.access_permission_0 == PTE_AP_USER_RW_KERNEL_RW)
     121        (((pte_level1_t *) (pte))->access_permission_0 == \
     122            PTE_AP_USER_RW_KERNEL_RW)
    122123#define PTE_EXECUTABLE_ARCH(pte) \
    123124        1
     
    158159} ATTRIBUTE_PACKED pte_level1_t;
    159160
    160 typedef union {
    161         pte_level0_t l0;
    162         pte_level1_t l1;
    163 } pte_t;
    164161
    165162/* Level 1 page tables access permissions */
     
    194191 * @param pt    Pointer to the page table to set.
    195192 */   
    196 static inline void set_ptl0_addr(pte_t *pt)
     193static inline void set_ptl0_addr(pte_level0_t *pt)
    197194{
    198195        asm volatile (
     
    208205 *  @param i      Index of the entry to return.
    209206 */
    210 static inline int get_pt_level0_flags(pte_t *pt, size_t i)
    211 {
    212         pte_level0_t *p = &pt[i].l0;
     207static inline int get_pt_level0_flags(pte_level0_t *pt, size_t i)
     208{
     209        pte_level0_t *p = &pt[i];
    213210        int np = (p->descriptor_type == PTE_DESCRIPTOR_NOT_PRESENT);
    214211
     
    223220 *  @param i      Index of the entry to return.
    224221 */
    225 static inline int get_pt_level1_flags(pte_t *pt, size_t i)
    226 {
    227         pte_level1_t *p = &pt[i].l1;
     222static inline int get_pt_level1_flags(pte_level1_t *pt, size_t i)
     223{
     224        pte_level1_t *p = &pt[i];
    228225
    229226        int dt = p->descriptor_type;
     
    248245 *  @param flags  new flags
    249246 */
    250 static inline void set_pt_level0_flags(pte_t *pt, size_t i, int flags)
    251 {
    252         pte_level0_t *p = &pt[i].l0;
     247static inline void set_pt_level0_flags(pte_level0_t *pt, size_t i, int flags)
     248{
     249        pte_level0_t *p = &pt[i];
    253250
    254251        if (flags & PAGE_NOT_PRESENT) {
     
    276273 *  @param flags  New flags.
    277274 */ 
    278 static inline void set_pt_level1_flags(pte_t *pt, size_t i, int flags)
    279 {
    280         pte_level1_t *p = &pt[i].l1;
     275static inline void set_pt_level1_flags(pte_level1_t *pt, size_t i, int flags)
     276{
     277        pte_level1_t *p = &pt[i];
    281278       
    282279        if (flags & PAGE_NOT_PRESENT) {
  • kernel/arch/arm32/include/types.h

    r3f35634c r3da11f37  
    8787#define PRIxn "x"       /**< Format for hexadecimal (u)native_t. */
    8888
     89/** Page table entry.
     90 *
     91 *  We have different structs for level 0 and level 1 page table entries.
     92 *  See page.h for definition of pte_level*_t.
     93 */
     94typedef struct {
     95        unsigned dummy : 32;
     96} pte_t;
     97
    8998#endif
    9099
  • kernel/arch/ia32/include/mm/page.h

    r3f35634c r3da11f37  
    146146#define PFERR_CODE_RSVD         (1 << 3)       
    147147
    148 /** Page Table Entry. */
    149 typedef struct {
    150         unsigned present : 1;
    151         unsigned writeable : 1;
    152         unsigned uaccessible : 1;
    153         unsigned page_write_through : 1;
    154         unsigned page_cache_disable : 1;
    155         unsigned accessed : 1;
    156         unsigned dirty : 1;
    157         unsigned pat : 1;
    158         unsigned global : 1;
    159         unsigned soft_valid : 1;        /**< Valid content even if the present bit is not set. */
    160         unsigned avl : 2;
    161         unsigned frame_address : 20;
    162 } __attribute__ ((packed)) pte_t;
    163 
    164148static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
    165149{
  • kernel/arch/ia32/include/types.h

    r3f35634c r3da11f37  
    8080#define PRIxn "x"       /**< Format for hexadecimal (u)native_t. */
    8181
     82/** Page Table Entry. */
     83typedef struct {
     84        unsigned present : 1;
     85        unsigned writeable : 1;
     86        unsigned uaccessible : 1;
     87        unsigned page_write_through : 1;
     88        unsigned page_cache_disable : 1;
     89        unsigned accessed : 1;
     90        unsigned dirty : 1;
     91        unsigned pat : 1;
     92        unsigned global : 1;
     93        unsigned soft_valid : 1;        /**< Valid content even if the present bit is not set. */
     94        unsigned avl : 2;
     95        unsigned frame_address : 20;
     96} __attribute__ ((packed)) pte_t;
     97
    8298#endif
    8399
  • kernel/arch/mips32/include/mm/page.h

    r3f35634c r3da11f37  
    141141#include <arch/exception.h>
    142142
    143 /** Page Table Entry. */
    144 typedef struct {
    145         unsigned g : 1;                 /**< Global bit. */
    146         unsigned p : 1;                 /**< Present bit. */
    147         unsigned d : 1;                 /**< Dirty bit. */
    148         unsigned cacheable : 1;         /**< Cacheable bit. */
    149         unsigned : 1;                   /**< Unused. */
    150         unsigned soft_valid : 1;        /**< Valid content even if not present. */
    151         unsigned pfn : 24;              /**< Physical frame number. */
    152         unsigned w : 1;                 /**< Page writable bit. */
    153         unsigned a : 1;                 /**< Accessed bit. */
    154 } pte_t;
    155 
    156 
    157143static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
    158144{
  • kernel/arch/mips32/include/types.h

    r3f35634c r3da11f37  
    8080#define PRIxn "x"       /**< Format for hexadecimal (u)native_t. */
    8181
     82/** Page Table Entry. */
     83typedef struct {
     84        unsigned g : 1;                 /**< Global bit. */
     85        unsigned p : 1;                 /**< Present bit. */
     86        unsigned d : 1;                 /**< Dirty bit. */
     87        unsigned cacheable : 1;         /**< Cacheable bit. */
     88        unsigned : 1;                   /**< Unused. */
     89        unsigned soft_valid : 1;        /**< Valid content even if not present. */
     90        unsigned pfn : 24;              /**< Physical frame number. */
     91        unsigned w : 1;                 /**< Page writable bit. */
     92        unsigned a : 1;                 /**< Accessed bit. */
     93} pte_t;
     94
    8295#endif
    8396
  • kernel/arch/ppc32/include/mm/page.h

    r3f35634c r3da11f37  
    131131#include <arch/interrupt.h>
    132132
    133 /** Page Table Entry. */
    134 typedef struct {
    135         unsigned present : 1;             /**< Present bit. */
    136         unsigned page_write_through : 1;  /**< Write thought caching. */
    137         unsigned page_cache_disable : 1;  /**< No caching. */
    138         unsigned accessed : 1;            /**< Accessed bit. */
    139         unsigned global : 1;              /**< Global bit. */
    140         unsigned valid : 1;               /**< Valid content even if not present. */
    141         unsigned pfn : 20;                /**< Physical frame number. */
    142 } pte_t;
    143 
    144133static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
    145134{
  • kernel/arch/ppc32/include/types.h

    r3f35634c r3da11f37  
    8282#define PRIxn "x"
    8383
     84/** Page Table Entry. */
     85typedef struct {
     86        unsigned present : 1;             /**< Present bit. */
     87        unsigned page_write_through : 1;  /**< Write thought caching. */
     88        unsigned page_cache_disable : 1;  /**< No caching. */
     89        unsigned accessed : 1;            /**< Accessed bit. */
     90        unsigned global : 1;              /**< Global bit. */
     91        unsigned valid : 1;               /**< Valid content even if not present. */
     92        unsigned pfn : 20;                /**< Physical frame number. */
     93} pte_t;
     94
    8495#endif
    8596
  • kernel/genarch/include/mm/as_pt.h

    r3f35634c r3da11f37  
    3636#define KERN_AS_PT_H_
    3737
    38 #include <arch/mm/page.h>
     38#include <mm/mm.h>
     39#include <arch/types.h>
    3940
    4041#define AS_PAGE_TABLE
  • kernel/genarch/include/mm/page_pt.h

    r3f35634c r3da11f37  
    4444#define KERN_PAGE_PT_H_
    4545
     46#include <arch/types.h>
    4647#include <mm/as.h>
    4748#include <mm/page.h>
    48 #include <arch/mm/page.h>
    49 #include <arch/types.h>
    5049
    5150/*
  • kernel/generic/include/ipc/ipc.h

    r3f35634c r3da11f37  
    5151/** This is answer to a call */
    5252#define IPC_CALL_ANSWERED       (1 << 0)
     53/** This call will not be freed on error */
     54#define IPC_CALL_STATIC_ALLOC   (1 << 1)
    5355/** Answer will not be passed to userspace, will be discarded */
    54 #define IPC_CALL_DISCARD_ANSWER (1 << 1)
     56#define IPC_CALL_DISCARD_ANSWER (1 << 2)
    5557/** Call was forwarded */
    56 #define IPC_CALL_FORWARDED      (1 << 2)
     58#define IPC_CALL_FORWARDED      (1 << 3)
    5759/** Identify connect_me_to answer */
    58 #define IPC_CALL_CONN_ME_TO     (1 << 3)
     60#define IPC_CALL_CONN_ME_TO     (1 << 4)
    5961/** Interrupt notification */
    60 #define IPC_CALL_NOTIF          (1 << 4)
     62#define IPC_CALL_NOTIF          (1 << 5)
    6163
    6264/*
     
    265267        waitq_t wq;
    266268
    267         /** Linkage for the list of task's synchronous answerboxes. */
    268         link_t sync_box_link;
    269 
    270269        /** Phones connected to this answerbox. */
    271270        link_t connected_phones;
     
    317316} call_t;
    318317
    319 
    320 extern answerbox_t *ipc_phone_0;
    321 
    322 
    323318extern void ipc_init(void);
    324 
    325 extern call_t * ipc_call_alloc(int);
    326 extern void ipc_call_free(call_t *);
    327 
     319extern call_t * ipc_wait_for_call(answerbox_t *, uint32_t, int);
     320extern void ipc_answer(answerbox_t *, call_t *);
    328321extern int ipc_call(phone_t *, call_t *);
    329322extern int ipc_call_sync(phone_t *, call_t *);
    330 extern call_t * ipc_wait_for_call(answerbox_t *, uint32_t, int);
    331 extern int ipc_forward(call_t *, phone_t *, answerbox_t *, int);
    332 extern void ipc_answer(answerbox_t *, call_t *);
    333 
    334323extern void ipc_phone_init(phone_t *);
    335324extern void ipc_phone_connect(phone_t *, answerbox_t *);
     325extern void ipc_call_free(call_t *);
     326extern call_t * ipc_call_alloc(int);
     327extern void ipc_answerbox_init(answerbox_t *, struct task *);
     328extern void ipc_call_static_init(call_t *);
     329extern void task_print_list(void);
     330extern int ipc_forward(call_t *, phone_t *, answerbox_t *, int);
     331extern void ipc_cleanup(void);
    336332extern int ipc_phone_hangup(phone_t *);
    337 
    338 extern void ipc_answerbox_init(answerbox_t *, struct task *);
    339 
    340 extern void ipc_cleanup(void);
    341333extern void ipc_backsend_err(phone_t *, call_t *, unative_t);
     334extern void ipc_print_task(task_id_t);
    342335extern void ipc_answerbox_slam_phones(answerbox_t *, bool);
    343336extern void ipc_cleanup_call_list(link_t *);
    344337
    345 extern void ipc_print_task(task_id_t);
     338extern answerbox_t *ipc_phone_0;
    346339
    347340#endif
  • kernel/generic/include/proc/task.h

    r3f35634c r3da11f37  
    9898         */
    9999        atomic_t active_calls;
    100         /** List of synchronous answerboxes. */
    101         link_t sync_box_head;
    102100
    103101#ifdef CONFIG_UDEBUG
     
    134132extern int task_kill(task_id_t id);
    135133extern uint64_t task_get_accounting(task_t *t);
    136 extern void task_print_list(void);
    137134
    138135extern void cap_set(task_t *t, cap_t caps);
  • kernel/generic/src/ipc/ipc.c

    r3f35634c r3da11f37  
    6262
    6363static slab_cache_t *ipc_call_slab;
    64 static slab_cache_t *ipc_answerbox_slab;
    6564
    6665/** Initialize a call structure.
     
    9796}
    9897
     98/** Initialize a statically allocated call structure.
     99 *
     100 * @param call          Statically allocated kernel call structure to be
     101 *                      initialized.
     102 */
     103void ipc_call_static_init(call_t *call)
     104{
     105        _ipc_call_init(call);
     106        call->flags |= IPC_CALL_STATIC_ALLOC;
     107}
     108
    99109/** Deallocate a call structure.
    100110 *
     
    103113void ipc_call_free(call_t *call)
    104114{
     115        ASSERT(!(call->flags & IPC_CALL_STATIC_ALLOC));
    105116        /* Check to see if we have data in the IPC_M_DATA_SEND buffer. */
    106117        if (call->buffer)
     
    119130        spinlock_initialize(&box->irq_lock, "ipc_box_irqlock");
    120131        waitq_initialize(&box->wq);
    121         link_initialize(&box->sync_box_link);
    122132        list_initialize(&box->connected_phones);
    123133        list_initialize(&box->calls);
     
    169179int ipc_call_sync(phone_t *phone, call_t *request)
    170180{
    171         answerbox_t *sync_box;
    172         ipl_t ipl;
    173 
    174         sync_box = slab_alloc(ipc_answerbox_slab, 0);
    175         ipc_answerbox_init(sync_box, TASK);
    176 
    177         /*
    178          * Put the answerbox on the TASK's list of synchronous answerboxes so
    179          * that it can be cleaned up if the call is interrupted.
    180          */
    181         ipl = interrupts_disable();
    182         spinlock_lock(&TASK->lock);
    183         list_append(&sync_box->sync_box_link, &TASK->sync_box_head);
    184         spinlock_unlock(&TASK->lock);
    185         interrupts_restore(ipl);
     181        answerbox_t sync_box;
     182
     183        ipc_answerbox_init(&sync_box, TASK);
    186184
    187185        /* We will receive data in a special box. */
    188         request->callerbox = sync_box;
     186        request->callerbox = &sync_box;
    189187
    190188        ipc_call(phone, request);
    191         if (!ipc_wait_for_call(sync_box, SYNCH_NO_TIMEOUT,
    192             SYNCH_FLAGS_INTERRUPTIBLE)) {
    193                 /* The answerbox and the call will be freed by ipc_cleanup(). */
     189        if (!ipc_wait_for_call(&sync_box, SYNCH_NO_TIMEOUT,
     190            SYNCH_FLAGS_INTERRUPTIBLE))
    194191                return EINTR;
    195         }
    196 
    197         /*
    198          * The answer arrived without interruption so we can remove the
    199          * answerbox from the TASK's list of synchronous answerboxes.
    200          */
    201         (void) interrupts_disable();
    202         spinlock_lock(&TASK->lock);
    203         list_remove(&sync_box->sync_box_link);
    204         spinlock_unlock(&TASK->lock);
    205         interrupts_restore(ipl);
    206 
    207         slab_free(ipc_answerbox_slab, sync_box);
    208192        return EOK;
    209193}
     
    536520        int i;
    537521        call_t *call;
    538         ipl_t ipl;
    539522
    540523        /* Disconnect all our phones ('ipc_phone_hangup') */
     
    562545        spinlock_unlock(&TASK->answerbox.lock);
    563546       
    564         /* Wait for all answers to interrupted synchronous calls to arrive */
    565         ipl = interrupts_disable();
    566         while (!list_empty(&TASK->sync_box_head)) {
    567                 answerbox_t *box = list_get_instance(TASK->sync_box_head.next,
    568                     answerbox_t, sync_box_link);
    569 
    570                 list_remove(&box->sync_box_link);
    571                 call = ipc_wait_for_call(box, SYNCH_NO_TIMEOUT,
    572                     SYNCH_FLAGS_NONE);
    573                 ipc_call_free(call);
    574                 slab_free(ipc_answerbox_slab, box);
    575         }
    576         interrupts_restore(ipl);
    577 
    578         /* Wait for all answers to asynchronous calls to arrive */
     547        /* Wait for all async answers to arrive */
    579548        while (1) {
    580549                /* Go through all phones, until all are FREE... */
     
    583552                for (i = 0; i < IPC_MAX_PHONES; i++) {
    584553                        if (TASK->phones[i].state == IPC_PHONE_HUNGUP &&
    585                             atomic_get(&TASK->phones[i].active_calls) == 0) {
     554                            atomic_get(&TASK->phones[i].active_calls) == 0)
    586555                                TASK->phones[i].state = IPC_PHONE_FREE;
    587                                 TASK->phones[i].callee = NULL;
    588                         }
    589556                       
    590557                        /* Just for sure, we might have had some
     
    607574                ASSERT((call->flags & IPC_CALL_ANSWERED) ||
    608575                    (call->flags & IPC_CALL_NOTIF));
     576                ASSERT(!(call->flags & IPC_CALL_STATIC_ALLOC));
    609577               
    610578                /*
     
    625593        ipc_call_slab = slab_cache_create("ipc_call", sizeof(call_t), 0, NULL,
    626594            NULL, 0);
    627         ipc_answerbox_slab = slab_cache_create("ipc_answerbox",
    628             sizeof(answerbox_t), 0, NULL, NULL, 0);
    629595}
    630596
  • kernel/generic/src/ipc/irq.c

    r3f35634c r3da11f37  
    418418                case CMD_ACCEPT:
    419419                        return IRQ_ACCEPT;
     420                        break;
    420421                case CMD_DECLINE:
    421422                default:
  • kernel/generic/src/ipc/sysipc.c

    r3f35634c r3da11f37  
    6161{ \
    6262        if (phoneid > IPC_MAX_PHONES) { \
    63                 err \
     63                err; \
    6464        } \
    6565        phone = &TASK->phones[phoneid]; \
     
    122122        case IPC_M_DATA_READ:
    123123                return 1;
     124                break;
    124125        default:
    125126                return 0;
     
    375376                phone_t *cloned_phone;
    376377                GET_CHECK_PHONE(cloned_phone, IPC_GET_ARG1(call->data),
    377                     return ENOENT;);
     378                    return ENOENT);
    378379                phones_lock(cloned_phone, phone);
    379380                if ((cloned_phone->state != IPC_PHONE_CONNECTED) ||
     
    530531    unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data)
    531532{
    532         call_t *call;
     533        call_t call;
    533534        phone_t *phone;
    534535        int res;
    535536        int rc;
    536537       
    537         GET_CHECK_PHONE(phone, phoneid, return ENOENT;);
    538 
    539         call = ipc_call_alloc(0);
    540         IPC_SET_METHOD(call->data, method);
    541         IPC_SET_ARG1(call->data, arg1);
    542         IPC_SET_ARG2(call->data, arg2);
    543         IPC_SET_ARG3(call->data, arg3);
     538        GET_CHECK_PHONE(phone, phoneid, return ENOENT);
     539
     540        ipc_call_static_init(&call);
     541        IPC_SET_METHOD(call.data, method);
     542        IPC_SET_ARG1(call.data, arg1);
     543        IPC_SET_ARG2(call.data, arg2);
     544        IPC_SET_ARG3(call.data, arg3);
    544545        /*
    545546         * To achieve deterministic behavior, zero out arguments that are beyond
    546547         * the limits of the fast version.
    547548         */
    548         IPC_SET_ARG4(call->data, 0);
    549         IPC_SET_ARG5(call->data, 0);
    550 
    551         if (!(res = request_preprocess(call, phone))) {
     549        IPC_SET_ARG4(call.data, 0);
     550        IPC_SET_ARG5(call.data, 0);
     551
     552        if (!(res = request_preprocess(&call, phone))) {
    552553#ifdef CONFIG_UDEBUG
    553554                udebug_stoppable_begin();
    554555#endif
    555                 rc = ipc_call_sync(phone, call);
     556                rc = ipc_call_sync(phone, &call);
    556557#ifdef CONFIG_UDEBUG
    557558                udebug_stoppable_end();
    558559#endif
    559                 if (rc != EOK) {
    560                         /* The call will be freed by ipc_cleanup(). */
     560                if (rc != EOK)
    561561                        return rc;
    562                 }
    563                 process_answer(call);
     562                process_answer(&call);
    564563
    565564        } else {
    566                 IPC_SET_RETVAL(call->data, res);
    567         }
    568         rc = STRUCT_TO_USPACE(&data->args, &call->data.args);
    569         ipc_call_free(call);
     565                IPC_SET_RETVAL(call.data, res);
     566        }
     567        rc = STRUCT_TO_USPACE(&data->args, &call.data.args);
    570568        if (rc != 0)
    571569                return rc;
     
    586584    ipc_data_t *reply)
    587585{
    588         call_t *call;
     586        call_t call;
    589587        phone_t *phone;
    590588        int res;
    591589        int rc;
    592590
    593         GET_CHECK_PHONE(phone, phoneid, return ENOENT;);
    594 
    595         call = ipc_call_alloc(0);
    596         rc = copy_from_uspace(&call->data.args, &question->args,
    597             sizeof(call->data.args));
    598         if (rc != 0) {
    599                 ipc_call_free(call);
     591        ipc_call_static_init(&call);
     592        rc = copy_from_uspace(&call.data.args, &question->args,
     593            sizeof(call.data.args));
     594        if (rc != 0)
    600595                return (unative_t) rc;
    601         }
    602 
    603 
    604         if (!(res = request_preprocess(call, phone))) {
     596
     597        GET_CHECK_PHONE(phone, phoneid, return ENOENT);
     598
     599        if (!(res = request_preprocess(&call, phone))) {
    605600#ifdef CONFIG_UDEBUG
    606601                udebug_stoppable_begin();
    607602#endif
    608                 rc = ipc_call_sync(phone, call);
     603                rc = ipc_call_sync(phone, &call);
    609604#ifdef CONFIG_UDEBUG
    610605                udebug_stoppable_end();
    611606#endif
    612                 if (rc != EOK) {
    613                         /* The call will be freed by ipc_cleanup(). */
     607                if (rc != EOK)
    614608                        return rc;
    615                 }
    616                 process_answer(call);
     609                process_answer(&call);
    617610        } else
    618                 IPC_SET_RETVAL(call->data, res);
    619 
    620         rc = STRUCT_TO_USPACE(&reply->args, &call->data.args);
    621         ipc_call_free(call);
     611                IPC_SET_RETVAL(call.data, res);
     612
     613        rc = STRUCT_TO_USPACE(&reply->args, &call.data.args);
    622614        if (rc != 0)
    623615                return rc;
     
    666658                return IPC_CALLRET_TEMPORARY;
    667659
    668         GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL;);
     660        GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL);
    669661
    670662        call = ipc_call_alloc(0);
     
    705697                return IPC_CALLRET_TEMPORARY;
    706698
    707         GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL;);
     699        GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL);
    708700
    709701        call = ipc_call_alloc(0);
     
    755747        call->flags |= IPC_CALL_FORWARDED;
    756748
    757         GET_CHECK_PHONE(phone, phoneid, {
     749        GET_CHECK_PHONE(phone, phoneid, { 
    758750                IPC_SET_RETVAL(call->data, EFORWARD);
    759751                ipc_answer(&TASK->answerbox, call);
     
    960952        phone_t *phone;
    961953
    962         GET_CHECK_PHONE(phone, phoneid, return ENOENT;);
     954        GET_CHECK_PHONE(phone, phoneid, return ENOENT);
    963955
    964956        if (ipc_phone_hangup(phone))
     
    999991
    1000992        if (call->flags & IPC_CALL_NOTIF) {
     993                ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC));
     994
    1001995                /* Set in_phone_hash to the interrupt counter */
    1002996                call->data.phone = (void *) call->priv;
     
    10111005        if (call->flags & IPC_CALL_ANSWERED) {
    10121006                process_answer(call);
     1007
     1008                ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC));
    10131009
    10141010                if (call->flags & IPC_CALL_DISCARD_ANSWER) {
  • kernel/generic/src/lib/elf.c

    r3f35634c r3da11f37  
    163163        case PT_LOAD:
    164164                return load_segment(entry, elf, as);
     165                break;
    165166        case PT_DYNAMIC:
    166167        case PT_INTERP:
     
    181182        default:
    182183                return EE_UNSUPPORTED;
     184                break;
    183185        }
    184186        return EE_OK;
  • kernel/generic/src/proc/task.c

    r3f35634c r3da11f37  
    7575static task_id_t task_counter = 0;
    7676
    77 static slab_cache_t *task_slab;
    78 
    7977/* Forward declarations. */
    8078static void task_kill_internal(task_t *);
    81 static int tsk_constructor(void *, int);
    8279
    8380/** Initialize kernel tasks support. */
     
    8683        TASK = NULL;
    8784        avltree_create(&tasks_tree);
    88         task_slab = slab_cache_create("task_slab", sizeof(task_t), 0,
    89             tsk_constructor, NULL, 0);
    9085}
    9186
     
    133128}
    134129
    135 int tsk_constructor(void *obj, int kmflags)
    136 {
    137         task_t *ta = obj;
     130/** Create new task with no threads.
     131 *
     132 * @param as            Task's address space.
     133 * @param name          Symbolic name (a copy is made).
     134 *
     135 * @return              New task's structure.
     136 *
     137 */
     138task_t *task_create(as_t *as, char *name)
     139{
     140        ipl_t ipl;
     141        task_t *ta;
    138142        int i;
     143       
     144        ta = (task_t *) malloc(sizeof(task_t), 0);
     145
     146        task_create_arch(ta);
     147
     148        spinlock_initialize(&ta->lock, "task_ta_lock");
     149        list_initialize(&ta->th_head);
     150        ta->as = as;
     151
     152        memcpy(ta->name, name, TASK_NAME_BUFLEN);
     153        ta->name[TASK_NAME_BUFLEN - 1] = 0;
    139154
    140155        atomic_set(&ta->refcount, 0);
    141156        atomic_set(&ta->lifecount, 0);
    142         atomic_set(&ta->active_calls, 0);
    143 
    144         spinlock_initialize(&ta->lock, "task_ta_lock");
    145         mutex_initialize(&ta->futexes_lock, MUTEX_PASSIVE);
    146 
    147         list_initialize(&ta->th_head);
    148         list_initialize(&ta->sync_box_head);
     157        ta->context = CONTEXT;
     158
     159        ta->capabilities = 0;
     160        ta->cycles = 0;
     161
     162#ifdef CONFIG_UDEBUG
     163        /* Init debugging stuff */
     164        udebug_task_init(&ta->udebug);
     165
     166        /* Init kbox stuff */
     167        ipc_answerbox_init(&ta->kb.box, ta);
     168        ta->kb.thread = NULL;
     169        mutex_initialize(&ta->kb.cleanup_lock, MUTEX_PASSIVE);
     170        ta->kb.finished = false;
     171#endif
    149172
    150173        ipc_answerbox_init(&ta->answerbox, ta);
    151174        for (i = 0; i < IPC_MAX_PHONES; i++)
    152175                ipc_phone_init(&ta->phones[i]);
    153 
    154 #ifdef CONFIG_UDEBUG
    155         /* Init kbox stuff */
    156         ta->kb.thread = NULL;
    157         ipc_answerbox_init(&ta->kb.box, ta);
    158         mutex_initialize(&ta->kb.cleanup_lock, MUTEX_PASSIVE);
    159 #endif
    160 
    161         return 0;
    162 }
    163 
    164 /** Create new task with no threads.
    165  *
    166  * @param as            Task's address space.
    167  * @param name          Symbolic name (a copy is made).
    168  *
    169  * @return              New task's structure.
    170  *
    171  */
    172 task_t *task_create(as_t *as, char *name)
    173 {
    174         ipl_t ipl;
    175         task_t *ta;
    176        
    177         ta = (task_t *) slab_alloc(task_slab, 0);
    178         task_create_arch(ta);
    179         ta->as = as;
    180         memcpy(ta->name, name, TASK_NAME_BUFLEN);
    181         ta->name[TASK_NAME_BUFLEN - 1] = 0;
    182 
    183         ta->context = CONTEXT;
    184         ta->capabilities = 0;
    185         ta->cycles = 0;
    186 
    187 #ifdef CONFIG_UDEBUG
    188         /* Init debugging stuff */
    189         udebug_task_init(&ta->udebug);
    190 
    191         /* Init kbox stuff */
    192         ta->kb.finished = false;
    193 #endif
    194 
    195         if ((ipc_phone_0) &&
    196             (context_check(ipc_phone_0->task->context, ta->context)))
     176        if ((ipc_phone_0) && (context_check(ipc_phone_0->task->context,
     177            ta->context)))
    197178                ipc_phone_connect(&ta->phones[0], ipc_phone_0);
    198 
     179        atomic_set(&ta->active_calls, 0);
     180
     181        mutex_initialize(&ta->futexes_lock, MUTEX_PASSIVE);
    199182        btree_create(&ta->futexes);
    200183       
    201184        ipl = interrupts_disable();
     185
     186        /*
     187         * Increment address space reference count.
     188         */
    202189        atomic_inc(&as->refcount);
     190
    203191        spinlock_lock(&tasks_lock);
    204192        ta->taskid = ++task_counter;
     
    241229                as_destroy(t->as);
    242230       
    243         slab_free(task_slab, t);
     231        free(t);
    244232        TASK = NULL;
    245233}
  • tools/config.py

    r3f35634c r3da11f37  
    227227       
    228228        timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    229        
    230         sys.stderr.write("Fetching current revision identifier ... ")
    231229        version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].split(':')
    232         sys.stderr.write("OK\n")
    233230       
    234231        if (len(version) == 3):
  • uspace/lib/libc/generic/async.c

    r3f35634c r3da11f37  
    392392        /* If nothing in queue, wait until something arrives */
    393393        while (list_empty(&conn->msg_queue)) {
    394                 if (conn->close_callid) {
    395                         /*
    396                          * Handle the case when the connection was already
    397                          * closed by the client but the server did not notice
    398                          * the first IPC_M_PHONE_HUNGUP call and continues to
    399                          * call async_get_call_timeout(). Repeat
    400                          * IPC_M_PHONE_HUNGUP until the caller notices.
    401                          */
    402                         memset(call, 0, sizeof(ipc_call_t));
    403                         IPC_SET_METHOD(*call, IPC_M_PHONE_HUNGUP);
    404                         futex_up(&async_futex);
    405                         return conn->close_callid;
    406                 }
    407 
    408394                if (usecs)
    409395                        async_insert_timeout(&conn->wdata);
     
    542528        list_initialize(&conn->msg_queue);
    543529        conn->callid = callid;
    544         conn->close_callid = 0;
     530        conn->close_callid = false;
    545531       
    546532        if (call)
  • uspace/lib/libc/generic/vfs/canonify.c

    r3f35634c r3da11f37  
    142142        t->start[-1] = '\0';
    143143}
    144 /** Eat the extra '/'.
     144/** Eat the extra '/'..
    145145 *
    146146 * @param t             The current TK_SLASH token.
     
    288288 *
    289289 * A file system path is canonical, if the following holds:
    290  *
    291  * 1) the path is absolute
    292  *    (i.e. a/b/c is not canonical)
    293  * 2) there is no trailing slash in the path if it has components
    294  *    (i.e. /a/b/c/ is not canonical)
    295  * 3) there is no extra slash in the path
    296  *    (i.e. /a//b/c is not canonical)
    297  * 4) there is no '.' component in the path
    298  *    (i.e. /a/./b/c is not canonical)
    299  * 5) there is no '..' component in the path
    300  *    (i.e. /a/b/../c is not canonical)
     290 * 1) the path is absolute (i.e. a/b/c is not canonical)
     291 * 2) there is no trailing slash in the path (i.e. /a/b/c is not canonical)
     292 * 3) there is no extra slash in the path (i.e. /a//b/c is not canonical)
     293 * 4) there is no '.' component in the path (i.e. /a/./b/c is not canonical)
     294 * 5) there is no '..' component in the path (i.e. /a/b/../c is not canonical)
    301295 *
    302296 * This function makes a potentially non-canonical file system path canonical.
Note: See TracChangeset for help on using the changeset viewer.