Changeset c7c0b89b in mainline


Ignore:
Timestamp:
2006-04-22T18:05:16Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
613bc54
Parents:
68091bd
Message:

Added uspace call to enable/disable interrupts.

Files:
14 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/include/cpu.h

    r68091bd rc7c0b89b  
    3030#define __amd64_CPU_H__
    3131
     32#define RFLAGS_IF       (1 << 9)
    3233#define RFLAGS_RF       (1 << 16)
    3334
  • arch/amd64/src/asm_utils.S

    r68091bd rc7c0b89b  
    244244        sti
    245245        movq %r9, %rcx      # Exchange last parameter as a third
     246       
     247        cmp $2, %r8          # Is this SYS_INT_CONTROL
     248        je sys_int_ctrl
     249       
    246250        call syscall_handler
     251sys_end:       
    247252        cli                 # We will be touching stack pointer
    248253               
     
    251256        movq 0(%rsp), %rsp
    252257        sysretq
     258       
     259sys_int_ctrl:
     260        mov %rsp, %rsi      # Pointer to flags
     261        call ddi_int_control
     262        jmp sys_end
     263       
    253264               
    254265.data
  • arch/amd64/src/ddi/ddi.c

    r68091bd rc7c0b89b  
    3535#include <arch/pm.h>
    3636#include <errno.h>
     37#include <arch/cpu.h>
    3738
    3839/** Enable I/O space range for task.
     
    9192        return 0;
    9293}
     94
     95/** Enable/disable interrupts form syscall
     96 *
     97 * @param enable If non-zero, interrupts are enabled, otherwise disabled
     98 * @param flags CP0 flags register
     99 */
     100__native ddi_int_control_arch(__native enable, __native *flags)
     101{
     102        if (enable)
     103                *flags |= RFLAGS_IF;
     104        else
     105                *flags &= ~RFLAGS_IF;
     106        return 0;
     107}
  • arch/amd64/src/mm/page.c

    r68091bd rc7c0b89b  
    169169        if (!as_page_fault(page)) {
    170170                print_info_errcode(n, istate);
    171                 printf("Page fault address: %Q\n", page);
     171                printf("Page fault address: %llX\n", page);
    172172                panic("page fault\n");
    173173        }
  • arch/ia32/include/cpu.h

    r68091bd rc7c0b89b  
    3434#include <arch/asm.h>
    3535
     36#define EFLAGS_IF       (1 << 9)
    3637#define EFLAGS_RF       (1 << 16)
    3738
  • arch/ia32/src/asm.S

    r68091bd rc7c0b89b  
    8787# and call exc_dispatch().
    8888#
    89 #define INTERRUPT_ALIGN 64
     89#define INTERRUPT_ALIGN 128
    9090.macro handler i n
    9191
     
    109109       
    110110        sti
     111        cmp $2, %edi           # Is this SYS_INT_CONTROL?
     112        je sys_int_ctrl
     113       
    111114        call syscall_handler   # syscall_handler(ax,cx,dx,si,di)
     115sysc_end:               
    112116        cli
    113117        addl $20, %esp         # clean-up of parameters
     
    120124        CLEAR_NT_FLAG
    121125        iret
     126sys_int_ctrl:               # Interrupt control
     127        mov %esp, %eax
     128        add $44, %eax
     129        mov %eax, 4(%esp)   # Pointer to flags - 2nd argument
     130        call ddi_int_control
     131        jmp sysc_end
    122132.else   
    123133        /*
  • arch/ia32/src/ddi/ddi.c

    r68091bd rc7c0b89b  
    3535#include <arch/pm.h>
    3636#include <errno.h>
     37#include <arch/cpu.h>
    3738
    3839/** Enable I/O space range for task.
     
    9192        return 0;
    9293}
     94
     95/** Enable/disable interrupts form syscall
     96 *
     97 * @param enable If non-zero, interrupts are enabled, otherwise disabled
     98 * @param flags CP0 flags register
     99 */
     100__native ddi_int_control_arch(__native enable, __native *flags)
     101{
     102        if (enable)
     103                *flags |= EFLAGS_IF;
     104        else
     105                *flags &= ~EFLAGS_IF;
     106        return 0;
     107}
  • arch/mips32/src/ddi/ddi.c

    r68091bd rc7c0b89b  
    3131#include <arch/types.h>
    3232#include <typedefs.h>
     33#include <security/cap.h>
     34#include <arch.h>
     35#include <arch/cp0.h>
    3336
    3437/** Enable I/O space range for task.
     
    4649        return 0;
    4750}
     51
     52/** Enable/disable interrupts form syscall
     53 *
     54 * @param enable If non-zero, interrupts are enabled, otherwise disabled
     55 * @param flags CP0 flags register
     56 */
     57__native ddi_int_control_arch(__native enable, __native *flags)
     58{
     59        if (enable)
     60                *flags |= cp0_status_ie_enabled_bit;
     61        else
     62                *flags &= ~cp0_status_ie_enabled_bit;
     63        return 0;
     64}
  • arch/mips32/src/start.S

    r68091bd rc7c0b89b  
    252252        mtc0 $t0, $status
    253253
     254        li $t4, 2                   # SYS_INT_CONTROL
     255        beq $t4, $v0, sysc_int_control
     256        nop
     257       
    254258        # CALL Syscall handler
    255259        jal syscall_handler
    256260        sw $v0, SS_ARG4($sp)        # save v0 - arg4 to stack
    257261
     262sysc_exit:     
    258263        # restore status
    259264        mfc0 $t0, $status
     
    276281        eret
    277282       
     283sysc_int_control:
     284        jal ddi_int_control
     285        addi $a1, $sp, SS_STATUS
     286       
     287        j sysc_exit
     288        nop
     289       
    278290tlb_refill_handler:
    279291        KERNEL_STACK_TO_K0
  • generic/include/ddi/ddi.h

    r68091bd rc7c0b89b  
    4040 * Interface to be implemented by all architectures.
    4141 */
     42extern __native ddi_int_control_arch(__native enable, __native *flags);
     43extern __native ddi_int_control(__native enable, __native *flags);
    4244extern int ddi_enable_iospace_arch(task_t *task, __address ioaddr, size_t size);
    4345
  • generic/include/security/cap.h

    r68091bd rc7c0b89b  
    5858#define CAP_IO_MANAGER          (1<<2)
    5959
     60/**
     61 * CAP_INT_CONTROL allows its holder to disable interrupts
     62 */
     63#define CAP_INT_CONTROL         (1<<3)
     64
    6065typedef __u32 cap_t;
    6166
  • generic/include/syscall/syscall.h

    r68091bd rc7c0b89b  
    3333        SYS_IO = 0,
    3434        SYS_TLS_SET = 1, /* Hardcoded in AMD64,IA32 uspace - psthread.S */
     35        SYS_INT_CONTROL = 2, /* Hardcoded in all SYSCALL handlers */
    3536        SYS_THREAD_CREATE,
    3637        SYS_THREAD_EXIT,
  • generic/src/ddi/ddi.c

    r68091bd rc7c0b89b  
    195195        return (__native) ddi_enable_iospace((task_id_t) arg.task_id, (__address) arg.ioaddr, (size_t) arg.size);
    196196}
     197
     198__native ddi_int_control(__native enable, __native *flags)
     199{
     200        if (! cap_get(TASK) & CAP_INT_CONTROL)
     201                return EPERM;
     202        return ddi_int_control_arch(enable, flags);
     203}
     204
  • generic/src/syscall/syscall.c

    r68091bd rc7c0b89b  
    6565}
    6666
     67static __native sys_int_control(int enable)
     68{
     69        panic("Not implemented.");
     70}
     71
    6772/** Dispatch system call */
    6873__native syscall_handler(__native a1, __native a2, __native a3,
     
    7883        sys_io,
    7984        sys_tls_set,
     85        sys_int_control,
    8086        sys_thread_create,
    8187        sys_thread_exit,
Note: See TracChangeset for help on using the changeset viewer.