aboutsummaryrefslogtreecommitdiff
path: root/lib/libhvcall/hvcall.code
blob: 4e47c06fea3d3f1f61bf31928234b0c787537b8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/******************************************************************************
 * Copyright (c) 2004, 2008 IBM Corporation
 * All rights reserved.
 * This program and the accompanying materials
 * are made available under the terms of the BSD License
 * which accompanies this distribution, and is available at
 * http://www.opensource.org/licenses/bsd-license.php
 *
 * Contributors:
 *     IBM Corporation - initial implementation
 *****************************************************************************/
#include <libhvcall.h>

// : hv-putchar ( char -- )
PRIM(hv_X2d_putchar)
	char c = TOS.n; POP;
	hv_putchar(c);
MIRP

// : hv-getchar ( -- char )
PRIM(hv_X2d_getchar)
	PUSH;
	TOS.n = hv_getchar();
MIRP

// : hv-haschar ( -- res )
PRIM(hv_X2d_haschar)
	PUSH;
	TOS.n = hv_haschar();
MIRP

// : hv-reg-crq ( unit qaddr qsize -- res )
PRIM(hv_X2d_reg_X2d_crq)
	unsigned long qsize = TOS.u; POP;
	unsigned long qaddr = TOS.u; POP;
	unsigned int unit = TOS.u;
	TOS.n = hv_reg_crq(unit, qaddr, qsize);
MIRP

// : hv-free-crq ( unit -- )
PRIM(hv_X2d_free_X2d_crq)
	unsigned int unit = TOS.u; POP;
	hv_free_crq(unit);
MIRP

// : hv-send-crq ( unit msgaddr -- rc )
PRIM(hv_X2d_send_X2d_crq)
	uint64_t *msgaddr = (uint64_t *)TOS.u; POP;
	unsigned int unit = TOS.u;
	TOS.n = hv_send_crq(unit, msgaddr);
MIRP