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