Subversion Repositories HelenOS

Rev

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

Rev 3783 Rev 3817
Line 137... Line 137...
137
    __hypercall_fast(p1, p2, p3, p4, 0, function_number)
137
    __hypercall_fast(p1, p2, p3, p4, 0, function_number)
138
#define __hypercall_fast5(function_number, p1, p2, p3, p4, p5) \
138
#define __hypercall_fast5(function_number, p1, p2, p3, p4, p5) \
139
    __hypercall_fast(p1, p2, p3, p4, p5, function_number)
139
    __hypercall_fast(p1, p2, p3, p4, p5, function_number)
140
 
140
 
141
/**
141
/**
142
 * Performs a fast hypervisor API call which can returns a value.
142
 * Performs a fast hypervisor API call which returns no value except for the
-
 
143
 * error status.
143
 *
144
 *
144
 * @param p1            the 1st argument of the hypervisor API call
145
 * @param p1            the 1st argument of the hypervisor API call
145
 * @param p2            the 2nd argument of the hypervisor API call
146
 * @param p2            the 2nd argument of the hypervisor API call
146
 * @param p3            the 3rd argument of the hypervisor API call
147
 * @param p3            the 3rd argument of the hypervisor API call
147
 * @param p4            the 4th argument of the hypervisor API call
148
 * @param p4            the 4th argument of the hypervisor API call
148
 * @param p5            the 5th argument of the hypervisor API call
149
 * @param p5            the 5th argument of the hypervisor API call
149
 * @param function_number   function number of the call
150
 * @param function_number   function number of the call
150
 * @param ret1          pointer to an address where the return value
-
 
151
 *              of the hypercall should be saved, or NULL
-
 
152
 * @return          error status
151
 * @return          error status
153
 */
152
 */
154
static inline uint64_t
153
static inline uint64_t
155
__hypercall_fast_ret1(const uint64_t p1, const uint64_t p2, const uint64_t p3,
154
__hypercall_fast(const uint64_t p1, const uint64_t p2, const uint64_t p3,
156
    const uint64_t p4, const uint64_t p5, const uint64_t function_number,
155
    const uint64_t p4, const uint64_t p5, const uint64_t function_number)
157
    uint64_t * const ret1)
-
 
158
{
156
{
159
    register uint64_t a6 asm("o5") = function_number;
157
    register uint64_t a6 asm("o5") = function_number;
160
    register uint64_t a1 asm("o0") = p1;
158
    register uint64_t a1 asm("o0") = p1;
161
    register uint64_t a2 asm("o1") = p2;
159
    register uint64_t a2 asm("o1") = p2;
162
    register uint64_t a3 asm("o2") = p3;
160
    register uint64_t a3 asm("o2") = p3;
Line 168... Line 166...
168
        : "=r" (a1)
166
        : "=r" (a1)
169
        : "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6),
167
        : "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6),
170
          "i" (FAST_TRAP)
168
          "i" (FAST_TRAP)
171
        : "memory"
169
        : "memory"
172
    );
170
    );
173
   
171
 
174
    if (ret1 != NULL)
-
 
175
        *ret1 = a2;
-
 
176
    return a1;
172
    return a1;
177
}
173
}
178
 
174
 
179
/**
175
/**
180
 * Performs a fast hypervisor API call which return no value except for the
176
 * Performs a fast hypervisor API call which can return a value.
181
 * error status.
-
 
182
 *
177
 *
183
 * @param p1            the 1st argument of the hypervisor API call
178
 * @param p1            the 1st argument of the hypervisor API call
184
 * @param p2            the 2nd argument of the hypervisor API call
179
 * @param p2            the 2nd argument of the hypervisor API call
185
 * @param p3            the 3rd argument of the hypervisor API call
180
 * @param p3            the 3rd argument of the hypervisor API call
186
 * @param p4            the 4th argument of the hypervisor API call
181
 * @param p4            the 4th argument of the hypervisor API call
187
 * @param p5            the 5th argument of the hypervisor API call
182
 * @param p5            the 5th argument of the hypervisor API call
188
 * @param function_number   function number of the call
183
 * @param function_number   function number of the call
-
 
184
 * @param ret1          pointer to an address where the return value
-
 
185
 *              of the hypercall should be saved, or NULL
189
 * @return          error status
186
 * @return          error status
190
 */
187
 */
191
static inline uint64_t
188
static inline uint64_t
192
__hypercall_fast(const uint64_t p1, const uint64_t p2, const uint64_t p3,
189
__hypercall_fast_ret1(const uint64_t p1, const uint64_t p2, const uint64_t p3,
193
    const uint64_t p4, const uint64_t p5, const uint64_t function_number)
190
    const uint64_t p4, const uint64_t p5, const uint64_t function_number,
-
 
191
    uint64_t * const ret1)
194
{
192
{
195
    return __hypercall_fast_ret1(p1, p2, p3, p4, p5, function_number,
193
    uint64_t errno = __hypercall_fast(p1, p2, p3, p4, p5, function_number);
196
                     NULL);
194
    if (ret1 != NULL) {
-
 
195
        asm volatile ("mov %%o1, %0\n" : "=r" (*ret1));
-
 
196
    }
-
 
197
    return errno;
197
}
198
}
198
 
199
 
199
/**
200
/**
200
 * Performs a hyperfast hypervisor API call.
201
 * Performs a hyperfast hypervisor API call.
201
 *
202
 *