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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
#define _ASM
#define __ASSEMBLY__
#include "macros.h"
#include "libhvcall.h"
#include <termctrl.h>
#include <product.h>
#define HVCALL .long 0x44000022
.text
.align 3
ENTRY(get_print_banner)
LOAD32(r4, print_version)
LOAD32(r5, print_version_end)
std r4,0(r3)
std r5,8(r3)
blr
ENTRY(hv_generic)
HVCALL
blr
/* r3 = char, r4 = hvtermno */
ENTRY(hv_putchar)
sldi r6,r3,(24+32)
li r3,H_PUT_TERM_CHAR
li r5,1
HVCALL
blr
/* r3 = hvtermno */
ENTRY(hv_getchar)
mflr r10
bl .hv_haschar
mtlr r10
cmpwi cr0,r3,0
beqlr
lis r9,inbuf@h
ori r9,r9,inbuf@l
lwz r4,20(r9)
lbzx r3,r4,r9
addi r4,r4,1
stw r4,20(r9)
blr
/* r3 = hvtermno */
ENTRY(hv_haschar)
mr r4,r3
li r3,-1
lis r9,inbuf@h
ori r9,r9,inbuf@l
lwz r5,16(r9)
lwz r6,20(r9)
cmplw cr0,r5,r6
bnelr
li r3,H_GET_TERM_CHAR
HVCALL
lis r9,inbuf@h
ori r9,r9,inbuf@l
stw r4,16(r9)
li r3,0
stw r3,20(r9)
cmplwi cr0,r4,0
beqlr
li r3,-1
std r5,0(r9)
std r6,8(r9)
blr
ENTRY(hv_send_crq)
ld r5,0(r4)
ld r6,8(r4)
mr r4,r3
li r3,H_SEND_CRQ
HVCALL
blr
ENTRY(hv_send_logical_lan)
li r11,0 /* no continue token for now */
mr r10,r9
mr r9,r8
mr r8,r7
mr r7,r6
mr r6,r5
mr r5,r4
mr r4,r3
li r3,H_SEND_LOGICAL_LAN
HVCALL
blr
ENTRY(hv_logical_ci_load)
mr r5,r4
mr r4,r3
li r3,H_LOGICAL_CI_LOAD
HVCALL
cmpdi cr0,r3,0
mr r3,r4
beqlr
li r3,-1
blr
ENTRY(hv_logical_ci_store)
mr r6,r5
mr r5,r4
mr r4,r3
li r3,H_LOGICAL_CI_STORE
HVCALL
blr
ENTRY(hv_logical_memop)
mr r8,r7
mr r7,r6
mr r6,r5
mr r5,r4
mr r4,r3
lis r3,KVMPPC_H_LOGICAL_MEMOP@h
ori r3,r3,KVMPPC_H_LOGICAL_MEMOP@l
HVCALL
blr
ENTRY(hv_cas)
mr r6,r5
mr r5,r4
mr r4,r3
lis r3,KVMPPC_H_CAS@h
ori r3,r3,KVMPPC_H_CAS@l
HVCALL
blr
.section ".bss"
inbuf: .space 16
inlen: .space 4
inpos: .space 4
.text
|