From: Matthias Kruk Date: Fri, 31 Jan 2020 11:26:41 +0000 (+0900) Subject: Correctly check the return value of cxrecv() in vga daemon, print a message during... X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=9c0680d80d43b15ca3ac8c1343f570198c52480e;p=corax Correctly check the return value of cxrecv() in vga daemon, print a message during startup --- diff --git a/kernel/vga/main.c b/kernel/vga/main.c index 9b4d162..41f2ac4 100644 --- a/kernel/vga/main.c +++ b/kernel/vga/main.c @@ -2,6 +2,7 @@ #include #include #include +#include enum vgacolor { BLACK = 0, @@ -71,6 +72,7 @@ static int _puts(struct context *ctx, const char *s) int vga_main(int argc, char *argv[]) { struct context ctx; + char line[80]; ctx.buffer = mmap(VGA_BUFFER_ADDR, 0x1000, PROT_READ | PROT_WRITE, MAP_PHYS, 0, 0); @@ -83,16 +85,22 @@ int vga_main(int argc, char *argv[]) ctx.attrs = FG(LGRAY) | BG(BLACK); memset(ctx.buffer, 0, VGA_BUFFER_SIZE); + snprintf(line, sizeof(line), "VGA video memory mapped at %p\n", ctx.buffer); + _puts(&ctx, line); + while(1) { struct cxmsg msg; int err; + int i; + + memset(&msg, 0, sizeof(msg)); err = cxrecv(PID_ANY, &msg); /* FIXME: Validate message */ /* FIXME: Only accept messages from IO process */ - if(err > 0) { + if(!err) { err = _puts(&ctx, (const char*)msg.cm_data); }