Ticket #2129: ugly-fastcall.r25229.patch

File ugly-fastcall.r25229.patch, 16.4 KB (added by tqh, 16 years ago)

Ugly fastcall patch against hrev25229

  • src/system/kernel/sem.cpp

     
    255255    \param nextID The ID the slot will get when reused. If < 0 the \a slot
    256256           is used.
    257257*/
    258 static void
     258__attribute__((fastcall)) static void
    259259free_sem_slot(int slot, sem_id nextID)
    260260{
    261261    struct sem_entry *sem = sSems + slot;
     
    286286    thread.
    287287    The thread lock must be held when called.
    288288*/
    289 static void
     289__attribute__((fastcall)) static void
    290290fill_sem_info(struct sem_entry *sem, sem_info *info, size_t size)
    291291{
    292292    info->sem = sem->id;
     
    300300//  #pragma mark - Private Kernel API
    301301
    302302
    303 status_t
     303__attribute__((fastcall)) status_t
    304304sem_init(kernel_args *args)
    305305{
    306306    area_id area;
     
    363363    should not be made public - if possible, we should remove it
    364364    completely (and have only create_sem() exported).
    365365*/
    366 sem_id
     366__attribute__((fastcall)) sem_id
    367367create_sem_etc(int32 count, const char *name, team_id owner)
    368368{
    369369    struct sem_entry *sem = NULL;
     
    520520    other threads in the process.
    521521    Must be called with semaphore lock held. The thread lock must not be held.
    522522*/
    523 static void
     523__attribute__((fastcall)) static void
    524524remove_thread_from_sem(queued_thread *entry, struct sem_entry *sem)
    525525{
    526526    if (!entry->queued)
     
    568568/*! This function cycles through the sem table, deleting all the sems
    569569    that are owned by the specified team.
    570570*/
    571 int
     571__attribute__((fastcall)) int
    572572sem_delete_owned_sems(team_id owner)
    573573{
    574574    int state;
  • src/system/kernel/lock.c

     
    1818#include <thread.h>
    1919
    2020
    21 int32
     21__attribute__((fastcall)) int32
    2222recursive_lock_get_recursion(recursive_lock *lock)
    2323{
    2424    if (lock->holder == thread_get_current_thread_id())
     
    2828}
    2929
    3030
    31 status_t
     31__attribute__((fastcall)) status_t
    3232recursive_lock_init(recursive_lock *lock, const char *name)
    3333{
    3434    if (lock == NULL)
     
    4848}
    4949
    5050
    51 void
     51__attribute__((fastcall)) void
    5252recursive_lock_destroy(recursive_lock *lock)
    5353{
    5454    if (lock == NULL)
     
    5959}
    6060
    6161
    62 status_t
     62__attribute__((fastcall)) status_t
    6363recursive_lock_lock(recursive_lock *lock)
    6464{
    6565    thread_id thread = thread_get_current_thread_id();
     
    7979}
    8080
    8181
    82 void
     82__attribute__((fastcall)) void
    8383recursive_lock_unlock(recursive_lock *lock)
    8484{
    8585    if (thread_get_current_thread_id() != lock->holder)
     
    9595//  #pragma mark -
    9696
    9797
    98 status_t
     98__attribute__((fastcall)) status_t
    9999mutex_init(mutex *m, const char *name)
    100100{
    101101    if (m == NULL)
     
    114114}
    115115
    116116
    117 void
     117__attribute__((fastcall)) void
    118118mutex_destroy(mutex *mutex)
    119119{
    120120    if (mutex == NULL)
     
    128128}
    129129
    130130
    131 status_t
     131__attribute__((fastcall)) status_t
    132132mutex_trylock(mutex *mutex)
    133133{
    134134    thread_id me = thread_get_current_thread_id();
     
    151151}
    152152
    153153
    154 status_t
     154__attribute__((fastcall)) status_t
    155155mutex_lock(mutex *mutex)
    156156{
    157157    thread_id me = thread_get_current_thread_id();
     
    174174}
    175175
    176176
    177 void
     177__attribute__((fastcall)) void
    178178mutex_unlock(mutex *mutex)
    179179{
    180180    thread_id me = thread_get_current_thread_id();
     
    195195//  #pragma mark -
    196196
    197197
    198 status_t
     198__attribute__((fastcall)) status_t
    199199benaphore_init(benaphore *ben, const char *name)
    200200{
    201201    if (ben == NULL || name == NULL)
     
    214214}
    215215
    216216
    217 void
     217__attribute__((fastcall)) void
    218218benaphore_destroy(benaphore *ben)
    219219{
    220220    delete_sem(ben->sem);
     
    225225//  #pragma mark -
    226226
    227227
    228 status_t
     228__attribute__((fastcall)) status_t
    229229rw_lock_init(rw_lock *lock, const char *name)
    230230{
    231231    if (lock == NULL)
     
    242242}
    243243
    244244
    245 void
     245__attribute__((fastcall)) void
    246246rw_lock_destroy(rw_lock *lock)
    247247{
    248248    if (lock == NULL)
     
    252252}
    253253
    254254
    255 status_t
     255__attribute__((fastcall)) status_t
    256256rw_lock_read_lock(rw_lock *lock)
    257257{
    258258    return acquire_sem(lock->sem);
    259259}
    260260
    261261
    262 status_t
     262__attribute__((fastcall)) status_t
    263263rw_lock_read_unlock(rw_lock *lock)
    264264{
    265265    return release_sem_etc(lock->sem, 1, 0/*B_DO_NOT_RESCHEDULE*/);
    266266}
    267267
    268268
    269 status_t
     269__attribute__((fastcall)) status_t
    270270rw_lock_write_lock(rw_lock *lock)
    271271{
    272272    return acquire_sem_etc(lock->sem, RW_MAX_READERS, 0, 0);
    273273}
    274274
    275275
    276 status_t
     276__attribute__((fastcall)) status_t
    277277rw_lock_write_unlock(rw_lock *lock)
    278278{
    279279    return release_sem_etc(lock->sem, RW_MAX_READERS, 0);
  • headers/private/kernel/condition_variable.h

     
    2727    inline                      ~ConditionVariableEntry();
    2828#endif
    2929
    30             bool                Add(const void* object, uint32 flags = 0);
    31             status_t            Wait(uint32 timeoutFlags = 0,
     30            __attribute__((fastcall)) bool              Add(const void* object, uint32 flags = 0);
     31            __attribute__((fastcall)) status_t          Wait(uint32 timeoutFlags = 0,
    3232                                    bigtime_t timeout = 0);
    33             status_t            Wait(const void* object, uint32 flags = 0,
     33            __attribute__((fastcall)) status_t          Wait(const void* object, uint32 flags = 0,
    3434                                    bigtime_t timeout = 0);
    3535
    3636    inline  ConditionVariable* Variable() const     { return fVariable; }
     
    4949
    5050class ConditionVariable : protected HashTableLink<ConditionVariable> {
    5151public:
    52             void                Init(const void* object,
     52            __attribute__((fastcall)) void              Init(const void* object,
    5353                                    const char* objectType);
    5454                                    // for anonymous (unpublished) cvars
    5555
    56             void                Publish(const void* object,
     56            __attribute__((fastcall)) void              Publish(const void* object,
    5757                                    const char* objectType);
    58             void                Unpublish(bool threadsLocked = false);
     58            __attribute__((fastcall)) void              Unpublish(bool threadsLocked = false);
    5959
    6060    inline  void                NotifyOne(bool threadsLocked = false);
    6161    inline  void                NotifyAll(bool threadsLocked = false);
    6262
    63             void                Add(ConditionVariableEntry* entry,
     63            __attribute__((fastcall)) void              Add(ConditionVariableEntry* entry,
    6464                                    uint32 flags = 0);
    6565
    6666            const void*         Object() const  { return fObject; }
     
    6969            void                Dump() const;
    7070
    7171private:
    72             void                _Notify(bool all, bool threadsLocked);
    73             void                _NotifyChecked(bool all, status_t result);
     72            __attribute__((fastcall)) void              _Notify(bool all, bool threadsLocked);
     73            __attribute__((fastcall)) void              _NotifyChecked(bool all, status_t result);
    7474
    7575protected:
    7676            typedef DoublyLinkedList<ConditionVariableEntry> EntryList;
  • headers/private/kernel/kscheduler.h

     
    1313extern "C" {
    1414#endif
    1515
    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);
    1818void scheduler_reschedule(void);
    1919
    2020void scheduler_init(void);
  • headers/private/kernel/sem.h

     
    2020extern "C" {
    2121#endif
    2222
    23 extern status_t sem_init(struct kernel_args *args);
    24 extern int sem_delete_owned_sems(team_id owner);
     23extern __attribute__((fastcall)) status_t sem_init(struct kernel_args *args);
     24extern __attribute__((fastcall)) int sem_delete_owned_sems(team_id owner);
    2525extern int32 sem_used_sems(void);
    2626extern int32 sem_max_sems(void);
    2727
     
    2929extern status_t deselect_sem(int32 object, struct select_info *info,
    3030            bool kernel);
    3131
    32 extern sem_id create_sem_etc(int32 count, const char *name, team_id owner);
     32extern __attribute__((fastcall)) sem_id create_sem_etc(int32 count, const char *name, team_id owner);
    3333
    3434/* user calls */
    3535sem_id _user_create_sem(int32 count, const char *name);
  • headers/private/kernel/heap.h

     
    2222extern "C" {
    2323#endif
    2424
    25 void *memalign(size_t alignment, size_t size);
     25__attribute__((fastcall)) void *memalign(size_t alignment, size_t size);
    2626
    27 void deferred_free(void* block);
     27__attribute__((fastcall)) void deferred_free(void* block);
    2828
    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);
    3232
    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();
    3636
    3737#ifdef __cplusplus
    3838}
  • headers/private/kernel/lock.h

     
    5353extern "C" {
    5454#endif
    5555
    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);
     56extern __attribute__((fastcall)) status_t   recursive_lock_init(recursive_lock *lock, const char *name);
     57extern __attribute__((fastcall)) void recursive_lock_destroy(recursive_lock *lock);
     58extern __attribute__((fastcall)) status_t recursive_lock_lock(recursive_lock *lock);
     59extern __attribute__((fastcall)) void recursive_lock_unlock(recursive_lock *lock);
     60extern __attribute__((fastcall)) int32 recursive_lock_get_recursion(recursive_lock *lock);
    6161
    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);
     62extern __attribute__((fastcall)) status_t   mutex_init(mutex *m, const char *name);
     63extern __attribute__((fastcall)) void mutex_destroy(mutex *m);
     64extern __attribute__((fastcall)) status_t mutex_trylock(mutex *mutex);
     65extern __attribute__((fastcall)) status_t mutex_lock(mutex *m);
     66extern __attribute__((fastcall)) void mutex_unlock(mutex *m);
    6767
    68 extern status_t benaphore_init(benaphore *ben, const char *name);
    69 extern void benaphore_destroy(benaphore *ben);
     68extern __attribute__((fastcall)) status_t benaphore_init(benaphore *ben, const char *name);
     69extern __attribute__((fastcall)) void benaphore_destroy(benaphore *ben);
    7070
    7171static inline status_t
    7272benaphore_lock_etc(benaphore *ben, uint32 flags, bigtime_t timeout)
     
    105105#endif
    106106}
    107107
    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);
     108extern __attribute__((fastcall)) status_t rw_lock_init(rw_lock *lock, const char *name);
     109extern __attribute__((fastcall)) void rw_lock_destroy(rw_lock *lock);
     110extern __attribute__((fastcall)) status_t rw_lock_read_lock(rw_lock *lock);
     111extern __attribute__((fastcall)) status_t rw_lock_read_unlock(rw_lock *lock);
     112extern __attribute__((fastcall)) status_t rw_lock_write_lock(rw_lock *lock);
     113extern __attribute__((fastcall)) status_t rw_lock_write_unlock(rw_lock *lock);
    114114
    115115#ifdef __cplusplus
    116116}
  • headers/private/kernel/slab/Depot.h

     
    2828    void (*returnObject)(object_depot *, void *));
    2929void object_depot_destroy(object_depot *depot);
    3030
     31__attribute__((fastcall))
    3132void *object_depot_obtain(object_depot *depot);
     33__attribute__((fastcall))
    3234int object_depot_store(object_depot *depot, void *object);
    3335
    3436void object_depot_make_empty(object_depot *depot);
  • headers/private/kernel/slab/Slab.h

     
    4545    object_cache_reclaimer reclaimer);
    4646
    4747void delete_object_cache(object_cache *cache);
    48 
     48__attribute__((fastcall))
    4949void *object_cache_alloc(object_cache *cache, uint32 flags);
     50__attribute__((fastcall))
    5051void object_cache_free(object_cache *cache, void *object);
    51 
     52__attribute__((fastcall))
    5253status_t object_cache_reserve(object_cache *cache, size_t object_count,
    5354    uint32 flags);
    5455
  • headers/private/kernel/thread.h

     
    2626extern "C" {
    2727#endif
    2828
    29 void thread_enqueue(struct thread *t, struct thread_queue *q);
    30 struct thread *thread_lookat_queue(struct thread_queue *q);
    31 struct thread *thread_dequeue(struct thread_queue *q);
    32 struct thread *thread_dequeue_id(struct thread_queue *q, thread_id id);
     29__attribute__((fastcall)) void thread_enqueue(struct thread *t, struct thread_queue *q);
     30__attribute__((fastcall)) struct thread *thread_lookat_queue(struct thread_queue *q);
     31__attribute__((fastcall)) struct thread *thread_dequeue(struct thread_queue *q);
     32__attribute__((fastcall)) struct thread *thread_dequeue_id(struct thread_queue *q, thread_id id);
    3333
    34 void thread_at_kernel_entry(bigtime_t now);
     34__attribute__((fastcall)) void thread_at_kernel_entry(bigtime_t now);
    3535    // called when the thread enters the kernel on behalf of the thread
    3636void thread_at_kernel_exit(void);
    3737void thread_at_kernel_exit_no_signals(void);
    3838void thread_reset_for_exec(void);
    3939
    40 status_t thread_init(struct kernel_args *args);
    41 status_t thread_preboot_init_percpu(struct kernel_args *args, int32 cpuNum);
    42 void thread_yield(bool force);
     40__attribute__((fastcall)) status_t thread_init(struct kernel_args *args);
     41__attribute__((fastcall)) status_t thread_preboot_init_percpu(struct kernel_args *args, int32 cpuNum);
     42__attribute__((fastcall)) void thread_yield(bool force);
    4343void thread_exit(void);
    4444
    4545int32 thread_max_threads(void);
     
    4747
    4848#define thread_get_current_thread arch_thread_get_current_thread
    4949
    50 struct thread *thread_get_thread_struct(thread_id id);
    51 struct thread *thread_get_thread_struct_locked(thread_id id);
     50__attribute__((fastcall)) struct thread *thread_get_thread_struct(thread_id id);
     51__attribute__((fastcall)) struct thread *thread_get_thread_struct_locked(thread_id id);
    5252
    5353static thread_id thread_get_current_thread_id(void);
    5454static inline thread_id
     
    6767thread_id allocate_thread_id(void);
    6868thread_id peek_next_thread_id(void);
    6969
    70 thread_id spawn_kernel_thread_etc(thread_func, const char *name, int32 priority,
     70__attribute__((fastcall)) thread_id spawn_kernel_thread_etc(thread_func, const char *name, int32 priority,
    7171    void *args, team_id team, thread_id threadID);
    72 status_t wait_for_thread_etc(thread_id id, uint32 flags, bigtime_t timeout,
     72__attribute__((fastcall)) status_t wait_for_thread_etc(thread_id id, uint32 flags, bigtime_t timeout,
    7373    status_t *_returnCode);
    7474
    7575status_t select_thread(int32 object, struct select_info *info, bool kernel);
     
    7878#define syscall_64_bit_return_value() arch_syscall_64_bit_return_value()
    7979
    8080status_t thread_block();
    81 status_t thread_block_with_timeout(uint32 timeoutFlags, bigtime_t timeout);
    82 status_t thread_block_with_timeout_locked(uint32 timeoutFlags,
     81__attribute__((fastcall)) status_t thread_block_with_timeout(uint32 timeoutFlags, bigtime_t timeout);
     82__attribute__((fastcall)) status_t thread_block_with_timeout_locked(uint32 timeoutFlags,
    8383            bigtime_t timeout);
    84 bool thread_unblock(status_t threadID, status_t status);
     84__attribute__((fastcall)) bool thread_unblock(status_t threadID, status_t status);
    8585
    8686// used in syscalls.c
    8787status_t _user_set_thread_priority(thread_id thread, int32 newPriority);