Changeset 80cd7cd in mainline for kernel/generic


Ignore:
Timestamp:
2011-01-13T20:58:24Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
87e373b
Parents:
eaef141 (diff), a613fea1 (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
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ddi/ddi.h

    reaef141 r80cd7cd  
    5454extern sysarg_t sys_physmem_map(sysarg_t, sysarg_t, sysarg_t, sysarg_t);
    5555extern sysarg_t sys_iospace_enable(ddi_ioarg_t *);
    56 extern sysarg_t sys_interrupt_enable(int irq, int enable);
    5756
    5857/*
  • kernel/generic/include/ddi/irq.h

    reaef141 r80cd7cd  
    5454        /** Read 4 bytes from the I/O space. */
    5555        CMD_PIO_READ_32,
     56       
    5657        /** Write 1 byte to the I/O space. */
    5758        CMD_PIO_WRITE_8,
     
    6263       
    6364        /**
    64          * Perform a bit test on the source argument and store the result into
    65          * the destination argument.
     65         * Write 1 byte from the source argument
     66         * to the I/O space.
     67         */
     68        CMD_PIO_WRITE_A_8,
     69        /**
     70         * Write 2 bytes from the source argument
     71         * to the I/O space.
     72         */
     73        CMD_PIO_WRITE_A_16,
     74        /**
     75         * Write 4 bytes from the source argument
     76         * to the I/O space.
     77         */
     78        CMD_PIO_WRITE_A_32,
     79       
     80        /**
     81         * Perform a bit masking on the source argument
     82         * and store the result into the destination argument.
    6683         */
    6784        CMD_BTEST,
    6885       
    6986        /**
    70          * Predicate the execution of the following N commands by the boolean
    71          * value of the source argument.
     87         * Predicate the execution of the following
     88         * N commands by the boolean value of the source
     89         * argument.
    7290         */
    7391        CMD_PREDICATE,
     
    7593        /** Accept the interrupt. */
    7694        CMD_ACCEPT,
     95       
    7796        /** Decline the interrupt. */
    7897        CMD_DECLINE,
  • kernel/generic/include/interrupt.h

    reaef141 r80cd7cd  
    6060extern void fault_if_from_uspace(istate_t *, const char *, ...)
    6161    PRINTF_ATTRIBUTE(2, 3);
     62extern istate_t *istate_get(thread_t *);
    6263extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t);
    6364extern void exc_dispatch(unsigned int, istate_t *);
  • kernel/generic/include/proc/task.h

    reaef141 r80cd7cd  
    154154
    155155extern sysarg_t sys_task_set_name(const char *, size_t);
     156extern sysarg_t sys_task_kill(task_id_t *);
    156157
    157158#endif
  • kernel/generic/include/syscall/syscall.h

    reaef141 r80cd7cd  
    4747        SYS_TASK_GET_ID,
    4848        SYS_TASK_SET_NAME,
     49        SYS_TASK_KILL,
    4950        SYS_PROGRAM_SPAWN_LOADER,
    5051       
     
    8182        SYS_PHYSMEM_MAP,
    8283        SYS_IOSPACE_ENABLE,
    83         SYS_INTERRUPT_ENABLE,
    8484       
    8585        SYS_SYSINFO_GET_TAG,
  • kernel/generic/src/ddi/ddi.c

    reaef141 r80cd7cd  
    258258}
    259259
    260 /** Disable or enable specified interrupts.
    261  *
    262  * @param irq the interrupt to be enabled/disabled.
    263  * @param enable if true enable the interrupt, disable otherwise.
    264  *
    265  * @retutn Zero on success, error code otherwise.
    266  */
    267 sysarg_t sys_interrupt_enable(int irq, int enable)
    268 {
    269 /* FIXME: this needs to be generic code, or better not be in kernel at all. */
    270 #if 0
    271         cap_t task_cap = cap_get(TASK);
    272         if (!(task_cap & CAP_IRQ_REG))
    273                 return EPERM;
    274                
    275         if (irq < 0 || irq > 16) {
    276                 return EINVAL;
    277         }
    278        
    279         uint16_t irq_mask = (uint16_t)(1 << irq);
    280         if (enable) {
    281                 trap_virtual_enable_irqs(irq_mask);
    282         } else {
    283                 trap_virtual_disable_irqs(irq_mask);
    284         }
    285        
    286 #endif
    287         return 0;
    288 }
    289 
    290260/** @}
    291261 */
  • kernel/generic/src/interrupt/interrupt.c

    reaef141 r80cd7cd  
    209209}
    210210
     211/** Get istate structure of a thread.
     212 *
     213 * Get pointer to the istate structure at the bottom of the kernel stack.
     214 *
     215 * This function can be called in interrupt or user context. In interrupt
     216 * context the istate structure is created by the low-level exception
     217 * handler. In user context the istate structure is created by the
     218 * low-level syscall handler.
     219 */
     220istate_t *istate_get(thread_t *thread)
     221{
     222        /*
     223         * The istate structure should be right at the bottom of the kernel
     224         * stack.
     225         */
     226        return (istate_t *) ((uint8_t *) thread->kstack + THREAD_STACK_SIZE -
     227            sizeof(istate_t));
     228}
     229
    211230#ifdef CONFIG_KCONSOLE
    212231
  • kernel/generic/src/ipc/ipc.c

    reaef141 r80cd7cd  
    706706                                break;
    707707                        case IPC_PHONE_CONNECTED:
    708                                 printf("connected to: %p ",
    709                                     task->phones[i].callee);
     708                                printf("connected to: %p (%" PRIu64 ") ",
     709                                    task->phones[i].callee,
     710                                    task->phones[i].callee->task->taskid);
    710711                                break;
    711712                        case IPC_PHONE_SLAMMED:
  • kernel/generic/src/ipc/irq.c

    reaef141 r80cd7cd  
    404404                            (uint32_t) code->cmds[i].value);
    405405                        break;
     406                case CMD_PIO_WRITE_A_8:
     407                        if (srcarg) {
     408                                pio_write_8((ioport8_t *) code->cmds[i].addr,
     409                                    (uint8_t) scratch[srcarg]);
     410                        }
     411                        break;
     412                case CMD_PIO_WRITE_A_16:
     413                        if (srcarg) {
     414                                pio_write_16((ioport16_t *) code->cmds[i].addr,
     415                                    (uint16_t) scratch[srcarg]);
     416                        }
     417                        break;
     418                case CMD_PIO_WRITE_A_32:
     419                        if (srcarg) {
     420                                pio_write_32((ioport32_t *) code->cmds[i].addr,
     421                                    (uint32_t) scratch[srcarg]);
     422                        }
     423                        break;
    406424                case CMD_BTEST:
    407425                        if ((srcarg) && (dstarg)) {
  • kernel/generic/src/main/main.c

    reaef141 r80cd7cd  
    185185        LOG("\nconfig.base=%p config.kernel_size=%zu"
    186186            "\nconfig.stack_base=%p config.stack_size=%zu",
    187             config.base, config.kernel_size, config.stack_base,
    188             config.stack_size);
     187            (void *) config.base, config.kernel_size,
     188            (void *) config.stack_base, config.stack_size);
    189189       
    190190#ifdef CONFIG_KCONSOLE
     
    242242                for (i = 0; i < init.cnt; i++)
    243243                        LOG("init[%zu].addr=%p, init[%zu].size=%zu",
    244                             i, init.tasks[i].addr, i, init.tasks[i].size);
     244                            i, (void *) init.tasks[i].addr, i, init.tasks[i].size);
    245245        } else
    246246                printf("No init binaries found.\n");
  • kernel/generic/src/mm/slab.c

    reaef141 r80cd7cd  
    806806}
    807807
    808 /** Go through all caches and reclaim what is possible
    809  *
    810  * Interrupts must be disabled before calling this function,
    811  * otherwise  memory allocation from interrupts can deadlock.
    812  *
    813  */
     808/** Go through all caches and reclaim what is possible */
    814809size_t slab_reclaim(unsigned int flags)
    815810{
    816         irq_spinlock_lock(&slab_cache_lock, false);
     811        irq_spinlock_lock(&slab_cache_lock, true);
    817812       
    818813        size_t frames = 0;
     
    824819        }
    825820       
    826         irq_spinlock_unlock(&slab_cache_lock, false);
     821        irq_spinlock_unlock(&slab_cache_lock, true);
    827822       
    828823        return frames;
  • kernel/generic/src/proc/task.c

    reaef141 r80cd7cd  
    360360}
    361361
     362/** Syscall to forcefully terminate a task
     363 *
     364 * @param uspace_taskid Pointer to task ID in user space.
     365 *
     366 * @return 0 on success or an error code from @ref errno.h.
     367 *
     368 */
     369sysarg_t sys_task_kill(task_id_t *uspace_taskid)
     370{
     371        task_id_t taskid;
     372        int rc;
     373
     374        rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));
     375        if (rc != 0)
     376                return (sysarg_t) rc;
     377
     378        return (sysarg_t) task_kill(taskid);
     379}
     380
    362381/** Find task structure corresponding to task ID.
    363382 *
  • kernel/generic/src/syscall/syscall.c

    reaef141 r80cd7cd  
    4545#include <debug.h>
    4646#include <ddi/device.h>
     47#include <interrupt.h>
    4748#include <ipc/sysipc.h>
    4849#include <synch/futex.h>
     
    6667#ifdef CONFIG_UDEBUG
    6768        /*
     69         * An istate_t-compatible record was created on the stack by the
     70         * low-level syscall handler. This is the userspace space state
     71         * structure.
     72         */
     73        THREAD->udebug.uspace_state = istate_get(THREAD);
     74
     75        /*
    6876         * Early check for undebugged tasks. We do not lock anything as this
    6977         * test need not be precise in either direction.
    70          *
    7178         */
    7279        if (THREAD->udebug.active)
     
    98105                udebug_stoppable_end();
    99106        }
     107
     108        /* Clear userspace state pointer */
     109        THREAD->udebug.uspace_state = NULL;
    100110#endif
    101111       
     
    120130        (syshandler_t) sys_task_get_id,
    121131        (syshandler_t) sys_task_set_name,
     132        (syshandler_t) sys_task_kill,
    122133        (syshandler_t) sys_program_spawn_loader,
    123134       
     
    160171        (syshandler_t) sys_physmem_map,
    161172        (syshandler_t) sys_iospace_enable,
    162         (syshandler_t) sys_interrupt_enable,
    163173       
    164174        /* Sysinfo syscalls */
Note: See TracChangeset for help on using the changeset viewer.