[BACK]Return to platform.h CVS log [TXT][DIR] Up to [local] / prex-old / sys / arch / i386 / pc

Annotation of prex-old/sys/arch/i386/pc/platform.h, Revision 1.1

1.1     ! nbrk        1: /*
        !             2:  * Copyright (c) 2007, Kohsuke Ohtani
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms, with or without
        !             6:  * modification, are permitted provided that the following conditions
        !             7:  * are met:
        !             8:  * 1. Redistributions of source code must retain the above copyright
        !             9:  *    notice, this list of conditions and the following disclaimer.
        !            10:  * 2. Redistributions in binary form must reproduce the above copyright
        !            11:  *    notice, this list of conditions and the following disclaimer in the
        !            12:  *    documentation and/or other materials provided with the distribution.
        !            13:  * 3. Neither the name of the author nor the names of any co-contributors
        !            14:  *    may be used to endorse or promote products derived from this software
        !            15:  *    without specific prior written permission.
        !            16:  *
        !            17:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
        !            18:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            19:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            20:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
        !            21:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            22:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            23:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            24:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            25:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            26:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            27:  * SUCH DAMAGE.
        !            28:  */
        !            29:
        !            30: #ifndef _PC_PLATFORM_H
        !            31: #define _PC_PLATFORM_H
        !            32:
        !            33: /*
        !            34:  * Memory location
        !            35:  */
        !            36:
        !            37: #ifdef CONFIG_MMU
        !            38: #define PAGE_OFFSET    0x80000000
        !            39: #else
        !            40: #define PAGE_OFFSET    0x00000000
        !            41: #endif
        !            42:
        !            43: #define KERNEL_BASE    PAGE_OFFSET
        !            44: #define KERNEL_MAX     0xffffffff
        !            45: #define USER_BASE      0x00000000
        !            46: #define USER_MAX       0x80000000
        !            47:
        !            48: #define BOOT_PTE0      0x00001000
        !            49: #define INT_STACK      0x00001000
        !            50: #define BOOT_INFO      0x00002000
        !            51: #define BOOT_STACK     0x00002800
        !            52: #define KERNEL_PGD     0x00003000
        !            53:
        !            54: #ifdef CONFIG_MMU
        !            55: #define RESERVED_BASE  0x00000000
        !            56: #define RESERVED_MAX   0x00004000
        !            57: #else
        !            58: #define RESERVED_BASE  0x00000000
        !            59: #define RESERVED_MAX   0x00003000
        !            60: #endif
        !            61:
        !            62:
        !            63: #ifndef __ASSEMBLY__
        !            64:
        !            65: /*
        !            66:  * Page mapping
        !            67:  */
        !            68: #define phys_to_virt(p_addr)   (void *)((u_long)(p_addr) + PAGE_OFFSET)
        !            69: #define virt_to_phys(v_addr)   (void *)((u_long)(v_addr) - PAGE_OFFSET)
        !            70:
        !            71: /*
        !            72:  * Kernel/User Locations
        !            73:  */
        !            74: #if KERNEL_BASE == 0
        !            75: #define kern_area(addr)                1
        !            76: #else
        !            77: #define kern_area(addr)                ((u_long)(addr) >= (u_long)KERNEL_BASE)
        !            78: #endif
        !            79: #define user_area(addr)                ((u_long)(addr) < (u_long)USER_MAX)
        !            80:
        !            81: /*
        !            82:  * Interrupt
        !            83:  */
        !            84: #define NIRQS          16              /* number of interrupt vectors */
        !            85:
        !            86: #define interrupt_enable()     __asm__ __volatile__("sti"::)
        !            87: #define interrupt_disable()    __asm__ __volatile__("cli"::)
        !            88:
        !            89: static __inline void
        !            90: interrupt_save(int *sts)
        !            91: {
        !            92:        register u_long eflags;
        !            93:        __asm__ __volatile__(
        !            94:                "pushfl\n\t"
        !            95:                "popl %0\n\t"
        !            96:                :"=r" (eflags));
        !            97:        *sts = (int)(eflags & 0x200);
        !            98: }
        !            99:
        !           100: static __inline void
        !           101: interrupt_restore(int sts)
        !           102: {
        !           103:        __asm__ __volatile__(
        !           104:                "pushfl\n\t"
        !           105:                "popl %%eax\n\t"
        !           106:                "andl $0xfffffdff, %%eax\n\t"
        !           107:                "orl %0, %%eax\n\t"
        !           108:                "pushl %%eax\n\t"
        !           109:                "popfl\n\t"
        !           110:                :
        !           111:                :"r" (sts)
        !           112:                :"eax");
        !           113: }
        !           114:
        !           115: extern void interrupt_mask(int);
        !           116: extern void interrupt_unmask(int, int);
        !           117: extern void interrupt_setup(int, int);
        !           118: extern void interrupt_init(void);
        !           119:
        !           120: /* Interrupt mode for interrupt_setup() */
        !           121: #define IMODE_EDGE     0               /* edge trigger */
        !           122: #define IMODE_LEVEL    1               /* level trigger */
        !           123:
        !           124: extern void clock_init(void);
        !           125:
        !           126: extern void diag_init(void);
        !           127: extern void diag_print(char *);
        !           128:
        !           129: #define machine_idle() __asm__ __volatile__("sti; hlt")
        !           130: extern void machine_reset(void);
        !           131: extern void machine_init(void);
        !           132:
        !           133: #endif /* !__ASSEMBLY__ */
        !           134: #endif /* !_PC_PLATFORM_H */

CVSweb