Subversion Repositories HelenOS

Rev

Rev 3743 | Rev 3783 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3743 Rev 3770
Line 69... Line 69...
69
#define MMU_FAULT_AREA_INFO 0x2b
69
#define MMU_FAULT_AREA_INFO 0x2b
70
#define CPU_MONDO_SEND      0x42
70
#define CPU_MONDO_SEND      0x42
71
#define CONS_GETCHAR        0x60
71
#define CONS_GETCHAR        0x60
72
#define CONS_PUTCHAR        0x61
72
#define CONS_PUTCHAR        0x61
73
 
73
 
-
 
74
 
-
 
75
/* return codes */
-
 
76
#define EOK     0   /**< Successful return */
-
 
77
#define ENOCPU      1   /**< Invalid CPU id */
-
 
78
#define ENORADDR    2   /**< Invalid real address */
-
 
79
#define ENOINTR     3   /**< Invalid interrupt id */
-
 
80
#define EBADPGSZ    4   /**< Invalid pagesize encoding */
-
 
81
#define EBADTSB     5   /**< Invalid TSB description */
-
 
82
#define EINVAL      6   /**< Invalid argument */
-
 
83
#define EBADTRAP    7   /**< Invalid function number */
-
 
84
#define EBADALIGN   8   /**< Invalid address alignment */
-
 
85
#define EWOULDBLOCK 9   /**< Cannot complete operation without blocking */
-
 
86
#define ENOACCESS   10  /**< No access to specified resource */
-
 
87
#define EIO     11  /**< I/O Error */
-
 
88
#define ECPUERROR   12  /**< CPU is in error state */
-
 
89
#define ENOTSUPPORTED   13  /**< Function not supported */
-
 
90
#define ENOMAP      14  /**< No mapping found */
-
 
91
#define ETOOMANY    15  /**< Too many items specified / limit reached */
-
 
92
#define ECHANNEL    16  /**< Invalid LDC channel */
-
 
93
#define EBUSY       17  /**< Operation failed as resource is otherwise busy */
-
 
94
 
-
 
95
 
74
/**
96
/**
75
 * Performs a hyperfast hypervisor API call from the assembly language code.
97
 * Performs a hyperfast hypervisor API call from the assembly language code.
76
 * Expects the registers %o1-%o4 are properly filled with the arguments of the
98
 * Expects the registers %o1-%o4 are properly filled with the arguments of the
77
 * call.
99
 * call.
78
 *
100
 *
Line 112... Line 134...
112
    __hypercall_fast(p1, p2, p3, p4, 0, function_number)
134
    __hypercall_fast(p1, p2, p3, p4, 0, function_number)
113
#define __hypercall_fast5(function_number, p1, p2, p3, p4, p5) \
135
#define __hypercall_fast5(function_number, p1, p2, p3, p4, p5) \
114
    __hypercall_fast(p1, p2, p3, p4, p5, function_number)
136
    __hypercall_fast(p1, p2, p3, p4, p5, function_number)
115
 
137
 
116
/**
138
/**
117
 * Performs a fast hypervisor API call.
139
 * Performs a fast hypervisor API call which can returns a value.
118
 *
140
 *
119
 * @param p1            the 1st argument of the hypervisor API call
141
 * @param p1            the 1st argument of the hypervisor API call
120
 * @param p2            the 2nd argument of the hypervisor API call
142
 * @param p2            the 2nd argument of the hypervisor API call
121
 * @param p3            the 3rd argument of the hypervisor API call
143
 * @param p3            the 3rd argument of the hypervisor API call
122
 * @param p4            the 4th argument of the hypervisor API call
144
 * @param p4            the 4th argument of the hypervisor API call
123
 * @param p5            the 5th argument of the hypervisor API call
145
 * @param p5            the 5th argument of the hypervisor API call
124
 * @param function_number   function number of the call
146
 * @param function_number   function number of the call
-
 
147
 * @param ret1          pointer to an address where the return value
-
 
148
 *              of the hypercall should be saved, or NULL
-
 
149
 * @return          error status
125
 */
150
 */
126
static inline uint64_t
151
static inline uint64_t
127
__hypercall_fast(const uint64_t p1, const uint64_t p2, const uint64_t p3,
152
__hypercall_fast_ret1(const uint64_t p1, const uint64_t p2, const uint64_t p3,
128
    const uint64_t p4, const uint64_t p5, const uint64_t function_number)
153
    const uint64_t p4, const uint64_t p5, const uint64_t function_number,
-
 
154
    uint64_t * const ret1)
129
{
155
{
130
    register uint64_t a6 asm("o5") = function_number;
156
    register uint64_t a6 asm("o5") = function_number;
131
    register uint64_t a1 asm("o0") = p1;
157
    register uint64_t a1 asm("o0") = p1;
132
    register uint64_t a2 asm("o1") = p2;
158
    register uint64_t a2 asm("o1") = p2;
133
    register uint64_t a3 asm("o2") = p3;
159
    register uint64_t a3 asm("o2") = p3;
Line 140... Line 166...
140
        : "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6),
166
        : "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6),
141
          "i" (FAST_TRAP)
167
          "i" (FAST_TRAP)
142
        : "memory"
168
        : "memory"
143
    );
169
    );
144
   
170
   
-
 
171
    if (ret1 != NULL)
-
 
172
        *ret1 = a2;
145
    return a1;
173
    return a1;
146
}
174
}
147
 
175
 
148
/**
176
/**
-
 
177
 * Performs a fast hypervisor API call which return no value except for the
-
 
178
 * error status.
-
 
179
 *
-
 
180
 * @param p1            the 1st argument of the hypervisor API call
-
 
181
 * @param p2            the 2nd argument of the hypervisor API call
-
 
182
 * @param p3            the 3rd argument of the hypervisor API call
-
 
183
 * @param p4            the 4th argument of the hypervisor API call
-
 
184
 * @param p5            the 5th argument of the hypervisor API call
-
 
185
 * @param function_number   function number of the call
-
 
186
 * @return          error status
-
 
187
 */
-
 
188
static inline uint64_t
-
 
189
__hypercall_fast(const uint64_t p1, const uint64_t p2, const uint64_t p3,
-
 
190
    const uint64_t p4, const uint64_t p5, const uint64_t function_number)
-
 
191
{
-
 
192
    return __hypercall_fast_ret1(p1, p2, p3, p4, p5, function_number,
-
 
193
                     NULL);
-
 
194
}
-
 
195
 
-
 
196
/**
149
 * Performs a hyperfast hypervisor API call.
197
 * Performs a hyperfast hypervisor API call.
150
 *
198
 *
151
 * @param p1            the 1st argument of the hypervisor API call
199
 * @param p1            the 1st argument of the hypervisor API call
152
 * @param p2            the 2nd argument of the hypervisor API call
200
 * @param p2            the 2nd argument of the hypervisor API call
153
 * @param p3            the 3rd argument of the hypervisor API call
201
 * @param p3            the 3rd argument of the hypervisor API call