linux.hh revision 2553
110513SAli.Saidi@ARM.com/*
211957Sgabeblack@google.com * Copyright (c) 2003-2005 The Regents of The University of Michigan
310260SAndrew.Bardsley@arm.com * All rights reserved.
410260SAndrew.Bardsley@arm.com *
510260SAndrew.Bardsley@arm.com * Redistribution and use in source and binary forms, with or without
611570SCurtis.Dunham@arm.com * modification, are permitted provided that the following conditions are
711570SCurtis.Dunham@arm.com * met: redistributions of source code must retain the above copyright
811957Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
911957Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1011957Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1110513SAli.Saidi@ARM.com * documentation and/or other materials provided with the distribution;
1211957Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1310513SAli.Saidi@ARM.com * contributors may be used to endorse or promote products derived from
1410513SAli.Saidi@ARM.com * this software without specific prior written permission.
1510260SAndrew.Bardsley@arm.com *
1610260SAndrew.Bardsley@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1710260SAndrew.Bardsley@arm.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1810513SAli.Saidi@ARM.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1910513SAli.Saidi@ARM.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2010513SAli.Saidi@ARM.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2110513SAli.Saidi@ARM.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2210260SAndrew.Bardsley@arm.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2310260SAndrew.Bardsley@arm.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2410260SAndrew.Bardsley@arm.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2510513SAli.Saidi@ARM.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2610513SAli.Saidi@ARM.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2710513SAli.Saidi@ARM.com */
2810513SAli.Saidi@ARM.com
2910513SAli.Saidi@ARM.com#ifndef __MIPS_MIPS_LINUX_HH
3010513SAli.Saidi@ARM.com#define __MIPS_MIPS_LINUX_HH
3110513SAli.Saidi@ARM.com
3210513SAli.Saidi@ARM.com#include "kern/linux/linux.hh"
3310513SAli.Saidi@ARM.com
3410513SAli.Saidi@ARM.comclass MipsLinux : public Linux
3511957Sgabeblack@google.com{
3611957Sgabeblack@google.com  public:
3711957Sgabeblack@google.com
3811957Sgabeblack@google.com    /// This table maps the target open() flags to the corresponding
3911957Sgabeblack@google.com    /// host open() flags.
4011957Sgabeblack@google.com    static OpenFlagTransTable openFlagTable[];
4111957Sgabeblack@google.com
4210513SAli.Saidi@ARM.com    /// Number of entries in openFlagTable[].
4310513SAli.Saidi@ARM.com    static const int NUM_OPEN_FLAGS;
4410513SAli.Saidi@ARM.com
4511957Sgabeblack@google.com    //@{
4611957Sgabeblack@google.com    /// open(2) flag values.
4710513SAli.Saidi@ARM.com    static const int TGT_O_RDONLY	= 00000000;	//!< O_RDONLY
4811957Sgabeblack@google.com    static const int TGT_O_WRONLY	= 00000001;	//!< O_WRONLY
4911957Sgabeblack@google.com    static const int TGT_O_RDWR	= 00000002;	//!< O_RDWR
5011957Sgabeblack@google.com    static const int TGT_O_NONBLOCK = 00000004;	//!< O_NONBLOCK
5111957Sgabeblack@google.com    static const int TGT_O_APPEND	= 00000010;	//!< O_APPEND
5211957Sgabeblack@google.com    static const int TGT_O_CREAT	= 00001000;	//!< O_CREAT
5311957Sgabeblack@google.com    static const int TGT_O_TRUNC	= 00002000;	//!< O_TRUNC
5410513SAli.Saidi@ARM.com    static const int TGT_O_EXCL	= 00004000;	//!< O_EXCL
5510513SAli.Saidi@ARM.com    static const int TGT_O_NOCTTY	= 00010000;	//!< O_NOCTTY
5610513SAli.Saidi@ARM.com    static const int TGT_O_SYNC	= 00040000;	//!< O_SYNC
5710513SAli.Saidi@ARM.com    static const int TGT_O_DRD	= 00100000;	//!< O_DRD
5810513SAli.Saidi@ARM.com    static const int TGT_O_DIRECTIO = 00200000;	//!< O_DIRECTIO
5910513SAli.Saidi@ARM.com    static const int TGT_O_CACHE	= 00400000;	//!< O_CACHE
6010513SAli.Saidi@ARM.com    static const int TGT_O_DSYNC	= 02000000;	//!< O_DSYNC
6110513SAli.Saidi@ARM.com    static const int TGT_O_RSYNC	= 04000000;	//!< O_RSYNC
6210513SAli.Saidi@ARM.com    //@}
6310513SAli.Saidi@ARM.com
6410513SAli.Saidi@ARM.com    /// For mmap().
6510513SAli.Saidi@ARM.com    static const unsigned TGT_MAP_ANONYMOUS = 0x10;
6610513SAli.Saidi@ARM.com
67    //@{
68    /// For getsysinfo().
69    static const unsigned GSI_PLATFORM_NAME = 103;  //!< platform name as string
70    static const unsigned GSI_CPU_INFO = 59;	//!< CPU information
71    static const unsigned GSI_PROC_TYPE = 60;	//!< get proc_type
72    static const unsigned GSI_MAX_CPU = 30;         //!< max # cpu's on this machine
73    static const unsigned GSI_CPUS_IN_BOX = 55;	//!< number of CPUs in system
74    static const unsigned GSI_PHYSMEM = 19;	        //!< Physical memory in KB
75    static const unsigned GSI_CLK_TCK = 42;	        //!< clock freq in Hz
76    //@}
77
78    //@{
79    /// For getrusage().
80    static const int TGT_RUSAGE_SELF = 0;
81    static const int TGT_RUSAGE_CHILDREN = -1;
82    static const int TGT_RUSAGE_BOTH = -2;
83    //@}
84
85    //@{
86    /// For setsysinfo().
87    static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control()
88    //@}
89
90    //@{
91    /// ioctl() command codes.
92    static const unsigned TIOCGETP   = 0x40067408;
93    static const unsigned TIOCSETP   = 0x80067409;
94    static const unsigned TIOCSETN   = 0x8006740a;
95    static const unsigned TIOCSETC   = 0x80067411;
96    static const unsigned TIOCGETC   = 0x40067412;
97    static const unsigned FIONREAD   = 0x4004667f;
98    static const unsigned TIOCISATTY = 0x2000745e;
99    static const unsigned TIOCGETS   = 0x402c7413;
100    static const unsigned TIOCGETA   = 0x40127417;
101    //@}
102
103    /// For table().
104    static const int TBL_SYSINFO = 12;
105};
106
107#endif
108