OSDN Git Service

* public snapshot of sid simulator
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / gloss / mips.h
1 // mips.h - Class declaration for the MIPS monitor support.
2 // Currently supported monitors: idt.  -*- C++ -*-
3
4 // Copyright (C) 1999, 2000 Red Hat.
5 // This file is part of SID and is licensed under the GPL.
6 // See the file COPYING.SID for conditions for redistribution.
7
8 #ifndef MIPS_H
9 #define MIPS_H
10
11 #include "gloss.h"
12
13 // ??? mips_idt, and have 64_p attribute?
14 // [with associated changes to gloss32/gloss64]
15
16 class mips32_idt: public gloss32
17 {
18 public:
19
20   mips32_idt();
21
22 private:
23
24   // Begin idt syscalls here to distinguish them from others.
25   // blah blah ... no suitable value ... blah blah
26   enum { SYSCALL_MIN = 0x42000 };
27
28   enum syscalls
29   {
30     SYSCALL_WRITE = 8,
31     SYSCALL_EXIT = 17,
32     SYSCALL_GET_MEM_INFO = 55,
33     SYSCALL_MAX = 64
34   };
35
36   // _exit() stuff's this in the `code' field of `break' insns.
37   enum { BREAK_EXIT = 0xffc00 };
38
39   // The main RAM memory of the cpu we support.
40   // ??? multi-cpu support, blah blah blah
41   component* ram;
42
43   // The ROM memory of the monitor we emulate.
44   component* rom;
45
46   // We need to do some extra processing at reset time.
47   void reset();
48
49   // ABI-specifics, for getting syscall arguments and setting results.
50   // ??? Class by itself.
51   // ??? Perhaps this shouldn't be here at all as it's really an
52   // implementation detail (but lots of implementations will probably use it).
53   bool get_int_argument(unsigned index, int32& value);
54   bool set_int_result(int32 value);
55   bool set_error_result(int32 value);
56
57   // Return boolean indicating if cpu is requesting something we're to handle.
58   bool syscall_trap_p();
59   // Perform a system call trap.
60   void syscall_trap();
61
62   // Convert host errno to target errno.
63   int host_to_target_errno (int errno_);
64 };
65
66 #endif /* MIPS_H */