Changeset 26e7d6d in mainline for kernel/generic/src


Ignore:
Timestamp:
2011-09-19T16:31:00Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a347a11
Parents:
3842a955 (diff), 086290d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

Location:
kernel/generic/src
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/adt/list.c

    r3842a955 r26e7d6d  
    4949 * @param list  List to look in.
    5050 *
    51  * @return true if link is contained in head, false otherwise.
     51 * @return true if link is contained in list, false otherwise.
    5252 *
    5353 */
  • kernel/generic/src/console/console.c

    r3842a955 r26e7d6d  
    8787};
    8888
    89 static void stdout_write(outdev_t *, wchar_t, bool);
     89static void stdout_write(outdev_t *, wchar_t);
    9090static void stdout_redraw(outdev_t *);
    9191
     
    9595};
    9696
    97 /** Silence output */
    98 bool silent = false;
     97/** Override kernel console lockout */
     98bool console_override = false;
    9999
    100100/** Standard input and output character devices */
     
    122122}
    123123
    124 static void stdout_write(outdev_t *dev, wchar_t ch, bool silent)
     124static void stdout_write(outdev_t *dev, wchar_t ch)
    125125{
    126126        list_foreach(dev->list, cur) {
    127127                outdev_t *sink = list_get_instance(cur, outdev_t, link);
    128128                if ((sink) && (sink->op->write))
    129                         sink->op->write(sink, ch, silent);
     129                        sink->op->write(sink, ch);
    130130        }
    131131}
     
    156156        klog_parea.frames = SIZE2FRAMES(sizeof(klog));
    157157        klog_parea.unpriv = false;
     158        klog_parea.mapped = false;
    158159        ddi_parea_register(&klog_parea);
    159160       
     
    167168void grab_console(void)
    168169{
    169         bool prev = silent;
    170        
    171         silent = false;
     170        bool prev = console_override;
     171       
     172        console_override = true;
    172173        if ((stdout) && (stdout->op->redraw))
    173174                stdout->op->redraw(stdout);
    174175       
    175         if ((stdin) && (prev)) {
     176        if ((stdin) && (!prev)) {
    176177                /*
    177178                 * Force the console to print the prompt.
     
    183184void release_console(void)
    184185{
    185         // FIXME arch_release_console
    186         silent = true;
    187 }
    188 
    189 /** Tell kernel to get keyboard/console access again */
    190 sysarg_t sys_debug_enable_console(void)
     186        console_override = false;
     187}
     188
     189/** Activate kernel console override */
     190sysarg_t sys_debug_activate_console(void)
    191191{
    192192#ifdef CONFIG_KCONSOLE
     
    196196        return false;
    197197#endif
    198 }
    199 
    200 /** Tell kernel to relinquish keyboard/console access */
    201 sysarg_t sys_debug_disable_console(void)
    202 {
    203         release_console();
    204         return true;
    205198}
    206199
     
    255248}
    256249
    257 void klog_update(void)
     250void klog_update(void *event)
    258251{
    259252        if (!atomic_get(&klog_inited))
     
    289282                         */
    290283                        spinlock_unlock(&klog_lock);
    291                         stdout->op->write(stdout, tmp, silent);
     284                        stdout->op->write(stdout, tmp);
    292285                        spinlock_lock(&klog_lock);
    293286                }
     
    317310                 * it should be no longer buffered.
    318311                 */
    319                 stdout->op->write(stdout, ch, silent);
     312                stdout->op->write(stdout, ch);
    320313        } else {
    321314                /*
     
    334327        /* Force notification on newline */
    335328        if (ch == '\n')
    336                 klog_update();
     329                klog_update(NULL);
    337330}
    338331
     
    365358                free(data);
    366359        } else
    367                 klog_update();
     360                klog_update(NULL);
    368361       
    369362        return size;
  • kernel/generic/src/ddi/ddi.c

    r3842a955 r26e7d6d  
    4141
    4242#include <ddi/ddi.h>
    43 #include <ddi/ddi_arg.h>
    4443#include <proc/task.h>
    4544#include <security/cap.h>
     
    122121        backend_data.frames = pages;
    123122       
    124         /* Find the zone of the physical memory */
     123        /*
     124         * Check if the memory region is explicitly enabled
     125         * for mapping by any parea structure.
     126         */
     127       
     128        mutex_lock(&parea_lock);
     129        btree_node_t *nodep;
     130        parea_t *parea = (parea_t *) btree_search(&parea_btree,
     131            (btree_key_t) pf, &nodep);
     132       
     133        if ((parea != NULL) && (parea->frames >= pages)) {
     134                if ((!priv) && (!parea->unpriv)) {
     135                        mutex_unlock(&parea_lock);
     136                        return EPERM;
     137                }
     138               
     139                goto map;
     140        }
     141       
     142        parea = NULL;
     143        mutex_unlock(&parea_lock);
     144       
     145        /*
     146         * Check if the memory region is part of physical
     147         * memory generally enabled for mapping.
     148         */
     149       
    125150        irq_spinlock_lock(&zones.lock, true);
    126151        size_t znum = find_zone(ADDR2PFN(pf), pages, 0);
     
    153178        }
    154179       
    155         if (zone_flags_available(zones.info[znum].flags)) {
    156                 /*
    157                  * Frames are part of physical memory, check
    158                  * if the memory region is enabled for mapping.
    159                  */
    160                 irq_spinlock_unlock(&zones.lock, true);
    161                
    162                 mutex_lock(&parea_lock);
    163                 btree_node_t *nodep;
    164                 parea_t *parea = (parea_t *) btree_search(&parea_btree,
    165                     (btree_key_t) pf, &nodep);
    166                
    167                 if ((!parea) || (parea->frames < pages)) {
    168                         mutex_unlock(&parea_lock);
    169                         return ENOENT;
    170                 }
    171                
    172                 if (!priv) {
    173                         if (!parea->unpriv) {
    174                                 mutex_unlock(&parea_lock);
    175                                 return EPERM;
    176                         }
    177                 }
    178                
    179                 mutex_unlock(&parea_lock);
    180                 goto map;
    181         }
    182        
    183180        irq_spinlock_unlock(&zones.lock, true);
    184181        return ENOENT;
     
    188185            AS_AREA_ATTR_NONE, &phys_backend, &backend_data)) {
    189186                /*
    190                  * The address space area could not have been created.
     187                 * The address space area was not created.
    191188                 * We report it using ENOMEM.
    192189                 */
     190               
     191                if (parea != NULL)
     192                        mutex_unlock(&parea_lock);
     193               
    193194                return ENOMEM;
    194195        }
     
    197198         * Mapping is created on-demand during page fault.
    198199         */
    199         return 0;
     200       
     201        if (parea != NULL) {
     202                parea->mapped = true;
     203                mutex_unlock(&parea_lock);
     204        }
     205       
     206        return EOK;
    200207}
    201208
  • kernel/generic/src/ddi/irq.c

    r3842a955 r26e7d6d  
    275275{
    276276        /*
    277          * If the kernel console is silenced,
    278          * then try first the uspace handlers,
    279          * eventually fall back to kernel handlers.
     277         * If the kernel console override is on,
     278         * then try first the kernel handlers
     279         * and eventually fall back to uspace
     280         * handlers.
    280281         *
    281          * If the kernel console is active,
    282          * then do it the other way around.
     282         * In the usual case the uspace handlers
     283         * have precedence.
    283284         */
    284         if (silent) {
    285                 irq_t *irq = irq_dispatch_and_lock_uspace(inr);
     285       
     286        if (console_override) {
     287                irq_t *irq = irq_dispatch_and_lock_kernel(inr);
    286288                if (irq)
    287289                        return irq;
    288290               
    289                 return irq_dispatch_and_lock_kernel(inr);
    290         }
    291        
    292         irq_t *irq = irq_dispatch_and_lock_kernel(inr);
     291                return irq_dispatch_and_lock_uspace(inr);
     292        }
     293       
     294        irq_t *irq = irq_dispatch_and_lock_uspace(inr);
    293295        if (irq)
    294296                return irq;
    295297       
    296         return irq_dispatch_and_lock_uspace(inr);
     298        return irq_dispatch_and_lock_kernel(inr);
    297299}
    298300
  • kernel/generic/src/debug/panic.c

    r3842a955 r26e7d6d  
    4848    uintptr_t address, const char *fmt, ...)
    4949{
    50         va_list args;
    51        
    52         silent = false;
     50        console_override = true;
    5351       
    5452        printf("\n%s Kernel panic ", BANNER_LEFT);
     
    5755        printf("due to ");
    5856       
     57        va_list args;
    5958        va_start(args, fmt);
    6059        if (cat == PANIC_ASSERT) {
  • kernel/generic/src/ipc/event.c

    r3842a955 r26e7d6d  
    3636
    3737#include <ipc/event.h>
    38 #include <ipc/event_types.h>
    3938#include <mm/slab.h>
    4039#include <typedefs.h>
    4140#include <synch/spinlock.h>
    4241#include <console/console.h>
     42#include <proc/task.h>
    4343#include <memstr.h>
    4444#include <errno.h>
     
    4848static event_t events[EVENT_END];
    4949
     50static void event_initialize(event_t *event)
     51{
     52        spinlock_initialize(&event->lock, "event.lock");
     53        event->answerbox = NULL;
     54        event->counter = 0;
     55        event->imethod = 0;
     56        event->masked = false;
     57        event->unmask_callback = NULL;
     58}
     59
     60static event_t *evno2event(int evno, task_t *t)
     61{
     62        ASSERT(evno < EVENT_TASK_END);
     63
     64        event_t *event;
     65
     66        if (evno < EVENT_END)
     67                event = &events[(event_type_t) evno];
     68        else
     69                event = &t->events[(event_task_type_t) evno - EVENT_END];
     70
     71        return event;
     72}
     73
    5074/** Initialize kernel events.
    5175 *
     
    5377void event_init(void)
    5478{
    55         for (unsigned int i = 0; i < EVENT_END; i++) {
    56                 spinlock_initialize(&events[i].lock, "event.lock");
    57                 events[i].answerbox = NULL;
    58                 events[i].counter = 0;
    59                 events[i].imethod = 0;
    60                 events[i].masked = false;
    61                 events[i].unmask_callback = NULL;
    62         }
    63 }
     79        for (unsigned int i = 0; i < EVENT_END; i++)
     80                event_initialize(evno2event(i, NULL));
     81}
     82
     83void event_task_init(task_t *task)
     84{
     85        for (unsigned int i = EVENT_END; i < EVENT_TASK_END; i++)
     86                event_initialize(evno2event(i, task));
     87}
     88
    6489
    6590/** Unsubscribe kernel events associated with an answerbox
     
    84109}
    85110
     111static void _event_set_unmask_callback(event_t *event, event_callback_t callback)
     112{
     113        spinlock_lock(&event->lock);
     114        event->unmask_callback = callback;
     115        spinlock_unlock(&event->lock);
     116}
     117
    86118/** Define a callback function for the event unmask event.
    87119 *
     
    95127        ASSERT(evno < EVENT_END);
    96128       
    97         spinlock_lock(&events[evno].lock);
    98         events[evno].unmask_callback = callback;
    99         spinlock_unlock(&events[evno].lock);
     129        _event_set_unmask_callback(evno2event(evno, NULL), callback);
     130}
     131
     132void event_task_set_unmask_callback(task_t *task, event_task_type_t evno,
     133    event_callback_t callback)
     134{
     135        ASSERT(evno >= (int) EVENT_END);
     136        ASSERT(evno < EVENT_TASK_END);
     137               
     138        _event_set_unmask_callback(evno2event(evno, task), callback);
     139}
     140
     141static int event_enqueue(event_t *event, bool mask, sysarg_t a1, sysarg_t a2,
     142    sysarg_t a3, sysarg_t a4, sysarg_t a5)
     143{
     144        int res;
     145
     146        spinlock_lock(&event->lock);
     147       
     148        if (event->answerbox != NULL) {
     149                if (!event->masked) {
     150                        call_t *call = ipc_call_alloc(FRAME_ATOMIC);
     151                       
     152                        if (call) {
     153                                call->flags |= IPC_CALL_NOTIF;
     154                                call->priv = ++event->counter;
     155                               
     156                                IPC_SET_IMETHOD(call->data, event->imethod);
     157                                IPC_SET_ARG1(call->data, a1);
     158                                IPC_SET_ARG2(call->data, a2);
     159                                IPC_SET_ARG3(call->data, a3);
     160                                IPC_SET_ARG4(call->data, a4);
     161                                IPC_SET_ARG5(call->data, a5);
     162                               
     163                                call->data.task_id = TASK ? TASK->taskid : 0;
     164                               
     165                                irq_spinlock_lock(&event->answerbox->irq_lock, true);
     166                                list_append(&call->link, &event->answerbox->irq_notifs);
     167                                irq_spinlock_unlock(&event->answerbox->irq_lock, true);
     168                               
     169                                waitq_wakeup(&event->answerbox->wq, WAKEUP_FIRST);
     170                               
     171                                if (mask)
     172                                        event->masked = true;
     173                               
     174                                res = EOK;
     175                        } else
     176                                res = ENOMEM;
     177                } else
     178                        res = EBUSY;
     179        } else
     180                res = ENOENT;
     181       
     182        spinlock_unlock(&event->lock);
     183        return res;
    100184}
    101185
     
    124208        ASSERT(evno < EVENT_END);
    125209       
    126         spinlock_lock(&events[evno].lock);
    127        
    128         int ret;
    129        
    130         if (events[evno].answerbox != NULL) {
    131                 if (!events[evno].masked) {
    132                         call_t *call = ipc_call_alloc(FRAME_ATOMIC);
    133                        
    134                         if (call) {
    135                                 call->flags |= IPC_CALL_NOTIF;
    136                                 call->priv = ++events[evno].counter;
    137                                
    138                                 IPC_SET_IMETHOD(call->data, events[evno].imethod);
    139                                 IPC_SET_ARG1(call->data, a1);
    140                                 IPC_SET_ARG2(call->data, a2);
    141                                 IPC_SET_ARG3(call->data, a3);
    142                                 IPC_SET_ARG4(call->data, a4);
    143                                 IPC_SET_ARG5(call->data, a5);
    144                                
    145                                 irq_spinlock_lock(&events[evno].answerbox->irq_lock, true);
    146                                 list_append(&call->link, &events[evno].answerbox->irq_notifs);
    147                                 irq_spinlock_unlock(&events[evno].answerbox->irq_lock, true);
    148                                
    149                                 waitq_wakeup(&events[evno].answerbox->wq, WAKEUP_FIRST);
    150                                
    151                                 if (mask)
    152                                         events[evno].masked = true;
    153                                
    154                                 ret = EOK;
    155                         } else
    156                                 ret = ENOMEM;
    157                 } else
    158                         ret = EBUSY;
    159         } else
    160                 ret = ENOENT;
    161        
    162         spinlock_unlock(&events[evno].lock);
    163        
    164         return ret;
     210        return event_enqueue(evno2event(evno, NULL), mask, a1, a2, a3, a4, a5);
     211}
     212
     213/** Send per-task kernel notification event
     214 *
     215 * @param task Destination task.
     216 * @param evno Event type.
     217 * @param mask Mask further notifications after a successful
     218 *             sending.
     219 * @param a1   First argument.
     220 * @param a2   Second argument.
     221 * @param a3   Third argument.
     222 * @param a4   Fourth argument.
     223 * @param a5   Fifth argument.
     224 *
     225 * @return EOK if notification was successfully sent.
     226 * @return ENOMEM if the notification IPC message failed to allocate.
     227 * @return EBUSY if the notifications of the given type are
     228 *         currently masked.
     229 * @return ENOENT if the notifications of the given type are
     230 *         currently not subscribed.
     231 *
     232 */
     233int event_task_notify(task_t *task, event_task_type_t evno, bool mask,
     234    sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5)
     235{
     236        ASSERT(evno >= (int) EVENT_END);
     237        ASSERT(evno < EVENT_TASK_END);
     238       
     239        return event_enqueue(evno2event(evno, task), mask, a1, a2, a3, a4, a5);
    165240}
    166241
     
    177252 *
    178253 */
    179 static int event_subscribe(event_type_t evno, sysarg_t imethod,
     254static int event_subscribe(event_t *event, sysarg_t imethod,
    180255    answerbox_t *answerbox)
    181256{
    182         ASSERT(evno < EVENT_END);
    183        
    184         spinlock_lock(&events[evno].lock);
    185        
    186257        int res;
    187        
    188         if (events[evno].answerbox == NULL) {
    189                 events[evno].answerbox = answerbox;
    190                 events[evno].imethod = imethod;
    191                 events[evno].counter = 0;
    192                 events[evno].masked = false;
     258
     259        spinlock_lock(&event->lock);
     260       
     261        if (event->answerbox == NULL) {
     262                event->answerbox = answerbox;
     263                event->imethod = imethod;
     264                event->counter = 0;
     265                event->masked = false;
    193266                res = EOK;
    194267        } else
    195268                res = EEXISTS;
    196269       
    197         spinlock_unlock(&events[evno].lock);
     270        spinlock_unlock(&event->lock);
    198271       
    199272        return res;
     
    205278 *
    206279 */
    207 static void event_unmask(event_type_t evno)
    208 {
    209         ASSERT(evno < EVENT_END);
    210        
    211         spinlock_lock(&events[evno].lock);
    212         events[evno].masked = false;
    213         event_callback_t callback = events[evno].unmask_callback;
    214         spinlock_unlock(&events[evno].lock);
     280static void event_unmask(event_t *event)
     281{
     282        spinlock_lock(&event->lock);
     283        event->masked = false;
     284        event_callback_t callback = event->unmask_callback;
     285        spinlock_unlock(&event->lock);
    215286       
    216287        /*
     
    219290         */
    220291        if (callback != NULL)
    221                 callback();
     292                callback(event);
    222293}
    223294
     
    236307sysarg_t sys_event_subscribe(sysarg_t evno, sysarg_t imethod)
    237308{
    238         if (evno >= EVENT_END)
     309        if (evno >= EVENT_TASK_END)
    239310                return ELIMIT;
    240311       
    241         return (sysarg_t) event_subscribe((event_type_t) evno, (sysarg_t)
    242             imethod, &TASK->answerbox);
     312        return (sysarg_t) event_subscribe(evno2event(evno, TASK),
     313            (sysarg_t) imethod, &TASK->answerbox);
    243314}
    244315
     
    258329sysarg_t sys_event_unmask(sysarg_t evno)
    259330{
    260         if (evno >= EVENT_END)
     331        if (evno >= EVENT_TASK_END)
    261332                return ELIMIT;
    262333       
    263         event_unmask((event_type_t) evno);
     334        event_unmask(evno2event(evno, TASK));
     335
    264336        return EOK;
    265337}
  • kernel/generic/src/ipc/ipc.c

    r3842a955 r26e7d6d  
    3838 */
    3939
    40 #include <synch/synch.h>
    4140#include <synch/spinlock.h>
    4241#include <synch/mutex.h>
    4342#include <synch/waitq.h>
    44 #include <synch/synch.h>
    4543#include <ipc/ipc.h>
    46 #include <ipc/ipc_methods.h>
     44#include <abi/ipc/methods.h>
    4745#include <ipc/kbox.h>
    4846#include <ipc/event.h>
     
    232230                }
    233231        }
     232
     233        call->data.task_id = TASK->taskid;
    234234       
    235235        if (do_lock)
     
    296296                atomic_inc(&phone->active_calls);
    297297                call->data.phone = phone;
    298                 call->data.task = TASK;
     298                call->data.task_id = TASK->taskid;
    299299        }
    300300       
     
    408408                        call->caller_phone = call->data.phone;
    409409                call->data.phone = newphone;
    410                 call->data.task = TASK;
     410                call->data.task_id = TASK->taskid;
    411411        }
    412412       
  • kernel/generic/src/ipc/kbox.c

    r3842a955 r26e7d6d  
    3333 */
    3434
    35 #include <synch/synch.h>
    3635#include <synch/spinlock.h>
    3736#include <synch/mutex.h>
    3837#include <ipc/ipc.h>
    39 #include <ipc/ipc_methods.h>
     38#include <abi/ipc/methods.h>
    4039#include <ipc/ipcrsc.h>
    4140#include <arch.h>
  • kernel/generic/src/ipc/sysipc.c

    r3842a955 r26e7d6d  
    4040#include <debug.h>
    4141#include <ipc/ipc.h>
    42 #include <ipc/ipc_methods.h>
     42#include <abi/ipc/methods.h>
    4343#include <ipc/sysipc.h>
    4444#include <ipc/irq.h>
    4545#include <ipc/ipcrsc.h>
     46#include <ipc/event.h>
    4647#include <ipc/kbox.h>
    4748#include <synch/waitq.h>
     
    5354#include <mm/as.h>
    5455#include <print.h>
     56#include <macros.h>
    5557
    5658/**
     
    134136        case IPC_M_DATA_WRITE:
    135137        case IPC_M_DATA_READ:
     138        case IPC_M_STATE_CHANGE_AUTHORIZE:
    136139                return true;
    137140        default:
     
    164167        case IPC_M_DATA_WRITE:
    165168        case IPC_M_DATA_READ:
     169        case IPC_M_STATE_CHANGE_AUTHORIZE:
    166170                return true;
    167171        default:
     
    249253                        /* The connection was accepted */
    250254                        phone_connect(phoneid, &answer->sender->answerbox);
    251                         /* Set 'task hash' as arg4 of response */
    252                         IPC_SET_ARG4(answer->data, (sysarg_t) TASK);
    253255                        /* Set 'phone hash' as arg5 of response */
    254256                        IPC_SET_ARG5(answer->data,
     
    334336                free(answer->buffer);
    335337                answer->buffer = NULL;
     338        } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_STATE_CHANGE_AUTHORIZE) {
     339                if (!IPC_GET_RETVAL(answer->data)) {
     340                        /* The recipient authorized the change of state. */
     341                        phone_t *recipient_phone;
     342                        task_t *other_task_s;
     343                        task_t *other_task_r;
     344                        int rc;
     345
     346                        rc = phone_get(IPC_GET_ARG1(answer->data),
     347                            &recipient_phone);
     348                        if (rc != EOK) {
     349                                IPC_SET_RETVAL(answer->data, ENOENT);
     350                                return ENOENT;
     351                        }
     352
     353                        mutex_lock(&recipient_phone->lock);
     354                        if (recipient_phone->state != IPC_PHONE_CONNECTED) {
     355                                mutex_unlock(&recipient_phone->lock);
     356                                IPC_SET_RETVAL(answer->data, EINVAL);
     357                                return EINVAL;
     358                        }
     359
     360                        other_task_r = recipient_phone->callee->task;
     361                        other_task_s = (task_t *) IPC_GET_ARG5(*olddata);
     362
     363                        /*
     364                         * See if both the sender and the recipient meant the
     365                         * same third party task.
     366                         */
     367                        if (other_task_r != other_task_s) {
     368                                IPC_SET_RETVAL(answer->data, EINVAL);
     369                                rc = EINVAL;
     370                        } else {
     371                                rc = event_task_notify_5(other_task_r,
     372                                    EVENT_TASK_STATE_CHANGE, false,
     373                                    IPC_GET_ARG1(*olddata),
     374                                    IPC_GET_ARG2(*olddata),
     375                                    IPC_GET_ARG3(*olddata),
     376                                    LOWER32(olddata->task_id),
     377                                    UPPER32(olddata->task_id));
     378                                IPC_SET_RETVAL(answer->data, rc);
     379                        }
     380
     381                        mutex_unlock(&recipient_phone->lock);
     382                        return rc;
     383                }
    336384        }
    337385       
     
    427475        case IPC_M_DATA_READ: {
    428476                size_t size = IPC_GET_ARG2(call->data);
    429                 if (size <= 0)
    430                         return ELIMIT;
    431477                if (size > DATA_XFER_LIMIT) {
    432478                        int flags = IPC_GET_ARG3(call->data);
     
    458504                }
    459505               
     506                break;
     507        }
     508        case IPC_M_STATE_CHANGE_AUTHORIZE: {
     509                phone_t *sender_phone;
     510                task_t *other_task_s;
     511
     512                if (phone_get(IPC_GET_ARG5(call->data), &sender_phone) != EOK)
     513                        return ENOENT;
     514
     515                mutex_lock(&sender_phone->lock);
     516                if (sender_phone->state != IPC_PHONE_CONNECTED) {
     517                        mutex_unlock(&sender_phone->lock);
     518                        return EINVAL;
     519                }
     520
     521                other_task_s = sender_phone->callee->task;
     522
     523                mutex_unlock(&sender_phone->lock);
     524
     525                /* Remember the third party task hash. */
     526                IPC_SET_ARG5(call->data, (sysarg_t) other_task_s);
    460527                break;
    461528        }
  • kernel/generic/src/lib/elf.c

    r3842a955 r26e7d6d  
    4747#include <macros.h>
    4848#include <arch.h>
     49
     50#include <lib/elf_load.h>
    4951
    5052static const char *error_codes[] = {
  • kernel/generic/src/lib/rd.c

    r3842a955 r26e7d6d  
    9191        rd_parea.frames = SIZE2FRAMES(dsize);
    9292        rd_parea.unpriv = false;
     93        rd_parea.mapped = false;
    9394        ddi_parea_register(&rd_parea);
    9495
  • kernel/generic/src/mm/as.c

    r3842a955 r26e7d6d  
    12841284 * thing which is forbidden in this context is locking the address space.
    12851285 *
    1286  * When this function is enetered, no spinlocks may be held.
     1286 * When this function is entered, no spinlocks may be held.
    12871287 *
    12881288 * @param old Old address space or NULL.
  • kernel/generic/src/mm/frame.c

    r3842a955 r26e7d6d  
    11421142        size_t znum = find_zone(pfn, 1, 0);
    11431143
    1144        
    11451144        ASSERT(znum != (size_t) -1);
    11461145       
  • kernel/generic/src/mm/slab.c

    r3842a955 r26e7d6d  
    180180    unsigned int flags)
    181181{
    182        
    183        
    184182        size_t zone = 0;
    185183       
  • kernel/generic/src/printf/printf_core.c

    r3842a955 r26e7d6d  
    7575#define PRINT_NUMBER_BUFFER_SIZE  (64 + 5)
    7676
     77/** Get signed or unsigned integer argument */
     78#define PRINTF_GET_INT_ARGUMENT(type, ap, flags) \
     79        ({ \
     80                unsigned type res; \
     81                \
     82                if ((flags) & __PRINTF_FLAG_SIGNED) { \
     83                        signed type arg = va_arg((ap), signed type); \
     84                        \
     85                        if (arg < 0) { \
     86                                res = -arg; \
     87                                (flags) |= __PRINTF_FLAG_NEGATIVE; \
     88                        } else \
     89                                res = arg; \
     90                } else \
     91                        res = va_arg((ap), unsigned type); \
     92                \
     93                res; \
     94        })
     95
    7796/** Enumeration of possible arguments types.
    7897 */
     
    207226        }
    208227       
    209         return (int) (counter + 1);
     228        return (int) (counter);
    210229}
    211230
     
    245264        }
    246265       
    247         return (int) (counter + 1);
     266        return (int) (counter);
    248267}
    249268
     
    832851                        size_t size;
    833852                        uint64_t number;
     853                       
    834854                        switch (qualifier) {
    835855                        case PrintfQualifierByte:
    836856                                size = sizeof(unsigned char);
    837                                 number = (uint64_t) va_arg(ap, unsigned int);
     857                                number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
    838858                                break;
    839859                        case PrintfQualifierShort:
    840860                                size = sizeof(unsigned short);
    841                                 number = (uint64_t) va_arg(ap, unsigned int);
     861                                number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
    842862                                break;
    843863                        case PrintfQualifierInt:
    844864                                size = sizeof(unsigned int);
    845                                 number = (uint64_t) va_arg(ap, unsigned int);
     865                                number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
    846866                                break;
    847867                        case PrintfQualifierLong:
    848868                                size = sizeof(unsigned long);
    849                                 number = (uint64_t) va_arg(ap, unsigned long);
     869                                number = PRINTF_GET_INT_ARGUMENT(long, ap, flags);
    850870                                break;
    851871                        case PrintfQualifierLongLong:
    852872                                size = sizeof(unsigned long long);
    853                                 number = (uint64_t) va_arg(ap, unsigned long long);
     873                                number = PRINTF_GET_INT_ARGUMENT(long long, ap, flags);
    854874                                break;
    855875                        case PrintfQualifierPointer:
     
    866886                                counter = -counter;
    867887                                goto out;
    868                         }
    869                        
    870                         if (flags & __PRINTF_FLAG_SIGNED) {
    871                                 if (number & (0x1 << (size * 8 - 1))) {
    872                                         flags |= __PRINTF_FLAG_NEGATIVE;
    873                                        
    874                                         if (size == sizeof(uint64_t)) {
    875                                                 number = -((int64_t) number);
    876                                         } else {
    877                                                 number = ~number;
    878                                                 number &=
    879                                                     ~(0xFFFFFFFFFFFFFFFFll <<
    880                                                     (size * 8));
    881                                                 number++;
    882                                         }
    883                                 }
    884888                        }
    885889                       
  • kernel/generic/src/proc/program.c

    r3842a955 r26e7d6d  
    4040#include <proc/thread.h>
    4141#include <proc/task.h>
    42 #include <proc/uarg.h>
    4342#include <mm/as.h>
    4443#include <mm/slab.h>
     
    4847#include <ipc/ipcrsc.h>
    4948#include <security/cap.h>
    50 #include <lib/elf.h>
     49#include <lib/elf_load.h>
    5150#include <errno.h>
    5251#include <print.h>
  • kernel/generic/src/proc/task.c

    r3842a955 r26e7d6d  
    5050#include <ipc/ipc.h>
    5151#include <ipc/ipcrsc.h>
     52#include <ipc/event.h>
    5253#include <print.h>
    5354#include <errno.h>
     
    5758#include <syscall/copy.h>
    5859#include <macros.h>
    59 #include <ipc/event.h>
    6060
    6161/** Spinlock protecting the tasks_tree AVL tree. */
     
    201201        task->ipc_info.irq_notif_received = 0;
    202202        task->ipc_info.forwarded = 0;
     203
     204        event_task_init(task);
    203205       
    204206#ifdef CONFIG_UDEBUG
  • kernel/generic/src/proc/thread.c

    r3842a955 r26e7d6d  
    3939#include <proc/thread.h>
    4040#include <proc/task.h>
    41 #include <proc/uarg.h>
    4241#include <mm/frame.h>
    4342#include <mm/page.h>
     
    4544#include <arch/cycle.h>
    4645#include <arch.h>
    47 #include <synch/synch.h>
    4846#include <synch/spinlock.h>
    4947#include <synch/waitq.h>
  • kernel/generic/src/synch/condvar.c

    r3842a955 r26e7d6d  
    3939#include <synch/mutex.h>
    4040#include <synch/waitq.h>
    41 #include <synch/synch.h>
    4241#include <arch.h>
    4342
  • kernel/generic/src/synch/futex.c

    r3842a955 r26e7d6d  
    3939#include <synch/mutex.h>
    4040#include <synch/spinlock.h>
    41 #include <synch/synch.h>
    4241#include <mm/frame.h>
    4342#include <mm/page.h>
  • kernel/generic/src/synch/mutex.c

    r3842a955 r26e7d6d  
    3838#include <synch/mutex.h>
    3939#include <synch/semaphore.h>
    40 #include <synch/synch.h>
    4140#include <debug.h>
    4241#include <arch.h>
  • kernel/generic/src/synch/semaphore.c

    r3842a955 r26e7d6d  
    3939#include <synch/waitq.h>
    4040#include <synch/spinlock.h>
    41 #include <synch/synch.h>
    4241#include <arch/asm.h>
    4342#include <arch.h>
  • kernel/generic/src/synch/waitq.c

    r3842a955 r26e7d6d  
    4545
    4646#include <synch/waitq.h>
    47 #include <synch/synch.h>
    4847#include <synch/spinlock.h>
    4948#include <proc/thread.h>
  • kernel/generic/src/syscall/syscall.c

    r3842a955 r26e7d6d  
    181181       
    182182        /* Sysinfo syscalls. */
    183         (syshandler_t) sys_sysinfo_get_tag,
     183        (syshandler_t) sys_sysinfo_get_val_type,
    184184        (syshandler_t) sys_sysinfo_get_value,
    185185        (syshandler_t) sys_sysinfo_get_data_size,
    186186        (syshandler_t) sys_sysinfo_get_data,
    187187       
    188         /* Debug calls */
    189         (syshandler_t) sys_debug_enable_console,
    190         (syshandler_t) sys_debug_disable_console
     188        /* Kernel console syscalls. */
     189        (syshandler_t) sys_debug_activate_console
    191190};
    192191
  • kernel/generic/src/sysinfo/stats.c

    r3842a955 r26e7d6d  
    3535
    3636#include <typedefs.h>
    37 #include <sysinfo/abi.h>
     37#include <abi/sysinfo.h>
    3838#include <sysinfo/stats.h>
    3939#include <sysinfo/sysinfo.h>
  • kernel/generic/src/sysinfo/sysinfo.c

    r3842a955 r26e7d6d  
    661661 *
    662662 */
    663 sysarg_t sys_sysinfo_get_tag(void *path_ptr, size_t path_size)
     663sysarg_t sys_sysinfo_get_val_type(void *path_ptr, size_t path_size)
    664664{
    665665        /*
  • kernel/generic/src/time/clock.c

    r3842a955 r26e7d6d  
    9494        clock_parea.frames = 1;
    9595        clock_parea.unpriv = true;
     96        clock_parea.mapped = false;
    9697        ddi_parea_register(&clock_parea);
    9798       
  • kernel/generic/src/time/delay.c

    r3842a955 r26e7d6d  
    6464
    6565/** @}
    66 */
     66 */
Note: See TracChangeset for help on using the changeset viewer.