Ignore:
Timestamp:
Jun 29, 2017, 3:48:39 PM (7 years ago)
Author:
max@…
Message:

add the irq functions; we will forbid nested critical sections, so
the argument will disappear soon

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/core/hal_irqmask.c

    r51 r99  
    11/*
    2  * hal_irqmask.c - implementation of Generic IRQ Masking API for TSAR-MIPS32
    3  *
    4  * Author  Ghassan Almaless (2008,2009,2010,2011,2012)
    5  *         Alain Greiner    (2016)
     2 * hal_irqmask.c - implementation of Generic IRQ Masking API for x86
    63 *
    7  * Copyright (c) UPMC Sorbonne Universites
    8  *
    9  * This file is part of ALMOS-MKH..
     4 * Copyright (c) 2017 Maxime Villard
    105 *
    11  * ALMOS-MKH. is free software; you can redistribute it and/or modify it
     6 * This file is part of ALMOS-MKH.
     7 *
     8 * ALMOS-MKH is free software; you can redistribute it and/or modify it
    129 * under the terms of the GNU General Public License as published by
    1310 * the Free Software Foundation; version 2.0 of the License.
    1411 *
    15  * ALMOS-MKH. is distributed in the hope that it will be useful, but
     12 * ALMOS-MKH is distributed in the hope that it will be useful, but
    1613 * WITHOUT ANY WARRANTY; without even the implied warranty of
    1714 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     
    2623#include <hal_internal.h>
    2724
    28 inline void hal_disable_irq( uint32_t * old )
     25static int interrupts_enabled __in_kdata = 0;
     26
     27inline void hal_disable_irq(uint32_t *old)
     28{
     29        if (!interrupts_enabled) {
     30                x86_panic("nested critical sections forbidden");
     31        }
     32        interrupts_enabled = 0;
     33        cli();
     34}
     35
     36inline void hal_enable_irq(uint32_t *old)
     37{
     38        if (interrupts_enabled) {
     39                x86_panic("nested critical sections forbidden");
     40        }
     41        interrupts_enabled = 1;
     42        sti();
     43}
     44
     45inline void hal_restore_irq(uint32_t old)
    2946{
    3047        x86_panic((char *)__func__);
    3148}
    3249
    33 inline void hal_enable_irq( uint32_t * old )
    34 {
    35         x86_panic((char *)__func__);
    36 }
    37 
    38 inline void hal_restore_irq( uint32_t old )
    39 {
    40         x86_panic((char *)__func__);
    41 }
    42 
Note: See TracChangeset for help on using the changeset viewer.