]> xenbits.xensource.com Git - people/liuw/rumprun.git/commitdiff
allow alternative console implementations, not just the vga console
authorAntti Kantee <pooka@iki.fi>
Thu, 30 Apr 2015 10:20:41 +0000 (10:20 +0000)
committerAntti Kantee <pooka@iki.fi>
Thu, 30 Apr 2015 10:21:17 +0000 (10:21 +0000)
platform/baremetal/arch/i386/Makefile.inc
platform/baremetal/arch/i386/vgacons.c [new file with mode: 0644]
platform/baremetal/kernel.c

index 7f44935e53fc20644701f8bed533bf95a158c906..7b918c4c46578b9552a877f6e2c61eae606982aa 100644 (file)
@@ -1,4 +1,5 @@
 OBJS_BMK+=     arch/i386/locore32.o arch/i386/machdep.o arch/i386/boot.o
+OBJS_BMK+=     arch/i386/vgacons.o
 LDSCRIPT=      arch/i386/kern.ldscript
 
 CFLAGS+=       -mno-sse -mno-mmx -march=i686
diff --git a/platform/baremetal/arch/i386/vgacons.c b/platform/baremetal/arch/i386/vgacons.c
new file mode 100644 (file)
index 0000000..5020814
--- /dev/null
@@ -0,0 +1,85 @@
+/*-
+ * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <bmk/types.h>
+#include <bmk/kernel.h>
+
+#define CONS_WIDTH 80
+#define CONS_HEIGHT 25
+#define CONS_MAGENTA 0x500
+static volatile uint16_t *cons_buf = (volatile uint16_t *)0xb8000;
+
+static void
+cons_putat(int c, int x, int y)
+{
+
+       cons_buf[x + y*CONS_WIDTH] = CONS_MAGENTA|c;
+}
+
+/* display a character in the next available slot */
+void
+bmk_cons_putc(int c)
+{
+       static int cons_x;
+       static int cons_y;
+       int x;
+       int doclear = 0;
+
+       if (c == '\n') {
+               cons_x = 0;
+               cons_y++;
+               doclear = 1;
+       } else if (c == '\r') {
+               cons_x = 0;
+       } else if (c == '\t') {
+               cons_x = (cons_x+8) & ~7;
+       } else {
+               cons_putat(c, cons_x++, cons_y);
+       }
+       if (cons_x == CONS_WIDTH) {
+               cons_x = 0;
+               cons_y++;
+               doclear = 1;
+       }
+       if (cons_y == CONS_HEIGHT) {
+               cons_y--;
+               /* scroll screen up one line */
+               for (x = 0; x < (CONS_HEIGHT-1)*CONS_WIDTH; x++)
+                       cons_buf[x] = cons_buf[x+CONS_WIDTH];
+       }
+       if (doclear) {
+               for (x = 0; x < CONS_WIDTH; x++)
+                       cons_putat(' ', x, cons_y);
+       }
+}
+
+void
+bmk_init(void)
+{
+       int x;
+
+       for (x = 0; x < CONS_HEIGHT * CONS_WIDTH; x++)
+               cons_putat(' ', x % CONS_WIDTH, x / CONS_WIDTH);
+}
index 301e75b2fb075a8d75b25234887fda0e312224c1..c1c6428c779a77ca188a679dd2240de50f8090ed 100644 (file)
@@ -155,75 +155,7 @@ bmk_platform_splx(unsigned long x)
 
        return; /* XXX */
 }
-
-/*
- * console.  quick, cheap, dirty, etc.
- * Should eventually keep an in-memory log.  printf-debugging is currently
- * a bit, hmm, limited.
- */
  
-#define CONS_WIDTH 80
-#define CONS_HEIGHT 25
-#define CONS_MAGENTA 0x500
-static volatile uint16_t *cons_buf = (volatile uint16_t *)0xb8000;
-
-static void
-cons_putat(int c, int x, int y)
-{
-
-       cons_buf[x + y*CONS_WIDTH] = CONS_MAGENTA|c;
-}
-
-/* display a character in the next available slot */
-void
-bmk_cons_putc(int c)
-{
-       static int cons_x;
-       static int cons_y;
-       int x;
-       int doclear = 0;
-
-       if (c == '\n') {
-               cons_x = 0;
-               cons_y++;
-               doclear = 1;
-       } else if (c == '\r') {
-               cons_x = 0;
-       } else if (c == '\t') {
-               cons_x = (cons_x+8) & ~7;
-       } else {
-               cons_putat(c, cons_x++, cons_y);
-       }
-       if (cons_x == CONS_WIDTH) {
-               cons_x = 0;
-               cons_y++;
-               doclear = 1;
-       }
-       if (cons_y == CONS_HEIGHT) {
-               cons_y--;
-               /* scroll screen up one line */
-               for (x = 0; x < (CONS_HEIGHT-1)*CONS_WIDTH; x++)
-                       cons_buf[x] = cons_buf[x+CONS_WIDTH];
-       }
-       if (doclear) {
-               for (x = 0; x < CONS_WIDTH; x++)
-                       cons_putat(' ', x, cons_y);
-       }
-}
-/*
- * init.  currently just clears the console.
- * rest is done in bmk_main()
- */
-void
-bmk_init(void)
-{
-       int x;
-
-       for (x = 0; x < CONS_HEIGHT * CONS_WIDTH; x++)
-               cons_putat(' ', x % CONS_WIDTH, x / CONS_WIDTH);
-}
-
 void
 bmk_run(char *cmdline)
 {