Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ddi/ddi.c

    r3f5b4e0d r7a0359b  
    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 unative_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))
     260/** Disable or enable preemption.
     261 *
     262 * @param enable If non-zero, the preemption counter will be decremented,
     263 *               leading to potential enabling of preemption. Otherwise
     264 *               the preemption counter will be incremented, preventing
     265 *               preemption from occurring.
     266 *
     267 * @return Zero on success or EPERM if callers capabilities are not sufficient.
     268 *
     269 */
     270unative_t sys_preempt_control(int enable)
     271{
     272        if (!(cap_get(TASK) & CAP_PREEMPT_CONTROL))
    273273                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
     274       
     275        if (enable)
     276                preemption_enable();
     277        else
     278                preemption_disable();
     279       
    287280        return 0;
    288281}
Note: See TracChangeset for help on using the changeset viewer.