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


Ignore:
Files:
2 added
27 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r3da11f37 r3f35634c  
    3030#
    3131
    32 .PHONY: all config config_default distclean clean cscope
     32CSCOPE = cscope
     33STANSE = stanse
     34
     35.PHONY: all config config_default distclean clean cscope stanse
    3336
    3437all: Makefile.config config.h config.defs
     
    3639        $(MAKE) -C uspace
    3740        $(MAKE) -C boot
     41
     42stanse: 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
     47cscope:
     48        find kernel boot uspace -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
    3849
    3950Makefile.config: config_default
     
    5061
    5162distclean: clean
    52         rm -f Makefile.config config.h config.defs tools/*.pyc
     63        rm -f $(CSCOPE).out Makefile.config config.h config.defs tools/*.pyc
    5364
    5465clean:
    55         -$(MAKE) -C kernel clean
    56         -$(MAKE) -C uspace clean
    57         -$(MAKE) -C boot clean
    58 
    59 cscope:
    60         find kernel boot uspace -regex '^.*\.[chsS]$$' -print > srclist
    61         rm -f cscope.out
    62         cscope -bi srclist
     66        $(MAKE) -C kernel clean
     67        $(MAKE) -C uspace clean
     68        $(MAKE) -C boot clean
  • contrib/bazaar/mbprotect/__init__.py

    r3da11f37 r3f35634c  
    5252        return
    5353
    54     # Look for old tip in new main branch.
     54    # First permitted case is appending changesets to main branch.Look for
     55    # old tip in new main branch.
    5556    for revision_id in repo.iter_reverse_revision_history(params.new_revid):
    5657        if revision_id == params.old_revid:
    5758            return      # Found old tip
    5859
    59     # Old tip was not found. Reject the change.
     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.
    6067    raise TipChangeRejected('Bad tip. Read http://trac.helenos.org/trac.fcgi/' +
    6168        'wiki/BazaarWorkflow')
  • kernel/Makefile

    r3da11f37 r3f35634c  
    3333all: ../version ../Makefile.config ../config.h ../config.defs
    3434        -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    35         $(MAKE) -f Makefile.build
     35        $(MAKE) -f Makefile.build EXTRA_TOOL=$(EXTRA_TOOL)
    3636
    3737clean:
    38         rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld
     38        rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(JOB) $(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

    r3da11f37 r3f35634c  
    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 = $(CC)
     112        GCC = gcc
    113113        AS = $(BINUTILS_PREFIX)as
    114114        LD = $(BINUTILS_PREFIX)ld
     
    168168        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    169169endif
     170
    170171
    171172## Generic kernel sources
     
    384385test/fpu/%.o: test/fpu/%.c $(DEPEND)
    385386        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@
     387ifeq ($(EXTRA_TOOL),stanse)
     388        ../tools/jobfile.py $(JOB) $< $@ $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
     389endif
    386390
    387391#
     
    390394%.o: %.c $(DEPEND)
    391395        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c $< -o $@
     396ifeq ($(EXTRA_TOOL),stanse)
     397        ../tools/jobfile.py $(JOB) $< $@ $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS)
     398endif
    392399
    393400$(REAL_MAP).o: $(REAL_MAP).bin
  • kernel/Makefile.common

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

    r3da11f37 r3f35634c  
    177177#define PFERR_CODE_ID           (1 << 4)
    178178
     179/** Page Table Entry. */
     180typedef 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
    179197static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
    180198{
  • kernel/arch/amd64/include/types.h

    r3da11f37 r3f35634c  
    8282#define PRIxn "llx"
    8383
    84 /** Page Table Entry. */
    85 typedef 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 
    10284#endif
    10385
  • kernel/arch/arm32/include/mm/page.h

    r3da11f37 r3f35634c  
    7575/* Get PTE address accessors for each level. */
    7676#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
    77         ((pte_t *) ((((pte_level0_t *)(ptl0))[(i)]).coarse_table_addr << 10))
     77        ((pte_t *) ((((pte_t *)(ptl0))[(i)].l0).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_level1_t *)(ptl3))[(i)]).frame_base_addr << 12))
     83        ((uintptr_t) ((((pte_t *)(ptl3))[(i)].l1).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_level0_t *) (ptl0)))
     87        (set_ptl0_addr((pte_t *) (ptl0)))
    8888#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
    89         (((pte_level0_t *) (ptl0))[(i)].coarse_table_addr = (a) >> 10)
     89        (((pte_t *) (ptl0))[(i)].l0.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_level1_t *) (ptl3))[(i)].frame_base_addr = (a) >> 12)
     93        (((pte_t *) (ptl3))[(i)].l1.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_level0_t *) (ptl0), (size_t) (i))
     97        get_pt_level0_flags((pte_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_level1_t *) (ptl3), (size_t) (i))
     103        get_pt_level1_flags((pte_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_level0_t *) (ptl0), (size_t) (i), (x))
     107        set_pt_level0_flags((pte_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_level1_t *) (ptl3), (size_t) (i), (x))
     111        set_pt_level1_flags((pte_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_level0_t *) (pte))->descriptor_type != 0)
     117        (((pte_t *) (pte))->l0.descriptor_type != 0)
    118118#define PTE_GET_FRAME_ARCH(pte) \
    119         (((pte_level1_t *) (pte))->frame_base_addr << FRAME_WIDTH)
     119        (((pte_t *) (pte))->l1.frame_base_addr << FRAME_WIDTH)
    120120#define PTE_WRITABLE_ARCH(pte) \
    121         (((pte_level1_t *) (pte))->access_permission_0 == \
    122             PTE_AP_USER_RW_KERNEL_RW)
     121        (((pte_t *) (pte))->l1.access_permission_0 == PTE_AP_USER_RW_KERNEL_RW)
    123122#define PTE_EXECUTABLE_ARCH(pte) \
    124123        1
     
    159158} ATTRIBUTE_PACKED pte_level1_t;
    160159
     160typedef union {
     161        pte_level0_t l0;
     162        pte_level1_t l1;
     163} pte_t;
    161164
    162165/* Level 1 page tables access permissions */
     
    191194 * @param pt    Pointer to the page table to set.
    192195 */   
    193 static inline void set_ptl0_addr(pte_level0_t *pt)
     196static inline void set_ptl0_addr(pte_t *pt)
    194197{
    195198        asm volatile (
     
    205208 *  @param i      Index of the entry to return.
    206209 */
    207 static inline int get_pt_level0_flags(pte_level0_t *pt, size_t i)
    208 {
    209         pte_level0_t *p = &pt[i];
     210static inline int get_pt_level0_flags(pte_t *pt, size_t i)
     211{
     212        pte_level0_t *p = &pt[i].l0;
    210213        int np = (p->descriptor_type == PTE_DESCRIPTOR_NOT_PRESENT);
    211214
     
    220223 *  @param i      Index of the entry to return.
    221224 */
    222 static inline int get_pt_level1_flags(pte_level1_t *pt, size_t i)
    223 {
    224         pte_level1_t *p = &pt[i];
     225static inline int get_pt_level1_flags(pte_t *pt, size_t i)
     226{
     227        pte_level1_t *p = &pt[i].l1;
    225228
    226229        int dt = p->descriptor_type;
     
    245248 *  @param flags  new flags
    246249 */
    247 static inline void set_pt_level0_flags(pte_level0_t *pt, size_t i, int flags)
    248 {
    249         pte_level0_t *p = &pt[i];
     250static inline void set_pt_level0_flags(pte_t *pt, size_t i, int flags)
     251{
     252        pte_level0_t *p = &pt[i].l0;
    250253
    251254        if (flags & PAGE_NOT_PRESENT) {
     
    273276 *  @param flags  New flags.
    274277 */ 
    275 static inline void set_pt_level1_flags(pte_level1_t *pt, size_t i, int flags)
    276 {
    277         pte_level1_t *p = &pt[i];
     278static inline void set_pt_level1_flags(pte_t *pt, size_t i, int flags)
     279{
     280        pte_level1_t *p = &pt[i].l1;
    278281       
    279282        if (flags & PAGE_NOT_PRESENT) {
  • kernel/arch/arm32/include/types.h

    r3da11f37 r3f35634c  
    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  */
    94 typedef struct {
    95         unsigned dummy : 32;
    96 } pte_t;
    97 
    9889#endif
    9990
  • kernel/arch/ia32/include/mm/page.h

    r3da11f37 r3f35634c  
    146146#define PFERR_CODE_RSVD         (1 << 3)       
    147147
     148/** Page Table Entry. */
     149typedef 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
    148164static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
    149165{
  • kernel/arch/ia32/include/types.h

    r3da11f37 r3f35634c  
    8080#define PRIxn "x"       /**< Format for hexadecimal (u)native_t. */
    8181
    82 /** Page Table Entry. */
    83 typedef 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 
    9882#endif
    9983
  • kernel/arch/mips32/include/mm/page.h

    r3da11f37 r3f35634c  
    141141#include <arch/exception.h>
    142142
     143/** Page Table Entry. */
     144typedef 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
    143157static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
    144158{
  • kernel/arch/mips32/include/types.h

    r3da11f37 r3f35634c  
    8080#define PRIxn "x"       /**< Format for hexadecimal (u)native_t. */
    8181
    82 /** Page Table Entry. */
    83 typedef 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 
    9582#endif
    9683
  • kernel/arch/ppc32/include/mm/page.h

    r3da11f37 r3f35634c  
    131131#include <arch/interrupt.h>
    132132
     133/** Page Table Entry. */
     134typedef 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
    133144static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
    134145{
  • kernel/arch/ppc32/include/types.h

    r3da11f37 r3f35634c  
    8282#define PRIxn "x"
    8383
    84 /** Page Table Entry. */
    85 typedef 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 
    9584#endif
    9685
  • kernel/genarch/include/mm/as_pt.h

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

    r3da11f37 r3f35634c  
    4444#define KERN_PAGE_PT_H_
    4545
    46 #include <arch/types.h>
    4746#include <mm/as.h>
    4847#include <mm/page.h>
     48#include <arch/mm/page.h>
     49#include <arch/types.h>
    4950
    5051/*
  • kernel/generic/include/ipc/ipc.h

    r3da11f37 r3f35634c  
    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)
    5553/** Answer will not be passed to userspace, will be discarded */
    56 #define IPC_CALL_DISCARD_ANSWER (1 << 2)
     54#define IPC_CALL_DISCARD_ANSWER (1 << 1)
    5755/** Call was forwarded */
    58 #define IPC_CALL_FORWARDED      (1 << 3)
     56#define IPC_CALL_FORWARDED      (1 << 2)
    5957/** Identify connect_me_to answer */
    60 #define IPC_CALL_CONN_ME_TO     (1 << 4)
     58#define IPC_CALL_CONN_ME_TO     (1 << 3)
    6159/** Interrupt notification */
    62 #define IPC_CALL_NOTIF          (1 << 5)
     60#define IPC_CALL_NOTIF          (1 << 4)
    6361
    6462/*
     
    267265        waitq_t wq;
    268266
     267        /** Linkage for the list of task's synchronous answerboxes. */
     268        link_t sync_box_link;
     269
    269270        /** Phones connected to this answerbox. */
    270271        link_t connected_phones;
     
    316317} call_t;
    317318
     319
     320extern answerbox_t *ipc_phone_0;
     321
     322
    318323extern void ipc_init(void);
    319 extern call_t * ipc_wait_for_call(answerbox_t *, uint32_t, int);
    320 extern void ipc_answer(answerbox_t *, call_t *);
     324
     325extern call_t * ipc_call_alloc(int);
     326extern void ipc_call_free(call_t *);
     327
    321328extern int ipc_call(phone_t *, call_t *);
    322329extern int ipc_call_sync(phone_t *, call_t *);
     330extern call_t * ipc_wait_for_call(answerbox_t *, uint32_t, int);
     331extern int ipc_forward(call_t *, phone_t *, answerbox_t *, int);
     332extern void ipc_answer(answerbox_t *, call_t *);
     333
    323334extern void ipc_phone_init(phone_t *);
    324335extern void ipc_phone_connect(phone_t *, answerbox_t *);
    325 extern void ipc_call_free(call_t *);
    326 extern call_t * ipc_call_alloc(int);
     336extern int ipc_phone_hangup(phone_t *);
     337
    327338extern void ipc_answerbox_init(answerbox_t *, struct task *);
    328 extern void ipc_call_static_init(call_t *);
    329 extern void task_print_list(void);
    330 extern int ipc_forward(call_t *, phone_t *, answerbox_t *, int);
     339
    331340extern void ipc_cleanup(void);
    332 extern int ipc_phone_hangup(phone_t *);
    333341extern void ipc_backsend_err(phone_t *, call_t *, unative_t);
    334 extern void ipc_print_task(task_id_t);
    335342extern void ipc_answerbox_slam_phones(answerbox_t *, bool);
    336343extern void ipc_cleanup_call_list(link_t *);
    337344
    338 extern answerbox_t *ipc_phone_0;
     345extern void ipc_print_task(task_id_t);
    339346
    340347#endif
  • kernel/generic/include/proc/task.h

    r3da11f37 r3f35634c  
    9898         */
    9999        atomic_t active_calls;
     100        /** List of synchronous answerboxes. */
     101        link_t sync_box_head;
    100102
    101103#ifdef CONFIG_UDEBUG
     
    132134extern int task_kill(task_id_t id);
    133135extern uint64_t task_get_accounting(task_t *t);
     136extern void task_print_list(void);
    134137
    135138extern void cap_set(task_t *t, cap_t caps);
  • kernel/generic/src/ipc/ipc.c

    r3da11f37 r3f35634c  
    6262
    6363static slab_cache_t *ipc_call_slab;
     64static slab_cache_t *ipc_answerbox_slab;
    6465
    6566/** Initialize a call structure.
     
    9697}
    9798
    98 /** Initialize a statically allocated call structure.
    99  *
    100  * @param call          Statically allocated kernel call structure to be
    101  *                      initialized.
    102  */
    103 void ipc_call_static_init(call_t *call)
    104 {
    105         _ipc_call_init(call);
    106         call->flags |= IPC_CALL_STATIC_ALLOC;
    107 }
    108 
    10999/** Deallocate a call structure.
    110100 *
     
    113103void ipc_call_free(call_t *call)
    114104{
    115         ASSERT(!(call->flags & IPC_CALL_STATIC_ALLOC));
    116105        /* Check to see if we have data in the IPC_M_DATA_SEND buffer. */
    117106        if (call->buffer)
     
    130119        spinlock_initialize(&box->irq_lock, "ipc_box_irqlock");
    131120        waitq_initialize(&box->wq);
     121        link_initialize(&box->sync_box_link);
    132122        list_initialize(&box->connected_phones);
    133123        list_initialize(&box->calls);
     
    179169int ipc_call_sync(phone_t *phone, call_t *request)
    180170{
    181         answerbox_t sync_box;
    182 
    183         ipc_answerbox_init(&sync_box, TASK);
     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);
    184186
    185187        /* We will receive data in a special box. */
    186         request->callerbox = &sync_box;
     188        request->callerbox = sync_box;
    187189
    188190        ipc_call(phone, request);
    189         if (!ipc_wait_for_call(&sync_box, SYNCH_NO_TIMEOUT,
    190             SYNCH_FLAGS_INTERRUPTIBLE))
     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(). */
    191194                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);
    192208        return EOK;
    193209}
     
    520536        int i;
    521537        call_t *call;
     538        ipl_t ipl;
    522539
    523540        /* Disconnect all our phones ('ipc_phone_hangup') */
     
    545562        spinlock_unlock(&TASK->answerbox.lock);
    546563       
    547         /* Wait for all async answers to arrive */
     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 */
    548579        while (1) {
    549580                /* Go through all phones, until all are FREE... */
     
    552583                for (i = 0; i < IPC_MAX_PHONES; i++) {
    553584                        if (TASK->phones[i].state == IPC_PHONE_HUNGUP &&
    554                             atomic_get(&TASK->phones[i].active_calls) == 0)
     585                            atomic_get(&TASK->phones[i].active_calls) == 0) {
    555586                                TASK->phones[i].state = IPC_PHONE_FREE;
     587                                TASK->phones[i].callee = NULL;
     588                        }
    556589                       
    557590                        /* Just for sure, we might have had some
     
    574607                ASSERT((call->flags & IPC_CALL_ANSWERED) ||
    575608                    (call->flags & IPC_CALL_NOTIF));
    576                 ASSERT(!(call->flags & IPC_CALL_STATIC_ALLOC));
    577609               
    578610                /*
     
    593625        ipc_call_slab = slab_cache_create("ipc_call", sizeof(call_t), 0, NULL,
    594626            NULL, 0);
     627        ipc_answerbox_slab = slab_cache_create("ipc_answerbox",
     628            sizeof(answerbox_t), 0, NULL, NULL, 0);
    595629}
    596630
  • kernel/generic/src/ipc/irq.c

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

    r3da11f37 r3f35634c  
    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;
    125124        default:
    126125                return 0;
     
    376375                phone_t *cloned_phone;
    377376                GET_CHECK_PHONE(cloned_phone, IPC_GET_ARG1(call->data),
    378                     return ENOENT);
     377                    return ENOENT;);
    379378                phones_lock(cloned_phone, phone);
    380379                if ((cloned_phone->state != IPC_PHONE_CONNECTED) ||
     
    531530    unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data)
    532531{
    533         call_t call;
     532        call_t *call;
    534533        phone_t *phone;
    535534        int res;
    536535        int rc;
    537536       
    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);
     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);
    545544        /*
    546545         * To achieve deterministic behavior, zero out arguments that are beyond
    547546         * the limits of the fast version.
    548547         */
    549         IPC_SET_ARG4(call.data, 0);
    550         IPC_SET_ARG5(call.data, 0);
    551 
    552         if (!(res = request_preprocess(&call, phone))) {
     548        IPC_SET_ARG4(call->data, 0);
     549        IPC_SET_ARG5(call->data, 0);
     550
     551        if (!(res = request_preprocess(call, phone))) {
    553552#ifdef CONFIG_UDEBUG
    554553                udebug_stoppable_begin();
    555554#endif
    556                 rc = ipc_call_sync(phone, &call);
     555                rc = ipc_call_sync(phone, call);
    557556#ifdef CONFIG_UDEBUG
    558557                udebug_stoppable_end();
    559558#endif
    560                 if (rc != EOK)
     559                if (rc != EOK) {
     560                        /* The call will be freed by ipc_cleanup(). */
    561561                        return rc;
    562                 process_answer(&call);
     562                }
     563                process_answer(call);
    563564
    564565        } else {
    565                 IPC_SET_RETVAL(call.data, res);
    566         }
    567         rc = STRUCT_TO_USPACE(&data->args, &call.data.args);
     566                IPC_SET_RETVAL(call->data, res);
     567        }
     568        rc = STRUCT_TO_USPACE(&data->args, &call->data.args);
     569        ipc_call_free(call);
    568570        if (rc != 0)
    569571                return rc;
     
    584586    ipc_data_t *reply)
    585587{
    586         call_t call;
     588        call_t *call;
    587589        phone_t *phone;
    588590        int res;
    589591        int rc;
    590592
    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)
     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);
    595600                return (unative_t) rc;
    596 
    597         GET_CHECK_PHONE(phone, phoneid, return ENOENT);
    598 
    599         if (!(res = request_preprocess(&call, phone))) {
     601        }
     602
     603
     604        if (!(res = request_preprocess(call, phone))) {
    600605#ifdef CONFIG_UDEBUG
    601606                udebug_stoppable_begin();
    602607#endif
    603                 rc = ipc_call_sync(phone, &call);
     608                rc = ipc_call_sync(phone, call);
    604609#ifdef CONFIG_UDEBUG
    605610                udebug_stoppable_end();
    606611#endif
    607                 if (rc != EOK)
     612                if (rc != EOK) {
     613                        /* The call will be freed by ipc_cleanup(). */
    608614                        return rc;
    609                 process_answer(&call);
     615                }
     616                process_answer(call);
    610617        } else
    611                 IPC_SET_RETVAL(call.data, res);
    612 
    613         rc = STRUCT_TO_USPACE(&reply->args, &call.data.args);
     618                IPC_SET_RETVAL(call->data, res);
     619
     620        rc = STRUCT_TO_USPACE(&reply->args, &call->data.args);
     621        ipc_call_free(call);
    614622        if (rc != 0)
    615623                return rc;
     
    658666                return IPC_CALLRET_TEMPORARY;
    659667
    660         GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL);
     668        GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL;);
    661669
    662670        call = ipc_call_alloc(0);
     
    697705                return IPC_CALLRET_TEMPORARY;
    698706
    699         GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL);
     707        GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL;);
    700708
    701709        call = ipc_call_alloc(0);
     
    747755        call->flags |= IPC_CALL_FORWARDED;
    748756
    749         GET_CHECK_PHONE(phone, phoneid, { 
     757        GET_CHECK_PHONE(phone, phoneid, {
    750758                IPC_SET_RETVAL(call->data, EFORWARD);
    751759                ipc_answer(&TASK->answerbox, call);
     
    952960        phone_t *phone;
    953961
    954         GET_CHECK_PHONE(phone, phoneid, return ENOENT);
     962        GET_CHECK_PHONE(phone, phoneid, return ENOENT;);
    955963
    956964        if (ipc_phone_hangup(phone))
     
    991999
    9921000        if (call->flags & IPC_CALL_NOTIF) {
    993                 ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC));
    994 
    9951001                /* Set in_phone_hash to the interrupt counter */
    9961002                call->data.phone = (void *) call->priv;
     
    10051011        if (call->flags & IPC_CALL_ANSWERED) {
    10061012                process_answer(call);
    1007 
    1008                 ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC));
    10091013
    10101014                if (call->flags & IPC_CALL_DISCARD_ANSWER) {
  • kernel/generic/src/lib/elf.c

    r3da11f37 r3f35634c  
    163163        case PT_LOAD:
    164164                return load_segment(entry, elf, as);
    165                 break;
    166165        case PT_DYNAMIC:
    167166        case PT_INTERP:
     
    182181        default:
    183182                return EE_UNSUPPORTED;
    184                 break;
    185183        }
    186184        return EE_OK;
  • kernel/generic/src/proc/task.c

    r3da11f37 r3f35634c  
    7575static task_id_t task_counter = 0;
    7676
     77static slab_cache_t *task_slab;
     78
    7779/* Forward declarations. */
    7880static void task_kill_internal(task_t *);
     81static int tsk_constructor(void *, int);
    7982
    8083/** Initialize kernel tasks support. */
     
    8386        TASK = NULL;
    8487        avltree_create(&tasks_tree);
     88        task_slab = slab_cache_create("task_slab", sizeof(task_t), 0,
     89            tsk_constructor, NULL, 0);
    8590}
    8691
     
    128133}
    129134
     135int tsk_constructor(void *obj, int kmflags)
     136{
     137        task_t *ta = obj;
     138        int i;
     139
     140        atomic_set(&ta->refcount, 0);
     141        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);
     149
     150        ipc_answerbox_init(&ta->answerbox, ta);
     151        for (i = 0; i < IPC_MAX_PHONES; i++)
     152                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
    130164/** Create new task with no threads.
    131165 *
     
    140174        ipl_t ipl;
    141175        task_t *ta;
    142         int i;
    143        
    144         ta = (task_t *) malloc(sizeof(task_t), 0);
    145 
     176       
     177        ta = (task_t *) slab_alloc(task_slab, 0);
    146178        task_create_arch(ta);
    147 
    148         spinlock_initialize(&ta->lock, "task_ta_lock");
    149         list_initialize(&ta->th_head);
    150179        ta->as = as;
    151 
    152180        memcpy(ta->name, name, TASK_NAME_BUFLEN);
    153181        ta->name[TASK_NAME_BUFLEN - 1] = 0;
    154182
    155         atomic_set(&ta->refcount, 0);
    156         atomic_set(&ta->lifecount, 0);
    157183        ta->context = CONTEXT;
    158 
    159184        ta->capabilities = 0;
    160185        ta->cycles = 0;
     
    165190
    166191        /* 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);
    170192        ta->kb.finished = false;
    171193#endif
    172194
    173         ipc_answerbox_init(&ta->answerbox, ta);
    174         for (i = 0; i < IPC_MAX_PHONES; i++)
    175                 ipc_phone_init(&ta->phones[i]);
    176         if ((ipc_phone_0) && (context_check(ipc_phone_0->task->context,
    177             ta->context)))
     195        if ((ipc_phone_0) &&
     196            (context_check(ipc_phone_0->task->context, ta->context)))
    178197                ipc_phone_connect(&ta->phones[0], ipc_phone_0);
    179         atomic_set(&ta->active_calls, 0);
    180 
    181         mutex_initialize(&ta->futexes_lock, MUTEX_PASSIVE);
     198
    182199        btree_create(&ta->futexes);
    183200       
    184201        ipl = interrupts_disable();
    185 
    186         /*
    187          * Increment address space reference count.
    188          */
    189202        atomic_inc(&as->refcount);
    190 
    191203        spinlock_lock(&tasks_lock);
    192204        ta->taskid = ++task_counter;
     
    229241                as_destroy(t->as);
    230242       
    231         free(t);
     243        slab_free(task_slab, t);
    232244        TASK = NULL;
    233245}
  • tools/config.py

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

    r3da11f37 r3f35634c  
    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
    394408                if (usecs)
    395409                        async_insert_timeout(&conn->wdata);
     
    528542        list_initialize(&conn->msg_queue);
    529543        conn->callid = callid;
    530         conn->close_callid = false;
     544        conn->close_callid = 0;
    531545       
    532546        if (call)
  • uspace/lib/libc/generic/vfs/canonify.c

    r3da11f37 r3f35634c  
    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  * 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)
     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)
    295301 *
    296302 * This function makes a potentially non-canonical file system path canonical.
Note: See TracChangeset for help on using the changeset viewer.