9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 1cf609461d03e920016b9f9bb7b8043ffbee57a2
parent f414d8cb32f4fdb42f59a9ce02873b9c18418284
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 18 Oct 2020 09:41:46 +0200

os9/arm64: Add isys()

This function is intended for the generic system initialization
such that the code can be shared between all the ports.

Change-Id: I0b4ae0881f56cc40ff104357f67a904b369fafc8

Diffstat:
Asrc/os9/init.c | 40++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+), 0 deletions(-)

diff --git a/src/os9/init.c b/src/os9/init.c @@ -0,0 +1,40 @@ +#include <os9/os9.h> + +#include <string.h> + +Chan *console; + +extern char *getconf(char *name); + +static void +icons(void) +{ + char *cfg, *p; + Chan *c; + + if ((cfg = getconf("console")) == NULL) + panic("missed console configuration"); + + if ((c = devopen("#c/ctl", O_WRITE)) == NULL) + panic("namec:/dev/cons/ctl open"); + + while ((p =strchr(cfg, '\n')) != NULL) { + if (devwrite(c, cfg, p - cfg) < 0) + panic("writing console configuration"); + cfg = p+1; + } + + if (devclose(c) < 0) + panic("devclose"); + + if ((console = devopen("#c/raw", O_RDWR)) == NULL) + panic("namec:#c/raw read"); +} + +void +isys(void) +{ + idev(); + icons(); + debug(); +}