extern const unsigned long _binary_vga_size;
#endif /* FEATURE(VGA) */
+#if FEATURE(IO)
+extern const char _binary_io_end[];
+extern const char _binary_io_start[];
+extern const unsigned long _binary_io_size;
+#endif /* FEATURE(VGA) */
+
static struct initfs_entry _ifs_entries[] = {
+#if FEATURE(IO)
+ {
+ .ife_name = "io",
+ .ife_base = &_binary_io_start,
+ .ife_limit = (unsigned long)&_binary_io_size
+ },
+#endif /* FEATURE(IO) */
#if FEATURE(KBD)
{
.ife_name = "kbd",
.ife_base = &_binary_kbd_start,
.ife_limit = (unsigned long)&_binary_kbd_size
},
-#endif
+#endif /* FEATURE(KBD) */
#if FEATURE(VGA)
{
.ife_name = "vga",
.ife_base = &_binary_vga_start,
.ife_limit = (unsigned long)&_binary_vga_size
},
-#endif
+#endif /* FEATURE(VGA) */
};
struct initfs initfs = {
--- /dev/null
+OBJECTS = main.o #globals.o open.o close.o read.o write.o
+OUTPUT = io
+MODULE = io.ko
+
+INCLUDES = -I../../include -I../..
+CFLAGS = -m32 -Wall -nostdlib -nodefaultlibs -nostartfiles -ffreestanding \
+ -nostdinc -fno-builtin -fno-builtin-memcpy
+LIBS = ../../libc/libc.a
+CFLAGS += $(INCLUDES)
+
+ASFLAGS = $(CFLAGS)
+PHONY = clean
+
+all: $(MODULE)
+
+$(MODULE): $(OUTPUT)
+ ld -r --oformat=elf32-i386 -m elf_i386 -b binary -o $@ $<
+ cp $@ ../
+
+$(OUTPUT): $(OBJECTS)
+ gcc -static $(CFLAGS) -o $@ $^ $(LIBS)
+
+clean:
+ rm -f $(OBJECTS) $(OUTPUT)
+
+.PHONY: $(PHONY)
--- /dev/null
+#include <crxstd.h>
+#include <corax/ipc.h>
+#include <corax/ipc/io.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+/*
+int cxio_read(struct cxmsg*);
+int cxio_write(struct cxmsg*);
+int cxio_open(struct cxmsg*);
+int cxio_close(struct cxmsg*);
+*/
+
+int main(int argc, char *argv[])
+{
+ struct cxmsg msg;
+ int err;
+
+ while(1) {
+ char str[64];
+ int len;
+
+ len = snprintf(str, sizeof(str), "[IO] Waiting for messages...\n");
+ debug(str, len);
+
+ err = cxrecv(PID_ANY, &msg);
+
+ len = snprintf(str, sizeof(str), "[IO] Received a message from %u\n", msg.cm_src);
+ debug(str, len);
+
+ if(err < 0) {
+ continue;
+ }
+
+ switch(msg.cm_type) {
+#if 0
+ case CXIO_READ:
+ err = cxio_read(&msg);
+ break;
+
+ case CXIO_WRITE:
+ err = cxio_write(&msg);
+ break;
+
+ case CXIO_OPEN:
+ err = cxio_open(&msg);
+ break;
+
+ case CXIO_CLOSE:
+ err = cxio_close(&msg);
+ break;
+#endif /* 0 */
+ case CXIO_PIPE:
+ memset(str, 0, sizeof(str));
+ len = snprintf(str, sizeof(str), "CXIO_PIPE from 0x%x.\n", msg.cm_src);
+ debug(str, len);
+ break;
+
+ default:
+ memset(str, 0, sizeof(str));
+ len = snprintf(str, sizeof(str), "0x%x from 0x%x.\n", msg.cm_type, msg.cm_src);
+ debug(str, len);
+ break;
+ }
+ }
+
+ return(0);
+}