Changes in / [3f35634c:3da11f37] in mainline
- Files:
-
- 2 deleted
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r3f35634c r3da11f37 30 30 # 31 31 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 36 33 37 34 all: Makefile.config config.h config.defs … … 39 36 $(MAKE) -C uspace 40 37 $(MAKE) -C boot 41 42 stanse: Makefile.config config.h config.defs43 $(MAKE) -C kernel clean44 $(MAKE) -C kernel EXTRA_TOOL=stanse45 $(STANSE) --checker ReachabilityChecker --checker ThreadChecker:contrib/$(STANSE)/ThreadChecker.xml --jobfile kernel/kernel.job46 47 cscope:48 find kernel boot uspace -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out49 38 50 39 Makefile.config: config_default … … 61 50 62 51 distclean: clean 63 rm -f $(CSCOPE).outMakefile.config config.h config.defs tools/*.pyc52 rm -f Makefile.config config.h config.defs tools/*.pyc 64 53 65 54 clean: 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 59 cscope: 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 52 52 return 53 53 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. 56 55 for revision_id in repo.iter_reverse_revision_history(params.new_revid): 57 56 if revision_id == params.old_revid: 58 57 return # Found old tip 59 58 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. 67 60 raise TipChangeRejected('Bad tip. Read http://trac.helenos.org/trac.fcgi/' + 68 61 'wiki/BazaarWorkflow') -
kernel/Makefile
r3f35634c r3da11f37 33 33 all: ../version ../Makefile.config ../config.h ../config.defs 34 34 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 35 $(MAKE) -f Makefile.build EXTRA_TOOL=$(EXTRA_TOOL)35 $(MAKE) -f Makefile.build 36 36 37 37 clean: 38 rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $( JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld38 rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld 39 39 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 91 91 ## Cross-platform assembly to start a symtab.data section 92 92 # 93 SYMTAB_SECTION =".section symtab.data, \"a\", $(ATSIGN)progbits;"93 SYMTAB_SECTION=".section symtab.data, \"a\", $(ATSIGN)progbits;" 94 94 95 95 ## Simple detection for the type of the host system … … 110 110 ifeq ($(COMPILER),gcc_native) 111 111 CC = gcc 112 GCC = gcc112 GCC = $(CC) 113 113 AS = $(BINUTILS_PREFIX)as 114 114 LD = $(BINUTILS_PREFIX)ld … … 168 168 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 169 169 endif 170 171 170 172 171 ## Generic kernel sources … … 385 384 test/fpu/%.o: test/fpu/%.c $(DEPEND) 386 385 $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@ 387 ifeq ($(EXTRA_TOOL),stanse)388 ../tools/jobfile.py $(JOB) $< $@ $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)389 endif390 386 391 387 # … … 394 390 %.o: %.c $(DEPEND) 395 391 $(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 endif399 392 400 393 $(REAL_MAP).o: $(REAL_MAP).bin -
kernel/Makefile.common
r3f35634c r3da11f37 36 36 BIN = kernel.bin 37 37 MAP = kernel.map 38 JOB = kernel.job39 38 MAP_PREV = $(MAP).prev 40 39 DISASM = kernel.disasm -
kernel/arch/amd64/include/mm/page.h
r3f35634c r3da11f37 177 177 #define PFERR_CODE_ID (1 << 4) 178 178 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 197 179 static inline unsigned int get_pt_flags(pte_t *pt, size_t i) 198 180 { -
kernel/arch/amd64/include/types.h
r3f35634c r3da11f37 82 82 #define PRIxn "llx" 83 83 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 84 102 #endif 85 103 -
kernel/arch/arm32/include/mm/page.h
r3f35634c r3da11f37 75 75 /* Get PTE address accessors for each level. */ 76 76 #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)) 78 78 #define GET_PTL2_ADDRESS_ARCH(ptl1, i) \ 79 79 (ptl1) … … 81 81 (ptl2) 82 82 #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)) 84 84 85 85 /* Set PTE address accessors for each level. */ 86 86 #define SET_PTL0_ADDRESS_ARCH(ptl0) \ 87 (set_ptl0_addr((pte_ t *) (ptl0)))87 (set_ptl0_addr((pte_level0_t *) (ptl0))) 88 88 #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) 90 90 #define SET_PTL2_ADDRESS_ARCH(ptl1, i, a) 91 91 #define SET_PTL3_ADDRESS_ARCH(ptl2, i, a) 92 92 #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) 94 94 95 95 /* Get PTE flags accessors for each level. */ 96 96 #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)) 98 98 #define GET_PTL2_FLAGS_ARCH(ptl1, i) \ 99 99 PAGE_PRESENT … … 101 101 PAGE_PRESENT 102 102 #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)) 104 104 105 105 /* Set PTE flags accessors for each level. */ 106 106 #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)) 108 108 #define SET_PTL2_FLAGS_ARCH(ptl1, i, x) 109 109 #define SET_PTL3_FLAGS_ARCH(ptl2, i, x) 110 110 #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)) 112 112 113 113 /* Macros for querying the last-level PTE entries. */ … … 115 115 (*((uint32_t *) (pte)) != 0) 116 116 #define PTE_PRESENT_ARCH(pte) \ 117 (((pte_ t *) (pte))->l0.descriptor_type != 0)117 (((pte_level0_t *) (pte))->descriptor_type != 0) 118 118 #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) 120 120 #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) 122 123 #define PTE_EXECUTABLE_ARCH(pte) \ 123 124 1 … … 158 159 } ATTRIBUTE_PACKED pte_level1_t; 159 160 160 typedef union {161 pte_level0_t l0;162 pte_level1_t l1;163 } pte_t;164 161 165 162 /* Level 1 page tables access permissions */ … … 194 191 * @param pt Pointer to the page table to set. 195 192 */ 196 static inline void set_ptl0_addr(pte_ t *pt)193 static inline void set_ptl0_addr(pte_level0_t *pt) 197 194 { 198 195 asm volatile ( … … 208 205 * @param i Index of the entry to return. 209 206 */ 210 static inline int get_pt_level0_flags(pte_ t *pt, size_t i)211 { 212 pte_level0_t *p = &pt[i] .l0;207 static inline int get_pt_level0_flags(pte_level0_t *pt, size_t i) 208 { 209 pte_level0_t *p = &pt[i]; 213 210 int np = (p->descriptor_type == PTE_DESCRIPTOR_NOT_PRESENT); 214 211 … … 223 220 * @param i Index of the entry to return. 224 221 */ 225 static inline int get_pt_level1_flags(pte_ t *pt, size_t i)226 { 227 pte_level1_t *p = &pt[i] .l1;222 static inline int get_pt_level1_flags(pte_level1_t *pt, size_t i) 223 { 224 pte_level1_t *p = &pt[i]; 228 225 229 226 int dt = p->descriptor_type; … … 248 245 * @param flags new flags 249 246 */ 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;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]; 253 250 254 251 if (flags & PAGE_NOT_PRESENT) { … … 276 273 * @param flags New flags. 277 274 */ 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;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]; 281 278 282 279 if (flags & PAGE_NOT_PRESENT) { -
kernel/arch/arm32/include/types.h
r3f35634c r3da11f37 87 87 #define PRIxn "x" /**< Format for hexadecimal (u)native_t. */ 88 88 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 89 98 #endif 90 99 -
kernel/arch/ia32/include/mm/page.h
r3f35634c r3da11f37 146 146 #define PFERR_CODE_RSVD (1 << 3) 147 147 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 164 148 static inline unsigned int get_pt_flags(pte_t *pt, size_t i) 165 149 { -
kernel/arch/ia32/include/types.h
r3f35634c r3da11f37 80 80 #define PRIxn "x" /**< Format for hexadecimal (u)native_t. */ 81 81 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 82 98 #endif 83 99 -
kernel/arch/mips32/include/mm/page.h
r3f35634c r3da11f37 141 141 #include <arch/exception.h> 142 142 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 157 143 static inline unsigned int get_pt_flags(pte_t *pt, size_t i) 158 144 { -
kernel/arch/mips32/include/types.h
r3f35634c r3da11f37 80 80 #define PRIxn "x" /**< Format for hexadecimal (u)native_t. */ 81 81 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 82 95 #endif 83 96 -
kernel/arch/ppc32/include/mm/page.h
r3f35634c r3da11f37 131 131 #include <arch/interrupt.h> 132 132 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 144 133 static inline unsigned int get_pt_flags(pte_t *pt, size_t i) 145 134 { -
kernel/arch/ppc32/include/types.h
r3f35634c r3da11f37 82 82 #define PRIxn "x" 83 83 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 84 95 #endif 85 96 -
kernel/genarch/include/mm/as_pt.h
r3f35634c r3da11f37 36 36 #define KERN_AS_PT_H_ 37 37 38 #include <arch/mm/page.h> 38 #include <mm/mm.h> 39 #include <arch/types.h> 39 40 40 41 #define AS_PAGE_TABLE -
kernel/genarch/include/mm/page_pt.h
r3f35634c r3da11f37 44 44 #define KERN_PAGE_PT_H_ 45 45 46 #include <arch/types.h> 46 47 #include <mm/as.h> 47 48 #include <mm/page.h> 48 #include <arch/mm/page.h>49 #include <arch/types.h>50 49 51 50 /* -
kernel/generic/include/ipc/ipc.h
r3f35634c r3da11f37 51 51 /** This is answer to a call */ 52 52 #define IPC_CALL_ANSWERED (1 << 0) 53 /** This call will not be freed on error */ 54 #define IPC_CALL_STATIC_ALLOC (1 << 1) 53 55 /** 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) 55 57 /** Call was forwarded */ 56 #define IPC_CALL_FORWARDED (1 << 2)58 #define IPC_CALL_FORWARDED (1 << 3) 57 59 /** Identify connect_me_to answer */ 58 #define IPC_CALL_CONN_ME_TO (1 << 3)60 #define IPC_CALL_CONN_ME_TO (1 << 4) 59 61 /** Interrupt notification */ 60 #define IPC_CALL_NOTIF (1 << 4)62 #define IPC_CALL_NOTIF (1 << 5) 61 63 62 64 /* … … 265 267 waitq_t wq; 266 268 267 /** Linkage for the list of task's synchronous answerboxes. */268 link_t sync_box_link;269 270 269 /** Phones connected to this answerbox. */ 271 270 link_t connected_phones; … … 317 316 } call_t; 318 317 319 320 extern answerbox_t *ipc_phone_0;321 322 323 318 extern void ipc_init(void); 324 325 extern call_t * ipc_call_alloc(int); 326 extern void ipc_call_free(call_t *); 327 319 extern call_t * ipc_wait_for_call(answerbox_t *, uint32_t, int); 320 extern void ipc_answer(answerbox_t *, call_t *); 328 321 extern int ipc_call(phone_t *, call_t *); 329 322 extern 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 334 323 extern void ipc_phone_init(phone_t *); 335 324 extern void ipc_phone_connect(phone_t *, answerbox_t *); 325 extern void ipc_call_free(call_t *); 326 extern call_t * ipc_call_alloc(int); 327 extern 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); 331 extern void ipc_cleanup(void); 336 332 extern int ipc_phone_hangup(phone_t *); 337 338 extern void ipc_answerbox_init(answerbox_t *, struct task *);339 340 extern void ipc_cleanup(void);341 333 extern void ipc_backsend_err(phone_t *, call_t *, unative_t); 334 extern void ipc_print_task(task_id_t); 342 335 extern void ipc_answerbox_slam_phones(answerbox_t *, bool); 343 336 extern void ipc_cleanup_call_list(link_t *); 344 337 345 extern void ipc_print_task(task_id_t);338 extern answerbox_t *ipc_phone_0; 346 339 347 340 #endif -
kernel/generic/include/proc/task.h
r3f35634c r3da11f37 98 98 */ 99 99 atomic_t active_calls; 100 /** List of synchronous answerboxes. */101 link_t sync_box_head;102 100 103 101 #ifdef CONFIG_UDEBUG … … 134 132 extern int task_kill(task_id_t id); 135 133 extern uint64_t task_get_accounting(task_t *t); 136 extern void task_print_list(void);137 134 138 135 extern void cap_set(task_t *t, cap_t caps); -
kernel/generic/src/ipc/ipc.c
r3f35634c r3da11f37 62 62 63 63 static slab_cache_t *ipc_call_slab; 64 static slab_cache_t *ipc_answerbox_slab;65 64 66 65 /** Initialize a call structure. … … 97 96 } 98 97 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 99 109 /** Deallocate a call structure. 100 110 * … … 103 113 void ipc_call_free(call_t *call) 104 114 { 115 ASSERT(!(call->flags & IPC_CALL_STATIC_ALLOC)); 105 116 /* Check to see if we have data in the IPC_M_DATA_SEND buffer. */ 106 117 if (call->buffer) … … 119 130 spinlock_initialize(&box->irq_lock, "ipc_box_irqlock"); 120 131 waitq_initialize(&box->wq); 121 link_initialize(&box->sync_box_link);122 132 list_initialize(&box->connected_phones); 123 133 list_initialize(&box->calls); … … 169 179 int ipc_call_sync(phone_t *phone, call_t *request) 170 180 { 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); 186 184 187 185 /* We will receive data in a special box. */ 188 request->callerbox = sync_box;186 request->callerbox = &sync_box; 189 187 190 188 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)) 194 191 return EINTR; 195 }196 197 /*198 * The answer arrived without interruption so we can remove the199 * 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);208 192 return EOK; 209 193 } … … 536 520 int i; 537 521 call_t *call; 538 ipl_t ipl;539 522 540 523 /* Disconnect all our phones ('ipc_phone_hangup') */ … … 562 545 spinlock_unlock(&TASK->answerbox.lock); 563 546 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 */ 579 548 while (1) { 580 549 /* Go through all phones, until all are FREE... */ … … 583 552 for (i = 0; i < IPC_MAX_PHONES; i++) { 584 553 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) 586 555 TASK->phones[i].state = IPC_PHONE_FREE; 587 TASK->phones[i].callee = NULL;588 }589 556 590 557 /* Just for sure, we might have had some … … 607 574 ASSERT((call->flags & IPC_CALL_ANSWERED) || 608 575 (call->flags & IPC_CALL_NOTIF)); 576 ASSERT(!(call->flags & IPC_CALL_STATIC_ALLOC)); 609 577 610 578 /* … … 625 593 ipc_call_slab = slab_cache_create("ipc_call", sizeof(call_t), 0, NULL, 626 594 NULL, 0); 627 ipc_answerbox_slab = slab_cache_create("ipc_answerbox",628 sizeof(answerbox_t), 0, NULL, NULL, 0);629 595 } 630 596 -
kernel/generic/src/ipc/irq.c
r3f35634c r3da11f37 418 418 case CMD_ACCEPT: 419 419 return IRQ_ACCEPT; 420 break; 420 421 case CMD_DECLINE: 421 422 default: -
kernel/generic/src/ipc/sysipc.c
r3f35634c r3da11f37 61 61 { \ 62 62 if (phoneid > IPC_MAX_PHONES) { \ 63 err \63 err; \ 64 64 } \ 65 65 phone = &TASK->phones[phoneid]; \ … … 122 122 case IPC_M_DATA_READ: 123 123 return 1; 124 break; 124 125 default: 125 126 return 0; … … 375 376 phone_t *cloned_phone; 376 377 GET_CHECK_PHONE(cloned_phone, IPC_GET_ARG1(call->data), 377 return ENOENT ;);378 return ENOENT); 378 379 phones_lock(cloned_phone, phone); 379 380 if ((cloned_phone->state != IPC_PHONE_CONNECTED) || … … 530 531 unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data) 531 532 { 532 call_t *call;533 call_t call; 533 534 phone_t *phone; 534 535 int res; 535 536 int rc; 536 537 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); 544 545 /* 545 546 * To achieve deterministic behavior, zero out arguments that are beyond 546 547 * the limits of the fast version. 547 548 */ 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))) { 552 553 #ifdef CONFIG_UDEBUG 553 554 udebug_stoppable_begin(); 554 555 #endif 555 rc = ipc_call_sync(phone, call);556 rc = ipc_call_sync(phone, &call); 556 557 #ifdef CONFIG_UDEBUG 557 558 udebug_stoppable_end(); 558 559 #endif 559 if (rc != EOK) { 560 /* The call will be freed by ipc_cleanup(). */ 560 if (rc != EOK) 561 561 return rc; 562 } 563 process_answer(call); 562 process_answer(&call); 564 563 565 564 } 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); 570 568 if (rc != 0) 571 569 return rc; … … 586 584 ipc_data_t *reply) 587 585 { 588 call_t *call;586 call_t call; 589 587 phone_t *phone; 590 588 int res; 591 589 int rc; 592 590 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) 600 595 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))) { 605 600 #ifdef CONFIG_UDEBUG 606 601 udebug_stoppable_begin(); 607 602 #endif 608 rc = ipc_call_sync(phone, call);603 rc = ipc_call_sync(phone, &call); 609 604 #ifdef CONFIG_UDEBUG 610 605 udebug_stoppable_end(); 611 606 #endif 612 if (rc != EOK) { 613 /* The call will be freed by ipc_cleanup(). */ 607 if (rc != EOK) 614 608 return rc; 615 } 616 process_answer(call); 609 process_answer(&call); 617 610 } 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); 622 614 if (rc != 0) 623 615 return rc; … … 666 658 return IPC_CALLRET_TEMPORARY; 667 659 668 GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL ;);660 GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL); 669 661 670 662 call = ipc_call_alloc(0); … … 705 697 return IPC_CALLRET_TEMPORARY; 706 698 707 GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL ;);699 GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL); 708 700 709 701 call = ipc_call_alloc(0); … … 755 747 call->flags |= IPC_CALL_FORWARDED; 756 748 757 GET_CHECK_PHONE(phone, phoneid, { 749 GET_CHECK_PHONE(phone, phoneid, { 758 750 IPC_SET_RETVAL(call->data, EFORWARD); 759 751 ipc_answer(&TASK->answerbox, call); … … 960 952 phone_t *phone; 961 953 962 GET_CHECK_PHONE(phone, phoneid, return ENOENT ;);954 GET_CHECK_PHONE(phone, phoneid, return ENOENT); 963 955 964 956 if (ipc_phone_hangup(phone)) … … 999 991 1000 992 if (call->flags & IPC_CALL_NOTIF) { 993 ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC)); 994 1001 995 /* Set in_phone_hash to the interrupt counter */ 1002 996 call->data.phone = (void *) call->priv; … … 1011 1005 if (call->flags & IPC_CALL_ANSWERED) { 1012 1006 process_answer(call); 1007 1008 ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC)); 1013 1009 1014 1010 if (call->flags & IPC_CALL_DISCARD_ANSWER) { -
kernel/generic/src/lib/elf.c
r3f35634c r3da11f37 163 163 case PT_LOAD: 164 164 return load_segment(entry, elf, as); 165 break; 165 166 case PT_DYNAMIC: 166 167 case PT_INTERP: … … 181 182 default: 182 183 return EE_UNSUPPORTED; 184 break; 183 185 } 184 186 return EE_OK; -
kernel/generic/src/proc/task.c
r3f35634c r3da11f37 75 75 static task_id_t task_counter = 0; 76 76 77 static slab_cache_t *task_slab;78 79 77 /* Forward declarations. */ 80 78 static void task_kill_internal(task_t *); 81 static int tsk_constructor(void *, int);82 79 83 80 /** Initialize kernel tasks support. */ … … 86 83 TASK = NULL; 87 84 avltree_create(&tasks_tree); 88 task_slab = slab_cache_create("task_slab", sizeof(task_t), 0,89 tsk_constructor, NULL, 0);90 85 } 91 86 … … 133 128 } 134 129 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 */ 138 task_t *task_create(as_t *as, char *name) 139 { 140 ipl_t ipl; 141 task_t *ta; 138 142 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; 139 154 140 155 atomic_set(&ta->refcount, 0); 141 156 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 149 172 150 173 ipc_answerbox_init(&ta->answerbox, ta); 151 174 for (i = 0; i < IPC_MAX_PHONES; i++) 152 175 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))) 197 178 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); 199 182 btree_create(&ta->futexes); 200 183 201 184 ipl = interrupts_disable(); 185 186 /* 187 * Increment address space reference count. 188 */ 202 189 atomic_inc(&as->refcount); 190 203 191 spinlock_lock(&tasks_lock); 204 192 ta->taskid = ++task_counter; … … 241 229 as_destroy(t->as); 242 230 243 slab_free(task_slab,t);231 free(t); 244 232 TASK = NULL; 245 233 } -
tools/config.py
r3f35634c r3da11f37 227 227 228 228 timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) 229 230 sys.stderr.write("Fetching current revision identifier ... ")231 229 version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].split(':') 232 sys.stderr.write("OK\n")233 230 234 231 if (len(version) == 3): -
uspace/lib/libc/generic/async.c
r3f35634c r3da11f37 392 392 /* If nothing in queue, wait until something arrives */ 393 393 while (list_empty(&conn->msg_queue)) { 394 if (conn->close_callid) {395 /*396 * Handle the case when the connection was already397 * closed by the client but the server did not notice398 * the first IPC_M_PHONE_HUNGUP call and continues to399 * call async_get_call_timeout(). Repeat400 * 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 408 394 if (usecs) 409 395 async_insert_timeout(&conn->wdata); … … 542 528 list_initialize(&conn->msg_queue); 543 529 conn->callid = callid; 544 conn->close_callid = 0;530 conn->close_callid = false; 545 531 546 532 if (call) -
uspace/lib/libc/generic/vfs/canonify.c
r3f35634c r3da11f37 142 142 t->start[-1] = '\0'; 143 143 } 144 /** Eat the extra '/'. 144 /** Eat the extra '/'.. 145 145 * 146 146 * @param t The current TK_SLASH token. … … 288 288 * 289 289 * 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) 301 295 * 302 296 * This function makes a potentially non-canonical file system path canonical.
Note:
See TracChangeset
for help on using the changeset viewer.