Add a low level function to write a string to the hypervisor

console directly.

Discussed with: kmacy
This commit is contained in:
jb 2006-11-03 06:31:56 +00:00
parent 9658161dc0
commit 09c57dd752
2 changed files with 17 additions and 0 deletions

View File

@ -116,6 +116,7 @@ extern uint64_t hv_dump_buf_update(uint64_t, uint64_t, uint64_t *);
extern int64_t hv_cnputchar(uint8_t); extern int64_t hv_cnputchar(uint8_t);
extern int64_t hv_cngetchar(uint8_t *); extern int64_t hv_cngetchar(uint8_t *);
extern void hv_cnputs(char *);
extern uint64_t hv_tod_get(uint64_t *seconds); extern uint64_t hv_tod_get(uint64_t *seconds);
extern uint64_t hv_tod_set(uint64_t); extern uint64_t hv_tod_set(uint64_t);

View File

@ -93,6 +93,22 @@ static cn_term_t hvcn_cnterm;
CONSOLE_DRIVER(hvcn); CONSOLE_DRIVER(hvcn);
void
hv_cnputs(char *p)
{
int c, error;
while ((c = *p++) != '\0') {
if (c == '\n') {
do {
error = hv_cnputchar('\r');
} while (error == H_EWOULDBLOCK);
}
do {
error = hv_cnputchar(c);
} while (error == H_EWOULDBLOCK);
}
}
static int static int
hvcn_open(struct cdev *dev, int flag, int mode, struct thread *td) hvcn_open(struct cdev *dev, int flag, int mode, struct thread *td)