Ticket #2129: ugly-fastcall.patch
File ugly-fastcall.patch, 14.5 KB (added by , 16 years ago) |
---|
-
src/system/kernel/sem.cpp
84 84 #define GRAB_SEM_LOCK(s) acquire_spinlock(&(s).lock) 85 85 #define RELEASE_SEM_LOCK(s) release_spinlock(&(s).lock) 86 86 87 __attribute__((fastcall)) 87 88 static int remove_thread_from_sem(struct thread *thread, struct sem_entry *sem, 88 89 struct thread_queue *queue, status_t acquireStatus, bool hasThreadLock); 89 90 … … 254 255 \param nextID The ID the slot will get when reused. If < 0 the \a slot 255 256 is used. 256 257 */ 257 static void258 __attribute__((fastcall)) static void 258 259 free_sem_slot(int slot, sem_id nextID) 259 260 { 260 261 struct sem_entry *sem = sSems + slot; … … 335 336 thread. 336 337 The thread lock must be held when called. 337 338 */ 338 static void339 __attribute__((fastcall)) static void 339 340 fill_sem_info(struct sem_entry *sem, sem_info *info, size_t size) 340 341 { 341 342 info->sem = sem->id; … … 355 356 // #pragma mark - Private Kernel API 356 357 357 358 358 status_t359 __attribute__((fastcall)) status_t 359 360 sem_init(kernel_args *args) 360 361 { 361 362 area_id area; … … 423 424 should not be made public - if possible, we should remove it 424 425 completely (and have only create_sem() exported). 425 426 */ 426 sem_id427 __attribute__((fastcall)) sem_id 427 428 create_sem_etc(int32 count, const char *name, team_id owner) 428 429 { 429 430 struct sem_entry *sem = NULL; … … 575 576 /*! Wake up a thread that's blocked on a semaphore 576 577 this function must be entered with interrupts disabled and THREADLOCK held 577 578 */ 578 status_t579 __attribute__((fastcall)) status_t 579 580 sem_interrupt_thread(struct thread *thread) 580 581 { 581 582 struct thread_queue wakeupQueue; … … 667 668 /*! This function cycles through the sem table, deleting all the sems 668 669 that are owned by the specified team. 669 670 */ 670 int671 __attribute__((fastcall)) int 671 672 sem_delete_owned_sems(team_id owner) 672 673 { 673 674 int state; -
src/system/kernel/lock.c
18 18 #include <thread.h> 19 19 20 20 21 int3221 __attribute__((fastcall)) int32 22 22 recursive_lock_get_recursion(recursive_lock *lock) 23 23 { 24 24 if (lock->holder == thread_get_current_thread_id()) … … 28 28 } 29 29 30 30 31 status_t31 __attribute__((fastcall)) status_t 32 32 recursive_lock_init(recursive_lock *lock, const char *name) 33 33 { 34 34 if (lock == NULL) … … 48 48 } 49 49 50 50 51 void51 __attribute__((fastcall)) void 52 52 recursive_lock_destroy(recursive_lock *lock) 53 53 { 54 54 if (lock == NULL) … … 59 59 } 60 60 61 61 62 status_t62 __attribute__((fastcall)) status_t 63 63 recursive_lock_lock(recursive_lock *lock) 64 64 { 65 65 thread_id thread = thread_get_current_thread_id(); … … 79 79 } 80 80 81 81 82 void82 __attribute__((fastcall)) void 83 83 recursive_lock_unlock(recursive_lock *lock) 84 84 { 85 85 if (thread_get_current_thread_id() != lock->holder) … … 95 95 // #pragma mark - 96 96 97 97 98 status_t98 __attribute__((fastcall)) status_t 99 99 mutex_init(mutex *m, const char *name) 100 100 { 101 101 if (m == NULL) … … 114 114 } 115 115 116 116 117 void117 __attribute__((fastcall)) void 118 118 mutex_destroy(mutex *mutex) 119 119 { 120 120 if (mutex == NULL) … … 128 128 } 129 129 130 130 131 status_t131 __attribute__((fastcall)) status_t 132 132 mutex_trylock(mutex *mutex) 133 133 { 134 134 thread_id me = thread_get_current_thread_id(); … … 151 151 } 152 152 153 153 154 status_t154 __attribute__((fastcall)) status_t 155 155 mutex_lock(mutex *mutex) 156 156 { 157 157 thread_id me = thread_get_current_thread_id(); … … 174 174 } 175 175 176 176 177 void177 __attribute__((fastcall)) void 178 178 mutex_unlock(mutex *mutex) 179 179 { 180 180 thread_id me = thread_get_current_thread_id(); … … 195 195 // #pragma mark - 196 196 197 197 198 status_t198 __attribute__((fastcall)) status_t 199 199 benaphore_init(benaphore *ben, const char *name) 200 200 { 201 201 if (ben == NULL || name == NULL) … … 214 214 } 215 215 216 216 217 void217 __attribute__((fastcall)) void 218 218 benaphore_destroy(benaphore *ben) 219 219 { 220 220 delete_sem(ben->sem); … … 225 225 // #pragma mark - 226 226 227 227 228 status_t228 __attribute__((fastcall)) status_t 229 229 rw_lock_init(rw_lock *lock, const char *name) 230 230 { 231 231 if (lock == NULL) … … 242 242 } 243 243 244 244 245 void245 __attribute__((fastcall)) void 246 246 rw_lock_destroy(rw_lock *lock) 247 247 { 248 248 if (lock == NULL) … … 252 252 } 253 253 254 254 255 status_t255 __attribute__((fastcall)) status_t 256 256 rw_lock_read_lock(rw_lock *lock) 257 257 { 258 258 return acquire_sem(lock->sem); 259 259 } 260 260 261 261 262 status_t262 __attribute__((fastcall)) status_t 263 263 rw_lock_read_unlock(rw_lock *lock) 264 264 { 265 265 return release_sem_etc(lock->sem, 1, 0/*B_DO_NOT_RESCHEDULE*/); 266 266 } 267 267 268 268 269 status_t269 __attribute__((fastcall)) status_t 270 270 rw_lock_write_lock(rw_lock *lock) 271 271 { 272 272 return acquire_sem_etc(lock->sem, RW_MAX_READERS, 0, 0); 273 273 } 274 274 275 275 276 status_t276 __attribute__((fastcall)) status_t 277 277 rw_lock_write_unlock(rw_lock *lock) 278 278 { 279 279 return release_sem_etc(lock->sem, RW_MAX_READERS, 0); -
headers/private/kernel/condition_variable.h
43 43 class Private; 44 44 45 45 protected: 46 bool Add(const void* object);47 status_t Wait(uint32 flags);48 status_t Wait(const void* object, uint32 flags);46 __attribute__((fastcall)) bool Add(const void* object); 47 __attribute__((fastcall)) status_t Wait(uint32 flags); 48 __attribute__((fastcall)) status_t Wait(const void* object, uint32 flags); 49 49 50 50 private: 51 51 void _Remove(); … … 68 68 void Dump() const; 69 69 const void* Object() const { return fObject; } 70 70 protected: 71 void Publish(const void* object,71 __attribute__((fastcall)) void Publish(const void* object, 72 72 const char* objectType); 73 void Unpublish(bool threadsLocked);74 void Notify(bool all, bool threadsLocked);73 __attribute__((fastcall)) void Unpublish(bool threadsLocked); 74 __attribute__((fastcall)) void Notify(bool all, bool threadsLocked); 75 75 76 76 private: 77 void _Notify(bool all, status_t result);77 __attribute__((fastcall)) void _Notify(bool all, status_t result); 78 78 79 79 protected: 80 80 typedef DoublyLinkedList<PrivateConditionVariableEntry> EntryList; -
headers/private/kernel/kscheduler.h
13 13 extern "C" { 14 14 #endif 15 15 16 void scheduler_enqueue_in_run_queue(struct thread *thread);17 void scheduler_remove_from_run_queue(struct thread *thread);16 __attribute__((fastcall)) void scheduler_enqueue_in_run_queue(struct thread *thread); 17 __attribute__((fastcall)) void scheduler_remove_from_run_queue(struct thread *thread); 18 18 void scheduler_reschedule(void); 19 19 20 20 void scheduler_init(void); -
headers/private/kernel/sem.h
20 20 extern "C" { 21 21 #endif 22 22 23 extern status_t sem_init(struct kernel_args *args);24 extern int sem_delete_owned_sems(team_id owner);25 extern status_t sem_interrupt_thread(struct thread *t);23 __attribute__((fastcall)) extern status_t sem_init(struct kernel_args *args); 24 __attribute__((fastcall)) extern int sem_delete_owned_sems(team_id owner); 25 __attribute__((fastcall)) extern status_t sem_interrupt_thread(struct thread *t); 26 26 extern int32 sem_used_sems(void); 27 27 extern int32 sem_max_sems(void); 28 28 … … 30 30 extern status_t deselect_sem(int32 object, struct select_info *info, 31 31 bool kernel); 32 32 33 extern sem_id create_sem_etc(int32 count, const char *name, team_id owner);33 __attribute__((fastcall)) extern sem_id create_sem_etc(int32 count, const char *name, team_id owner); 34 34 35 35 /* user calls */ 36 36 sem_id _user_create_sem(int32 count, const char *name); -
headers/private/kernel/heap.h
22 22 extern "C" { 23 23 #endif 24 24 25 void *memalign(size_t alignment, size_t size);25 __attribute__((fastcall)) void *memalign(size_t alignment, size_t size); 26 26 27 void deferred_free(void* block);27 __attribute__((fastcall)) void deferred_free(void* block); 28 28 29 void* malloc_referenced(size_t size);30 void* malloc_referenced_acquire(void* data);31 void malloc_referenced_release(void* data);29 __attribute__((fastcall)) void* malloc_referenced(size_t size); 30 __attribute__((fastcall)) void* malloc_referenced_acquire(void* data); 31 __attribute__((fastcall)) void malloc_referenced_release(void* data); 32 32 33 status_t heap_init(addr_t heapBase, size_t heapSize);34 status_t heap_init_post_sem();35 status_t heap_init_post_thread();33 __attribute__((fastcall)) status_t heap_init(addr_t heapBase, size_t heapSize); 34 __attribute__((fastcall)) status_t heap_init_post_sem(); 35 __attribute__((fastcall)) status_t heap_init_post_thread(); 36 36 37 37 #ifdef __cplusplus 38 38 } -
headers/private/kernel/lock.h
53 53 extern "C" { 54 54 #endif 55 55 56 extern status_t recursive_lock_init(recursive_lock *lock, const char *name);57 extern void recursive_lock_destroy(recursive_lock *lock);58 extern status_t recursive_lock_lock(recursive_lock *lock);59 extern void recursive_lock_unlock(recursive_lock *lock);60 extern int32 recursive_lock_get_recursion(recursive_lock *lock);56 __attribute__((fastcall)) extern status_t recursive_lock_init(recursive_lock *lock, const char *name); 57 __attribute__((fastcall)) extern void recursive_lock_destroy(recursive_lock *lock); 58 __attribute__((fastcall)) extern status_t recursive_lock_lock(recursive_lock *lock); 59 __attribute__((fastcall)) extern void recursive_lock_unlock(recursive_lock *lock); 60 __attribute__((fastcall)) extern int32 recursive_lock_get_recursion(recursive_lock *lock); 61 61 62 extern status_t mutex_init(mutex *m, const char *name);63 extern void mutex_destroy(mutex *m);64 extern status_t mutex_trylock(mutex *mutex);65 extern status_t mutex_lock(mutex *m);66 extern void mutex_unlock(mutex *m);62 __attribute__((fastcall)) extern status_t mutex_init(mutex *m, const char *name); 63 __attribute__((fastcall)) extern void mutex_destroy(mutex *m); 64 __attribute__((fastcall)) extern status_t mutex_trylock(mutex *mutex); 65 __attribute__((fastcall)) extern status_t mutex_lock(mutex *m); 66 __attribute__((fastcall)) extern void mutex_unlock(mutex *m); 67 67 68 extern status_t benaphore_init(benaphore *ben, const char *name);69 extern void benaphore_destroy(benaphore *ben);68 __attribute__((fastcall)) extern status_t benaphore_init(benaphore *ben, const char *name); 69 __attribute__((fastcall)) extern void benaphore_destroy(benaphore *ben); 70 70 71 71 static inline status_t 72 72 benaphore_lock_etc(benaphore *ben, uint32 flags, bigtime_t timeout) … … 105 105 #endif 106 106 } 107 107 108 extern status_t rw_lock_init(rw_lock *lock, const char *name);109 extern void rw_lock_destroy(rw_lock *lock);110 extern status_t rw_lock_read_lock(rw_lock *lock);111 extern status_t rw_lock_read_unlock(rw_lock *lock);112 extern status_t rw_lock_write_lock(rw_lock *lock);113 extern status_t rw_lock_write_unlock(rw_lock *lock);108 __attribute__((fastcall)) extern status_t rw_lock_init(rw_lock *lock, const char *name); 109 __attribute__((fastcall)) extern void rw_lock_destroy(rw_lock *lock); 110 __attribute__((fastcall)) extern status_t rw_lock_read_lock(rw_lock *lock); 111 __attribute__((fastcall)) extern status_t rw_lock_read_unlock(rw_lock *lock); 112 __attribute__((fastcall)) extern status_t rw_lock_write_lock(rw_lock *lock); 113 __attribute__((fastcall)) extern status_t rw_lock_write_unlock(rw_lock *lock); 114 114 115 115 #ifdef __cplusplus 116 116 } -
headers/private/kernel/syscalls.h
467 467 #ifdef __cplusplus 468 468 } 469 469 #endif 470 471 470 #endif /* _KERNEL_SYSCALLS_H */ -
headers/private/kernel/thread.h
21 21 extern "C" { 22 22 #endif 23 23 24 void thread_enqueue(struct thread *t, struct thread_queue *q);25 struct thread *thread_lookat_queue(struct thread_queue *q);26 struct thread *thread_dequeue(struct thread_queue *q);27 struct thread *thread_dequeue_id(struct thread_queue *q, thread_id id);24 __attribute__((fastcall)) void thread_enqueue(struct thread *t, struct thread_queue *q); 25 __attribute__((fastcall)) struct thread *thread_lookat_queue(struct thread_queue *q); 26 __attribute__((fastcall)) struct thread *thread_dequeue(struct thread_queue *q); 27 __attribute__((fastcall)) struct thread *thread_dequeue_id(struct thread_queue *q, thread_id id); 28 28 29 void thread_at_kernel_entry(bigtime_t now);29 __attribute__((fastcall)) void thread_at_kernel_entry(bigtime_t now); 30 30 // called when the thread enters the kernel on behalf of the thread 31 31 void thread_at_kernel_exit(void); 32 32 void thread_at_kernel_exit_no_signals(void); 33 33 void thread_reset_for_exec(void); 34 34 35 status_t thread_init(struct kernel_args *args);36 status_t thread_preboot_init_percpu(struct kernel_args *args, int32 cpuNum);37 void thread_yield(bool force);35 __attribute__((fastcall)) status_t thread_init(struct kernel_args *args); 36 __attribute__((fastcall)) status_t thread_preboot_init_percpu(struct kernel_args *args, int32 cpuNum); 37 __attribute__((fastcall)) void thread_yield(bool force); 38 38 void thread_exit(void); 39 39 40 40 int32 thread_max_threads(void); … … 42 42 43 43 #define thread_get_current_thread arch_thread_get_current_thread 44 44 45 struct thread *thread_get_thread_struct(thread_id id);46 struct thread *thread_get_thread_struct_locked(thread_id id);45 __attribute__((fastcall)) struct thread *thread_get_thread_struct(thread_id id); 46 __attribute__((fastcall)) struct thread *thread_get_thread_struct_locked(thread_id id); 47 47 48 48 static thread_id thread_get_current_thread_id(void); 49 49 static inline thread_id … … 62 62 thread_id allocate_thread_id(void); 63 63 thread_id peek_next_thread_id(void); 64 64 65 thread_id spawn_kernel_thread_etc(thread_func, const char *name, int32 priority,65 __attribute__((fastcall)) thread_id spawn_kernel_thread_etc(thread_func, const char *name, int32 priority, 66 66 void *args, team_id team, thread_id threadID); 67 status_t wait_for_thread_etc(thread_id id, uint32 flags, bigtime_t timeout,67 __attribute__((fastcall)) status_t wait_for_thread_etc(thread_id id, uint32 flags, bigtime_t timeout, 68 68 status_t *_returnCode); 69 69 70 70 status_t select_thread(int32 object, struct select_info *info, bool kernel);