예제 #1
0
int vmm_printchars(struct vmm_chardev *cdev, char *ch, u32 num_ch, bool block)
{
	int i, rc;

	if (!ch || !num_ch) {
		return VMM_EFAIL;
	}

	if (stdio_init_done) {
		if (cdev) {
			rc = vmm_chardev_dowrite(cdev, (u8 *)ch, num_ch, NULL,
						 block) ? VMM_OK : VMM_EFAIL;
		} else {
			for (i = 0; i < num_ch; i++) {
				while ((rc = arch_defterm_putc((u8)ch[i])) && block);
			}
		}
	} else {
		for (i = 0; i < num_ch; i++) {
			arch_defterm_early_putc(ch[i]);
		}
		rc = VMM_OK;
	}

	return rc;
}
예제 #2
0
int vmm_printchars(struct vmm_chardev *cdev, char *ch, u32 num_ch, bool block)
{
	int i, rc;

	if (!ch || !num_ch) {
		return VMM_EFAIL;
	}

	if (stdio_init_done) {
		if (cdev) {
			rc = vmm_chardev_dowrite(cdev, (u8 *)ch, num_ch,
						 block) ? VMM_OK : VMM_EFAIL;
		} else {
			for (i = 0; i < num_ch; i++) {
				while ((rc = arch_defterm_putc((u8)ch[i])) && block);
			}
		}
	} else {
		for (i = 0; i < num_ch; i++) {
#if defined(ARCH_HAS_DEFTERM_EARLY_PRINT)
			arch_defterm_early_putc(ch[i]);
#else
			if (stdio_early_count < EARLY_BUF_SZ) {
				stdio_early_buffer[stdio_early_count] = ch[i];
				stdio_early_count++;
			}
#endif
		}
		rc = VMM_OK;
	}

	return rc;
}
예제 #3
0
int vmm_printchar(char **str, struct vmm_chardev *cdev, char c, bool block)
{
    int rc ;

    if (str && *str) {
        **str = c;
        ++(*str);
        rc = VMM_OK;
    } else if (stdio_init_done) {
        if (cdev) {
            rc = vmm_chardev_dowrite(cdev, (u8 *)&c, 0, sizeof(c),
                                     block) ? VMM_OK : VMM_EFAIL;
        } else {
            while ((rc = arch_defterm_putc((u8)c)) && block);
        }
    } else {
        if (stdio_early_count < EARLY_BUF_SZ) {
            stdio_early_buffer[stdio_early_count] = c;
            stdio_early_count++;
        }
        rc = VMM_OK;
    }

    return rc;
}
예제 #4
0
int vmm_printchar(char **str, struct vmm_chardev *cdev, char c, bool block)
{
	int rc ;
	if (str && *str) {
		**str = c;
		++(*str);
		rc = VMM_OK;
	} else if (cdev) {
		rc = ((vmm_chardev_dowrite(cdev, (u8 *)&c, 0, sizeof(c), 
					   block)) ? VMM_OK : VMM_EFAIL);
	} else {
		while (((rc = arch_defterm_putc((u8)c)) == VMM_EFAIL) 
		       && block);
	}

	return rc;
}
예제 #5
0
파일: vmm_stdio.c 프로젝트: nmaiti/xvisor
int vmm_printchar(char **str, vmm_chardev_t *cdev, char c, bool block)
{
	int rc = VMM_OK;
	if (str) {
		**str = c;
		++(*str);
	} else {
		if (cdev) {
			if (!vmm_chardev_dowrite(cdev, 
					(u8 *)&c, 0, sizeof(c), block)) {
				if (!block) {
					rc = VMM_EFAIL;
				}
			}
		} else {
			while ((rc = vmm_defterm_putc((u8)c))) {
				if (!block) {
					break;
				}
			}
		}
	}
	return rc;
}