From 9b79673dcb33e0904154f905a2564a20a4d9c2dd Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Fri, 5 Aug 2011 14:25:00 +0200 Subject: [PATCH] Initial version of Sortix. --- Makefile | 113 ++ debsrc/DEBIAN/control | 11 + debsrc/DEBIAN/postinst | 4 + debsrc/DEBIAN/postrm | 3 + debsrc/etc/grub.d/42_sortix | 11 + hello/Makefile | 46 + hello/hello.c | 9 + isosrc/boot/grub/grub.cfg | 27 + isosrc/boot/grub/sortix.png | Bin 0 -> 152351 bytes libmaxsi/Makefile | 135 +++ libmaxsi/c++.cpp | 106 ++ libmaxsi/c/decl/FILE.h | 5 + libmaxsi/c/decl/SEEK_CUR.h | 3 + libmaxsi/c/decl/SEEK_END.h | 3 + libmaxsi/c/decl/SEEK_SET.h | 3 + libmaxsi/c/decl/WEOF.h | 3 + libmaxsi/c/decl/useconds_t.h | 4 + libmaxsi/c/decl/wctrans_t.h | 4 + libmaxsi/c/decl/wctype_t.h | 4 + libmaxsi/c/file.c | 305 +++++ libmaxsi/c/hsrc/fcntl.h | 95 ++ libmaxsi/c/hsrc/features.h | 51 + libmaxsi/c/hsrc/stdarg.h | 42 + libmaxsi/c/hsrc/stddef.h | 44 + libmaxsi/c/hsrc/stdio.h | 157 +++ libmaxsi/c/hsrc/stdlib.h | 125 +++ libmaxsi/c/hsrc/string.h | 77 ++ libmaxsi/c/hsrc/sys/stat.h | 39 + libmaxsi/c/hsrc/sys/types.h | 39 + libmaxsi/c/hsrc/unistd.h | 173 +++ libmaxsi/c/hsrc/wchar.h | 151 +++ libmaxsi/c/hsrc/wctype.h | 79 ++ libmaxsi/c/string.c | 35 + libmaxsi/decl/NULL.h | 3 + libmaxsi/decl/WCHAR_MAX.h | 3 + libmaxsi/decl/WCHAR_MIN.h | 3 + libmaxsi/decl/gid_t.h | 4 + libmaxsi/decl/id_t.h | 4 + libmaxsi/decl/intn_t.h | 80 ++ libmaxsi/decl/intptr_t.h | 4 + libmaxsi/decl/locale_t.h | 4 + libmaxsi/decl/mode_t.h | 4 + libmaxsi/decl/mode_t_values.h | 27 + libmaxsi/decl/off_t.h | 4 + libmaxsi/decl/pid_t.h | 4 + libmaxsi/decl/ptrdiff_t.h | 4 + libmaxsi/decl/size_t.h | 4 + libmaxsi/decl/ssize_t.h | 4 + libmaxsi/decl/uid_t.h | 4 + libmaxsi/decl/va_list.h | 8 + libmaxsi/decl/wchar_t.h | 6 + libmaxsi/decl/wint_t.h | 4 + libmaxsi/error.cpp | 35 + libmaxsi/format.cpp | 280 +++++ libmaxsi/hsrc/error.h | 58 + libmaxsi/hsrc/format.h | 39 + libmaxsi/hsrc/io.h | 54 + libmaxsi/hsrc/memory.h | 53 + libmaxsi/hsrc/platform.h | 87 ++ libmaxsi/hsrc/string.h | 46 + libmaxsi/hsrc/syscall.h | 208 ++++ libmaxsi/hsrc/thread.h | 42 + libmaxsi/hsrc/types.h | 52 + libmaxsi/io.cpp | 48 + libmaxsi/memory.cpp | 484 ++++++++ libmaxsi/start.s | 43 + libmaxsi/string.cpp | 137 +++ libmaxsi/thread.cpp | 90 ++ mxmpp/COPYING | 674 ++++++++++++ mxmpp/Makefile.in | 68 ++ mxmpp/README | 28 + mxmpp/config.guess | 1502 +++++++++++++++++++++++++ mxmpp/config.h.in | 152 +++ mxmpp/config.sub | 1714 +++++++++++++++++++++++++++++ mxmpp/configure.ac | 110 ++ mxmpp/install-sh | 322 ++++++ mxmpp/mxmpp.cpp | 414 +++++++ sortix/Makefile | 120 ++ sortix/application.cpp | 63 ++ sortix/astroids.cpp | 143 +++ sortix/astroids.h | 64 ++ sortix/bits.h | 32 + sortix/conway.cpp | 194 ++++ sortix/conway.h | 41 + sortix/descriptor_tables.cpp | 210 ++++ sortix/descriptor_tables.h | 181 +++ sortix/descriptors.h | 64 ++ sortix/device.cpp | 56 + sortix/device.h | 89 ++ sortix/filesystem.cpp | 80 ++ sortix/filesystem.h | 98 ++ sortix/globals.h | 32 + sortix/http.cpp | 183 +++ sortix/iirqhandler.h | 37 + sortix/iprintable.cpp | 257 +++++ sortix/iprintable.h | 48 + sortix/isr.cpp | 77 ++ sortix/isr.h | 26 + sortix/kernel.cpp | 274 +++++ sortix/keyboard.cpp | 709 ++++++++++++ sortix/keyboard.h | 48 + sortix/link.ld | 33 + sortix/log.cpp | 223 ++++ sortix/log.h | 98 ++ sortix/memorymanagement.cpp | 491 +++++++++ sortix/memorymanagement.h | 98 ++ sortix/mount.cpp | 305 +++++ sortix/mount.h | 75 ++ sortix/multiboot.h | 224 ++++ sortix/mxfs.cpp | 429 ++++++++ sortix/mxfs.h | 118 ++ sortix/panic.cpp | 92 ++ sortix/panic.h | 42 + sortix/pci.cpp | 292 +++++ sortix/pci.h | 39 + sortix/platform.h | 82 ++ sortix/pong.cpp | 311 ++++++ sortix/pong.h | 45 + sortix/process.h | 71 ++ sortix/scheduler.cpp | 506 +++++++++ sortix/scheduler.h | 120 ++ sortix/serialterminal.cpp | 53 + sortix/serialterminal.h | 39 + sortix/shell.cpp | 167 +++ sortix/shell.h | 62 ++ sortix/sound.cpp | 57 + sortix/sound.h | 38 + sortix/stream.h | 88 ++ sortix/syscall.cpp | 92 ++ sortix/syscall.h | 54 + sortix/system.h | 51 + sortix/test.cpp | 12 + sortix/thread.h | 1 + sortix/time.cpp | 106 ++ sortix/time.h | 41 + sortix/types.h | 101 ++ sortix/uart.cpp | 310 ++++++ sortix/uart.h | 45 + sortix/user.h | 43 + sortix/vga.h | 62 ++ sortix/vgaterminal.cpp | 535 +++++++++ sortix/vgaterminal.h | 39 + sortix/x64/base.s | 72 ++ sortix/x64/bits.h | 130 +++ sortix/x64/boot.s | 175 +++ sortix/x64/gdt.asm | 43 + sortix/x64/interrupt.asm | 108 ++ sortix/x64/memorymanagement-asm.s | 163 +++ sortix/x64/x64.cpp | 68 ++ sortix/x64/x64.h | 52 + sortix/x86/base.s | 61 + sortix/x86/bits.h | 130 +++ sortix/x86/boot.s | 47 + sortix/x86/gdt.asm | 39 + sortix/x86/interrupt.asm | 162 +++ sortix/x86/memorymanagement-asm.s | 173 +++ sortix/x86/x86.cpp | 68 ++ sortix/x86/x86.h | 51 + subsystem/man | 64 ++ 159 files changed, 19246 insertions(+) create mode 100644 Makefile create mode 100644 debsrc/DEBIAN/control create mode 100755 debsrc/DEBIAN/postinst create mode 100755 debsrc/DEBIAN/postrm create mode 100755 debsrc/etc/grub.d/42_sortix create mode 100644 hello/Makefile create mode 100644 hello/hello.c create mode 100644 isosrc/boot/grub/grub.cfg create mode 100644 isosrc/boot/grub/sortix.png create mode 100644 libmaxsi/Makefile create mode 100644 libmaxsi/c++.cpp create mode 100644 libmaxsi/c/decl/FILE.h create mode 100644 libmaxsi/c/decl/SEEK_CUR.h create mode 100644 libmaxsi/c/decl/SEEK_END.h create mode 100644 libmaxsi/c/decl/SEEK_SET.h create mode 100644 libmaxsi/c/decl/WEOF.h create mode 100644 libmaxsi/c/decl/useconds_t.h create mode 100644 libmaxsi/c/decl/wctrans_t.h create mode 100644 libmaxsi/c/decl/wctype_t.h create mode 100644 libmaxsi/c/file.c create mode 100644 libmaxsi/c/hsrc/fcntl.h create mode 100644 libmaxsi/c/hsrc/features.h create mode 100644 libmaxsi/c/hsrc/stdarg.h create mode 100644 libmaxsi/c/hsrc/stddef.h create mode 100644 libmaxsi/c/hsrc/stdio.h create mode 100644 libmaxsi/c/hsrc/stdlib.h create mode 100644 libmaxsi/c/hsrc/string.h create mode 100644 libmaxsi/c/hsrc/sys/stat.h create mode 100644 libmaxsi/c/hsrc/sys/types.h create mode 100644 libmaxsi/c/hsrc/unistd.h create mode 100644 libmaxsi/c/hsrc/wchar.h create mode 100644 libmaxsi/c/hsrc/wctype.h create mode 100644 libmaxsi/c/string.c create mode 100644 libmaxsi/decl/NULL.h create mode 100644 libmaxsi/decl/WCHAR_MAX.h create mode 100644 libmaxsi/decl/WCHAR_MIN.h create mode 100644 libmaxsi/decl/gid_t.h create mode 100644 libmaxsi/decl/id_t.h create mode 100644 libmaxsi/decl/intn_t.h create mode 100644 libmaxsi/decl/intptr_t.h create mode 100644 libmaxsi/decl/locale_t.h create mode 100644 libmaxsi/decl/mode_t.h create mode 100644 libmaxsi/decl/mode_t_values.h create mode 100644 libmaxsi/decl/off_t.h create mode 100644 libmaxsi/decl/pid_t.h create mode 100644 libmaxsi/decl/ptrdiff_t.h create mode 100644 libmaxsi/decl/size_t.h create mode 100644 libmaxsi/decl/ssize_t.h create mode 100644 libmaxsi/decl/uid_t.h create mode 100644 libmaxsi/decl/va_list.h create mode 100644 libmaxsi/decl/wchar_t.h create mode 100644 libmaxsi/decl/wint_t.h create mode 100644 libmaxsi/error.cpp create mode 100644 libmaxsi/format.cpp create mode 100644 libmaxsi/hsrc/error.h create mode 100644 libmaxsi/hsrc/format.h create mode 100644 libmaxsi/hsrc/io.h create mode 100644 libmaxsi/hsrc/memory.h create mode 100644 libmaxsi/hsrc/platform.h create mode 100644 libmaxsi/hsrc/string.h create mode 100644 libmaxsi/hsrc/syscall.h create mode 100644 libmaxsi/hsrc/thread.h create mode 100644 libmaxsi/hsrc/types.h create mode 100644 libmaxsi/io.cpp create mode 100644 libmaxsi/memory.cpp create mode 100644 libmaxsi/start.s create mode 100644 libmaxsi/string.cpp create mode 100644 libmaxsi/thread.cpp create mode 100644 mxmpp/COPYING create mode 100644 mxmpp/Makefile.in create mode 100644 mxmpp/README create mode 100755 mxmpp/config.guess create mode 100644 mxmpp/config.h.in create mode 100755 mxmpp/config.sub create mode 100644 mxmpp/configure.ac create mode 100755 mxmpp/install-sh create mode 100644 mxmpp/mxmpp.cpp create mode 100644 sortix/Makefile create mode 100644 sortix/application.cpp create mode 100644 sortix/astroids.cpp create mode 100644 sortix/astroids.h create mode 100644 sortix/bits.h create mode 100644 sortix/conway.cpp create mode 100644 sortix/conway.h create mode 100644 sortix/descriptor_tables.cpp create mode 100644 sortix/descriptor_tables.h create mode 100644 sortix/descriptors.h create mode 100644 sortix/device.cpp create mode 100644 sortix/device.h create mode 100644 sortix/filesystem.cpp create mode 100644 sortix/filesystem.h create mode 100644 sortix/globals.h create mode 100644 sortix/http.cpp create mode 100644 sortix/iirqhandler.h create mode 100644 sortix/iprintable.cpp create mode 100644 sortix/iprintable.h create mode 100644 sortix/isr.cpp create mode 100644 sortix/isr.h create mode 100644 sortix/kernel.cpp create mode 100644 sortix/keyboard.cpp create mode 100644 sortix/keyboard.h create mode 100644 sortix/link.ld create mode 100644 sortix/log.cpp create mode 100644 sortix/log.h create mode 100644 sortix/memorymanagement.cpp create mode 100644 sortix/memorymanagement.h create mode 100644 sortix/mount.cpp create mode 100644 sortix/mount.h create mode 100644 sortix/multiboot.h create mode 100644 sortix/mxfs.cpp create mode 100644 sortix/mxfs.h create mode 100644 sortix/panic.cpp create mode 100644 sortix/panic.h create mode 100644 sortix/pci.cpp create mode 100644 sortix/pci.h create mode 100644 sortix/platform.h create mode 100644 sortix/pong.cpp create mode 100644 sortix/pong.h create mode 100644 sortix/process.h create mode 100644 sortix/scheduler.cpp create mode 100644 sortix/scheduler.h create mode 100644 sortix/serialterminal.cpp create mode 100644 sortix/serialterminal.h create mode 100644 sortix/shell.cpp create mode 100644 sortix/shell.h create mode 100644 sortix/sound.cpp create mode 100644 sortix/sound.h create mode 100644 sortix/stream.h create mode 100644 sortix/syscall.cpp create mode 100644 sortix/syscall.h create mode 100644 sortix/system.h create mode 100644 sortix/test.cpp create mode 100644 sortix/thread.h create mode 100644 sortix/time.cpp create mode 100644 sortix/time.h create mode 100644 sortix/types.h create mode 100644 sortix/uart.cpp create mode 100644 sortix/uart.h create mode 100644 sortix/user.h create mode 100644 sortix/vga.h create mode 100644 sortix/vgaterminal.cpp create mode 100644 sortix/vgaterminal.h create mode 100644 sortix/x64/base.s create mode 100644 sortix/x64/bits.h create mode 100644 sortix/x64/boot.s create mode 100644 sortix/x64/gdt.asm create mode 100644 sortix/x64/interrupt.asm create mode 100644 sortix/x64/memorymanagement-asm.s create mode 100644 sortix/x64/x64.cpp create mode 100644 sortix/x64/x64.h create mode 100644 sortix/x86/base.s create mode 100644 sortix/x86/bits.h create mode 100644 sortix/x86/boot.s create mode 100644 sortix/x86/gdt.asm create mode 100644 sortix/x86/interrupt.asm create mode 100644 sortix/x86/memorymanagement-asm.s create mode 100644 sortix/x86/x86.cpp create mode 100644 sortix/x86/x86.h create mode 100644 subsystem/man diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..75c34cf1 --- /dev/null +++ b/Makefile @@ -0,0 +1,113 @@ +ifndef CPU + CPU=x86 +endif + +REMOTE=192.168.2.6 +REMOTEUSER=sortie +REMOTECOPYDIR:=/home/$(REMOTEUSER)/Desktop/MaxsiOS +MODULES=libmaxsi hello sortix + +VERSION=0.4 +DEBNAME:=sortix_$(VERSION)_$(CPU) +DEBSRCNAME:=sortix_$(VERSION) +DEBDIR:=builds/$(DEBNAME) +DEBSRCDIR:=builds/$(DEBSRCNAME)-src +DEBFILE:=builds/$(DEBNAME).deb +PACKAGENAME:=sortix +ISODIR:=builds/$(DEBNAME)-iso +ISOFILE:=builds/$(DEBNAME).iso +JSNAME:=jssortix_$(VERSION)_$(CPU).bin + +all: + (for D in $(MODULES); do $(MAKE) all $(MFLAGS) --directory $$D; done) +clean: + (for D in $(MODULES); do $(MAKE) clean $(MFLAGS) --directory $$D; done) + +distclean: clean cleanbuilds + +cleanbuilds: + rm -rf builds/ + rm -f sortix.iso + +everything: all deb iso jssortix + +# Local machine + +install: all + cp sortix/sortix.bin /boot + cp debsrc/etc/grub.d/42_sortix /etc/grub.d/42_sortix + chmod +x /etc/grub.d/42_sortix + update-grub + +uninstall: + rm -f /boot/sortix.bin + rm -f /etc/grub.d/42_sortix + update-grub + +# Remote machine + +install-remote: all + scp -r ./ $(REMOTE):$(REMOTECOPYDIR) + scp sortix/sortix.bin root@$(REMOTE):/boot + ssh root@$(REMOTE) "init 6" + +uninstall-remote: + ssh root@$(REMOTE) "rm /boot/sortix.bin" + +# Packaging + +deb: debfile debsource + +debfile: all + rm -rf $(DEBDIR) + mkdir -p $(DEBDIR) + cp -r debsrc/. $(DEBDIR) + mkdir -p $(DEBDIR)/boot + cp sortix/sortix.bin $(DEBDIR)/boot + cat debsrc/DEBIAN/control | \ + sed "s/SORTIX_PACKAGE_NAME/$(PACKAGENAME)/g" | \ + sed "s/SORTIX_VERSION/$(VERSION)/g" | \ + sed "s/SORTIX_ARCH/all/g" | \ + cat > $(DEBDIR)/DEBIAN/control + dpkg --build $(DEBDIR) $(DEBFILE) + rm -rf $(DEBDIR)/DEBIAN + (cd builds/$(DEBNAME) && tar cfzv ../$(DEBNAME).tar.gz `ls`) + rm -rf $(DEBDIR) + +debsource: all + rm -rf $(DEBSRCDIR) + mkdir -p $(DEBSRCDIR) + for D in `ls | grep -v builds`; do cp -r $$D $(DEBSRCDIR); done + (cd $(DEBSRCDIR) && make distclean) + (cd builds && tar cfzv $(DEBSRCNAME)-src.tar.gz $(DEBSRCNAME)-src) + rm -rf $(DEBSRCDIR) + +jssortix: all + mkdir -p builds + $(MAKE) jssortix $(MFLAGS) --directory sortix + cp sortix/jssortix.bin builds/$(JSNAME) + +# Bootable images + +iso: all debsource + rm -rf $(ISODIR) + mkdir -p builds + mkdir -p $(ISODIR) + cp -r isosrc/. $(ISODIR) + cp sortix/sortix.bin $(ISODIR)/boot + cp hello/hello $(ISODIR)/boot/sortix.initrd + cp builds/$(DEBSRCNAME)-src.tar.gz $(ISODIR) + grub-mkrescue -o $(ISOFILE) $(ISODIR) + rm -rf $(ISODIR) + +sortix.iso: iso + cp $(ISOFILE) sortix.iso + +# Virtualization +run-virtualbox: sortix.iso + virtualbox --startvm sortix + +run-virtualbox-debug: sortix.iso + virtualbox --debug --start-running --startvm sortix + + diff --git a/debsrc/DEBIAN/control b/debsrc/DEBIAN/control new file mode 100644 index 00000000..73579c71 --- /dev/null +++ b/debsrc/DEBIAN/control @@ -0,0 +1,11 @@ +Package: SORTIX_PACKAGE_NAME +Version: SORTIX_VERSION +Section: kernel +Priority: optional +Architecture: SORTIX_ARCH +Essential: no +Recommends: grub2, xorriso +Provides: sortix +Maintainer: Jonas Termansen [sortie@maxsi.org] +Description: Sortix is a small hobby kernel developed for the heck of it. + diff --git a/debsrc/DEBIAN/postinst b/debsrc/DEBIAN/postinst new file mode 100755 index 00000000..c0370b10 --- /dev/null +++ b/debsrc/DEBIAN/postinst @@ -0,0 +1,4 @@ +#!/bin/sh +set -e +update-grub + diff --git a/debsrc/DEBIAN/postrm b/debsrc/DEBIAN/postrm new file mode 100755 index 00000000..89246e83 --- /dev/null +++ b/debsrc/DEBIAN/postrm @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +if [ "$1" != "upgrade" ]; then update-grub; fi diff --git a/debsrc/etc/grub.d/42_sortix b/debsrc/etc/grub.d/42_sortix new file mode 100755 index 00000000..1dbe3ca0 --- /dev/null +++ b/debsrc/etc/grub.d/42_sortix @@ -0,0 +1,11 @@ +#!/bin/sh +if [ -f /boot/sortix.bin ]; then + echo "Found Sortix kernel: /boot/sortix" >&2 + +cat << EOF +menuentry "Sortix" { + multiboot /boot/sortix.bin +} +EOF +fi + diff --git a/hello/Makefile b/hello/Makefile new file mode 100644 index 00000000..db544657 --- /dev/null +++ b/hello/Makefile @@ -0,0 +1,46 @@ +# This is a bit bothersome design, but it should serve well enough as a simple +# cross-compiler for the Sortix operating system. + +ifndef CPU + CPU=x86 +endif + +ifeq ($(CPU),x86) + X86FAMILY=1 + CPUDEFINES=-DPLATFORM_X86 + CPUFLAGS=-m32 + CPULDFLAGS=-melf_i386 +endif + +ifeq ($(CPU),x64) + X86FAMILY=1 + CPUDEFINES=-DPLATFORM_X64 + CPUFLAGS=-m64 + CPULDFLAGS=-melf_x86_64 +endif + +LIBMAXSIROOT=../libmaxsi + +INCLUDES=-I $(LIBMAXSIROOT)/c/h/ -I ../ +CPPFLAGS=$(CPUDEFINES) + +LD=ld +LDFLAGS=$(CPULDFLAGS) -Ttext 400000 $(LIBMAXSIROOT)/start.o +CC=gcc +CFLAGS=$(CPUFLAGS) -nostdinc -nostdlib -fno-builtin -nostartfiles -nodefaultlibs -fno-stack-protector $(INCLUDES) +CXX=g++ +CXXFLAGS=$(CPUFLAGS) -nostdinc -nostdlib -fno-builtin -nostartfiles -nodefaultlibs -fno-exceptions -fno-rtti -fno-stack-protector $(INCLUDES) +LIBC=$(LIBMAXSIROOT)/libc.a + +all: hello + +hello: hello.o + $(LD) $(LDFLAGS) hello.o -o hello.tmp $(LIBC) + objcopy -O binary hello.tmp hello + +hello.o: hello.c + $(CC) $(CPPFLAGS) $(CFLAGS) -O2 -c hello.c -o hello.o + +clean: + rm -f hello.tmp hello.o hello + diff --git a/hello/hello.c b/hello/hello.c new file mode 100644 index 00000000..526c72fb --- /dev/null +++ b/hello/hello.c @@ -0,0 +1,9 @@ +#include + +int main(int argc, char* argv[]) +{ + printf("\e[m\e[0J"); + printf("OH MY GOD! Sortix can load programs!\n"); + return 0; +} + diff --git a/isosrc/boot/grub/grub.cfg b/isosrc/boot/grub/grub.cfg new file mode 100644 index 00000000..9ecee080 --- /dev/null +++ b/isosrc/boot/grub/grub.cfg @@ -0,0 +1,27 @@ +insmod part_msdos +insmod ext2 +insmod png + +if loadfont /boot/grub/fonts/unicode.pf2 ; then + set gfxmode=800x600 + insmod vbe + insmod vga + insmod gfxterm +fi +terminal_output gfxterm + +if background_image /boot/grub/sortix.png ; then + set color_normal=white/black + set color_highlight=white/light-gray +else + set menu_color_normal=white/black + set menu_color_highlight=white/light-gray +fi + +set timeout=10 +set default="0" + +menuentry "Sortix" { + multiboot /boot/sortix.bin + module /boot/sortix.initrd +} diff --git a/isosrc/boot/grub/sortix.png b/isosrc/boot/grub/sortix.png new file mode 100644 index 0000000000000000000000000000000000000000..dbdf7a57d51ee287406d2f1d812740c1c3fca528 GIT binary patch literal 152351 zcmV*uKtaEWP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipZ0 z6ErM-@-%S(000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dak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< -o $@ + +%.o: %.asm + nasm $(CPUNASMFLAGS) $< -o $@ + +# libc + +c/*.c: $(CHEADERS) + +c/%.o: c/%.c + gcc -c $< -o $@ $(CFLAGS) + +c/h/%.h: c/hsrc/%.h + echo "/* WARNING: This header is generated - edits will be lost! */" > $@ + mxmpp -I decl -I c/decl $< >> $@ + +# libmaxsi-sortix + +sortix/*.cpp: $(HEADERS) + +sortix/%.o: %.cpp $(HEADERS) + g++ -c $< -o $@ $(SORTIXFLAGS) + +sortix/%.o: sortix/%.cpp + g++ -c $< -o $@ $(SORTIXFLAGS) + +clean: + rm -f *.o sortix/*.o c/*.o *.a *.so $(CHEADERS) $(HEADERS) + diff --git a/libmaxsi/c++.cpp b/libmaxsi/c++.cpp new file mode 100644 index 00000000..d734fb2a --- /dev/null +++ b/libmaxsi/c++.cpp @@ -0,0 +1,106 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + c++.cpp + Implements required C++ stuff for use in the Sortix kernel. + +******************************************************************************/ + +#include "platform.h" + +extern "C" void __cxa_pure_virtual() +{ + // This shouldn't happen. TODO: Possibly crash the kernel here. +} + +#ifdef PLATFORM_X86 + +// TODO: These two stubs are buggy! + +// Divides two 64-bit integers in O(logN). I think. +extern "C" uint64_t __udivdi3(uint64_t A, uint64_t B) +{ + uint64_t ACC = 0; + uint64_t R = 0; + uint64_t PWR = 1; + uint64_t EXP = B; + + while ( EXP <= A - ACC ) + { + R += PWR; + ACC += EXP; + + if ( 2 * EXP <= A - ACC ) + { + PWR++; + EXP *= 2; + } + else if ( A - ACC < B ) + { + break; + } + else + { + while ( A - ACC < EXP ) + { + PWR--; + EXP /= 2; + } + } + } + + return R; +} + +// Mods two 64-bit integers in O(logN). I think. +extern "C" uint64_t __umoddi3(uint64_t A, uint64_t B) +{ + uint64_t ACC = 0; + uint64_t R = 0; + uint64_t PWR = 1; + uint64_t EXP = B; + + while ( EXP <= A - ACC ) + { + R += PWR; + ACC += EXP; + + if ( 2 * EXP <= A - ACC ) + { + PWR++; + EXP *= 2; + } + else if ( A - ACC < B ) + { + break; + } + else + { + while ( A - ACC < EXP ) + { + PWR--; + EXP /= 2; + } + } + } + + return A - ACC; +} +#endif + diff --git a/libmaxsi/c/decl/FILE.h b/libmaxsi/c/decl/FILE.h new file mode 100644 index 00000000..4b1bcee0 --- /dev/null +++ b/libmaxsi/c/decl/FILE.h @@ -0,0 +1,5 @@ +#ifndef _FILE_DECL +#define _FILE_DECL +struct _IO_FILE; +typedef struct _IO_FILE FILE; +#endif diff --git a/libmaxsi/c/decl/SEEK_CUR.h b/libmaxsi/c/decl/SEEK_CUR.h new file mode 100644 index 00000000..18f6e05c --- /dev/null +++ b/libmaxsi/c/decl/SEEK_CUR.h @@ -0,0 +1,3 @@ +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* Seek from current position. */ +#endif diff --git a/libmaxsi/c/decl/SEEK_END.h b/libmaxsi/c/decl/SEEK_END.h new file mode 100644 index 00000000..dc64c8f0 --- /dev/null +++ b/libmaxsi/c/decl/SEEK_END.h @@ -0,0 +1,3 @@ +#ifndef SEEK_SET +#define SEEK_SET 2 /* Seek from end of file. */ +#endif diff --git a/libmaxsi/c/decl/SEEK_SET.h b/libmaxsi/c/decl/SEEK_SET.h new file mode 100644 index 00000000..1d71d9e9 --- /dev/null +++ b/libmaxsi/c/decl/SEEK_SET.h @@ -0,0 +1,3 @@ +#ifndef SEEK_SET +#define SEEK_SET 0 /* Seek from beginning of file. */ +#endif diff --git a/libmaxsi/c/decl/WEOF.h b/libmaxsi/c/decl/WEOF.h new file mode 100644 index 00000000..18878996 --- /dev/null +++ b/libmaxsi/c/decl/WEOF.h @@ -0,0 +1,3 @@ +#ifndef WEOF +#define WEOF (-1) +#endif diff --git a/libmaxsi/c/decl/useconds_t.h b/libmaxsi/c/decl/useconds_t.h new file mode 100644 index 00000000..97db54cf --- /dev/null +++ b/libmaxsi/c/decl/useconds_t.h @@ -0,0 +1,4 @@ +#ifndef _USECONDS_T_DECL +#define _USECONDS_T_DECL +typedef __useconds_t useconds_t; +#endif diff --git a/libmaxsi/c/decl/wctrans_t.h b/libmaxsi/c/decl/wctrans_t.h new file mode 100644 index 00000000..4d19621c --- /dev/null +++ b/libmaxsi/c/decl/wctrans_t.h @@ -0,0 +1,4 @@ +#ifndef _WCTRANS_T_DECL +#define _WCTRANS_T_DECL +typedef __wctrans_t wctrans_t; +#endif diff --git a/libmaxsi/c/decl/wctype_t.h b/libmaxsi/c/decl/wctype_t.h new file mode 100644 index 00000000..f50b1faf --- /dev/null +++ b/libmaxsi/c/decl/wctype_t.h @@ -0,0 +1,4 @@ +#ifndef _WCTYPE_T_DECL +#define _WCTYPE_T_DECL +typedef __wctype_t wctype_t; +#endif diff --git a/libmaxsi/c/file.c b/libmaxsi/c/file.c new file mode 100644 index 00000000..1659a716 --- /dev/null +++ b/libmaxsi/c/file.c @@ -0,0 +1,305 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + file.c + Implements every related to the FILE structure. This API is not compatible + enough with LibMaxsi's design goals, so it is implemented as a layer upon + the C functions in LibMaxsi. + +******************************************************************************/ + +#include +#include +#include +#include +#include + +#if 0 + +// TODO: Make a real errno system! +volatile int errno; +#define EINVAL 1 + +typedef struct +{ + off_t pos; + mbstate_t state; +} _fpos_t; + +struct _IO_FILE +{ + int fd; + _fpos_t pos; +}; + +// TODO: Actually implement these stubs. + +char* fgets(char* restrict s, int n, FILE* restrict stream) +{ + return NULL; +} + +FILE* fdopen(int fildes, const char* mode) +{ + return NULL; +} + +FILE *fmemopen(void* restrict buf, size_t size, const char* restrict mode) +{ + return NULL; +} + +FILE* fopen(const char* restrict filename, const char* restrict mode) +{ + int len; + if ( mode[0] == '\0' ) { errno = EINVAL; return NULL; } else + if ( mode[1] == '\1' ) { len = 1; } else + if ( mode[2] == '\0' ) { len = 2; } + if ( mode[3] == '\0' ) { len = 3; } else { errno = EINVAL; return NULL; } + + int oflags; + + if ( len == 1 || (len == 2 && mode[1] == 'b') ) + { + switch ( mode[0] ) + { + case 'r': oflags = O_RDONLY; break; + case 'w': oflags = O_WRONLY | O_TRUNC | O_CREAT; break; + case 'a': oflags = O_WRONLY | O_APPEND | O_CREAT; break; + default: errno = EINVAL; return NULL; + } + } + else if ( (len == 2 && mode[1] == '+') || (len == 3 && mode[1] == '+' && mode[1] == 'b') || (len == 3 && mode[1] == 'b' && mode[1] == '+') ) + { + switch ( mode[0] ) + { + case 'r': oflags = O_RDWR; break; + case 'w': oflags = O_RDWR | O_TRUNC | O_CREAT; break; + case 'a': oflags = O_RDWR | O_APPEND | O_CREAT; break; + default: errno = EINVAL; return NULL; + } + } + else { errno = EINVAL; return NULL; } + + // TODO: Does anything else modify this mask? + // TODO: POSIX says this should be "S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH", + // but Linux applies this in a simple test case! + mode_t perms = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; + + FILE* file = malloc(sizeof(FILE)); + + if ( file == NULL ) { return NULL; } + + int fd = open(filename, oflags, perms); + + if ( fd < 0 ) { free(file); return NULL; } + + file->fd = fd; + // TODO: set other stuff here! + + return file; +} + +FILE* freopen(const char* restrict filename, const char *restrict mode, FILE* restrict stream) +{ + return NULL; +} + +FILE* popen(const char* command, const char* mode) +{ + return NULL; +} + +FILE* tmpfile(void) +{ + return NULL; +} + +int fclose(FILE* stream) +{ + return -1; +} + +int feof(FILE* stream) +{ + return -1; +} + +int ferror(FILE* stream) +{ + return -1; +} + +int fflush(FILE* stream) +{ + return -1; +} + +int fgetc(FILE* stream) +{ + return -1; +} + +int fgetpos(FILE* restrict stream, fpos_t* restrict pos) +{ + return -1; +} + +int fileno(FILE* stream) +{ + return -1; +} + +int fprintf(FILE* restrict stream, const char* restrict format, ...) +{ + return -1; +} + +int fputc(int c, FILE* stream) +{ + return -1; +} + +int fputs(const char* restrict s, FILE* restrict stream) +{ + return -1; +} + +int fscanf(FILE* restrict stream, const char* restrict format, ... ) +{ + return -1; +} + +int fseek(FILE* stream, long offset, int whence) +{ + return -1; +} + +int fseeko(FILE* stream, off_t offset, int whence) +{ + return -1; +} + +int fsetpos(FILE* stream, const fpos_t* pos) +{ + return -1; +} + +int ftrylockfile(FILE* file) +{ + return -1; +} + +int getc(FILE* stream) +{ + return -1; +} + +int getc_unlocked(FILE* stream) +{ + return -1; +} + +int pclose(FILE* steam) +{ + return -1; +} + +int putc(int c, FILE* stream) +{ + return -1; +} + +int putc_unlocked(int c, FILE* steam) +{ + return -1; +} + +int setvbuf(FILE* restrict stream, char* restrict buf, int type, size_t size) +{ + return -1; +} + +int ungetc(int c, FILE* stream) +{ + return -1; +} + +int vfprintf(FILE* restrict stream, const char* restrict format, va_list ap) +{ + return -1; +} + +int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg) +{ + return -1; +} + +int vprintf(FILE* restrict stream, const char* restrict format, va_list ap) +{ + return -1; +} + +long ftell(FILE* stream) +{ + return -1; +} + +off_t ftello(FILE* stream) +{ + return -1; +} + +size_t fread(void* restrict ptr, size_t size, size_t nitems, FILE* restrict stream) +{ + return 0; +} + +size_t fwrite(const void* restrict ptr, size_t size, size_t nitems, FILE* restrict stream) +{ + return 0; +} + +void clearerr(FILE* stream) +{ + +} + +void flockfile(FILE* file) +{ + +} + +void funlockfile(FILE* file) +{ + +} + +void rewind(FILE* stream) +{ + +} + +void setbuf(FILE* restrict stream, char* restrict buf) +{ + +} + +#endif + diff --git a/libmaxsi/c/hsrc/fcntl.h b/libmaxsi/c/hsrc/fcntl.h new file mode 100644 index 00000000..ecb24876 --- /dev/null +++ b/libmaxsi/c/hsrc/fcntl.h @@ -0,0 +1,95 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + fcntl.h + File control options. + +******************************************************************************/ + +/* TODO: POSIX-1.2008 compliance is only partial */ + +#ifndef _FCNTL_H +#define _FCNTL_H 1 + +#include + +__BEGIN_DECLS + +/* TODO: F_* missing here */ + +/* TODO: FD_CLOEXEC missing here */ + +/* TODO: F_RDLCK, F_UNLCK, F_WRLCK missing here */ + +@include(SEEK_SET.h) +@include(SEEK_CUR.h) +@include(SEEK_END.h) + +/* TODO: Keep these aligned with those in the Sortix kernel */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 +#define O_EXCL 0200 +#define O_NOCTTY 0400 +#define O_TRUNC 01000 +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 04010000 +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 + +@include(mode_t.h) +@include(mode_t_values.h) + +/* TODO: AT_FDCWD missing here */ +/* TODO: AT_EACCESS missing here */ +/* TODO: AT_SYMLINK_NOFOLLOW missing here */ +/* TODO: AT_SYMLINK_FOLLOW missing here */ +/* TODO: AT_REMOVEDIR missing here */ + +/* TODO: POSIX_FADV_* missing here */ + +@include(pid_t.h) + +struct _flock +{ + short l_type; /* Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. */ + short l_whence; /* Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. */ + off_t l_start; /* Relative offset in bytes. */ + off_t l_len; /* Size; if 0 then until EOF. */ + pid_t l_pid; /* Process ID of the process holding the lock; returned with F_GETLK. */ +}; + +typedef struct _flock flock; + +/* TODO: These are not implemented in libmaxsi/sortix yet. */ +#ifndef SORTIX_UNIMPLEMENTED +int creat(const char* path, mode_t mode); +int fcntl(int fd, int cmd, ...); +int open(const char* path, int oflag, ...); +int openat(int fd, const char* path, int oflag, ...); +#endif + +__END_DECLS + +#endif + diff --git a/libmaxsi/c/hsrc/features.h b/libmaxsi/c/hsrc/features.h new file mode 100644 index 00000000..ad362da4 --- /dev/null +++ b/libmaxsi/c/hsrc/features.h @@ -0,0 +1,51 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + features.h + Various things for various systems, programs, compabillity, and whatnot. + +******************************************************************************/ + +#ifndef _FEATURES_H +#define _FEATURES_H 1 + +/* C++ needs to know that types and declarations are C, not C++. */ +#ifdef __cplusplus + #define __BEGIN_DECLS extern "C" { + #define __END_DECLS } +#else + #define __BEGIN_DECLS + #define __END_DECLS + #define restrict +#endif + +#define __POSIX_NO_OBSOLETE + +#ifdef __POSIX_NO_OBSOLETE + #define __POSIX_OBSOLETE 999999L +#else + #define __POSIX_OBSOLETE 200112L +#endif + +#include + +// Don't provide things from standard headers that is not implemented in libmaxsi/sortix. +#define SORTIX_UNIMPLEMENTED + +#endif diff --git a/libmaxsi/c/hsrc/stdarg.h b/libmaxsi/c/hsrc/stdarg.h new file mode 100644 index 00000000..7d71613c --- /dev/null +++ b/libmaxsi/c/hsrc/stdarg.h @@ -0,0 +1,42 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + stdarg.h + Handle variable argument list + +******************************************************************************/ + +#ifndef _STDARG_H +#define _STDARG_H 1 + +#include + +__BEGIN_DECLS + +@include(va_list.h) + +#define va_start(ap, argN) ap = (void*) ((&argN) + 1) +#define va_copy(dest, src) dest = src +#define va_arg(ap, type) (ap = (void*) ((type*) ap) + 1, *(((type*) ap) - 1) +#define va_end(ap) ap = null + +__END_DECLS + +#endif + diff --git a/libmaxsi/c/hsrc/stddef.h b/libmaxsi/c/hsrc/stddef.h new file mode 100644 index 00000000..f3b494c1 --- /dev/null +++ b/libmaxsi/c/hsrc/stddef.h @@ -0,0 +1,44 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + stddef.h + Standard type definitions. + +******************************************************************************/ + +#ifndef _STDDEF_H +#define _STDDEF_H 1 + +#include + +__BEGIN_DECLS + +@include(NULL.h) + +#define offsetof(type, member) ((size_t) &(type)) - (size_t) (&(member))) + +@include(ptrdiff_t.h) + +@include(wchar_t.h) + +@include(size_t.h) + +__END_DECLS + +#endif diff --git a/libmaxsi/c/hsrc/stdio.h b/libmaxsi/c/hsrc/stdio.h new file mode 100644 index 00000000..e7e286a5 --- /dev/null +++ b/libmaxsi/c/hsrc/stdio.h @@ -0,0 +1,157 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + stdio.h + Standard buffered input/output. + +******************************************************************************/ + +#ifndef _STDIO_H +#define _STDIO_H 1 + +#include + +__BEGIN_DECLS + +@include(FILE.h) + +struct _fpos_t; +typedef struct _fpos_t fpos_t; + +@include(off_t.h) +@include(size_t.h) +@include(ssize_t.h) +@include(va_list.h) +@include(NULL.h) + +/* TODO: Implement BUFSIZ */ +/* TODO: Implement L_ctermid */ +#if __POSIX_OBSOLETE <= 200801 +/* TODO: Implement L_tmpnam */ +#endif + +/* The possibilities for the third argument to `fseek'. + These values should not be changed. */ +@include(SEEK_SET.h) +@include(SEEK_CUR.h) +@include(SEEK_END.h) + +/* The possibilities for the third argument to `setvbuf'. */ +#define _IOFBF 0 /* Fully buffered. */ +#define _IOLBF 1 /* Line buffered. */ +#define _IONBF 2 /* No buffering. */ + +#define EOF (-1) + +/* FILENAME_MAX, FOPEN_MAX, TMP_MAX are not defined because libmaxsi and Sortix + do not have these restrictions. */ + +/* Default path prefix for `tempnam' and `tmpnam'. */ +#if __POSIX_OBSOLETE <= 200801 +#define P_tmpdir "/tmp" +#endif + +extern FILE* stdin; +extern FILE* stdout; +extern FILE* stderr; + +/* C89/C99 say they're macros. Make them happy. */ +#define stdin stdin +#define stdout stdout +#define stderr stderr + +extern int printf(const char* restrict format, ...); + +/* TODO: These are not implemented in libmaxsi/sortix yet. */ +#ifndef SORTIX_UNIMPLEMENTED +extern char* ctermid(char* s); +extern char* fgets(char* restrict s, int n, FILE* restrict stream); +extern FILE* fdopen(int fildes, const char* mode); +extern FILE *fmemopen(void* restrict buf, size_t size, const char* restrict mode); +extern FILE* fopen(const char* restrict filename, const char* restrict mode); +extern FILE* freopen(const char* restrict filename, const char *restrict mode, FILE* restrict stream); +extern FILE* open_memstream(char** bufp, size_t* sizep); +extern FILE* popen(const char* command, const char* mode); +extern FILE* tmpfile(void); +extern int dprintf(int fildes, const char* restrict format, ...); +extern int fclose(FILE* stream); +extern int feof(FILE* stream); +extern int ferror(FILE* stream); +extern int fflush(FILE* stream); +extern int fgetc(FILE* stream); +extern int fgetpos(FILE* restrict stream, fpos_t* restrict pos); +extern int fileno(FILE* stream); +extern int fprintf(FILE* restrict stream, const char* restrict format, ...); +extern int fputc(int c, FILE* stream); +extern int fputs(const char* restrict s, FILE* restrict stream); +extern int fscanf(FILE* restrict stream, const char* restrict format, ... ); +extern int fseek(FILE* stream, long offset, int whence); +extern int fseeko(FILE* stream, off_t offset, int whence); +extern int fsetpos(FILE* stream, const fpos_t* pos); +extern int ftrylockfile(FILE* file); +extern int getc(FILE* stream); +extern int getchar_unlocked(void); +extern int getchar(void); +extern int getc_unlocked(FILE* stream); +extern int pclose(FILE* steam); +extern int putchar(int c); +extern int putchar_unlocked(int c); +extern int putc(int c, FILE* stream); +extern int putc_unlocked(int c, FILE* steam); +extern int puts(const char* s); +extern int remove(const char* path); +extern int rename(const char* oldname, const char* newname); +extern int renameat(int oldfd, const char* oldname, int newfd, const char* newname); +extern int scanf(const char* restrict format, ...); +extern int setvbuf(FILE* restrict stream, char* restrict buf, int type, size_t size); +extern int snprintf(char* restrict s, size_t n, const char* restrict format, ...); +extern int sprintf(char* restrict s, const char* restrict format, ...); +extern int sscanf(const char* restrict s, const char* restrict format, ...); +extern int ungetc(int c, FILE* stream); +extern int vdprintf(int fildes, const char* restrict format, va_list ap); +extern int vfprintf(FILE* restrict stream, const char* restrict format, va_list ap); +extern int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); +extern int vprintf(const char* restrict format, va_list ap); +extern int vscanf(const char* restrict format, va_list arg); +extern int vsnprintf(char* restrict, size_t, const char* restrict, va_list); +extern int vsprintf(char* restrict s, const char* restrict format, va_list ap); +extern int vsscanf(const char* restrict s, const char* restrict format, va_list arg); +extern long ftell(FILE* stream); +extern off_t ftello(FILE* stream); +extern size_t fread(void* restrict ptr, size_t size, size_t nitems, FILE* restrict stream); +extern size_t fwrite(const void* restrict ptr, size_t size, size_t nitems, FILE* restrict stream); +extern ssize_t getdelim(char** restrict lineptr, size_t* restrict n, int delimiter, FILE* restrict stream); +extern ssize_t getline(char** restrict lineptr, size_t* restrict n, FILE* restrict stream); +extern void clearerr(FILE* stream); +extern void flockfile(FILE* file); +extern void funlockfile(FILE* file); +extern void perror(const char* s); +extern void rewind(FILE* stream); +extern void setbuf(FILE* restrict stream, char* restrict buf); + +#if __POSIX_OBSOLETE <= 200801 +extern char* gets(char* s); +extern char* tmpnam(char* s); +extern char* tempnam(const char* dir, const char* pfx); +#endif +#endif + +__END_DECLS + +#endif diff --git a/libmaxsi/c/hsrc/stdlib.h b/libmaxsi/c/hsrc/stdlib.h new file mode 100644 index 00000000..0fbc9e3d --- /dev/null +++ b/libmaxsi/c/hsrc/stdlib.h @@ -0,0 +1,125 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + stdlib.h + Standard library definitions. + +******************************************************************************/ + +#ifndef _STDLIB_H +#define _STDLIB_H 1 + +#include + +__BEGIN_DECLS + +#define EXIT_SUCCESS (0) +#define EXIT_FAILURE (1) + +/* TODO: This random interface is stupid. What should a good value be? */ +#define RAND_MAX 32767 + +/* TODO: MB_CUR_MAX is missing here */ +/* TODO: div_t, ldiv_t, and lldiv_t is missing here */ +typedef int div_t, ldiv_t, lldiv_t; + +@include(NULL.h) +@include(size_t.h) +@include(wchar_t.h) + +/* TODO: WEXITSTATUS, WIFEXITED, WIFSIGNALED, WIFSTOPPED, WNOHANG, WSTOPSIG, WTERMSIG, WUNTRACED is missing here */ + +/* TODO: _Exit(int) is missing here */ + +void exit(int); +void free(void*); +void* malloc(size_t); + +/* TODO: These are not implemented in libmaxsi/sortix yet. */ +#ifndef SORTIX_UNIMPLEMENTED +long a64l(const char* s); +void abort(void); +int abs(int value); +int atexit(void (*function)(void)); +double atof(const char* value); +int atoi(const char*); +long atol(const char*); +long long atoll(const char*); +void* bsearch(const void*, const void*, size_t, size_t, int (*)(const void*, const void*)); +void* calloc(size_t, size_t); +div_t div(int, int); +double drand48(void); +double erand48(unsigned short [3]); +char* getenv(const char*); +int getsubopt(char**, char* const *, char**); +int grantpt(int); +char* initstate(unsigned, char*, size_t); +long jrand48(unsigned short [3]); +char* l64a(long); +long labs(long); +void lcong48(unsigned short [7]); +ldiv_t ldiv(long, long); +long long llabs(long long); +lldiv_t lldiv(long long, long long); +long lrand48(void); +int mblen(const char*, size_t); +size_t mbstowcs(wchar_t *restrict, const char* restrict, size_t); +int mbtowc(wchar_t *restrict, const char* restrict, size_t); +char* mkdtemp(char*); +int mkstemp(char*); +long mrand48(void); +long nrand48(unsigned short[3]); +int posix_memalign(void**, size_t, size_t); +int posix_openpt(int); +char* ptsname(int); +int putenv(char*); +void qsort(void*, size_t, size_t, int (*)(const void*, const void*)); +int rand(void); +long random(void); +void* realloc(void*, size_t); +char* realpath(const char* restrict, char* restrict); +unsigned short *seed48(unsigned short [3]); +int setenv(const char*, const char*, int); +void setkey(const char*); +char* setstate(char*); +void srand(unsigned); +void srand48(long); +void srandom(unsigned); +double strtod(const char* restrict, char** restrict); +float strtof(const char* restrict, char** restrict); +long strtol(const char* restrict, char** restrict, int); +long double strtold(const char* restrict, char** restrict); +long long strtoll(const char* restrict, char** restrict, int); +unsigned long strtoul(const char* restrict, char** restrict, int); +unsigned long long strtoull(const char* restrict, char** restrict, int); +int system(const char*); +int unlockpt(int); +int unsetenv(const char*); +size_t wcstombs(char* restrict, const wchar_t *restrict, size_t); +int wctomb(char*, wchar_t); + +#if __POSIX_OBSOLETE <= 200801 +int rand_r(unsigned *); +#endif + +#endif + +__END_DECLS + +#endif diff --git a/libmaxsi/c/hsrc/string.h b/libmaxsi/c/hsrc/string.h new file mode 100644 index 00000000..fc0e2b56 --- /dev/null +++ b/libmaxsi/c/hsrc/string.h @@ -0,0 +1,77 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + string.h + String operations. + +******************************************************************************/ + +#ifndef _STRING_H +#define _STRING_H 1 + +#include + +__BEGIN_DECLS + +@include(NULL.h) +@include(size_t.h) +@include(locale_t.h) + +void* memcpy(void* restrict, const void* restrict, size_t); +char* strcat(char* restrict, const char* restrict); +int strcmp(const char*, const char*); +char* strcpy(char* restrict, const char* restrict); +size_t strlen(const char*); +int strncmp(const char*, const char*, size_t); + +/* TODO: These are not implemented in libmaxsi/sortix yet. */ +#ifndef SORTIX_UNIMPLEMENTED +void* memccpy(void* restrict, const void* restrict, int, size_t); +void* memchr(const void*, int, size_t); +int memcmp(const void*, const void*, size_t); +void* memmove(void*, const void*, size_t); +void* memset(void*, int, size_t); +char* stpcpy(char* restrict, const char* restrict); +char* stpncpy(char* restrict, const char* restrict, size_t); +char* strchr(const char*, int); +int strcoll(const char*, const char*); +int strcoll_l(const char*, const char*, locale_t); +size_t strcspn(const char*, const char*); +char* strdup(const char*); +char* strerror(int); +char* strerror_l(int, locale_t); +int strerror_r(int, char*, size_t); +char* strncat(char* restrict, const char* restrict, size_t); +char* strncpy(char* restrict, const char* restrict, size_t); +char* strndup(const char*, size_t); +size_t strnlen(const char*, size_t); +char* strpbrk(const char*, const char*); +char* strrchr(const char*, int); +char* strsignal(int); +size_t strspn(const char*, const char*); +char* strstr(const char*, const char*); +char* strtok(char* restrict, const char* restrict); +char* strtok_r(char* restrict, const char* restrict, char** restrict); +size_t strxfrm(char* restrict, const char* restrict, size_t); +size_t strxfrm_l(char* restrict, const char* restrict, size_t, locale_t); +#endif + +__END_DECLS + +#endif diff --git a/libmaxsi/c/hsrc/sys/stat.h b/libmaxsi/c/hsrc/sys/stat.h new file mode 100644 index 00000000..5a6cd294 --- /dev/null +++ b/libmaxsi/c/hsrc/sys/stat.h @@ -0,0 +1,39 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + stat.h + Data returned by the stat() function. + +******************************************************************************/ + +// TODO: Make this header comply with POSIX-1.2008 + +#ifndef _STAT_H +#define _STAT_H 1 + +#include + +__BEGIN_DECLS + +@include(mode_t_values.h) + +__END_DECLS + +#endif + diff --git a/libmaxsi/c/hsrc/sys/types.h b/libmaxsi/c/hsrc/sys/types.h new file mode 100644 index 00000000..46abb15e --- /dev/null +++ b/libmaxsi/c/hsrc/sys/types.h @@ -0,0 +1,39 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + types.h + Data types. + +******************************************************************************/ + +// TODO: Make this header comply with POSIX-1.2008 + +#ifndef _STAT_H +#define _STAT_H 1 + +#include + +__BEGIN_DECLS + +@include(useconds_t.h) + +__END_DECLS + +#endif + diff --git a/libmaxsi/c/hsrc/unistd.h b/libmaxsi/c/hsrc/unistd.h new file mode 100644 index 00000000..0b5d020c --- /dev/null +++ b/libmaxsi/c/hsrc/unistd.h @@ -0,0 +1,173 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + unistd.h + The header defines miscellaneous symbolic constants and types, + and declares miscellaneous functions. + +******************************************************************************/ + +/* TODO: POSIX-1.2008 compliance is only partial */ + +#ifndef _UNISTD_H +#define _UNISTD_H 1 + +#include + +__BEGIN_DECLS + +/* Currently just say we support the newest POSIX. */ +/* TODO: Support the newest POSIX. */ +#define _POSIX_VERSION 200809L +#define _POSIX2_VERSION 200809L + +/* Currently just say we support the newest X/Open */ +/* TODO: Support the newest X/Open */ +#define _XOPEN_VERSION 700 + +/* TODO: _POSIX_*, _POSIX2_*, _XOPEN_* is missing here. */ + +/* TODO: _POSIX_*, _POSIX2_* is missing here. */ + +@include(NULL.h) + +/* TODO: F_OK, R_OK, W_OK, X_OK is missing here. */ + +/* TODO: _CS_* is missing here. */ + +@include(SEEK_CUR.h) +@include(SEEK_END.h) +@include(SEEK_SET.h) + +/* TODO: F_* is missing here. */ + +/* TODO: _PC_* is missing here. */ + +/* TODO: _SC_* is missing here. */ + +#define STDIN_FILENO (0) +#define STDOUT_FILENO (1) +#define STDERR_FILENO (2) + +/* TODO: _POSIX_VDISABLE is missing here. */ + +@include(size_t.h) +@include(ssize_t.h) +@include(uid_t.h) +@include(gid_t.h) +@include(off_t.h) +@include(pid_t.h) + +/* TODO: These are not implemented in libmaxsi/sortix yet. */ +#ifndef SORTIX_UNIMPLEMENTED +int access(const char*, int); +unsigned alarm(unsigned); +int chdir(const char*); +int chown(const char*, uid_t, gid_t); +int close(int); +size_t confstr(int, char*, size_t); +char* crypt(const char*, const char*); +char* ctermid(char*); +int dup(int); +int dup2(int, int); +void _exit(int); +void encrypt(char [64], int); +int execl(const char*, const char*, ...); +int execle(const char*, const char*, ...); +int execlp(const char*, const char*, ...); +int execv(const char*, char* const []); +int execve(const char*, char* const [], char* const []); +int execvp(const char*, char* const []); +int faccessat(int, const char*, int, int); +int fchdir(int); +int fchown(int, uid_t, gid_t); +int fchownat(int, const char*, uid_t, gid_t, int); +int fdatasync(int); +int fexecve(int, char* const [], char* const []); +pid_t fork(void); +long fpathconf(int, int); +int fsync(int); +int ftruncate(int, off_t); +char* getcwd(char*, size_t); +gid_t getegid(void); +uid_t geteuid(void); +gid_t getgid(void); +int getgroups(int, gid_t []); +long gethostid(void); +int gethostname(char*, size_t); +char* getlogin(void); +int getlogin_r(char*, size_t); +int getopt(int, char* const [], const char*); +pid_t getpgid(pid_t); +pid_t getpgrp(void); +pid_t getpid(void); +pid_t getppid(void); +pid_t getsid(pid_t); +uid_t getuid(void); +int isatty(int); +int lchown(const char*, uid_t, gid_t); +int link(const char*, const char*); +int linkat(int, const char*, int, const char*, int); +int lockf(int, int, off_t); +off_t lseek(int, off_t, int); +int nice(int); +long pathconf(const char*, int); +int pause(void); +int pipe(int [2]); +ssize_t pread(int, void*, size_t, off_t); +ssize_t pwrite(int, const void*, size_t, off_t); +ssize_t read(int, void*, size_t); +ssize_t readlink(const char* restrict, char* restrict, size_t); +ssize_t readlinkat(int, const char* restrict, char* restrict, size_t); +int rmdir(const char*); +int setegid(gid_t); +int seteuid(uid_t); +int setgid(gid_t); +int setpgid(pid_t, pid_t); +int setregid(gid_t, gid_t); +int setreuid(uid_t, uid_t); +pid_t setsid(void); +int setuid(uid_t); +unsigned sleep(unsigned); +void swab(const void* restrict, void* restrict, ssize_t); +int symlink(const char*, const char*); +int symlinkat(const char*, int, const char*); +void sync(void); +long sysconf(int); +pid_t tcgetpgrp(int); +int tcsetpgrp(int, pid_t); +int truncate(const char*, off_t); +char* ttyname(int); +int ttyname_r(int, char*, size_t); +int unlink(const char*); +int unlinkat(int, const char*, int); +ssize_t write(int, const void*, size_t); + +#if __POSIX_OBSOLETE <= 200801 +pid_t setpgrp(void); +#endif + +extern char* optarg; +extern int opterr, optind, optopt; +#endif + +__END_DECLS + +#endif + diff --git a/libmaxsi/c/hsrc/wchar.h b/libmaxsi/c/hsrc/wchar.h new file mode 100644 index 00000000..3c44e7d2 --- /dev/null +++ b/libmaxsi/c/hsrc/wchar.h @@ -0,0 +1,151 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + wchar.h + Handle variable argument list + +******************************************************************************/ + +#ifndef _WCHAR_H +#define _WCHAR_H 1 + +#include + +__BEGIN_DECLS + +@include(FILE.h) +@include(locale_t.h) +@include(size_t.h) +@include(va_list.h) +@include(wchar_t.h) +@include(wint_t.h) +@include(WCHAR_MAX.h) +@include(WCHAR_MIN.h) +@include(WEOF.h) +@include(NULL.h) + +#ifndef __mbstate_t_defined + /* Conversion state information. */ + typedef struct + { + int __count; + union + { + wint_t __wch; + char __wchb[4]; + } __value; /* Value so far. */ + } mbstate_t; + #define __mbstate_t_defined 1 +#endif + +#if __POSIX_OBSOLETE <= 200809L +@include(wctype_t.h) +#endif + +struct tm; + +/* TODO: These are not implemented in libmaxsi/sortix yet. */ +#ifndef SORTIX_UNIMPLEMENTED +double wcstod(const wchar_t* restrict, wchar_t** restrict); +FILE* open_wmemstream(wchar_t** bufp, size_t* sizep); +float wcstof(const wchar_t* restrict, wchar_t** restrict); +int fputws(const wchar_t* restrict, FILE* restrict); +int fwide(FILE*, int); +int fwprintf(FILE* restrict, const wchar_t* restrict, ...); +int fwscanf(FILE* restrict, const wchar_t* restrict, ...); +int mbsinit(const mbstate_t*); +int swprintf(wchar_t* restrict, size_t, const wchar_t* restrict, ...); +int swscanf(const wchar_t* restrict, const wchar_t* restrict, ...); +int vfwprintf(FILE* restrict, const wchar_t* restrict, va_list); +int vfwscanf(FILE* restrict, const wchar_t* restrict, va_list); +int vswprintf(wchar_t* restrict, size_t, const wchar_t* restrict, va_list); +int vswscanf(const wchar_t* restrict, const wchar_t* restrict, va_list); +int vwprintf(const wchar_t* restrict, va_list); +int vwscanf(const wchar_t* restrict, va_list); +int wcscmp(const wchar_t*, const wchar_t*); +int wcscoll(const wchar_t*, const wchar_t*); +int wcsncmp(const wchar_t*, const wchar_t*, size_t); +int wcswidth(const wchar_t*, size_t); +int wctob(wint_t); +int wcwidth(wchar_t); +int wmemcmp(const wchar_t*, const wchar_t*, size_t); +int wprintf(const wchar_t* restrict, ...); +int wscanf(const wchar_t* restrict, ...); +long double wcstold(const wchar_t* restrict, wchar_t** restrict); +long long wcstoll(const wchar_t* restrict, wchar_t** restrict, int); +long wcstol(const wchar_t* restrict, wchar_t** restrict, int); +size_t mbrlen(const char* restrict, size_t, mbstate_t* restrict); +size_t mbrtowc(wchar_t* restrict, const char* restrict, size_t, mbstate_t* restrict); +size_t mbsrtowcs(wchar_t* restrict, const char** restrict, size_t, mbstate_t* restrict); +size_t wcrtomb(char* restrict, wchar_t, mbstate_t* restrict); +size_t wcscspn(const wchar_t*, const wchar_t*); +size_t wcsftime(wchar_t* restrict, size_t, const wchar_t* restrict, const struct tm* restrict); +size_t wcslen(const wchar_t*); +size_t wcsrtombs(char* restrict, const wchar_t** restrict, size_t, mbstate_t* restrict); +size_t wcsspn(const wchar_t*, const wchar_t*); +size_t wcsxfrm(wchar_t* restrict, const wchar_t* restrict, size_t); +unsigned long long wcstoull(const wchar_t* restrict, wchar_t** restrict, int); +unsigned long wcstoul(const wchar_t* restrict, wchar_t** restrict, int); +wchar_t* fgetws(wchar_t* restrict, int, FILE* restrict); +wchar_t* wcscat(wchar_t* restrict, const wchar_t* restrict); +wchar_t* wcschr(const wchar_t*, wchar_t); +wchar_t* wcscpy(wchar_t* restrict, const wchar_t* restrict); +wchar_t* wcsncat(wchar_t* restrict, const wchar_t* restrict, size_t); +wchar_t* wcsncpy(wchar_t* restrict, const wchar_t* restrict, size_t); +wchar_t* wcspbrk(const wchar_t*, const wchar_t*); +wchar_t* wcsrchr(const wchar_t*, wchar_t); +wchar_t* wcsstr(const wchar_t* restrict, const wchar_t* restrict); +wchar_t* wcstok(wchar_t* restrict, const wchar_t* restrict, wchar_t** restrict); +wchar_t* wcswcs(const wchar_t*, const wchar_t*); +wchar_t* wmemchr(const wchar_t*, wchar_t, size_t); +wchar_t* wmemcpy(wchar_t* restrict, const wchar_t* restrict, size_t); +wchar_t* wmemmove(wchar_t*, const wchar_t*, size_t); +wchar_t* wmemset(wchar_t*, wchar_t, size_t); +wint_t btowc(int); +wint_t fgetwc(FILE*); +wint_t fputwc(wchar_t, FILE*); +wint_t getwc(FILE*); +wint_t getwchar(void); +wint_t putwchar(wchar_t); +wint_t putwc(wchar_t, FILE*); +wint_t ungetwc(wint_t, FILE*); + +#if __POSIX_OBSOLETE <= 200809L +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswcntrl(wint_t); +int iswctype(wint_t, wctype_t); +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); +wint_t towlower(wint_t); +wint_t towupper(wint_t); +wctype_t wctype(const char *); +#endif +#endif + +__END_DECLS + +#endif + diff --git a/libmaxsi/c/hsrc/wctype.h b/libmaxsi/c/hsrc/wctype.h new file mode 100644 index 00000000..92cd44d6 --- /dev/null +++ b/libmaxsi/c/hsrc/wctype.h @@ -0,0 +1,79 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + wctype.h + Wide-character classification and mapping utilities + +******************************************************************************/ + +#ifndef _WCTYPE_H +#define _WCTYPE_H 1 + +#include + +__BEGIN_DECLS + +@include(wint_t.h) +@include(wctrans_t.h) +@include(locale_t.h) +@include(WEOF.h) + +/* TODO: These are not implemented in libmaxsi/sortix yet. */ +#ifndef SORTIX_UNIMPLEMENTED +int iswalnum(wint_t); +int iswalnum_l(wint_t, locale_t); +int iswalpha(wint_t); +int iswalpha_l(wint_t, locale_t); +int iswblank(wint_t); +int iswblank_l(wint_t, locale_t); +int iswcntrl(wint_t); +int iswcntrl_l(wint_t, locale_t); +int iswctype(wint_t, wctype_t); +int iswctype_l(wint_t, wctype_t, locale_t); +int iswdigit(wint_t); +int iswdigit_l(wint_t, locale_t); +int iswgraph(wint_t); +int iswgraph_l(wint_t, locale_t); +int iswlower(wint_t); +int iswlower_l(wint_t, locale_t); +int iswprint(wint_t); +int iswprint_l(wint_t, locale_t); +int iswpunct(wint_t); +int iswpunct_l(wint_t, locale_t); +int iswspace(wint_t); +int iswspace_l(wint_t, locale_t); +int iswupper(wint_t); +int iswupper_l(wint_t, locale_t); +int iswxdigit(wint_t); +int iswxdigit_l(wint_t, locale_t); +wint_t towctrans(wint_t, wctrans_t); +wint_t towctrans_l(wint_t, wctrans_t, locale_t); +wint_t towlower(wint_t); +wint_t towlower_l(wint_t, locale_t); +wint_t towupper(wint_t); +wint_t towupper_l(wint_t, locale_t); +wctrans_t wctrans(const char *); +wctrans_t wctrans_l(const char *, locale_t); +wctype_t wctype(const char *); +wctype_t wctype_l(const char *, locale_t); +#endif + +__END_DECLS + +#endif diff --git a/libmaxsi/c/string.c b/libmaxsi/c/string.c new file mode 100644 index 00000000..1be26876 --- /dev/null +++ b/libmaxsi/c/string.c @@ -0,0 +1,35 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + string.c + Implements things from that is slightly incompatible with + how libmaxsi does stuff. + +******************************************************************************/ + +#include + +char* strdup(const char* input) +{ + size_t inputsize = strlen(input); + char* result = (char*) malloc(inputsize + 1); + if ( result == NULL ) { return NULL; } + memcpy(result, input, inputsize + 1); + return result; +} diff --git a/libmaxsi/decl/NULL.h b/libmaxsi/decl/NULL.h new file mode 100644 index 00000000..fa951f3d --- /dev/null +++ b/libmaxsi/decl/NULL.h @@ -0,0 +1,3 @@ +#ifndef NULL +#define NULL __NULL +#endif diff --git a/libmaxsi/decl/WCHAR_MAX.h b/libmaxsi/decl/WCHAR_MAX.h new file mode 100644 index 00000000..9fa66500 --- /dev/null +++ b/libmaxsi/decl/WCHAR_MAX.h @@ -0,0 +1,3 @@ +#ifndef WCHAR_MAX +#define WCHAR_MAX __WCHAR_MAX +#endif diff --git a/libmaxsi/decl/WCHAR_MIN.h b/libmaxsi/decl/WCHAR_MIN.h new file mode 100644 index 00000000..eebe2970 --- /dev/null +++ b/libmaxsi/decl/WCHAR_MIN.h @@ -0,0 +1,3 @@ +#ifndef WCHAR_MIN +#define WCHAR_MIN __WCHAR_MIN +#endif diff --git a/libmaxsi/decl/gid_t.h b/libmaxsi/decl/gid_t.h new file mode 100644 index 00000000..49e42cfd --- /dev/null +++ b/libmaxsi/decl/gid_t.h @@ -0,0 +1,4 @@ +#ifndef _GID_T_DECL +#define _GID_T_DECL +typedef __gid_t gid_t; +#endif diff --git a/libmaxsi/decl/id_t.h b/libmaxsi/decl/id_t.h new file mode 100644 index 00000000..2648b8e5 --- /dev/null +++ b/libmaxsi/decl/id_t.h @@ -0,0 +1,4 @@ +#ifndef _ID_T_DECL +#define _ID_T_DECL +typedef __id_t id_t; +#endif diff --git a/libmaxsi/decl/intn_t.h b/libmaxsi/decl/intn_t.h new file mode 100644 index 00000000..7c64b024 --- /dev/null +++ b/libmaxsi/decl/intn_t.h @@ -0,0 +1,80 @@ +#ifndef _INTN_T_DECL +#define _INTN_T_DECL + +/* Define basic signed types. */ +typedef __int8_t int8_t; +typedef __int16_t int16_t; +typedef __int32_t int32_t; +typedef __int64_t int64_t; + +/* Define basic unsigned types. */ +typedef __uint8_t uint8_t; +typedef __uint16_t uint16_t; +typedef __uint32_t uint32_t; +typedef __uint64_t uint64_t; + +/* The maximum width integers available on this platform. */ +typedef __intmax_t intmax_t; +typedef __uintmax_t uintmax_t; + +/* Define an integer able to hold the size of the largest continious memory */ +/* region and define pointer safe integer types. */ +typedef __size_t size_t; +typedef __ssize_t ssize_t; +typedef __intptr_t intptr_t; +typedef __uintptr_t uintptr_t; +typedef __ptrdiff_t ptrdiff_t; + +#define INT8_MIN __INT8_MIN +#define INT16_MIN __INT16_MIN +#define INT32_MIN __INT32_MIN +#define INT64_MIN __INT64_MIN +#define INT8_MAX __INT8_MAX +#define INT16_MAX __INT16_MAX +#define INT32_MAX __INT32_MAX +#define INT64_MAX __INT64_MAX +#define UINT8_MAX __UINT8_MAX +#define UINT16_MAX __UINT16_MAX +#define UINT32_MAX __UINT32_MAX +#define UINT64_MAX __UINT64_MAX + +#define INTMAX_MIN __INTMAX_MIN +#define INTMAX_MAX __INTMAX_MAX +#define UINTMAX_MAX __UINTMAX_MAX + +#define CHAR_BIT __CHAR_BIT +#define SCHAR_MIN __SCHAR_MIN +#define SCHAR_MAX __SCHAR_MAX +#define UCHAR_MAX __UCHAR_MAX +#define CHAR_MIN __CHAR_MIN +#define CHAR_MAX __CHAR_MAX + +#define WCHAR_MIN __WCHAR_MIN +#define WCHAR_MAX __WCHAR_MAX + +#define SHRT_MIN __SHRT_MIN +#define SHRT_MAX __SHRT_MAX +#define USHRT_MAX __USHRT_MAX + +#define WORD_BIT __WORD_BIT +#define INT_MIN __INT_MIN +#define INT_MAX __INT_MAX +#define UINT_MAX __UINT_MAX + +#define LONG_BIT __LONG_BIT +#define LONG_MIN __LONG_MIN +#define LONG_MAX __LONG_MAX +#define ULONG_MAX __ULONG_MAX + +#define LONG_MIN __LONG_MIN +#define LLONG_MAX __LLONG_MAX +#define ULLONG_MAX __ULLONG_MAX + +#define SSIZE_MIN __SSIZE_MIN +#define SSIZE_MAX __SSIZE_MAX +#define SIZE_MAX __SIZE_MAX +#define INTPTR_MIN __INTPTR_MIN +#define INTPTR_MAX __INTPTR_MAX +#define UINTPTR_MAX __UINTPTR_MAX + +#endif diff --git a/libmaxsi/decl/intptr_t.h b/libmaxsi/decl/intptr_t.h new file mode 100644 index 00000000..4f69866b --- /dev/null +++ b/libmaxsi/decl/intptr_t.h @@ -0,0 +1,4 @@ +#ifndef _INTPTR_T_DECL +#define _INTPTR_T_DECL +typedef __intptr_t intptr_t; +#endif diff --git a/libmaxsi/decl/locale_t.h b/libmaxsi/decl/locale_t.h new file mode 100644 index 00000000..dc1c104e --- /dev/null +++ b/libmaxsi/decl/locale_t.h @@ -0,0 +1,4 @@ +#ifndef _LOCALE_T_DECL +#define _LOCALT_T_DECL +typedef __locale_t locale_t; +#endif diff --git a/libmaxsi/decl/mode_t.h b/libmaxsi/decl/mode_t.h new file mode 100644 index 00000000..6a53a9b2 --- /dev/null +++ b/libmaxsi/decl/mode_t.h @@ -0,0 +1,4 @@ +#ifndef _MODE_T_DECL +#define _MODE_T_DECL +typedef __mode_t mode_t; +#endif diff --git a/libmaxsi/decl/mode_t_values.h b/libmaxsi/decl/mode_t_values.h new file mode 100644 index 00000000..c060d951 --- /dev/null +++ b/libmaxsi/decl/mode_t_values.h @@ -0,0 +1,27 @@ +#ifndef _MODE_T_VALUES_DECL +#define _MODE_T_VALUES_DECL +#define S_IRUSR __S_IREAD /* Read by owner. */ +#define S_IWUSR __S_IWRITE /* Write by owner. */ +#define S_IXUSR __S_IEXEC /* Execute by owner. */ +/* Read, write, and execute by owner. */ +#define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC) + +#define S_IRGRP (S_IRUSR >> 3) /* Read by group. */ +#define S_IWGRP (S_IWUSR >> 3) /* Write by group. */ +#define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */ +/* Read, write, and execute by group. */ +#define S_IRWXG (S_IRWXU >> 3) + +#define S_IROTH (S_IRGRP >> 3) /* Read by others. */ +#define S_IWOTH (S_IWGRP >> 3) /* Write by others. */ +#define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */ +/* Read, write, and execute by others. */ +#define S_IRWXO (S_IRWXG >> 3) + +#define __S_ISUID 04000 /* Set user ID on execution. */ +#define __S_ISGID 02000 /* Set group ID on execution. */ +#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ +#define __S_IREAD 0400 /* Read by owner. */ +#define __S_IWRITE 0200 /* Write by owner. */ +#define __S_IEXEC 0100 /* Execute by owner. */ +#endif diff --git a/libmaxsi/decl/off_t.h b/libmaxsi/decl/off_t.h new file mode 100644 index 00000000..e5eacfd2 --- /dev/null +++ b/libmaxsi/decl/off_t.h @@ -0,0 +1,4 @@ +#ifndef _OFF_T_DECL +#define _OFF_T_DECL +typedef __off_t off_t; +#endif diff --git a/libmaxsi/decl/pid_t.h b/libmaxsi/decl/pid_t.h new file mode 100644 index 00000000..68441f57 --- /dev/null +++ b/libmaxsi/decl/pid_t.h @@ -0,0 +1,4 @@ +#ifndef _PID_T_DECL +#define _PID_T_DECL +typedef __pid_t pid_t; +#endif diff --git a/libmaxsi/decl/ptrdiff_t.h b/libmaxsi/decl/ptrdiff_t.h new file mode 100644 index 00000000..bda0d3c8 --- /dev/null +++ b/libmaxsi/decl/ptrdiff_t.h @@ -0,0 +1,4 @@ +#ifndef _PTRDIFF_T_DECL +#define _PTRDIFF_T_DECL +typedef __ptrdiff_t ptrdiff_t; +#endif diff --git a/libmaxsi/decl/size_t.h b/libmaxsi/decl/size_t.h new file mode 100644 index 00000000..846c0ad0 --- /dev/null +++ b/libmaxsi/decl/size_t.h @@ -0,0 +1,4 @@ +#ifndef _SIZE_T_DECL +#define _SIZE_T_DECL +typedef __size_t size_t; +#endif diff --git a/libmaxsi/decl/ssize_t.h b/libmaxsi/decl/ssize_t.h new file mode 100644 index 00000000..5870f192 --- /dev/null +++ b/libmaxsi/decl/ssize_t.h @@ -0,0 +1,4 @@ +#ifndef _SSIZE_T_DECL +#define _SSIZE_T_DECL +typedef __ssize_t ssize_t; +#endif diff --git a/libmaxsi/decl/uid_t.h b/libmaxsi/decl/uid_t.h new file mode 100644 index 00000000..b69159a4 --- /dev/null +++ b/libmaxsi/decl/uid_t.h @@ -0,0 +1,4 @@ +#ifndef _UID_T_DECL +#define _UID_T_DECL +typedef __uid_t uid_t; +#endif diff --git a/libmaxsi/decl/va_list.h b/libmaxsi/decl/va_list.h new file mode 100644 index 00000000..0b19e091 --- /dev/null +++ b/libmaxsi/decl/va_list.h @@ -0,0 +1,8 @@ +#ifndef _VALIST_DECL +#define _VALIST_DECL +#define va_start(v,l) __builtin_va_start(v,l) +#define va_arg(v,l) __builtin_va_arg(v,l) +#define va_end(v) __builtin_va_end(v) +#define va_copy(d,s) __builtin_va_copy(d,s) +typedef __builtin_va_list va_list; +#endif diff --git a/libmaxsi/decl/wchar_t.h b/libmaxsi/decl/wchar_t.h new file mode 100644 index 00000000..abc0ffc4 --- /dev/null +++ b/libmaxsi/decl/wchar_t.h @@ -0,0 +1,6 @@ +#ifndef _WCHAR_T_DECL +#define _WCHAR_T_DECL +#if !defined(__cplusplus) +typedef __wchar_t wchar_t; +#endif +#endif diff --git a/libmaxsi/decl/wint_t.h b/libmaxsi/decl/wint_t.h new file mode 100644 index 00000000..f47af45e --- /dev/null +++ b/libmaxsi/decl/wint_t.h @@ -0,0 +1,4 @@ +#ifndef _WINT_T_DECL +#define _WINT_T_DECL +typedef __wint_t wint_t; +#endif diff --git a/libmaxsi/error.cpp b/libmaxsi/error.cpp new file mode 100644 index 00000000..a2bb1992 --- /dev/null +++ b/libmaxsi/error.cpp @@ -0,0 +1,35 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + error.cpp + Error reporting functions and utilities. + +******************************************************************************/ + +#include "error.h" + +namespace Maxsi +{ + namespace Error + { + // TODO: merge with errno interface. + int _errornumber; + } +} + diff --git a/libmaxsi/format.cpp b/libmaxsi/format.cpp new file mode 100644 index 00000000..839c8987 --- /dev/null +++ b/libmaxsi/format.cpp @@ -0,0 +1,280 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + format.cpp + Provides printf formatting functions that uses callbacks. + +******************************************************************************/ + +#include "platform.h" +#include "string.h" +#include "format.h" + +namespace Maxsi +{ + namespace Format + { + int UInt8ToString(uint8_t Num, char* Dest) + { + uint8_t Copy = Num; + int Result = 0; + + while ( Copy > 9 ) { Copy /= 10; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + Dest[Offset] = '0' + Num % 10; Num /= 10; Offset--; + } + + return Result + 1; + } + + int UInt16ToString(uint16_t Num, char* Dest) + { + uint16_t Copy = Num; + int Result = 0; + + while ( Copy > 9 ) { Copy /= 10; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + Dest[Offset] = '0' + Num % 10; Num /= 10; Offset--; + } + + return Result + 1; + } + + int UInt32ToString(uint32_t Num, char* Dest) + { + uint32_t Copy = Num; + int Result = 0; + + while ( Copy > 9 ) { Copy /= 10; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + Dest[Offset] = '0' + Num % 10; Num /= 10; Offset--; + } + + return Result + 1; + } + + int UInt64ToString(uint64_t Num, char* Dest) + { + uint64_t Copy = Num; + int Result = 0; + + while ( Copy > 9 ) { Copy /= 10; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + Dest[Offset] = '0' + Num % 10; Num /= 10; Offset--; + } + + return Result + 1; + } + + // Missing functions here. + + int UInt32ToString16(uint32_t Num, char* Dest) + { + uint32_t Copy = Num; + int Result = 0; + + while ( Copy > 15 ) { Copy /= 16; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + if ( Num % 16 < 10 ) + { + Dest[Offset] = '0' + Num % 16; + } + else + { + Dest[Offset] = 'A' + (Num % 16) - 10; + } + Num /= 16; Offset--; + } + + return Result + 1; + } + + int UInt64ToString16(uint64_t Num, char* Dest) + { + uint64_t Copy = Num; + int Result = 0; + + while ( Copy > 15 ) { Copy /= 16; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + if ( Num % 16 < 10 ) + { + Dest[Offset] = '0' + Num % 16; + } + else + { + Dest[Offset] = 'A' + (Num % 16) - 10; + } + Num /= 16; Offset--; + } + + return Result + 1; + } + + #define READY_SIZE 128 + + #define READY_FLUSH() \ + ready[readylen] = '\0'; \ + if ( 0 < readylen && callback && callback(user, ready, readylen) != readylen ) { return SIZE_MAX; } \ + written += readylen; readylen = 0; + + size_t Virtual(Callback callback, void* user, const char* format, va_list parameters) + { + size_t written = 0; + size_t readylen = 0; + char ready[READY_SIZE + 1]; + + while ( *format != '\0' ) + { + char c = *(format++); + + if ( c != '%' ) + { + if ( READY_SIZE <= readylen ) { READY_FLUSH(); } + ready[readylen++] = c; + continue; + } + + const nat UNSIGNED = 0; + const nat BIT64 = (1<<0); + const nat HEX = (1<<1); + const nat STRING = 4; + const nat CHARACTER = 5; + #ifdef PLATFORM_X64 + const nat WORDWIDTH = BIT64; + #else + const nat WORDWIDTH = 0; + #endif + + // TODO: Support signed datatypes! + + nat type = 0; + + bool scanning = true; + while ( scanning ) + { + switch( *(format++) ) + { + case '3': + case '2': + break; + case '6': + case '4': + type |= BIT64; + break; + case 'p': + type = WORDWIDTH | HEX; + scanning = false; + break; + case 'z': + type |= WORDWIDTH; + break; + case 'u': + type |= UNSIGNED; + scanning = false; + break; + case 'x': + type |= HEX; + scanning = false; + break; + case 's': + type = STRING; + scanning = false; + break; + case 'c': + type = CHARACTER; + scanning = false; + break; + default: + return SIZE_MAX; + } + } + + switch ( type ) + { + case UNSIGNED: + { + if ( READY_SIZE - readylen < 10 ) { READY_FLUSH(); } + uint32_t num = va_arg(parameters, uint32_t); + readylen += UInt32ToString(num, ready + readylen); + break; + } + case UNSIGNED | BIT64: + { + if ( READY_SIZE - readylen < 20 ) { READY_FLUSH(); } + uint64_t num = va_arg(parameters, uint64_t); + readylen += UInt64ToString(num, ready + readylen); + break; + } + case UNSIGNED | HEX: + { + if ( READY_SIZE - readylen < 8 ) { READY_FLUSH(); } + uint32_t num = va_arg(parameters, uint32_t); + readylen += UInt32ToString16(num, ready + readylen); + break; + } + case UNSIGNED | BIT64 | HEX: + { + if ( READY_SIZE - readylen < 16 ) { READY_FLUSH(); } + uint64_t num = va_arg(parameters, uint64_t); + readylen += UInt64ToString16(num, ready + readylen); + break; + } + case STRING: + { + READY_FLUSH(); + const char* str = va_arg(parameters, const char*); + size_t len = String::Length(str); + if ( callback && callback(user, str, len) != len ) { return SIZE_MAX; } + written += len; + break; + } + case CHARACTER: + { + int c = va_arg(parameters, int); + if ( READY_SIZE <= readylen ) { READY_FLUSH(); } + ready[readylen++] = c; + break; + } + } + } + + READY_FLUSH(); + + return written; + } + } +} diff --git a/libmaxsi/hsrc/error.h b/libmaxsi/hsrc/error.h new file mode 100644 index 00000000..123caaaf --- /dev/null +++ b/libmaxsi/hsrc/error.h @@ -0,0 +1,58 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + error.h + Error reporting functions and utilities. + +******************************************************************************/ + +#ifndef LIBMAXSI_ERROR_H +#define LIBMAXSI_ERROR_H + +namespace Maxsi +{ + namespace Error + { + // TODO: merge with errno interface. + + const int SUCCESS = 0; + const int NONE = 1; + const int DENIED = 2; + const int NOTFOUND = 3; + const int NOSUPPORT = 4; + const int NOTIMPLEMENTED = 5; + const int PENDING = 6; + const int BADINPUT = 7; + const int CORRUPT = 8; + const int NOMEM = 9; + const int NOTDIR = 10; + const int ISDIR = 11; + + const int ENOTBLK = 12; + const int ENODEV = 13; + + extern int _errornumber; + + inline int Last() { return _errornumber; } + inline void Set(int error) { _errornumber = error; } + } +} + +#endif + diff --git a/libmaxsi/hsrc/format.h b/libmaxsi/hsrc/format.h new file mode 100644 index 00000000..2240288e --- /dev/null +++ b/libmaxsi/hsrc/format.h @@ -0,0 +1,39 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + format.h + Provides printf formatting functions that uses callbacks. + +******************************************************************************/ + +#ifndef LIBMAXSI_FORMAT_H +#define LIBMAXSI_FORMAT_H + +namespace Maxsi +{ + namespace Format + { + typedef size_t (*Callback)(void* user, const char* string, size_t stringlen); + + size_t Virtual(Callback callback, void* user, const char* format, va_list parameters); + } +} + +#endif + diff --git a/libmaxsi/hsrc/io.h b/libmaxsi/hsrc/io.h new file mode 100644 index 00000000..313e1203 --- /dev/null +++ b/libmaxsi/hsrc/io.h @@ -0,0 +1,54 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + io.h + Functions for management of input and output. + +******************************************************************************/ + +#ifndef LIBMAXSI_IO_H +#define LIBMAXSI_IO_H + +namespace Maxsi +{ + namespace IO + { + // TODO: + + enum Seek_t { SEEK_SET, SEEK_CUR, SEEK_END }; + + int Open(const char* Path, int Flags, int Mode = 0); // TODO: Better default value for Mode + int Close(int FileDesc = -1); + int Truncate(int FileDesc, intmax_t Size = 0); + int Sync(int FileDesc = -1); + intmax_t Seek(int FileDesc, intmax_t Offset, Seek_t Whence = SEEK_SET); + size_t Read(int FileDesc, const void* Buffer, size_t BufferSize); + size_t Write(int FileDesc, const void* Buffer, size_t BufferSize); + size_t ReadAt(int FileDesc, const void* Buffer, size_t BufferSize, intmax_t Position); + size_t WriteAt(int FileDesc, const void* Buffer, size_t BufferSize, intmax_t Position); + } + + namespace StdOut + { + size_t Print(const char* Message); + } +} + +#endif + diff --git a/libmaxsi/hsrc/memory.h b/libmaxsi/hsrc/memory.h new file mode 100644 index 00000000..3392c80e --- /dev/null +++ b/libmaxsi/hsrc/memory.h @@ -0,0 +1,53 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + memory.h + Useful functions for manipulating memory, as well as the implementation + of the heap. + +******************************************************************************/ + +#ifndef LIBMAXSI_MEMORY_H +#define LIBMAXSI_MEMORY_H + +namespace Maxsi +{ + namespace Memory + { + void Init(); + void* Allocate(size_t Size); + void Free(void* Addr); + size_t GetChunkOverhead(); + void* Copy(void* Dest, const void* Src, size_t Length); + void* Set(void* Dest, int Value, size_t Length); + } +} + +inline void* operator new(size_t, void* p) { return p; } +inline void* operator new[](size_t, void* p) { return p; } +inline void operator delete (void*, void*) { }; +inline void operator delete[](void*, void*) { }; + +inline void* operator new(size_t Size) { return Maxsi::Memory::Allocate(Size); } +inline void* operator new[](size_t Size) { return Maxsi::Memory::Allocate(Size); } +inline void operator delete (void* Addr) { return Maxsi::Memory::Free(Addr); }; +inline void operator delete[](void* Addr) { return Maxsi::Memory::Free(Addr); }; + +#endif + diff --git a/libmaxsi/hsrc/platform.h b/libmaxsi/hsrc/platform.h new file mode 100644 index 00000000..d003eb83 --- /dev/null +++ b/libmaxsi/hsrc/platform.h @@ -0,0 +1,87 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + platform.h + Defines platform specific stuff. + +******************************************************************************/ + +#ifndef LIBMAXSI_PLATFORM_H +#define LIBMAXSI_PLATFORM_H + + // Detect which platform we are compiling to and declare some useful macros. + #ifdef PLATFORM_X86 + #define CPU X86 + #endif + + #ifdef PLATFORM_X64 + #define CPU X64 + #endif + + #if defined(PLATFORM_X86) || defined(PLATFORM_X64) + #define PLATFORM_X86_FAMILY + #define CPU_FAMILY X86_FAMILY + #endif + + // Libmaxsi is also compatible as a C library, if enabled. + #ifdef LIBMAXSI_LIBRARY + #if defined(SORTIX_KERNEL) && !defined(LIBMAXSI_NO_LIBC) + #define LIBMAXSI_NO_LIBC + #endif + + #ifndef LIBMAXSI_NO_LIBC + #define LIBMAXSI_LIBC + #endif + + #ifdef LIBMAXSI_LIBC + #define DUAL_FUNCTION(Type, CName, LibMaxsiName, Parameters) \ + Type LibMaxsiName Parameters __attribute__ ((weak, alias (#CName))); \ + extern "C" Type CName Parameters + #else + #define DUAL_FUNCTION(Type, CName, LibMaxsiName, Parameters) \ + Type LibMaxsiName Parameters + #endif + #endif + + #ifdef SORTIX_KERNEL + #define ASSERT(invariant) \ + if ( unlikely(!(invariant)) ) \ + { \ + Sortix::PanicF("Assertion failure: %s:%u: %s: %s\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, #invariant); \ + while ( true ) { } \ + } + #else + + #define ASSERT(invariant) + + #endif + + #define STATIC_ASSERT(condition) static_assert(condition, #condition) + + // Define common datatypes. + #include "types.h" + +#endif + +#ifdef SORTIX_KERNEL +#include +#include +#include +#endif + diff --git a/libmaxsi/hsrc/string.h b/libmaxsi/hsrc/string.h new file mode 100644 index 00000000..b1adb1ab --- /dev/null +++ b/libmaxsi/hsrc/string.h @@ -0,0 +1,46 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + string.h + Useful functions for manipulating strings. + +******************************************************************************/ + +#ifndef LIBMAXSI_STRING_H +#define LIBMAXSI_STRING_H + +namespace Maxsi +{ + namespace String + { + const char ASCII_ESCAPE = 27; + + size_t Length(const char* String); + char* Clone(const char* Source); + char* Combine(size_t NumParameters, ...); + char* Copy(char* Dest, const char* Src); + char* Cat(char* Dest, const char* Src); + int Compare(const char* A, const char* B); + int CompareN(const char* A, const char* B, size_t MaxLength); + int StartsWith(const char* Haystack, const char* Needle); + } +} + +#endif + diff --git a/libmaxsi/hsrc/syscall.h b/libmaxsi/hsrc/syscall.h new file mode 100644 index 00000000..5e1cc975 --- /dev/null +++ b/libmaxsi/hsrc/syscall.h @@ -0,0 +1,208 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + string.h + Useful functions for manipulating strings. + +******************************************************************************/ + +#ifndef LIBMAXSI_SYSCALL_H +#define LIBMAXSI_SYSCALL_H + +namespace Maxsi +{ +#ifdef SORTIX_KERNEL +#warning === +#warning Sortix does not support syscalls from within the kernel, building this part of LibMaxsi should not be needed, and should not be used in kernel mode +#warning === +#endif + + #define DECL_SYSCALL0(type,fn) type fn(); + #define DECL_SYSCALL1(type,fn,p1) type fn(p1); + #define DECL_SYSCALL2(type,fn,p1,p2) type fn(p1,p2); + #define DECL_SYSCALL3(type,fn,p1,p2,p3) type fn(p1,p2,p3); + #define DECL_SYSCALL4(type,fn,p1,p2,p3,p4) type fn(p1,p2,p3,p4); + #define DECL_SYSCALL5(type,fn,p1,p2,p3,p4,p5) type fn(p1,p2,p3,p4,p5); + +#ifdef PLATFORM_X86 + + #define DEFN_SYSCALL0(type, fn, num) \ + inline type fn() \ + { \ + type a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num)); \ + return a; \ + } + + #define DEFN_SYSCALL1(type, fn, num, P1) \ + inline type fn(P1 p1) \ + { \ + type a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((size_t)p1)); \ + return a; \ + } + + #define DEFN_SYSCALL2(type, fn, num, P1, P2) \ + inline type fn(P1 p1, P2 p2) \ + { \ + type a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((size_t)p1), "c" ((size_t)p2)); \ + return a; \ + } + + #define DEFN_SYSCALL3(type, fn, num, P1, P2, P3) \ + inline type fn(P1 p1, P2 p2, P3 p3) \ + { \ + type a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((size_t)p1), "c" ((size_t)p2), "d" ((size_t)p3)); \ + return a; \ + } + + #define DEFN_SYSCALL4(type, fn, num, P1, P2, P3, P4) \ + inline type fn(P1 p1, P2 p2, P3 p3, P4 p4) \ + { \ + type a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((size_t)p1), "c" ((size_t)p2), "d" ((size_t)p3), "D" ((size_t)p4)); \ + return a; \ + } + + #define DEFN_SYSCALL5(type, fn, num, P1, P2, P3, P4, P5) \ + inline type fn(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) \ + { \ + type a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((size_t)p1), "c" ((size_t)p2), "d" ((size_t)p3), "D" ((size_t)p4), "S" ((size_t)p5)); \ + return a; \ + } + + #define DEFN_SYSCALL0_VOID(fn, num) \ + inline void fn() \ + { \ + size_t a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num)); \ + } + + #define DEFN_SYSCALL1_VOID(fn, num, P1) \ + inline void fn(P1 p1) \ + { \ + size_t a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((size_t)p1)); \ + } + + #define DEFN_SYSCALL2_VOID(fn, num, P1, P2) \ + inline void fn(P1 p1, P2 p2) \ + { \ + size_t a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((size_t)p1), "c" ((size_t)p2)); \ + } + + #define DEFN_SYSCALL3_VOID(fn, num, P1, P2, P3) \ + inline void fn(P1 p1, P2 p2, P3 p3) \ + { \ + size_t a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((size_t)p1), "c" ((size_t)p2), "d" ((size_t)p3)); \ + } + + #define DEFN_SYSCALL4_VOID(fn, num, P1, P2, P3, P4) \ + inline void fn(P1 p1, P2 p2, P3 p3, P4 p4) \ + { \ + size_t a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((size_t)p1), "c" ((size_t)p2), "d" ((size_t)p3), "D" ((size_t)p4)); \ + } + + #define DEFN_SYSCALL5_VOID(fn, num, P1, P2, P3, P4, P5) \ + inline void fn(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) \ + { \ + size_t a; \ + asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((size_t)p1), "c" ((size_t)p2), "d" ((size_t)p3), "D" ((size_t)p4), "S" ((size_t)p5)); \ + } + +#else + + #define DEFN_SYSCALL0(type, fn, num) \ + inline type fn() \ + { \ + return 0; \ + } + + #define DEFN_SYSCALL1(type, fn, num, P1) \ + inline type fn(P1 p1) \ + { \ + return 0; \ + } + + #define DEFN_SYSCALL2(type, fn, num, P1, P2) \ + inline type fn(P1 p1, P2 p2) \ + { \ + return 0; \ + } + + #define DEFN_SYSCALL3(type, fn, num, P1, P2, P3) \ + inline type fn(P1 p1, P2 p2, P3 p3) \ + { \ + return 0; \ + } + + #define DEFN_SYSCALL4(type, fn, num, P1, P2, P3, P4) \ + inline type fn(P1 p1, P2 p2, P3 p3, P4 p4) \ + { \ + return 0; \ + } + + #define DEFN_SYSCALL5(type, fn, num, P1, P2, P3, P4, P5) \ + inline type fn(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) \ + { \ + return 0; \ + } + + #define DEFN_SYSCALL0_VOID(fn, num) \ + inline void fn() \ + { \ + } + + #define DEFN_SYSCALL1_VOID(fn, num, P1) \ + inline void fn(P1 p1) \ + { \ + } + + #define DEFN_SYSCALL2_VOID(fn, num, P1, P2) \ + inline void fn(P1 p1, P2 p2) \ + { \ + } + + #define DEFN_SYSCALL3_VOID(fn, num, P1, P2, P3) \ + inline void fn(P1 p1, P2 p2, P3 p3) \ + { \ + } + + #define DEFN_SYSCALL4_VOID(fn, num, P1, P2, P3, P4) \ + inline void fn(P1 p1, P2 p2, P3 p3, P4 p4) \ + { \ + } + + #define DEFN_SYSCALL5_VOID(fn, num, P1, P2, P3, P4, P5) \ + inline void fn(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) \ + { \ + } + +#endif + +} + +#endif + diff --git a/libmaxsi/hsrc/thread.h b/libmaxsi/hsrc/thread.h new file mode 100644 index 00000000..b71336cb --- /dev/null +++ b/libmaxsi/hsrc/thread.h @@ -0,0 +1,42 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + thread.h + Exposes system calls for thread creation and management. + +******************************************************************************/ + +#ifndef LIBMAXSI_THREAD_H +#define LIBMAXSI_THREAD_H + +namespace Maxsi +{ + namespace Thread + { + typedef void* (*Entry)(void*); + + size_t Create(Entry Start, const void* Parameter, size_t StackSize = SIZE_MAX); + void Exit(const void* Result); + void Sleep(long Seconds); + void USleep(long Microseconds); + } +} + +#endif + diff --git a/libmaxsi/hsrc/types.h b/libmaxsi/hsrc/types.h new file mode 100644 index 00000000..03434b90 --- /dev/null +++ b/libmaxsi/hsrc/types.h @@ -0,0 +1,52 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + types.h + Declares the required datatypes based on the kernel's configuration. + +******************************************************************************/ + +#ifndef LIBMAXSI_TYPES_H +#define LIBMAXSI_TYPES_H + +#include + +@include(NULL.h) + +@include(intn_t.h) + +@include(wint_t.h) +@include(id_t.h) +@include(gid_t.h) +@include(pid_t.h) +@include(uid_t.h) +@include(locale_t.h) +@include(mode_t.h) +@include(off_t.h) +@include(gid_t.h) + +@include(va_list.h) + +// Maxsi datatype extentions. +typedef __nat nat; +typedef uint8_t byte; +typedef uintptr_t addr_t; + +#endif + diff --git a/libmaxsi/io.cpp b/libmaxsi/io.cpp new file mode 100644 index 00000000..38565c74 --- /dev/null +++ b/libmaxsi/io.cpp @@ -0,0 +1,48 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + io.h + Functions for management of input and output. + +******************************************************************************/ + +#include "platform.h" +#include "syscall.h" +#include "io.h" + +namespace Maxsi +{ + namespace StdOut + { + DEFN_SYSCALL1(size_t, SysPrint, 4, const char*); + + size_t Print(const char* Message) + { + return SysPrint(Message); + } + +#ifdef LIBMAXSI_LIBC + extern "C" int printf(const char* /*restrict*/ format, ...) + { + // TODO: The format string is currently being ignored! + return Print(format); + } +#endif + } +} diff --git a/libmaxsi/memory.cpp b/libmaxsi/memory.cpp new file mode 100644 index 00000000..974e4487 --- /dev/null +++ b/libmaxsi/memory.cpp @@ -0,0 +1,484 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + memory.cpp + Useful functions for manipulating memory, as well as the implementation + of the heap. + +******************************************************************************/ + +#include "platform.h" +#include "memory.h" +#include "error.h" +#include "io.h" // DEBUG + +#ifdef SORTIX_KERNEL +#include +#include // DEBUG +#include // DEBUG +#include // DEBUG + +#include +#include + +namespace Sortix +{ + namespace VirtualMemory + { + extern uintptr_t KernelHalfStart; + extern uintptr_t KernelHalfEnd; + } +} +#endif + +#define IsGoodChunkPosition(Chunk) ((uintptr_t) Wilderness + WildernessSize <= (uintptr_t) (Chunk) && (uintptr_t) (Chunk) <= (uintptr_t) HeapStart) +#define IsGoodChunkInfo(Chunk) ( ( (UnusedChunkFooter*) (((byte*) (Chunk)) + (Chunk)->Size - sizeof(UnusedChunkFooter)) )->Size == (Chunk)->Size ) +#define IsGoodChunk(Chunk) (IsGoodChunkPosition(Chunk) && (Chunk)->Size >= 32 && IsGoodChunkPosition((uintptr_t) (Chunk) + (Chunk)->Size) && IsGoodChunkInfo(Chunk) ) +#define IsGoodUnusedChunk(Chunk) ( IsGoodChunk(Chunk) && ( Chunk->NextUnused == NULL || IsGoodChunkPosition(Chunk->NextUnused) ) ) +#define IsGoodUsedChunk(Chunk) ( IsGoodChunk(Chunk) && Chunk->Magic == Magic ) +#ifdef PLATFORM_X64 +#define IsGoodBinIndex(Index) ( 4 <= Index && Index < 32 ) +#else +#define IsGoodBinIndex(Index) ( 5 <= Index && Index < 64 ) +#endif +#define IsAligned(Value, Alignment) ( (Value & (Alignment-1)) == 0 ) + +#define BITS(x) (8UL*sizeof(x)) + +namespace Maxsi +{ + // TODO: How should this API exist? Should it be publicly accessasble? + // Where should the C bindings (if relevant) be declared and defined? + // Is it part of the kernel or the standard library? What should it be + // called? Is it an extension? For now, I'll just leave this here, hidden + // away in libmaxsi until I figure out how libmaxsi/sortix should handle + // facilities currently only available on Sortix. + namespace System + { + namespace Memory + { + bool Allocate(void* /*position*/, size_t /*length*/) + { + // TODO: Implement a syscall for this! + return true; + } + } + } + + namespace Memory + { + // This magic word is useful to see if the program has written into the + // chunk's header or footer, which means the program has malfunctioned + // and ought to be terminated. +#ifdef PLATFORM_X64 + const size_t Magic = 0xDEADDEADDEADDEADULL; +#else + const size_t Magic = 0xDEADDEAD; +#endif + + // All requsted sizes must be a multiple of this. + const size_t Alignment = 16ULL; + + // Returns the index of the most significant set bit. + inline size_t BSR(size_t Value) + { +#if 1 + ASSERT(Value > 0); + for ( size_t I = 8*sizeof(size_t); I > 0; I-- ) + { + if ( Value & ( 1 << (I-1) ) ) { return I-1; } + } + return 0; +#else + size_t Result; + asm("bsr %0, %1" : "=r"(Result) : "r"(Value)); + return Result; +#endif + } + + // Returns the index of the least significant set bit. + inline size_t BSF(size_t Value) + { +#if 1 + ASSERT(Value > 0); + for ( size_t I = 0; I < 8*sizeof(size_t); I++ ) + { + if ( Value & ( 1 << I ) ) { return I; } + } + return 0; +#else + size_t Result; + asm("bsf %0, %1" : "=r"(Result) : "r"(Value)); + return Result; +#endif + } + // NOTE: BSR(N) = Log2RoundedDown(N). + + // NOTE: BSR(N-1)+1 = Log2RoundedUp(N), N > 1. + // PROOF: If X=2^N is a power of two, then BSR(X) = Log2(X) = N. + // If X is not a power of two, then BSR(X) will return the previous + // power of two. + // If we want the next power of two for a non-power-of-two then + // BSR(X)+1 would work. However, this causes problems for X=2^N, where + // it returns a value one too big. + // BSR(X-1)+1 = BSR(X)+1 give the same value for all X that is not a + // power of two. For X=2^N, BSR(X-1)+1 will be one lower, which is + // exactly what we want. QED. + + // Now declare some structures that are put around the allocated data. + struct UnusedChunkHeader + { + size_t Size; + UnusedChunkHeader* NextUnused; + }; + + struct UnusedChunkFooter + { + void* Unused; + size_t Size; + }; + + struct UsedChunkHeader + { + size_t Size; + size_t Magic; + }; + + struct UsedChunkFooter + { + size_t Magic; + size_t Size; + }; + + // How much extra space will our headers use? + const size_t ChunkOverhead = sizeof(UsedChunkHeader) + sizeof(UsedChunkFooter); + size_t GetChunkOverhead() { return ChunkOverhead; } + + // A bin for each power of two. + UnusedChunkHeader* Bins[BITS(size_t)]; + + // INVARIANT: A bit is set for each bin if it contains anything. + size_t BinContainsChunks; + + // And south of everything, there is nothing allocated, at which + // extra space can be added on-demand. + // INVARIANT: Wilderness is always page-aligned! + const byte* HeapStart; + const byte* Wilderness; + size_t WildernessSize; + + // Initializes the heap system. + void Init() + { + Memory::Set(Bins, 0, sizeof(Bins)); +#ifdef SORTIX_KERNEL + Wilderness = (byte*) Sortix::VirtualMemory::KernelHalfEnd; +#else + // TODO: This is very 32-bit specific! + Wilderness = (byte*) 0x80000000; +#endif + HeapStart = Wilderness; + WildernessSize = 0; + BinContainsChunks = 0; + } + + // Expands the wilderness block (the heap grows downwards). + bool ExpandWilderness(size_t NeededSize) + { + if ( NeededSize <= WildernessSize ) { return true; } + + ASSERT(Wilderness != NULL); + + // Check if we are going too far down (beneath the NULL position!). + if ( (uintptr_t) Wilderness < NeededSize ) { return false; } + +#ifdef SORTIX_KERNEL + // Check if the wilderness would grow larger than the kernel memory area. + if ( ( ((uintptr_t) Wilderness) - Sortix::VirtualMemory::KernelHalfStart ) < NeededSize ) { return false; } +#endif + + // Figure out how where the new wilderness will be. + uintptr_t NewWilderness = ((uintptr_t) Wilderness) + WildernessSize - NeededSize; + + // And now align downwards to the page boundary. + NewWilderness &= ~(0xFFFUL); + + ASSERT(NewWilderness < (uintptr_t) Wilderness); + + // Figure out where and how much memory we need. + byte* MemoryStart = (byte*) NewWilderness; + size_t MemorySize = (uintptr_t) Wilderness - (uintptr_t) NewWilderness; + +#ifndef SORTIX_KERNEL // We are user-space. + + // Ask the kernel to map memory to the needed region! + if ( !System::Memory::Allocate(MemoryStart, MemorySize) ) { return false; } + +#else // We are Sortix. + + // Figure out how many pages we need. + size_t NumPages = MemorySize / 4096; + size_t PagesLeft = NumPages; + + ASSERT(NumPages > 0); + + // Attempt to allocate and map each of them. + while ( PagesLeft > 0 ) + { + PagesLeft--; + + // Get a raw unused physical page. + void* Page = Sortix::Page::Get(); + + if ( Page == NULL ) + { + // If none is available, simply let the allocation fail + // and unallocate everything we did allocate so far. + while ( PagesLeft < NumPages ) + { + PagesLeft++; + + uintptr_t OldVirtual = NewWilderness + 4096 * PagesLeft; + void* OldPage = Sortix::VirtualMemory::LookupAddr(OldVirtual); + Sortix::VirtualMemory::Map(0, OldVirtual, 0); + Sortix::Page::Put(OldPage); + } + + // Flash the TLB to restore everything safely. + Sortix::VirtualMemory::Flush(); + return false; + } + + // Map the physical page to a virtual one. + uintptr_t VirtualAddr = NewWilderness + 4096 * PagesLeft; + + Sortix::VirtualMemory::Map((uintptr_t) Page, VirtualAddr, TABLE_PRESENT | TABLE_WRITABLE); + } + + // Now flush the TLB such that the new pages can be safely used. + Sortix::VirtualMemory::Flush(); +#endif + + // Update the wilderness information now that it is safe. + Wilderness = MemoryStart; + WildernessSize += MemorySize; + + ASSERT(WildernessSize >= NeededSize); + + return true; + } + + // Allocates a continious memory region of Size bytes that must be deallocated using Free. + DUAL_FUNCTION(void*, malloc, Allocate, (size_t Size)) + { + // Always allocate a multiple of alignment (round up to nearest aligned size). + // INVARIANT: Size is always aligned after this statement. + Size = (Size + Alignment - 1) & ~(Alignment-1); + + // Account for the overhead of the headers and footers. + Size += ChunkOverhead; + + ASSERT((Size & (Alignment-1)) == 0); + + // Find the index of the smallest usable bin. + // INVARIANT: Size is always at least ChunkOverhead bytes, thus + // Size-1 will never be 0, and thus BSR is always defined. + size_t MinBinIndex = BSR(Size-1)+1; + ASSERT(IsGoodBinIndex(MinBinIndex)); + + // Make a bitmask that filters away all bins that are too small. + size_t MinBinMask = ~((1 << MinBinIndex) - 1); + ASSERT( ( (1 << (MinBinIndex-1)) & MinBinMask ) == 0); + + // Now filter all bins away that are too small. + size_t AvailableBins = BinContainsChunks & MinBinMask; + + // Does any bin contain an usable chunk? + if ( AvailableBins > 0 ) + { + // Now find the smallest usable bin. + size_t BinIndex = BSF( AvailableBins ); + ASSERT(IsGoodBinIndex(BinIndex)); + + // And pick the first thing in it. + UnusedChunkHeader* Chunk = Bins[BinIndex]; + ASSERT(IsGoodUnusedChunk(Chunk)); + + // Increment the bin's linked list. + Bins[BinIndex] = Chunk->NextUnused; + ASSERT(Chunk->NextUnused == NULL || IsGoodUnusedChunk(Chunk->NextUnused)); + + // Find the size of this bin (also the value of this bins flag). + size_t BinSize = 1 << BinIndex; + ASSERT(BinSize >= Size); + + // If we emptied the bin, then remove the flag that says this bin is usable. + ASSERT(BinContainsChunks & BinSize); + if ( Chunk->NextUnused == NULL ) { BinContainsChunks ^= BinSize; } + + // Figure out where the chunk ends. + uintptr_t ChunkEnd = ((uintptr_t) Chunk) + Chunk->Size; + + // If we were to split the chunk into one used part, and one unused part, then + // figure out where the unused part would begin. + uintptr_t NewChunkStart = ((uintptr_t) Chunk) + Size; + + // INVARIANT: NewChunkStart is always less or equal to ChunkEnd, + // because Size is less or equal to Chunk->Size (otherwise this + // chunk could not have been selected above). + ASSERT(NewChunkStart <= ChunkEnd); + // INVARIANT: NewChunkStart is aligned because Chunk is (this + // is made sure when chunks are made when expanding into the + // wilderness, when splitting blocks, and when combining them), + // and because Size is aligned (first thing we make sure). + ASSERT( IsAligned(NewChunkStart, Alignment) ); + + // Find the size of the possible new chunk. + size_t NewChunkSize = ChunkEnd - NewChunkStart; + + UsedChunkHeader* ResultHeader = (UsedChunkHeader*) Chunk; + + // See if it's worth it to split the chunk into two, if any space is left in it. + if ( NewChunkSize >= sizeof(UnusedChunkHeader) + sizeof(UnusedChunkFooter) ) + { + // Figure out which bin to put the new chunk in. + size_t NewBinIndex = BSR(NewChunkSize); + ASSERT(IsGoodBinIndex(NewBinIndex)); + + // Mark that a chunk is available for this bin. + BinContainsChunks |= (1 << NewBinIndex); + + // Now write some headers and footers for the new chunk. + UnusedChunkHeader* NewChunkHeader = (UnusedChunkHeader*) NewChunkStart; + ASSERT(IsGoodChunkPosition(NewChunkStart)); + + NewChunkHeader->Size = NewChunkSize; + NewChunkHeader->NextUnused = Bins[NewBinIndex]; + ASSERT(NewChunkHeader->NextUnused == NULL || IsGoodChunk(NewChunkHeader->NextUnused)); + + UnusedChunkFooter* NewChunkFooter = (UnusedChunkFooter*) (ChunkEnd - sizeof(UnusedChunkFooter)); + NewChunkFooter->Size = NewChunkSize; + NewChunkFooter->Unused = NULL; + + // Put the new chunk in front of our linked list. + ASSERT(IsGoodUnusedChunk(NewChunkHeader)); + Bins[NewBinIndex] = NewChunkHeader; + + // We need to modify our resulting chunk to be smaller. + ResultHeader->Size = Size; + } + + // Set the required magic values. + UsedChunkFooter* ResultFooter = (UsedChunkFooter*) ( ((byte*) ResultHeader) + ResultHeader->Size - sizeof(UsedChunkFooter) ); + ResultHeader->Magic = Magic; + ResultFooter->Magic = Magic; + ResultFooter->Size = Size; + + ASSERT(IsGoodUsedChunk(ResultHeader)); + + return ((byte*) ResultHeader) + sizeof(UnusedChunkHeader); + } + else + { + // We have no free chunks that are big enough, let's expand our heap into the unknown, if possible. + if ( WildernessSize < Size && !ExpandWilderness(Size) ) { Error::Set(Error::NOMEM); return NULL; } + + // Write some headers and footers around our newly allocated data. + UsedChunkHeader* ResultHeader = (UsedChunkHeader*) (Wilderness + WildernessSize - Size); + UsedChunkFooter* ResultFooter = (UsedChunkFooter*) (Wilderness + WildernessSize - sizeof(UsedChunkFooter)); + WildernessSize -= Size; + + ResultHeader->Size = Size; + ResultHeader->Magic = Magic; + ResultFooter->Size = Size; + ResultFooter->Magic = Magic; + + ASSERT(IsGoodUsedChunk(ResultHeader)); + + return ((byte*) ResultHeader) + sizeof(UsedChunkHeader); + } + } + + // Frees a continious memory region allocated by Allocate. + DUAL_FUNCTION(void, free, Free, (void* Addr)) + { + // Just ignore NULL-pointers. + if ( Addr == NULL ) { return; } + + // Restore the chunk information structures. + UsedChunkHeader* ChunkHeader = (UsedChunkHeader*) ( ((byte*) Addr) - sizeof(UsedChunkHeader) ); + UsedChunkFooter* ChunkFooter = (UsedChunkFooter*) ( ((byte*) ChunkHeader) + ChunkHeader->Size - sizeof(UsedChunkFooter) ); + + ASSERT(IsGoodUsedChunk(ChunkHeader)); + + // If you suspect a chunk of bein' a witch, report them immediately. I cannot stress that enough. Witchcraft will not be tolerated. + if ( ChunkHeader->Magic != Magic || ChunkFooter->Magic != Magic || ChunkHeader->Size != ChunkFooter->Size ) + { +#ifdef SORTIX_KERNEL + Sortix::PanicF("Witchcraft detected!\n", ChunkHeader); +#endif + // TODO: Report witchcraft (terminating the process is probably a good idea). + } + + // TODO: Combine this chunk with its neighbors, if they are also unused. + + // Calculate which bin this chunk belongs to. + size_t BinIndex = BSR(ChunkHeader->Size); + ASSERT(IsGoodBinIndex(BinIndex)); + + // Mark that a chunk is available for this bin. + BinContainsChunks |= (1 << BinIndex); + + UnusedChunkHeader* UnChunkHeader = (UnusedChunkHeader*) ChunkHeader; + UnusedChunkFooter* UnChunkFooter = (UnusedChunkFooter*) ChunkFooter; + + // Now put this chunk back in the linked list. + ASSERT(Bins[BinIndex] == NULL || IsGoodUnusedChunk(Bins[BinIndex])); + UnChunkHeader->NextUnused = Bins[BinIndex]; + UnChunkFooter->Unused = NULL; + + ASSERT(IsGoodUnusedChunk(UnChunkHeader)); + Bins[BinIndex] = UnChunkHeader; + } + + DUAL_FUNCTION(void*, memcpy, Copy, (void* Dest, const void* Src, size_t Length)) + { + char* D = (char*) Dest; const char* S = (const char*) Src; + + for ( size_t I = 0; I < Length; I++ ) + { + D[I] = S[I]; + } + + return Dest; + } + + DUAL_FUNCTION(void*, memset, Set, (void* Dest, int Value, size_t Length)) + { + byte* D = (byte*) Dest; + + for ( size_t I = 0; I < Length; I++ ) + { + D[I] = Value & 0xFF; + } + + return Dest; + } + } +} diff --git a/libmaxsi/start.s b/libmaxsi/start.s new file mode 100644 index 00000000..60dc499c --- /dev/null +++ b/libmaxsi/start.s @@ -0,0 +1,43 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + start.s + A stub for linking to the C runtime on Sortix. + +******************************************************************************/ + +.globl _start + +.section .text + +.text 0x100000 +.type _start, @function +_start: + + # Run main + # TODO: Sortix should push these values to the stack itself! + push $0x0 # argv + push $0 # argc + call main + + # Now return mains result when exiting the process + mov %eax, %ebx + mov $1, %eax + mov $0x0, %ebx # TODO: This syscall exits a thread, not a process! + int $0x80 diff --git a/libmaxsi/string.cpp b/libmaxsi/string.cpp new file mode 100644 index 00000000..174c46d2 --- /dev/null +++ b/libmaxsi/string.cpp @@ -0,0 +1,137 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + string.cpp + Useful functions for manipulating strings. + +******************************************************************************/ + +#include "platform.h" +#include "string.h" +#include "memory.h" + +namespace Maxsi +{ + namespace String + { + DUAL_FUNCTION(size_t, strlen, Length, (const char* String)) + { + size_t Result = 0; + + while ( String[Result] != '\0' ) + { + Result++; + } + + return Result; + } + + DUAL_FUNCTION(char*, strcpy, Copy, (char* Dest, const char* Src)) + { + char* OriginalDest = Dest; + + while ( *Src != '\0' ) + { + *Dest = *Src; + Dest++; Src++; + } + + return OriginalDest; + } + + DUAL_FUNCTION(char*, strcat, Cat, (char* Dest, const char* Src)) + { + char* OriginalDest = Dest; + + while ( *Dest != '\0' ) { Dest++; } + + while ( *Src != '\0' ) + { + *Dest = *Src; + Dest++; Src++; + } + + return OriginalDest; + } + + DUAL_FUNCTION(int, strcmp, Compare, (const char* A, const char* B)) + { + while ( true ) + { + if ( *A == '\0' && *B == '\0' ) { return 0; } + if ( *A < *B ) { return -1; } + if ( *A > *B ) { return 1; } + A++; B++; + } + } + + char* Clone(const char* Input) + { + size_t InputSize = Length(Input); + char* Result = new char[InputSize + 1]; + if ( Result == NULL ) { return NULL; } + Memory::Copy(Result, Input, InputSize + 1); + return Result; + } + +#if 0 + char* Combine(size_t NumParameters, ...) + { + va_list param_pt; + + va_start(param_pt, NumParameters); + + // First calculate the string length. + size_t ResultLength = 0; + const char* TMP = 0; + + for ( size_t I = 0; I < NumParameters; I++ ) + { + TMP = va_arg(param_pt, const char*); + + if ( TMP != NULL ) { ResultLength += strlen(TMP); } + } + + // Allocate a string with the desired length. + char* Result = new char[ResultLength+1]; + + Result[0] = 0; + + va_end(param_pt); + va_start(param_pt, NumParameters); + + size_t ResultOffset = 0; + + for ( size_t I = 0; I < NumParameters; I++ ) + { + TMP = va_arg(param_pt, const char*); + + if ( TMP ) + { + size_t TMPLength = strlen(TMP); + strcpy(Result + ResultOffset, TMP); + ResultOffset += TMPLength; + } + } + + return Result; + } +#endif + } +} diff --git a/libmaxsi/thread.cpp b/libmaxsi/thread.cpp new file mode 100644 index 00000000..86ea4d05 --- /dev/null +++ b/libmaxsi/thread.cpp @@ -0,0 +1,90 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + thread.cpp + Exposes system calls for thread creation and management. + +******************************************************************************/ + +#include "platform.h" +#ifdef LIBMAXSI_LIBC +#include +#endif +#include "syscall.h" +#include "thread.h" + +#ifdef SORTIX_KERNEL +extern "C" void PanicF(const char* Format, ...); +#endif + +namespace Maxsi +{ + namespace Thread + { + typedef void (*SysEntry)(size_t, Entry, void*); + DEFN_SYSCALL4(size_t, SysCreate, 0, SysEntry, Entry, const void*, size_t); + DEFN_SYSCALL1_VOID(SysExit, 1, const void*); + DEFN_SYSCALL1_VOID(SysSleep, 2, long); + DEFN_SYSCALL1_VOID(SysUSleep, 3, long); + + void Exit(const void* Result) + { + SysExit(Result); + } + +#ifdef LIBMAXSI_LIBC + extern "C" void exit(int result) + { + SysExit(NULL); + } +#endif + + void ThreadStartup(size_t Id, Entry Start, void* Parameter) + { + Exit(Start(Parameter)); + } + + size_t Create(Entry Start, const void* Parameter, size_t StackSize) + { + return SysCreate(&ThreadStartup, Start, Parameter, StackSize); + } + +#ifdef LIBMAXSI_LIBC + extern "C" unsigned sleep(unsigned Seconds) { SysSleep(Seconds); return 0; /* TODO: Posix mentions something about signals and whatnot. */} +#endif + + // TODO: Thinking about it, there is no need for this to be a long. + // Sortix will never run for that long time, and shouldn't it be unsigned long? + void Sleep(long Seconds) + { + SysSleep(Seconds); + } + + +#ifdef LIBMAXSI_LIBC + extern "C" int usleep(useconds_t Microseconds) { SysUSleep(Microseconds); return 0; } +#endif + + void USleep(long Microseconds) + { + SysUSleep(Microseconds); + } + } +} + diff --git a/mxmpp/COPYING b/mxmpp/COPYING new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/mxmpp/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/mxmpp/Makefile.in b/mxmpp/Makefile.in new file mode 100644 index 00000000..e13571a5 --- /dev/null +++ b/mxmpp/Makefile.in @@ -0,0 +1,68 @@ +subdirs = @subdirs@ +top_srcdir = @top_srcdir@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = $(exec_prefix)/bin +infodir = $(prefix)/info +libdir = $(prefix)/lib/gnudl +mandir = $(prefix)/man/man1 + +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_TARNAME = @PACKAGE_NAME@-@PACKAGE_VERSION@ +CC=@CC@ +CXX=@CXX@ +CPPFLAGS=@CPPFLAGS@ +CXXFLAGS=@CXXFLAGS@ -Wall +LDFLAGS=@LDFLAGS@ $(LIBS) +LIBS = @LIBS@ +INSTALL = @INSTALL@ +EXEEXT = @EXEEXT@ +HOST = @HOST@ +BINARY=mxmpp$(EXEEXT) + +DISTDIR:=$(PACKAGE_TARNAME) +DISTFILES=config.guess config.h.in config.sub configure configure.ac COPYING README install-sh Makefile.in mxmpp.cpp + +all: $(BINARY) + +$(BINARY): mxmpp.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ mxmpp.cpp $(LDFLAGS) $(TARGET_ARCH) + +clean: + $(RM) $(BINARY) + +distclean: clean + $(RM) Makefile config.h config.status config.cache config.log + $(RM) -r $(BUILDDIR) $(DISTDIR) + +install: all + $(INSTALL) $(BINARY) $(bindir) + +dist: dist-gzip + +dist-all: dist-gzip dist-lzma dist-bzip2 dist-xz + +dist-gzip: $(DISTDIR) + $(RM) $(PACKAGE_TARNAME).tar.gz + tar -cf - $(DISTDIR) | gzip -9 > $(PACKAGE_TARNAME).tar.gz + +dist-lzma: $(DISTDIR) + $(RM) $(PACKAGE_TARNAME).tar.lzma + tar -cf - $(DISTDIR) | lzma -9 > $(PACKAGE_TARNAME).tar.lzma + +dist-bzip2: $(DISTDIR) + $(RM) $(PACKAGE_TARNAME).tar.bz2 + tar -cf - $(DISTDIR) | bzip2 -9 > $(PACKAGE_TARNAME).tar.bz2 + +dist-xz: $(DISTDIR) + $(RM) $(PACKAGE_TARNAME).tar.xz + tar -cf - $(DISTDIR) | xz -c > $(PACKAGE_TARNAME).tar.xz + +$(DISTDIR): FORCE + mkdir -p $(DISTDIR) + cp -rv $(DISTFILES) $(DISTDIR) + +FORCE: + diff --git a/mxmpp/README b/mxmpp/README new file mode 100644 index 00000000..3368645c --- /dev/null +++ b/mxmpp/README @@ -0,0 +1,28 @@ +This is a small command-line tool for creating sound files in .wav or raw header-less PCM format with a specific frequency, duration, and amplitude. + += Website +Please see http://www.maxsi.org/software/mksound/ + += Features +* Supports .wav format and header-less PCM format. +* Generates sound files with a specific frequency, amplitude, and duration. +* Supports any sample rate. +* Supports any number of channels +* Sound data can be piped to audio software. +* Cross-Platform - works on GNU/Linux and Windows, and (possibly) Mac OS X. + += Releases +== Version 0.2 - Thursday, July 14 2011 +* Added support for any number of channels. +* Added support for any number of channels. + +== Version 0.1 - Wednesday, July 13 2011 +* Initial release. + += Installing +./configure +make +sudo make install + += License Terms +Maxsi mksound is licensed under the GNU GPL (verson 3 or later), which means it is free software, giving your the right to freely use, study, modify and redistribute it. There is a few conditions to use the software, such as you must provide its source code when redistributing it. diff --git a/mxmpp/config.guess b/mxmpp/config.guess new file mode 100755 index 00000000..c2246a4f --- /dev/null +++ b/mxmpp/config.guess @@ -0,0 +1,1502 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +timestamp='2009-12-30' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/mxmpp/config.h.in b/mxmpp/config.h.in new file mode 100644 index 00000000..e8bf3221 --- /dev/null +++ b/mxmpp/config.h.in @@ -0,0 +1,152 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* this is an AmigaOS4 platform */ +#undef AMIGAOS4_HOST + +/* this is an Android platform */ +#undef ANDROID_HOST + +/* this is a Darwin platform */ +#undef DARWIN_HOST + +/* this is a FreeBSD platform */ +#undef FREEBSD_HOST + +/* this is a GNU platform */ +#undef GNU_HOST + +/* this is a Haiku platform */ +#undef HAIKU_HOST + +/* Define to 1 if you have the `close' function. */ +#undef HAVE_CLOSE + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `fprintf' function. */ +#undef HAVE_FPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `open' function. */ +#undef HAVE_OPEN + +/* Define to 1 if you have the `perror' function. */ +#undef HAVE_PERROR + +/* Define to 1 if you have the `printf' function. */ +#undef HAVE_PRINTF + +/* Define to 1 if you have the `sscanf' function. */ +#undef HAVE_SSCANF + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcmp' function. */ +#undef HAVE_STRCMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `write' function. */ +#undef HAVE_WRITE + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* this is a Linux platform */ +#undef LINUX_HOST + +/* this is a NetBSD platform */ +#undef NETBSD_HOST + +/* this is an OpenBSD platform */ +#undef OPENBSD_HOST + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* this is a Solaris platform */ +#undef SOLARIS_HOST + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* this is a Win32 platform */ +#undef WIN32_HOST + +/* this is a WINCE6 platform */ +#undef WINCE6_HOST + +/* this is a WINCE platform */ +#undef WINCE_HOST + +/* this is a 64 platform */ +#undef WORDSIZE + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT8_T + +/* this is a 64 bit powerpc */ +#undef __powerpc64__ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to the type of a signed integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef int16_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#undef uint8_t diff --git a/mxmpp/config.sub b/mxmpp/config.sub new file mode 100755 index 00000000..c2d12572 --- /dev/null +++ b/mxmpp/config.sub @@ -0,0 +1,1714 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +timestamp='2010-01-22' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile-* | tilegx-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + # This must be matched before tile*. + tilegx*) + basic_machine=tilegx-unknown + os=-linux-gnu + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/mxmpp/configure.ac b/mxmpp/configure.ac new file mode 100644 index 00000000..8b0ef680 --- /dev/null +++ b/mxmpp/configure.ac @@ -0,0 +1,110 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.67]) +AC_INIT([mxmpp], [0.1], [sortie@maxsi.org]) +AC_CONFIG_SRCDIR([mxmpp.cpp]) +AC_CONFIG_HEADERS([config.h]) + +AC_CANONICAL_BUILD +AC_CANONICAL_HOST +AC_CANONICAL_SYSTEM + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_MINGW32 +AC_EXEEXT +AC_PROG_INSTALL + +dnl Some things you can only do by looking at the platform name. +case "${host}" in + powerpc-apple-darwin*) + AC_DEFINE([__powerpc64__], [1], [this is a 64 bit powerpc]) + darwin=yes + AC_DEFINE([DARWIN_HOST], [1], [this is a Darwin platform]) + ;; + *-apple-darwin*) + darwin=yes + AC_DEFINE([DARWIN_HOST], [1], [this is a Darwin platform]) + ;; + dnl Unfortunately, all BSD distributions are not identical, so + dnl as tacky as it is to look for the distribution name, we don't + dnl have much choice. The use of these should be avoid as much as possible. + *-openbsd*) + bsd=yes + openbsd=yes + AC_DEFINE([OPENBSD_HOST], [1], [this is an OpenBSD platform]) + ;; + *-freebsd* | *-kfreebsd*) + bsd=yes + freebsd=yes + AC_DEFINE([FREEBSD_HOST], [1], [this is a FreeBSD platform]) + ;; + *-netbsd*) + bsd=yes + netbsd=yes + AC_DEFINE([NETBSD_HOST], [1], [this is a NetBSD platform]) + ;; + *-*solaris*) + solaris=yes + AC_DEFINE([SOLARIS_HOST], [1], [this is a Solaris platform]) + ;; + *-*linux*) + linux=yes + AC_DEFINE([LINUX_HOST], [1], [this is a Linux platform]) + ;; + *-cygwin* | *-mingw* | *-pw32*) + windows=yes + AC_DEFINE([WIN32_HOST], [1], [this is a Win32 platform]) + ;; + *64-*-*bsd*) + bsd_os=bsd + AC_DEFINE([WORDSIZE], [64], [this is a 64 platform]) + ;; + *-*amigaos*) + amigaos4=yes + AC_DEFINE([AMIGAOS4_HOST], [1], [this is an AmigaOS4 platform]) + ;; + *-*haiku*) + haiku=yes + AC_DEFINE([HAIKU_HOST], [1], [this is a Haiku platform]) + ;; + *-gnu*) + gnu=yes + AC_DEFINE([GNU_HOST], [1], [this is a GNU platform]) + ;; + *-*wince) + wince=yes + AC_DEFINE([WINCE_HOST], [1], [this is a WINCE platform]) + ;; + *-*winmo) + wince=yes + AC_DEFINE([WINCE_HOST], [1], [this is a WINCE platform]) + AC_DEFINE([WINCE6_HOST], [1], [this is a WINCE6 platform]) + ;; + *-android*) + android=yes + AC_DEFINE([ANDROID_HOST], [1], [this is an Android platform]) + ;; +esac + +HOST="$host" +AC_SUBST([HOST]) + +# Checks for header files. +AC_CHECK_HEADERS([fcntl.h unistd.h sys/types.h sys/stat.h]) +AC_CHECK_HEADERS([stdint.h stdio.h string.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_INLINE +AC_TYPE_SIZE_T +AC_TYPE_UINT8_T +AC_TYPE_INT16_T + +# Checks for library functions. +AC_CHECK_FUNCS([open write close fprintf strcmp printf sscanf perror]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/mxmpp/install-sh b/mxmpp/install-sh new file mode 100755 index 00000000..dd97db7a --- /dev/null +++ b/mxmpp/install-sh @@ -0,0 +1,322 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2004-09-10.20 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit 0;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit 0;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/mxmpp/mxmpp.cpp b/mxmpp/mxmpp.cpp new file mode 100644 index 00000000..21487024 --- /dev/null +++ b/mxmpp/mxmpp.cpp @@ -0,0 +1,414 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of mksound. + + mksound is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + mksound is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with mksound. If not, see . + + mxmpp.cpp + A simple macro preprocessor. + +******************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include +#include + +#ifndef S_IRGRP +#define S_IRGRP (0) +#endif +#ifndef S_IWGRP +#define S_IWGRP (0) +#endif +#ifndef S_IROTH +#define S_IROTH (0) +#endif +#ifndef S_IWOTH +#define S_IWOTH (0) +#endif + +bool writeall(int fd, const void* p, size_t size) +{ + const uint8_t* buffer = (const uint8_t*) p; + + size_t bytesWritten = 0; + + while ( bytesWritten < size ) + { + ssize_t written = write(fd, buffer + bytesWritten, size - bytesWritten); + if ( written < 0 ) { perror("write"); return false; } + bytesWritten += written; + } + + return true; +} + +void usage(int argc, char* argv[]) +{ + printf("usage: %s [OPTIONS] [FILE]...\n", argv[0]); + printf("Preprocess FILE(s), or standard input."); + printf("\n"); + printf("Options:\n"); + printf(" -o Write output to this file\n"); + printf(" Default = Standard Output\n"); + printf(" -I Add this directory to the include search paths\n"); + printf(" If no paths are set, include from working dir\n"); + printf(" -q Surpress normal output\n"); + printf(" -v Be verbose\n"); + printf(" --usage Display this screen\n"); + printf(" --help Display this screen\n"); + printf(" --version Display version information\n"); +} + +void version() +{ + printf("The Maxsi Macro PreProcessor 0.1\n"); + printf("Copyright (C) 2011 Jonas 'Sortie' Termansen\n"); + printf("This is free software; see the source for copying conditions. There is NO\n"); + printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); + printf("website: http://www.maxsi.org/software/mxmpp/\n"); +} + +struct searchpath +{ + const char* path; + searchpath* next; +}; + +struct inputfile +{ + const char* path; + inputfile* next; +}; + +int outfd = -1; + +searchpath* firstpath = NULL; +inputfile* firstfile = NULL; + +const size_t CONSTRUCT_SIZE = 511; +const size_t BUFFER_SIZE = 4096; + +bool verbose = false; + +char* search(const char* filename); +bool include(const char* parameter); +bool expand(const char* command, const char* parameter); +bool process(int fd); +bool process(const char* path); + +char* search(const char* filename) +{ + size_t filenamelen = strlen(filename); + + for ( searchpath* path = firstpath; path != NULL; path = path->next ) + { + size_t searchpathlen = strlen(path->path); + size_t filepathlen = searchpathlen + 1 + filenamelen; + char* filepath = new char[filepathlen + 1]; + strcpy(filepath, path->path); + strcpy(filepath + searchpathlen, "/"); + strcpy(filepath + searchpathlen + 1, filename); + + struct stat sts; + int statrs = stat(filepath, &sts); + if ( statrs < 0 && errno != ENOENT ) + { + fprintf(stderr, "error: could not stat file '%s': %s\n", filepath, strerror(errno)); return NULL; + } + + bool found = ( statrs != -1 ); + + if ( verbose ) + { + fprintf(stderr, "info: searching for '%s': %s\n", filepath, ( found ) ? "found" : "not found"); + } + + if ( found ) + { + return filepath; + } + + delete[] filepath; + } + + return NULL; +} + +bool include(const char* parameter) +{ + if ( parameter[0] == '\0' ) + { + fprintf(stderr, "error: @include expects a non-empty parameter\n"); + return false; + } + + if ( parameter[0] == '/' ) + { + return process(parameter); + } + + char* included = search(parameter); + + if ( included == NULL ) + { + fprintf(stderr, "error: could not find included file '%s'\n", parameter); + return false; + } + + bool result = process(included); + delete[] included; + + return result; +} + +bool expand(const char* command, const char* parameter) +{ + if ( strcmp(command, "@include") == 0 ) + { + return include(parameter); + } + else + { + fprintf(stderr, "error: unknown macro command %s\n", command); + return false; + } +} + +bool process(int fd) +{ + char construct[CONSTRUCT_SIZE+1]; + char buffer[BUFFER_SIZE]; + size_t constructed = 0; + int phase = 0; + + const char* command = NULL; + const char* parameter = NULL; + + bool quote = false; + bool backslash = false; + + while ( true ) + { + ssize_t numread = read(fd, buffer, BUFFER_SIZE); + if ( numread == 0 ) { break; } + if ( numread < 0 ) { perror("read"); return false; } + size_t writefrom = 0; + + for ( ssize_t i = 0; i < numread; i++ ) + { + if ( constructed == 0 ) + { + if ( buffer[i] == '\\' ) { backslash = !backslash; continue; } + if ( buffer[i] == '"' && !backslash ) { quote = !quote; } + if ( buffer[i] == '@' && !quote ) + { + if ( i - writefrom > 0 ) + { + if ( !writeall(outfd, buffer + writefrom, i - writefrom) ) { return false; } + } + construct[0] = '@'; constructed++; + } + backslash = false; + } + else + { + if ( phase == 0 ) + { + if ( ( ('a' <= buffer[i] && buffer[i] <= 'z' ) || + ('A' <= buffer[i] && buffer[i] <= 'Z' ) ) && + ( constructed < CONSTRUCT_SIZE) ) + { + construct[constructed] = buffer[i]; constructed++; + } + else if ( buffer[i] == '(' ) + { + construct[constructed] = '\0'; constructed++; + command = construct; + parameter = construct + constructed; + phase++; + continue; + } + else + { + construct[constructed] = '\0'; + fprintf(stderr, "error: expected '(' after '%s'\n", construct); + return false; + } + } + if ( phase == 1 ) + { + if ( buffer[i] == ')' ) + { + construct[constructed] = '\0'; + if ( !expand(command, parameter) ) { return false; } + phase = 0; + constructed = 0; + writefrom = i + 1; + } + else if ( buffer[i] != '\n' && buffer[i] != '\r' && constructed < CONSTRUCT_SIZE ) + { + construct[constructed] = buffer[i]; constructed++; + } + else + { + construct[constructed] = '\0'; + fprintf(stderr, "error: expected ')' after '%s'\n", parameter); + return false; + } + } + } + } + + if ( constructed == 0 && numread - writefrom > 0 ) + { + if ( !writeall(outfd, buffer + writefrom, numread - writefrom) ) { return false; } + } + } + + return true; +} + +bool process(const char* path) +{ + int fd; + if ( strcmp(path, "-") == 0 ) { fd = 0; } + else if ( (fd = open(path, O_RDONLY) ) < 0 ) + { + fprintf(stderr, "error: couldn't open file '%s'\n", path); return false; + } + + if ( verbose ) + { + fprintf(stderr, "info: including file '%s'\n", path); + } + + bool result = process(fd); + + if ( verbose ) + { + fprintf(stderr, "info: end of file '%s'\n", path); + } + + if ( close(fd) < 0 ) + { + perror("close"); return false; + } + + return result; +} + +int main(int argc, char* argv[]) +{ + const char* dest = NULL; + searchpath* lastpath = NULL; + inputfile* lastfile = NULL; + + for ( int i = 1; i < argc; i++ ) + { + if ( strcmp(argv[i], "-I") == 0 ) + { + if ( 2 <= argc - i ) + { + searchpath* path = new searchpath(); + path->path = argv[i+1]; + path->next = NULL; + if ( firstpath == NULL ) { firstpath = path; } else { lastpath->next = path; } + lastpath = path; + i++; + } + } + else if ( strcmp(argv[i], "-o") == 0 ) + { + if ( 2 <= argc - i ) + { + dest = argv[i+1]; + i++; + } + } + else if ( strcmp(argv[i], "-v") == 0 ) + { + verbose = true; + } + else if ( strcmp(argv[i], "-q") == 0 ) + { + verbose = false; + } + else if ( strcmp(argv[i], "--help") == 0 ) + { + usage(argc, argv); + return 0; + } + else if ( strcmp(argv[i], "--usage") == 0 ) + { + usage(argc, argv); + return 0; + } + else if ( strcmp(argv[i], "--version") == 0 ) + { + version(); + return 0; + } + else + { + inputfile* file = new inputfile(); + file->path = argv[i]; + file->next = NULL; + if ( firstfile == NULL ) { firstfile = file; } else { lastfile->next = file; } + lastfile = file; + } + } + + if ( dest == NULL || strcmp(dest, "-") == 0 ) { outfd = 1; } + else if ( (outfd = open(dest, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) ) < 0 ) + { + fprintf(stderr, "error: couldn't open file '%s'\n", dest); return 1; + } + + if ( firstpath == NULL ) + { + firstpath = new searchpath; + firstpath->path = "."; + firstpath->next = NULL; + lastpath = firstpath; + } + + if ( firstfile == NULL ) + { + firstfile = new inputfile; + firstfile->path = "-"; + firstfile->next = NULL; + lastfile = firstfile; + } + + inputfile* tmp = firstfile; + while ( tmp != NULL ) + { + if ( !process(tmp->path) ) { return 1; } + tmp = tmp->next; + } + + if ( close(outfd) < 0 ) + { + perror("close"); return 1; + } + + return 0; +} diff --git a/sortix/Makefile b/sortix/Makefile new file mode 100644 index 00000000..80a2fc59 --- /dev/null +++ b/sortix/Makefile @@ -0,0 +1,120 @@ +ifndef CPU + CPU=x86 +endif + +ifeq ($(CPU),x86) + X86FAMILY=1 + CPUDEFINES=-DPLATFORM_X86 + CPUFLAGS=-m32 + CPULDFLAGS=-melf_i386 + CPUASFLAGS=-32 + CPUNASMFLAGS=-felf32 + CPUOBJS=$(CPU)/boot.o $(CPU)/base.o $(CPU)/x86.o +endif + +ifeq ($(CPU),x64) + X86FAMILY=1 + CPUDEFINES=-DPLATFORM_X64 + CPUFLAGS=-m64 -ffreestanding -mcmodel=large -mno-red-zone + CPULDFLAGS=-melf64-little -z max-page-size=0x1000 + CPUASFLAGS=-64 + CPUNASMFLAGS=-felf64 + CPUOBJS=$(CPU)/base.o $(CPU)/x64.o +endif + +ifdef X86FAMILY + CPUOBJS:=$(CPUOBJS) \ + $(CPU)/memorymanagement-asm.o \ + $(CPU)/interrupt.o \ + $(CPU)/gdt.o + CPUFLAGS:=$(CPUFLAGS) -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow +endif + +DIRS=. x64 x86 + +DEFINES:=-DSORTIX_KERNEL $(CPUDEFINES) +DEFINES:=$(DEFINES) -DPLATFORM_VIRTUAL_MEMORY +DEFINES:=$(DEFINES) -DPLATFORM_KERNEL_HEAP +#DEFINES:=$(DEFINES) -DPLATFORM_SERIAL +#DEFINES:=$(DEFINES) -DPLATFORM_HTP +#DEFINES:=$(DEFINES) -DCONWAY +#DEFINES:=$(DEFINES) -DPONG +DEFINES:=$(DEFINES) -DINITRD +CPPFLAGSRELEASE=-s -O3 +CPPFLAGSDEBUG= +CPPFLAGS=-I.. $(CPUDEFINES) $(CPUFLAGS) -std=gnu++0x -Wall -Wextra -nostdlib -fno-builtin -nostartfiles -nodefaultlibs -fno-exceptions -fno-rtti -fno-stack-protector $(DEFINES) $(CPPFLAGSRELEASE) +OBJS=$(CPUOBJS) kernel.o descriptor_tables.o isr.o time.o log.o iprintable.o panic.o keyboard.o memorymanagement.o scheduler.o syscall.o application.o pong.o sound.o pci.o uart.o conway.o test.o http.o vgaterminal.o serialterminal.o ../libmaxsi/libmaxsi-sortix.a +JSOBJS:=$(subst .o,-js.o,$(OBJS)) + +all: sortix.bin + +# jssortix compilation + +jssortix: jssortix.bin + +jssortix.bin: $(JSOBJS) + ld -melf_i386 -Ttext 100000 -o jssortix.out $(JSOBJS) + objcopy -O binary jssortix.out jssortix.bin + +# x64 compilation +x64/boot.o: x64/boot.s + as -32 $< -o $@ + +sortix-x64.tmp: $(OBJS) x64/boot.o + ld -N -melf_x86_64 -Ttext 110000 -o sortix-x64-internal.out $(OBJS) + objcopy -O binary sortix-x64-internal.out sortix-x64-internal.tmp + objcopy --add-section kernel64=sortix-x64-internal.tmp \ + --set-section-flag kernel64=alloc,data,load,contents \ + $(CPU)/boot.o + ld -melf_i386 -Ttext 100000 $(CPU)/boot.o -o $@ + # move section to 0x11000 + objcopy --change-section-address kernel64=1114112 $@ + +# x86 compilation + +sortix-x86.tmp: $(OBJS) + ld -melf_i386 -Ttext 100000 -o $@ $(OBJS) + +# general rules + +sortix.bin: sortix-$(CPU).tmp + cp -vu $< $@ + +%.o: %.cpp + g++ -c $< -o $@ $(CPPFLAGS) + +%.o: %.s + as $(CPUASFLAGS) $< -o $@ + +%.o: %.asm + nasm $(CPUNASMFLAGS) $< -o $@ + +%-js.o: %.cpp + g++ -c $< -o $@ $(CPPFLAGS) -DJSSORTIX + +%-js.o: %.s + as $(CPUASFLAGS) $< -o $@ + +%-js.o: %.asm + nasm $(CPUNASMFLAGS) $< -o $@ + +clean: + for D in $(DIRS); do rm -fv $$D/*.o $$D/*.bin $$D/*.out $$D/*.tmp; done + +# Local machine + +install: sortix.bin + cp sortix.bin /boot + +uninstall: + rm -f /boot/sortix.bin + +# Remote machine + +install-remote: sortix.bin + scp -r ./ 192.168.2.6:/home/sortie/Desktop/sortix + scp sortix.bin root@192.168.2.6:/boot + ssh root@192.168.2.6 "init 6" + +uninstall-remote: + ssh root@192.168.2.6 "rm /boot/sortix.bin" diff --git a/sortix/application.cpp b/sortix/application.cpp new file mode 100644 index 00000000..8bb890c0 --- /dev/null +++ b/sortix/application.cpp @@ -0,0 +1,63 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + application.cpp + A test application for the scheduler and libmaxsi. + +******************************************************************************/ + +#include +#include +#include + +using namespace Maxsi; + +void* TestThread(void* Parameter) +{ + for ( size_t I = 0; I < 64; I++ ) + { + StdOut::Print("."); + Thread::USleep(20*1000); // Sleep 100 * 1000 microseconds = 100 ms. + } + + StdOut::Print("\n"); + + return NULL; +} + +// The entry point in this sample program for sortix. +void* RunApplication(void* Parameter) +{ + StdOut::Print("Hello, says the thread!\n"); + + const char* Message = "Oooh! And message passing works!\n"; + + while ( true ) + { + StdOut::Print("Created Thread: "); + if ( Thread::Create(TestThread, Message) == 0 ) + { + StdOut::Print("ERROR: Could not create child thread\n"); + } + Thread::USleep(1300 * 1000); // Sleep 2 seconds. + } + + return NULL; +} + diff --git a/sortix/astroids.cpp b/sortix/astroids.cpp new file mode 100644 index 00000000..9d2fd857 --- /dev/null +++ b/sortix/astroids.cpp @@ -0,0 +1,143 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + astroids.cpp + IN SPACE, NO ONE CAN HEAR YOU find ~ | xargs shred + +******************************************************************************/ + +#include "platform.h" +#include +#include "globals.h" +#include "iirqhandler.h" +#include "iprintable.h" +#include "keyboard.h" +#include "timer.h" +#include "log.h" +#include "astroids.h" + +using namespace Maxsi; + +namespace Sortix +{ + DEFINE_GLOBAL_OBJECT(Astroids, Astroids); + + const int Height = 25; + const int Width = 80; + + void Astroids::Init() + { + Time = 0; + + Reset(); + Update(); + + GKeyboard->SetReader(this); + GTimer->SetTimerable(this); + } + + void Astroids::ClearScreen() + { + uint16_t* Destination = (uint16_t*) 0xB8000; + + // Copy and apply colors. + for ( int Y = 0; Y < Height; Y++ ) + { + uint16_t Color = COLOR8_BLACK << 8; + + for ( int X = 0; X < Width; X++ ) + { + Destination[X + Y*Width] = ' ' | Color; + } + } + } + + void Astroids::Reset() + { + ClearScreen(); + PX = Width/2; + PY = Height/2; + PVX = 0; + PVY = 0; + TrailX = PX; + TrailY = PY; + TrailLen = 0; + TrailMaxLen = 15; + } + + void Astroids::Update() + { + uint16_t* Destination = (uint16_t*) 0xB8000; + + PX += PVX; PX = ((nat) PX) % ((nat) Width); + PY += PVY; PY = ((nat) PY) % ((nat) Height); + + uint16_t Prev = 0; + if ( !(PVX == 0 && PVY == 0) && Destination[PX + PY*Width] > 0 ) { Reset(); } + + if ( !(PVX == 0 && PVY == 0) ) + { + if ( PVX < 0 ) { Prev = 0; } + if ( PVX > 0 ) { Prev = 1; } + if ( PVY < 0 ) { Prev = 2; } + if ( PVY > 0 ) { Prev = 3; } + + if ( TrailMaxLen <= TrailLen ) + { + uint16_t AtTrail = Destination[TrailX + TrailY*Width]; + Destination[TrailX + TrailY*Width] = ' ' | (COLOR8_BLACK << 8); + if ( (AtTrail & 0x4) == 0 ) { TrailX--; } else + if ( (AtTrail & 0x4) == 1 ) { TrailX++; } else + if ( (AtTrail & 0x4) == 2 ) { TrailY--; } else + if ( (AtTrail & 0x4) == 3 ) { TrailY++; } + } + else { TrailLen++; } + } + Destination[PX + PY*Width] = (COLOR8_GREEN << 12) | Prev; + + NextUpdate = Time + 75; + } + + void Astroids::OnKeystroke(uint32_t CodePoint, bool KeyUp) + { + const uint32_t UP = 0xFFFFFFFF - 20; + const uint32_t LEFT = 0xFFFFFFFF - 21; + const uint32_t RIGHT = 0xFFFFFFFF - 22; + const uint32_t DOWN = 0xFFFFFFFF - 23; + + if ( CodePoint == '\n' && !KeyUp ) + { + ClearScreen(); + Reset(); + Update(); + } + + if ( !(PVX == 0 && PVY == 1) && (CodePoint == 'w' || CodePoint == 'W') && !KeyUp ) { PVY = -1; PVX = 0; } + if ( !(PVX == 1 && PVY == 0) && (CodePoint == 'a' || CodePoint == 'A') && !KeyUp ) { PVY = 0; PVX = -1; } + if ( !(PVX == 0 && PVY == -1) && (CodePoint == 's' || CodePoint == 'S') && !KeyUp ) { PVY = 1; PVX = 0; } + if ( !(PVX == -1 && PVY == 0) && (CodePoint == 'd' || CodePoint == 'D') && !KeyUp ) { PVY = 0; PVX = 1; } + } + + void Astroids::OnFuture(uint32_t Miliseconds) + { + Time += Miliseconds; + + if ( NextUpdate <= Time ) { Update(); } + } +} diff --git a/sortix/astroids.h b/sortix/astroids.h new file mode 100644 index 00000000..cae8167a --- /dev/null +++ b/sortix/astroids.h @@ -0,0 +1,64 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + astroids.h + IN SPACE, NO ONE CAN HEAR YOU find ~ | xargs shred + +******************************************************************************/ + +#ifndef SORTIX_ASTROIDS_H +#define SORTIX_ASTROIDS_H + +namespace Sortix +{ + class Astroids : public IKeystrokable, public ITimerable + { + private: + nat Time; + nat NextUpdate; + + private: + int PX; + int PY; + int TrailX; + int TrailY; + int TrailLen; + int TrailMaxLen; + int PVX; + int PVY; + + public: + void Init(); + + private: + void ClearScreen(); + void Reset(); + void Update(); + + public: + virtual void OnKeystroke(uint32_t CodePoint, bool KeyUp); + virtual void OnFuture(uint32_t Miliseconds); + + }; + + DECLARE_GLOBAL_OBJECT(Astroids, Astroids); +} + +#endif + diff --git a/sortix/bits.h b/sortix/bits.h new file mode 100644 index 00000000..7a5a2e55 --- /dev/null +++ b/sortix/bits.h @@ -0,0 +1,32 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + types.h + Declares the required datatypes for the x86 architecture. + +******************************************************************************/ + +#ifdef PLATFORM_X86 +#include "x86/bits.h" +#endif + +#ifdef PLATFORM_X64 +#include "x64/bits.h" +#endif + diff --git a/sortix/conway.cpp b/sortix/conway.cpp new file mode 100644 index 00000000..bdded776 --- /dev/null +++ b/sortix/conway.cpp @@ -0,0 +1,194 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + conway.cpp + THE GAME! You lost it. OF LIFE! + +******************************************************************************/ + +#include "platform.h" + +#include "globals.h" +#include "iprintable.h" +#include "log.h" +#include "vga.h" + +#ifdef PLATFORM_SERIAL +#include "uart.h" +#endif + +namespace Sortix +{ + namespace Conway + { + const int Height = 25; + const int Width = 80; + const int RowStride = Width + 2; + const int BufferSize = (Height+2) * (Width+2); + +#ifdef PLATFORM_SERIAL + VGA::Frame FrameData; + VGA::Frame* Frame = &FrameData; +#else + VGA::Frame* Frame = (VGA::Frame*) 0xB8000; +#endif + + char FrameA[BufferSize]; + char FrameB[BufferSize]; + char* CurrentFrame; + char* LastFrame; + bool Running; + int PosX; + int PosY; + int TimeToNextFrame; + int Time; + + void Clear() + { + for ( int I = 0; I < BufferSize; I++ ) { FrameA[I] = 0; FrameB[I] = 0; } + } + + void Init() + { + CurrentFrame = FrameA; + LastFrame = FrameB; + + Running = false; + + PosY = Height / 2 + 1; + PosX = Width / 2 + 1; + Time = 0; + + Clear(); + } + + void Cycle() + { + for ( int Y = 1; Y <= Height; Y++ ) + { + for ( int X = 1; X <= Width; X++ ) + { + int AliveAround = 0; + int Current = LastFrame[Y * RowStride + X]; + + if ( LastFrame[(Y-1) * RowStride + (X-1)] > 0 ) { AliveAround++; } + if ( LastFrame[(Y-1) * RowStride + (X-0)] > 0 ) { AliveAround++; } + if ( LastFrame[(Y-1) * RowStride + (X+1)] > 0 ) { AliveAround++; } + if ( LastFrame[(Y-0) * RowStride + (X-1)] > 0 ) { AliveAround++; } + if ( LastFrame[(Y-0) * RowStride + (X+1)] > 0 ) { AliveAround++; } + if ( LastFrame[(Y+1) * RowStride + (X-1)] > 0 ) { AliveAround++; } + if ( LastFrame[(Y+1) * RowStride + (X-0)] > 0 ) { AliveAround++; } + if ( LastFrame[(Y+1) * RowStride + (X+1)] > 0 ) { AliveAround++; } + + CurrentFrame[Y * RowStride + X] = ( (Current > 0 && (AliveAround == 3 || AliveAround == 2)) || (Current == 0 && AliveAround == 3) ) ? 1 : 0; + } + } + + // Swap buffers. + char* TMP = LastFrame; LastFrame = CurrentFrame; CurrentFrame = TMP; + } + + void Render() + { + uint16_t* Destination = Frame->Data; + + uint16_t Set = 'O' | (COLOR8_LIGHT_GREY << 8); + uint16_t Unset = ' ' | (COLOR8_LIGHT_GREY << 8); + + for ( int Y = 1; Y <= Height; Y++ ) + { + for ( int X = 1; X <= Width; X++ ) + { + Destination[(Y-1) * Width + (X-1)] = (LastFrame[Y * RowStride + X] > 0) ? Set : Unset; + } + } + + // Render the cursor. + if ( !Running ) + { + Destination[(PosY-1) * Width + (PosX-1)] |= (COLOR8_RED << 12); + } + +#ifdef PLATFORM_SERIAL + UART::RenderVGA(Frame); +#endif + } + + void Update(int TimePassed) + { +#ifdef PLATFORM_SERIAL + while ( true ) + { + int C = UART::TryPopChar(); + + if ( C == 'r' || C == 'R' ) { TimeToNextFrame = 0; Running = !Running; } + + if ( !Running ) + { + if ( C == 'w' || C == 'W' ) { if ( PosY > 1 ) { PosY--; } } + if ( C == 's' || C == 'S' ) { if ( PosY < Height ) { PosY++; } } + if ( C == 'a' || C == 'A' ) { if ( PosX > 1 ) { PosX--; } } + if ( C == 'd' || C == 'D' ) { if ( PosX < Width ) { PosX++; } } + if ( C == 'c' || C == 'C' ) { Clear(); } + if ( C == ' ' ) { LastFrame[PosY * RowStride + PosX] = 1 - LastFrame[PosY * RowStride + PosX]; } + } + + if ( C == -1 ) { break; } + } +#endif + + if ( Running ) + { + if ( TimeToNextFrame <= TimePassed ) + { + Cycle(); + TimeToNextFrame = 50; + } + else + { + TimeToNextFrame -= TimePassed; + } + } + + Render(); + } + + void OnFuture() + { + const int TimePassed = 10; + + Time += TimePassed; + + +#ifdef PLATFORM_SERIAL + +#ifdef JSSORIX + const nat WaitTime = 2000; +#else + const nat WaitTime = 3500; +#endif + + // Artificially display the boot welcome screen. + if ( Time < WaitTime ) { return; } +#endif + + Update(TimePassed); + } + } +} diff --git a/sortix/conway.h b/sortix/conway.h new file mode 100644 index 00000000..46913b1e --- /dev/null +++ b/sortix/conway.h @@ -0,0 +1,41 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + conway.h + THE GAME! You lost it. OF LIFE! + +******************************************************************************/ + +#ifndef SORTIX_CONWAY_H +#define SORTIX_CONWAY_H + +namespace Sortix +{ + namespace Conway + { + void Init(); + void Cycle(); + void Render(); + void Update(int TimePassed); + void OnFuture(); + } +} + +#endif + diff --git a/sortix/descriptor_tables.cpp b/sortix/descriptor_tables.cpp new file mode 100644 index 00000000..1662751a --- /dev/null +++ b/sortix/descriptor_tables.cpp @@ -0,0 +1,210 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + descriptor_tables.cpp + Initializes and handles the GDT, TSS and IDT. + +******************************************************************************/ + +#include "platform.h" +#include "iirqhandler.h" +#include +#include "descriptor_tables.h" +#include "isr.h" +#include "panic.h" + +using namespace Maxsi; + +namespace Sortix +{ + namespace GDT + { + // Lets us access our ASM functions from our C++ code. + extern "C" void gdt_flush(addr_t); + extern "C" void tss_flush(); + + gdt_entry_t gdt_entries[6]; + gdt_ptr_t gdt_ptr; + tss_entry_t tss_entry; + + void Init() + { + gdt_ptr.limit = (sizeof(gdt_entry_t) * 6) - 1; + gdt_ptr.base = (addr_t) &gdt_entries; + + SetGate(0, 0, 0, 0, 0); // Null segment + SetGate(1, 0, 0xFFFFFFFF, 0x9A, 0xCF); // Code segment + SetGate(2, 0, 0xFFFFFFFF, 0x92, 0xCF); // Data segment + SetGate(3, 0, 0xFFFFFFFF, 0xFA, 0xCF); // User mode code segment + SetGate(4, 0, 0xFFFFFFFF, 0xF2, 0xCF); // User mode data segment + WriteTSS(5, 0x10, 0x0); + + gdt_flush((addr_t) &gdt_ptr); + tss_flush(); + } + + // Set the value of a GDT entry. + void SetGate(int32_t num, uint32_t base, uint32_t limit, uint8_t access, uint8_t gran) + { + gdt_entries[num].base_low = (base & 0xFFFF); + gdt_entries[num].base_middle = (base >> 16) & 0xFF; + gdt_entries[num].base_high = (base >> 24) & 0xFF; + + gdt_entries[num].limit_low = (limit & 0xFFFF); + gdt_entries[num].granularity = (limit >> 16) & 0x0F; + + gdt_entries[num].granularity |= gran & 0xF0; + gdt_entries[num].access = access; + } + + // Initialise our task state segment structure. + void WriteTSS(int32_t num, uint16_t ss0, uint32_t esp0) + { + // Firstly, let's compute the base and limit of our entry into the GDT. + addr_t base = (addr_t) &tss_entry; + uint32_t limit = base + sizeof(tss_entry); + + // Now, add our TSS descriptor's address to the GDT. + SetGate(num, base, limit, 0xE9, 0x00); + + // Ensure the descriptor is initially zero. + Memory::Set(&tss_entry, 0, sizeof(tss_entry)); + + tss_entry.ss0 = ss0; // Set the kernel stack segment. + tss_entry.esp0 = esp0; // Set the kernel stack pointer. + + // Here we set the cs, ss, ds, es, fs and gs entries in the TSS. These specify what + // segments should be loaded when the processor switches to kernel mode. Therefore + // they are just our normal kernel code/data segments - 0x08 and 0x10 respectively, + // but with the last two bits set, making 0x0b and 0x13. The setting of these bits + // sets the RPL (requested privilege level) to 3, meaning that this TSS can be used + // to switch to kernel mode from ring 3. + tss_entry.cs = 0x08 | 0x3; + tss_entry.ss = tss_entry.ds = tss_entry.es = tss_entry.fs = tss_entry.gs = 0x10 | 0x3; + } + + void SetKernelStack(size_t* stack) + { +#ifdef PLATFORM_X86 + tss_entry.esp0 = (uint32_t) stack; +#else + #warning "TSS is not yet supported on this arch!" + while(true); +#endif + } + } + + namespace IDT + { + // Lets us access our ASM functions from our C++ code. + extern "C" void idt_flush(uint32_t); + + idt_entry_t idt_entries[256]; + idt_ptr_t idt_ptr; + + void Init() + { +#ifdef PLATFORM_X86 + idt_ptr.limit = sizeof(idt_entry_t) * 256 - 1; + idt_ptr.base = (uint32_t)&idt_entries; + + Memory::Set(&idt_entries, 0, sizeof(idt_entry_t)*256); + + // Remap the irq table. + X86::OutPortB(0x20, 0x11); + X86::OutPortB(0xA0, 0x11); + X86::OutPortB(0x21, 0x20); + X86::OutPortB(0xA1, 0x28); + X86::OutPortB(0x21, 0x04); + X86::OutPortB(0xA1, 0x02); + X86::OutPortB(0x21, 0x01); + X86::OutPortB(0xA1, 0x01); + X86::OutPortB(0x21, 0x0); + X86::OutPortB(0xA1, 0x0); + + SetGate( 0, (uint32_t) isr0 , 0x08, 0x8E); + SetGate( 1, (uint32_t) isr1 , 0x08, 0x8E); + SetGate( 2, (uint32_t) isr2 , 0x08, 0x8E); + SetGate( 3, (uint32_t) isr3 , 0x08, 0x8E); + SetGate( 4, (uint32_t) isr4 , 0x08, 0x8E); + SetGate( 5, (uint32_t) isr5 , 0x08, 0x8E); + SetGate( 6, (uint32_t) isr6 , 0x08, 0x8E); + SetGate( 7, (uint32_t) isr7 , 0x08, 0x8E); + SetGate( 8, (uint32_t) isr8 , 0x08, 0x8E); + SetGate( 9, (uint32_t) isr9 , 0x08, 0x8E); + SetGate(10, (uint32_t) isr10, 0x08, 0x8E); + SetGate(11, (uint32_t) isr11, 0x08, 0x8E); + SetGate(12, (uint32_t) isr12, 0x08, 0x8E); + SetGate(13, (uint32_t) isr13, 0x08, 0x8E); + SetGate(14, (uint32_t) isr14, 0x08, 0x8E); + SetGate(15, (uint32_t) isr15, 0x08, 0x8E); + SetGate(16, (uint32_t) isr16, 0x08, 0x8E); + SetGate(17, (uint32_t) isr17, 0x08, 0x8E); + SetGate(18, (uint32_t) isr18, 0x08, 0x8E); + SetGate(19, (uint32_t) isr19, 0x08, 0x8E); + SetGate(20, (uint32_t) isr20, 0x08, 0x8E); + SetGate(21, (uint32_t) isr21, 0x08, 0x8E); + SetGate(22, (uint32_t) isr22, 0x08, 0x8E); + SetGate(23, (uint32_t) isr23, 0x08, 0x8E); + SetGate(24, (uint32_t) isr24, 0x08, 0x8E); + SetGate(25, (uint32_t) isr25, 0x08, 0x8E); + SetGate(26, (uint32_t) isr26, 0x08, 0x8E); + SetGate(27, (uint32_t) isr27, 0x08, 0x8E); + SetGate(28, (uint32_t) isr28, 0x08, 0x8E); + SetGate(29, (uint32_t) isr29, 0x08, 0x8E); + SetGate(30, (uint32_t) isr30, 0x08, 0x8E); + SetGate(31, (uint32_t) isr31, 0x08, 0x8E); + SetGate(32, (uint32_t) irq0, 0x08, 0x8E); + SetGate(33, (uint32_t) irq1, 0x08, 0x8E); + SetGate(34, (uint32_t) irq2, 0x08, 0x8E); + SetGate(35, (uint32_t) irq3, 0x08, 0x8E); + SetGate(36, (uint32_t) irq4, 0x08, 0x8E); + SetGate(37, (uint32_t) irq5, 0x08, 0x8E); + SetGate(38, (uint32_t) irq6, 0x08, 0x8E); + SetGate(39, (uint32_t) irq7, 0x08, 0x8E); + SetGate(40, (uint32_t) irq8, 0x08, 0x8E); + SetGate(41, (uint32_t) irq9, 0x08, 0x8E); + SetGate(42, (uint32_t) irq10, 0x08, 0x8E); + SetGate(43, (uint32_t) irq11, 0x08, 0x8E); + SetGate(44, (uint32_t) irq12, 0x08, 0x8E); + SetGate(45, (uint32_t) irq13, 0x08, 0x8E); + SetGate(46, (uint32_t) irq14, 0x08, 0x8E); + SetGate(47, (uint32_t) irq15, 0x08, 0x8E); + SetGate(128, (uint32_t) isr128, 0x08, 0x8E); // System Calls + SetGate(177, (uint32_t) isr177, 0x08, 0x8E); // System Calls + + idt_flush((uint32_t)&idt_ptr); +#else + #warning "IDT is not yet supported on this arch!" + while(true); +#endif + } + + void SetGate(uint8_t num, uint32_t base, uint16_t sel, uint8_t flags) + { + idt_entries[num].base_lo = base & 0xFFFF; + idt_entries[num].base_hi = (base >> 16) & 0xFFFF; + + idt_entries[num].sel = sel; + idt_entries[num].always0 = 0; + idt_entries[num].flags = flags | 0x60; + } + } +} + diff --git a/sortix/descriptor_tables.h b/sortix/descriptor_tables.h new file mode 100644 index 00000000..fc99d5cb --- /dev/null +++ b/sortix/descriptor_tables.h @@ -0,0 +1,181 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + descriptor_tables.cpp + Initializes and handles the GDT, TSS and IDT. + +******************************************************************************/ + +#ifndef SORTIX_DESCRIPTOR_TABLES_H +#define SORTIX_DESCRIPTOR_TABLES_H + +namespace Sortix +{ + namespace GDT + { + // This structure contains the value of one GDT entry. + // We use the attribute 'packed' to tell GCC not to change + // any of the alignment in the structure. + struct gdt_entry_struct + { + uint16_t limit_low; // The lower 16 bits of the limit. + uint16_t base_low; // The lower 16 bits of the base. + uint8_t base_middle; // The next 8 bits of the base. + uint8_t access; // Access flags, determine what ring this segment can be used in. + uint8_t granularity; + uint8_t base_high; // The last 8 bits of the base. + } __attribute__((packed)); + + typedef struct gdt_entry_struct gdt_entry_t; + + // This struct describes a GDT pointer. It points to the start of + // our array of GDT entries, and is in the format required by the + // lgdt instruction. + struct gdt_ptr_struct + { + uint16_t limit; // The upper 16 bits of all selector limits. + addr_t base; // The address of the first gdt_entry_t struct. + } __attribute__((packed)); + + typedef struct gdt_ptr_struct gdt_ptr_t; + + // A struct describing a Task State Segment. + struct tss_entry_struct + { + uint32_t prev_tss; // The previous TSS - if we used hardware task switching this would form a linked list. + uint32_t esp0; // The stack pointer to load when we change to kernel mode. + uint32_t ss0; // The stack segment to load when we change to kernel mode. + uint32_t esp1; // Unused... + uint32_t ss1; + uint32_t esp2; + uint32_t ss2; + uint32_t cr3; + uint32_t eip; + uint32_t eflags; + uint32_t eax; + uint32_t ecx; + uint32_t edx; + uint32_t ebx; + uint32_t esp; + uint32_t ebp; + uint32_t esi; + uint32_t edi; + uint32_t es; // The value to load into ES when we change to kernel mode. + uint32_t cs; // The value to load into CS when we change to kernel mode. + uint32_t ss; // The value to load into SS when we change to kernel mode. + uint32_t ds; // The value to load into DS when we change to kernel mode. + uint32_t fs; // The value to load into FS when we change to kernel mode. + uint32_t gs; // The value to load into GS when we change to kernel mode. + uint32_t ldt; // Unused... + uint16_t trap; + uint16_t iomap_base; + } __attribute__((packed)); + + typedef struct tss_entry_struct tss_entry_t; + + void Init(); + void SetGate(int32_t num, uint32_t base, uint32_t limit, uint8_t access, uint8_t gran); + void WriteTSS(int32_t num, uint16_t ss0, uint32_t esp0); + void SetKernelStack(size_t* stack); + } + + namespace IDT + { + + // A struct describing an interrupt gate. + struct idt_entry_struct + { + uint16_t base_lo; // The lower 16 bits of the address to jump to when this interrupt fires. + uint16_t sel; // Kernel segment selector. + uint8_t always0; // This must always be zero. + uint8_t flags; // More flags. See documentation. + uint16_t base_hi; // The upper 16 bits of the address to jump to. + } __attribute__((packed)); + + typedef struct idt_entry_struct idt_entry_t; + + // A struct describing a pointer to an array of interrupt handlers. + // This is in a format suitable for giving to 'lidt'. + struct idt_ptr_struct + { + uint16_t limit; + addr_t base; // The address of the first element in our idt_entry_t array. + } __attribute__((packed)); + + typedef struct idt_ptr_struct idt_ptr_t; + + void Init(); + void SetGate(uint8_t num, uint32_t base, uint16_t sel, uint8_t flags); + } +} + +// These extern directives let us access the addresses of our ASM ISR handlers. +extern "C" void isr0 (); +extern "C" void isr1 (); +extern "C" void isr2 (); +extern "C" void isr3 (); +extern "C" void isr4 (); +extern "C" void isr5 (); +extern "C" void isr6 (); +extern "C" void isr7 (); +extern "C" void isr8 (); +extern "C" void isr9 (); +extern "C" void isr10(); +extern "C" void isr11(); +extern "C" void isr12(); +extern "C" void isr13(); +extern "C" void isr14(); +extern "C" void isr15(); +extern "C" void isr16(); +extern "C" void isr17(); +extern "C" void isr18(); +extern "C" void isr19(); +extern "C" void isr20(); +extern "C" void isr21(); +extern "C" void isr22(); +extern "C" void isr23(); +extern "C" void isr24(); +extern "C" void isr25(); +extern "C" void isr26(); +extern "C" void isr27(); +extern "C" void isr28(); +extern "C" void isr29(); +extern "C" void isr30(); +extern "C" void isr31(); +extern "C" void isr128(); +extern "C" void isr177(); +extern "C" void irq0 (); +extern "C" void irq1 (); +extern "C" void irq2 (); +extern "C" void irq3 (); +extern "C" void irq4 (); +extern "C" void irq5 (); +extern "C" void irq6 (); +extern "C" void irq7 (); +extern "C" void irq8 (); +extern "C" void irq9 (); +extern "C" void irq10(); +extern "C" void irq11(); +extern "C" void irq12(); +extern "C" void irq13(); +extern "C" void irq14(); +extern "C" void irq15(); + +#endif + diff --git a/sortix/descriptors.h b/sortix/descriptors.h new file mode 100644 index 00000000..ef370f17 --- /dev/null +++ b/sortix/descriptors.h @@ -0,0 +1,64 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + descriptors.h + Handles file descriptors, socket descriptors, and whatnot for each process. + +******************************************************************************/ + +#ifndef SORTIX_DESCRIPTORS_H +#define SORTIX_DESCRIPTORS_H + +namespace Sortix +{ + class Device; + + struct Description + { + nat type; + Device* object; + }; + + class DescriptorTable + { + public: + DescriptorTable(); + ~DescriptorTable(); + + private: + int _numDescs + Description* _descs; + + public: + int Reserve(); + void UseReservation(int index, Device* object); + int Allocate(Device* object; + bool Free(int index); + + public: + inline Description* get(int index) + { + if ( _numDescs <= index ) { return NULL; } + return _descs + index; + } + }; +} + +#endif + diff --git a/sortix/device.cpp b/sortix/device.cpp new file mode 100644 index 00000000..b535db13 --- /dev/null +++ b/sortix/device.cpp @@ -0,0 +1,56 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + device.cpp + A base class for all devices. + +******************************************************************************/ + +#include "platform.h" +#include "device.h" + +namespace Sortix +{ + void Device::close() + { + _refCount--; + if ( _refCount == 0 ) + { + delete this; + } + } + + void Device::Think() + { + + } + + void Device::RequestThink() + { + Think(); + } + + bool Device::Sync() + { + return true; + } +} + +#endif + diff --git a/sortix/device.h b/sortix/device.h new file mode 100644 index 00000000..091dad2c --- /dev/null +++ b/sortix/device.h @@ -0,0 +1,89 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + device.h + A base class for all devices. + +******************************************************************************/ + +#ifndef SORTIX_DEVICE_H +#define SORTIX_DEVICE_H + +namespace Sortix +{ + class User; + + class Device + { + public: + // Flags + const nat READABLE = (1<<0); + const nat WRITABLE = (1<<1); + const nat SEEKABLE = (1<<2); + const nat SIZEABLE = (1<<3); + const nat BLOCK = (1<<4); + const nat FLAGMASK = ((1<<5)-1); + + // Types + const nat TYPEMASK = ~FLAGMASK; + const nat STREAM = (1<<5); + const nat BUFFER = (2<<5); + const nat DIRECTORY = (3<<5); + const nat FILESYSTEM = (4<<5); + const nat NETWORK = (5<<5); + const nat SOUND = (6<<5); + const nat GRAPHICS = (7<<5); + const nat MOUSE = (8<<5); + const nat KEYBOARD = (9<<5); + const nat PRINTER = (10<<5); + const nat SCANNER = (11<<5); + const nat OTHER = TYPEMASK; + + public: + volatile size_t _refCount; + + public: + Device() { RefCount = 1; } + virtual ~Device() { } + + private: + User* _owner; + + public: + bool IsOwner(User* candidate) { return candidate == _owner; } + + public: + bool Close(); + void RequestThink(); + + protected: + virtual void Think(); + + public: + virtual bool Sync(); + virtual nat Flags() = 0; + + public: + bool IsType(nat type) { return Flags() & TYPEMASK == type); } + + }; +} + +#endif + diff --git a/sortix/filesystem.cpp b/sortix/filesystem.cpp new file mode 100644 index 00000000..d19ab7dd --- /dev/null +++ b/sortix/filesystem.cpp @@ -0,0 +1,80 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + filesystem.cpp + Abstracts away a file system device. + +******************************************************************************/ + +#include "device.h" +#include "thread.h" +#include "process.h" +#include "filesystem.h" + +namespace Sortix +{ + bool DevFileSystem::LegalNodeName(const char* name) + { + if ( *name == '\0' ) { return false; } + while ( *name != '\0' ) + { + if ( *name == '/' ) { return false; } + } + return true; + } + + bool DevFileSystem::Open(const char* path, nat openFlags, nat mode, Mount::SysCallback* callbackInfo, Thread* thread) + { +#if 0 + nat requestMode = flags & O_LOWERFLAGS; + + MXFSNode* node; + + if ( flags & O_CREAT ) + { + if ( flags & O_DIRECTORY ) { return CreateDirectory(path, flags, permissions, type); } + else { return CreateFile(path, flags, permissions, type); } + } + else + { + node = Search(path); + } + + if ( node == NULL ) { return NULL; } + + if ( node->IsDir() ) + { + if ( requestMode == O_SEARCH || requestMode == O_RDONLY ) + { + // TODO: Make a directory device. + Error::Set(Error::NOTIMPLEMENTED); + return NULL; + } + else + { + Error::Set(Error::ISDIR); + return NULL; + } + } + + if ( +#endif + } +} + diff --git a/sortix/filesystem.h b/sortix/filesystem.h new file mode 100644 index 00000000..592d394a --- /dev/null +++ b/sortix/filesystem.h @@ -0,0 +1,98 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + filesystem.h + Abstracts away a file system device. + +******************************************************************************/ + +#ifndef SORTIX_FILESYSTEM_H +#define SORTIX_FILESYSTEM_H + +#include "device.h" +#include "mount.h" + +namespace Sortix +{ + class Thread; + + namespace FileSystem + { + struct SysCallback + { + Device* device; + union { int deviceError; nat deviceType; } + } + } + + // TODO: These belong in libmaxsi! + + const nat O_RDONLY = 1; + const nat O_WRONLY = 2; + const nat O_RDWR = 3; + const nat O_EXEC = 4; + const nat O_SEARCH = 5; + const nat O_LOWERFLAGS = 0x7; + + // TODO: Sortix might never support all of these flags if they are stupid. + const nat O_APPEND = (1<<3); + const nat O_CLOEXEC = (1<<4); + const nat O_CREAT = (1<<5); + const nat O_DIRECTORY = (1<<6); + const nat O_DSYNC = (1<<6); + const nat O_EXCL = (1<<7); + const nat O_NOCTTY = (1<<8); + const nat O_NOFOLLOW = (1<<9); + const nat O_RSYNC = (1<<11); + const nat O_SYNC = (1<<12); + const nat O_TRUNC = (1<<13); + const nat O_TTY_INIT = (1<<13); + + // If O_RDONLY, then no one is allowed to write to this, or if O_RDWD then + // no one else is allowed to use this besides me. + const nat O_EXCLUSIVELY = (1<<14); + const nat O_USERSPACEABLE = ((1<<15)-1); + + const nat O_MOUNT = (1<<31); + + class DevFileSystem : public Device + { + public: + DevFileSystem() { }; + virtual ~DevFileSystem() { } + + public: + bool LegalNodeName(const char* name); + + public: + virtual int Initialize(MountPoint* mountPoint, const char* commandLine) = 0; + + public: + virtual bool Open(const char* path, nat openFlags, nat mode, FileSystem::SysCallback* callbackInfo, Thread* thread); + + }; + + namespace FileSystem + { + DevFileSystem* CreateDriver(const char* fsType); + } +} + +#endif + diff --git a/sortix/globals.h b/sortix/globals.h new file mode 100644 index 00000000..4e961cf3 --- /dev/null +++ b/sortix/globals.h @@ -0,0 +1,32 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + globals.h + Macros useful to declare and define global objects in Sortix. + +******************************************************************************/ + +#ifndef SORTIX_GLOBALS_H +#define SORTIX_GLOBALS_H + +#define DECLARE_GLOBAL_OBJECT(Type, Name) extern Type* G##Name; +#define DEFINE_GLOBAL_OBJECT(Type, Name) Type D##Name; Type* G##Name = &D##Name; + +#endif + diff --git a/sortix/http.cpp b/sortix/http.cpp new file mode 100644 index 00000000..b5a96a9b --- /dev/null +++ b/sortix/http.cpp @@ -0,0 +1,183 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + http.cpp + A very small http server running in kernel mode, heh! + +******************************************************************************/ + +#include "platform.h" +#include +#include +#include "uart.h" + +using namespace Maxsi; + +namespace Sortix +{ + namespace HTTP + { + uint32_t Left; + + bool TryByte(char* Dest) + { + if ( Left == 0 ) + { + UART::Read((uint8_t*) &Left, sizeof(Left)); + } + + if ( Left == 0 ) { return false; } + + UART::Read((uint8_t*) Dest, 1); + Left--; + + return true; + } + + void Close() + { + uint32_t ToSend = 0; + UART::Write(&ToSend, sizeof(ToSend)); + } + + void Send(const char* Response, uint32_t Len) + { + UART::Write(&Len, sizeof(Len)); + UART::Write(Response, Len); + } + + void Respond(const char* Body, uint32_t Len) + { + const char* Headers = "HTTP/1.1 200 Success\r\nConnection: close\r\nContent-Type: application/xhtml+xml\r\n\r\n"; + Send(Headers, String::Length(Headers)); + Send(Body, Len); + Close(); + } + + void HandleResource(const char* Operation, const char* Resource) + { + if ( String::Compare(Resource, "/") == 0 ) + { + const char* Response = + "\n" + "\n" + " \n" + " Hello, World!\n" + " \n" + " \n" + "

\"Hello, World!\" said Sortix with a big smile!

\n" + "

\"Finally\", Sortix continued, \"someone completed a working HTTP server that runs under Sortix, which runs as a virtual machine, that communicates over a serial terminal driver to proxy server that communicates with the real internet!\".

\n" + "

Sortix was happy.

\n" + "

This website was served by a server running under my very own operating system, which is connected to the internet through a serial modem driver. Heh!

\n" + " \n" + "\n" + ; + + Respond(Response, String::Length(Response)); return; + } + else + { + const char* Response = "HTTP/1.1 400 Not Found\r\nConnection: close\r\n\r\nHTTP 404 File Not Found\n"; + Send(Response, String::Length(Response)); Close(); return; + } + } + + void HandleConnection() + { + char Buffer[1024]; + + char* Operation = NULL; + char* Resource = NULL; + + size_t Used = 0; + + nat State = 0; + + while ( true ) + { + if ( !TryByte(Buffer + Used) ) { return; } + Used++; + Buffer[Used] = '\0'; + + if ( State == 0 ) + { + if ( Used >= 4 ) + { + if ( Buffer[0] == 'G' && Buffer[1] == 'E' && Buffer[2] == 'T' && Buffer[3] == ' ' ) + { + State++; + Buffer[3] = '\0'; + Operation = Buffer; + } + else + { + const char* Response = "HTTP/1.1 501 Not Implemented\r\nConnection: close\r\n\r\nThis request is not supported by this server!\n"; + Send(Response, String::Length(Response)); Close(); return; + } + } + } + if ( State == 1 ) + { + if ( Buffer[Used-1] == ' ' ) + { + Resource = Buffer + 4; + Buffer[Used-1] = '\0'; + State++; + break; + } + } + + if ( Used == 1024 ) + { + const char* Response = "HTTP/1.1 400 Bad Request\r\n\r\n"; + Send(Response, String::Length(Response)); Close(); return; + } + } + + nat LineChars = 0; + + while ( LineChars < 4 ) + { + char TMP; + if ( !TryByte(&TMP) ) { return; } + + if ( TMP == '\r' || TMP == '\n' ) + { + LineChars++; + } + else + { + LineChars = 0; + } + } + + HandleResource(Operation, Resource); + } + + void Init() + { + Left = 0; + + while ( true ) + { + HandleConnection(); + } + } + } +} diff --git a/sortix/iirqhandler.h b/sortix/iirqhandler.h new file mode 100644 index 00000000..c974f36a --- /dev/null +++ b/sortix/iirqhandler.h @@ -0,0 +1,37 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + iirqhandler.h + An interface for classes able to handle IRQs. + + TODO: This is stupid. Get rid of this header and put the declaration + someplace more intelligent. + +******************************************************************************/ + +#ifndef SORTIX_IIRQHANDLER_H +#define SORTIX_IIRQHANDLER_H + +namespace Sortix +{ + typedef void (*InterruptHandler)(CPU::InterruptRegisters* Registers); +} + +#endif + diff --git a/sortix/iprintable.cpp b/sortix/iprintable.cpp new file mode 100644 index 00000000..adbce5eb --- /dev/null +++ b/sortix/iprintable.cpp @@ -0,0 +1,257 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + iprintable.cpp + A common interface shared by all devices that can be printed text to. + +******************************************************************************/ + +#include "platform.h" +#include "iprintable.h" + +namespace Sortix +{ + int UInt8ToString(uint8_t Num, char* Dest) + { + uint8_t Copy = Num; + int Result = 0; + + while ( Copy > 9 ) { Copy /= 10; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + Dest[Offset] = '0' + Num % 10; Num /= 10; Offset--; + } + + return Result + 1; + } + + int UInt16ToString(uint16_t Num, char* Dest) + { + uint16_t Copy = Num; + int Result = 0; + + while ( Copy > 9 ) { Copy /= 10; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + Dest[Offset] = '0' + Num % 10; Num /= 10; Offset--; + } + + return Result + 1; + } + + int UInt32ToString(uint32_t Num, char* Dest) + { + uint32_t Copy = Num; + int Result = 0; + + while ( Copy > 9 ) { Copy /= 10; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + Dest[Offset] = '0' + Num % 10; Num /= 10; Offset--; + } + + return Result + 1; + } + + int UInt64ToString(uint64_t Num, char* Dest) + { + uint64_t Copy = Num; + int Result = 0; + + while ( Copy > 9 ) { Copy /= 10; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + Dest[Offset] = '0' + Num % 10; Num /= 10; Offset--; + } + + return Result + 1; + } + + // Missing functions here. + + int UInt32ToString16(uint32_t Num, char* Dest) + { + uint32_t Copy = Num; + int Result = 0; + + while ( Copy > 15 ) { Copy /= 16; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + if ( Num % 16 < 10 ) + { + Dest[Offset] = '0' + Num % 16; + } + else + { + Dest[Offset] = 'A' + (Num % 16) - 10; + } + Num /= 16; Offset--; + } + + return Result + 1; + } + + int UInt64ToString16(uint64_t Num, char* Dest) + { + uint64_t Copy = Num; + int Result = 0; + + while ( Copy > 15 ) { Copy /= 16; Result++; } + + int Offset = Result; + while ( Offset >= 0 ) + { + if ( Num % 16 < 10 ) + { + Dest[Offset] = '0' + Num % 16; + } + else + { + Dest[Offset] = 'A' + (Num % 16) - 10; + } + Num /= 16; Offset--; + } + + return Result + 1; + } + + // Missing functions here. + + #define READY_SIZE 128 + #define READY_FLUSH() Ready[AmountReady] = 0; Written += Print(Ready); AmountReady = 0; + #define F(N) (*(Format+N)) + + #define U32 1 + #define U64 2 + #define X32 3 + #define X64 4 + #define STRING 5 + #define CHAR 6 + + + size_t IPrintable::PrintF(const char* Format, ...) + { + va_list list; + va_start(list, Format); + size_t result = PrintFV(Format, list); + va_end(list); + return result; + } + + size_t IPrintable::PrintFV(const char* Format, va_list Parameters) + { + size_t Written = 0; + char Ready[READY_SIZE + 1]; + int AmountReady = 0; + + while ( *Format != '\0' ) + { + if ( *Format != '%' ) + { + Ready[AmountReady] = *Format; AmountReady++; Format++; + } + else + { + int Type = 0; + int Len = 1; + + if ( F(1) == 'c' ) { Type = CHAR; Len += 1; } else + if ( F(1) == 's' ) { Type = STRING; Len += 1; } else + if ( F(1) == 'u' ) { Type = U32; Len += 1; } else + if ( F(1) == '3' && F(2) == '2' && F(3) == 'u' ) { Type = U32; Len += 3; } else + if ( F(1) == '6' && F(2) == '4' && F(3) == 'u' ) { Type = U64; Len += 3; } else + if ( F(1) == 'x' ) { Type = X32; Len += 1; } else + if ( F(1) == '3' && F(2) == '2' && F(3) == 'x' ) { Type = X32; Len += 3; } else + if ( F(1) == '6' && F(2) == '4' && F(3) == 'x' ) { Type = X64; Len += 3; } else + #ifdef PLATFORM_X86 + if ( F(1) == 'z' ) { Type = U32; Len += 1; } else + if ( F(1) == 'p' ) { Type = X32; Len += 1; } else + #elif defined(PLATFORM_X64) + if ( F(1) == 'z' ) { Type = U64; Len += 1; } else + if ( F(1) == 'p' ) { Type = X64; Len += 1; } else + #endif + //#ifdef PLATFORM_X86_FAMILY + if ( F(1) == 'j' && F(2) == 'u' ) { Type = U64; Len += 2; } else + if ( F(1) == 'j' && F(2) == 'x' ) { Type = X64; Len += 2; } else { } + //#endif + + if ( Type == STRING ) + { + // TODO: This isn't efficient. + READY_FLUSH(); + const char* param = va_arg(Parameters, const char*); + Written += Print(param); + } + else if ( Type == CHAR ) + { + if ( READY_SIZE <= AmountReady ) { READY_FLUSH(); } + uint32_t param = va_arg(Parameters, uint32_t); + Ready[AmountReady] = param & 0xFF; AmountReady++; + } + else if ( Type == U32 ) + { + if ( READY_SIZE - AmountReady < 10 ) { READY_FLUSH(); } + uint32_t Num = va_arg(Parameters, uint32_t); + AmountReady += UInt32ToString(Num, Ready + AmountReady); + } + else if ( Type == U64 ) + { + if ( READY_SIZE - AmountReady < 20 ) { READY_FLUSH(); } + uint64_t Num = va_arg(Parameters, uint64_t); + AmountReady += UInt64ToString(Num, Ready + AmountReady); + } + else if ( Type == X32 ) + { + if ( READY_SIZE - AmountReady < 8 ) { READY_FLUSH(); } + uint32_t Num = va_arg(Parameters, uint32_t); + AmountReady += UInt32ToString16(Num, Ready + AmountReady); + } + else if ( Type == X64 ) + { + if ( READY_SIZE - AmountReady < 16 ) { READY_FLUSH(); } + uint64_t Num = va_arg(Parameters, uint64_t); + AmountReady += UInt64ToString16(Num, Ready + AmountReady); + } + else // Unsupported/unknown format. Just echo! + { + Ready[AmountReady] = *Format; AmountReady++; Written++; + } + + Format += Len; + } + + if ( READY_SIZE == AmountReady ) { READY_FLUSH(); } + } + + // Flush our cache. + if ( AmountReady ) { Ready[AmountReady] = 0; Written += Print(Ready); } + + return Written; + } +} diff --git a/sortix/iprintable.h b/sortix/iprintable.h new file mode 100644 index 00000000..57348f11 --- /dev/null +++ b/sortix/iprintable.h @@ -0,0 +1,48 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + iprintable.h + A common interface shared by all devices that can be printed text to. + +******************************************************************************/ + +#ifndef SORTIX_IPRINTABLE_H +#define SORTIX_IPRINTABLE_H + +namespace Sortix +{ + int UInt8ToString(uint8_t Num, char* Dest); + int UInt16ToString(uint16_t Num, char* Dest); + int UInt32ToString(uint32_t Num, char* Dest); + int UInt64ToString(uint64_t Num, char* Dest); + + class IPrintable + { + public: + size_t PrintFV(const char* Format, va_list Parameters); + size_t PrintF(const char* Format, ...); + + public: + virtual size_t Print(const char* Message) = 0; + + }; +} + +#endif + diff --git a/sortix/isr.cpp b/sortix/isr.cpp new file mode 100644 index 00000000..15cca13d --- /dev/null +++ b/sortix/isr.cpp @@ -0,0 +1,77 @@ +// +// isr.c -- High level interrupt service routines and interrupt request handlers. +// Part of this code is modified from Bran's kernel development tutorials. +// Rewritten for JamesM's kernel development tutorials. +// + +#include "platform.h" +#include "globals.h" +#include "iprintable.h" +#include "iirqhandler.h" +#include "log.h" +#include "isr.h" +#include "panic.h" + +size_t numknownexceptions = 19; +const char* exceptions[] = { "Divide by zero", "Debug", "Non maskable interrupt", "Breakpoint", + "Into detected overflow", "Out of bounds", "Invalid opcode", + "No coprocessor", "Double fault", "Coprocessor segment overrun", + "Bad TSS", "Segment not present", "Stack fault", + "General protection fault", "Page fault", "Unknown interrupt", + "Coprocessor fault", "Alignment check", "Machine check" }; + + Sortix::InterruptHandler interrupt_handlers[256]; + + void register_interrupt_handler(uint8_t n, Sortix::InterruptHandler handler) + { + interrupt_handlers[n] = handler; + } + + // This gets called from our ASM interrupt handler stub. + extern "C" void isr_handler(Sortix::CPU::InterruptRegisters* Regs) + { +#ifdef PLATFORM_X86 + if ( Regs->int_no < 32 ) + { + const char* message = ( Regs->int_no < numknownexceptions ) ? exceptions[Regs->int_no] : "Unknown"; + Sortix::PanicF("Unhandled CPU Exception id %zu '%s' at eip=0x%zx (cr2=0x%p)", Regs->int_no, message, Regs->eip, Regs->cr2); + } + + if ( interrupt_handlers[Regs->int_no] != NULL ) + { + interrupt_handlers[Regs->int_no](Regs); + } +#else + #warning "ISR handlers are not supported on this arch" + while(true); +#endif + } + + // This gets called from our ASM interrupt handler stub. + extern "C" void irq_handler(Sortix::CPU::InterruptRegisters* Regs) + { +#ifdef PLATFORM_X86 + if ( Regs->int_no != 32 ) + { + Sortix::Log::PrintF("IRQ eax=%u, int_no=%u, err_code=%u, eip=0x%x!\n", Regs->eax, Regs->int_no, Regs->err_code, Regs->eip); + } + + if ( Regs->int_no < 32 || 48 < Regs->int_no ) { Sortix::PanicF("IRQ eax=%u, int_no=%u, err_code=%u, eip=%u!", Regs->eax, Regs->int_no, Regs->err_code, Regs->eip); } + + // TODO! IRQ 7 and 15 might be spurious and might need to be ignored. + // See http://wiki.osdev.org/PIC for details (section Spurious IRQs). + + // Send an EOI (end of interrupt) signal to the PICs. + if (Regs->int_no >= 40) { Sortix::X86::OutPortB(0xA0, 0x20); } // Send reset signal to slave if this interrupt involved the slave. + Sortix::X86::OutPortB(0x20, 0x20); // Send reset signal to master. + + if ( interrupt_handlers[Regs->int_no] != NULL ) + { + interrupt_handlers[Regs->int_no](Regs); + } +#else + #warning "IRQ handlers are not supported on this arch" + while(true); +#endif + } + diff --git a/sortix/isr.h b/sortix/isr.h new file mode 100644 index 00000000..cdfee4b7 --- /dev/null +++ b/sortix/isr.h @@ -0,0 +1,26 @@ +// +// isr.h -- Interface and structures for high level interrupt service routines. +// Part of this code is modified from Bran's kernel development tutorials. +// Rewritten for JamesM's kernel development tutorials. +// + +// A few defines to make life a little easier +#define IRQ0 32 +#define IRQ1 33 +#define IRQ2 34 +#define IRQ3 35 +#define IRQ4 36 +#define IRQ5 37 +#define IRQ6 38 +#define IRQ7 39 +#define IRQ8 40 +#define IRQ9 41 +#define IRQ10 42 +#define IRQ11 43 +#define IRQ12 44 +#define IRQ13 45 +#define IRQ14 46 +#define IRQ15 47 + +void register_interrupt_handler(uint8_t n, Sortix::InterruptHandler handler); + diff --git a/sortix/kernel.cpp b/sortix/kernel.cpp new file mode 100644 index 00000000..9a9c4cd6 --- /dev/null +++ b/sortix/kernel.cpp @@ -0,0 +1,274 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + kernel.cpp + A common interface shared by all devices that can be printed text to. + +******************************************************************************/ + +#include "platform.h" +#include +#include +#include +#include "globals.h" +#include "iprintable.h" +#include "log.h" +#include "panic.h" +#include "descriptor_tables.h" +#include "iirqhandler.h" +#include "time.h" +#include "keyboard.h" +#include "multiboot.h" +#include "memorymanagement.h" +#include "scheduler.h" +#include "syscall.h" +#include "pong.h" +#include "conway.h" +#include "pci.h" +#include "uart.h" +#include "serialterminal.h" +#include "vgaterminal.h" + +using namespace Maxsi; + +void* RunApplication(void* Parameter); + +extern "C" size_t stack[4096] = {0}; +extern "C" size_t stackend = 0; + +namespace Sortix +{ +#ifdef PLATFORM_HTTP + namespace HTTP { void Init(); } +#endif + + void DoBSoD() + { +#ifdef PLATFORM_SERIAL + UART::WriteChar(27); + UART::WriteChar(91); + UART::WriteChar(48 + 4); + UART::WriteChar(48 + 4); + UART::WriteChar(109); +#endif + + Log::Print(" "); + Log::Print(" "); + Log::Print("Windows Boot Manager has experienced a problem. "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" Status: 0xc000000f "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" Info: An error occured during transferring execution. "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); + Log::Print("You can try to recover the system with the Microsoft Windows System Recovery "); + Log::Print("Tools. (You might need to restart the system manually). "); + Log::Print(" "); + Log::Print("If the problem continues, please contact your system administrator or computer "); + Log::Print("manufacturer. "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); + +#ifdef JSSORTIX + JSSortix::Exit(); +#else + while ( true ) { } +#endif + } + + void DoMaxsiLogo() + { + Log::Print(" _ "); + Log::Print(" / \\ "); + Log::Print(" /\\ /\\ / \\ "); + Log::Print(" / \\ / \\ | | "); + Log::Print(" / \\/ \\ | | "); + Log::Print(" | O O \\_______________________ / | "); + Log::Print(" | | "); + Log::Print(" | \\_______/ / "); + Log::Print(" \\ / "); + Log::Print(" ------ --------------- ---/ "); + Log::Print(" / \\ / \\ "); + Log::Print(" / \\ / \\ "); + Log::Print(" / \\ / \\ "); + Log::Print(" /_____________\\ /____________\\ "); + Log::Print(" "); + } + + void DoWelcome() + { +#ifdef BSOD + DoBSoD(); +#endif + + DoMaxsiLogo(); + +#ifdef PLATFORM_SERIAL +#ifdef PONG + Log::Print(" = THE SORTIX KERNEL - PONG EDITION = "); +#elif defined(CONWAY) + Log::Print(" = THE SORTIX KERNEL - CONWAY'S GAME OF LIFE EDITION = "); +#else + Log::Print(" "); +#endif + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" "); +#endif + } + + extern "C" void KernelInit(unsigned long Magic, multiboot_info_t* BootInfo) + { +#ifdef JSSORTIX + // TODO: Make JSVM multiboot compliant. + multiboot_info_t MBInfo; BootInfo = &MBInfo; + multiboot_memory_map_t MBMMap; + + MBMMap.addr = 0x100000; + MBMMap.len = 0xC00000; + MBMMap.type = MULTIBOOT_MEMORY_AVAILABLE; + MBMMap.size = sizeof(MBMMap) - sizeof(MBMMap.size); + BootInfo->flags = MULTIBOOT_INFO_MEM_MAP; + BootInfo->mmap_addr = (multiboot_uint32_t) &MBMMap; + BootInfo->mmap_length = sizeof(MBMMap); +#endif + + // Initialize the default terminal. + Maxsi::Format::Callback logcallback; + void* logpointer; + +#if PLATFORM_SERIAL + // Initialize the serial driver. + UART::Init(); + + SerialTerminal::Init(); + logcallback = SerialTerminal::Print; + logpointer = NULL; + +#else + VGATerminal::Init(); + logcallback = VGATerminal::Print; + logpointer = NULL; + +#endif + + // Initialize the kernel log. + Log::Init(logcallback, logpointer); + + // Just a test to see if the color system works! Make the BG red! + Log::Print("\e[37;41m\e[2J"); + + // Display the boot welcome screen. + DoWelcome(); + +#ifndef JSSORTIX + // Search for PCI devices and load their drivers. + PCI::Init(); +#endif + + // Initialize the paging. + Page::Init(BootInfo); + + uint8_t* initrd = NULL; + size_t initrdsize = 0; + +#ifdef INITRD + uint8_t** modules = (uint8_t**) BootInfo->mods_addr; + for ( uint32_t I = 0; I < BootInfo->mods_count; I++ ) + { + initrdsize = modules[2*I+1] - modules[2*I+0]; + initrd = modules[2*I+0]; + break; + } +#endif + + // Initialize the GDT and TSS structures. + GDT::Init(); + + // Initialize the interrupt descriptor tables. + IDT::Init(); + + if ( BootInfo == NULL ) { Panic("kernel.cpp: The bootinfo structure was NULL. Are your bootloader multiboot compliant?"); } + + + // Initialize the keyboard. + Keyboard::Init(); + +#ifdef PLATFORM_VIRTUAL_MEMORY + // Initialize virtual memory. TODO: This is not fully working yet. + VirtualMemory::Init(); + +#ifdef PLATFORM_KERNEL_HEAP + // Initialize the kernel heap. + Maxsi::Memory::Init(); +#endif + +#endif + + // Initialize system calls. + Syscall::Init(); + + // Initialize the scheduler. + Scheduler::Init(); + + Thread::Entry initstart = RunApplication; + + if ( initrd != NULL ) + { + void* loadptr = (void*) 0x400000; + uintptr_t loadint = (uintptr_t) loadptr; + +#ifdef PLATFORM_VIRTUAL_MEMORY + ASSERT(initrdsize <= 4096); + void* apppageptr = Page::Get(); + uintptr_t apppageint = (uintptr_t) apppageptr; + + uintptr_t flags = TABLE_PRESENT | TABLE_WRITABLE | TABLE_USER_SPACE; + VirtualMemory::Map(apppageint, loadint, flags); + VirtualMemory::Flush(); +#endif + + Memory::Copy(loadptr, initrd, initrdsize); + initstart = (Thread::Entry) loadptr; + } + + if ( Scheduler::CreateThread(NULL, initstart) == NULL ) + { + Panic("Could not create a sample thread!"); + } + + // Lastly set up the timer driver and we are ready to run the OS. + Time::Init(); + + // Run the OS. + Scheduler::MainLoop(); + } +} diff --git a/sortix/keyboard.cpp b/sortix/keyboard.cpp new file mode 100644 index 00000000..223ec6b4 --- /dev/null +++ b/sortix/keyboard.cpp @@ -0,0 +1,709 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + keyboard.cpp + A driver for the PS2 Keyboard. + +******************************************************************************/ + +#include "platform.h" +#include "globals.h" +#include "iprintable.h" +#include "iirqhandler.h" +#include "log.h" +#include "panic.h" +#include "keyboard.h" +#include "isr.h" + +#include "pong.h" + +namespace Sortix +{ + namespace Keyboard + { + namespace Layouts + { + const uint32_t UNKNOWN = 0xFFFFFFFF; + const uint32_t ESC = 0xFFFFFFFF - 1; + const uint32_t CTRL = 0xFFFFFFFF - 2; + const uint32_t LSHFT = 0xFFFFFFFF - 3; + const uint32_t RSHFT = 0xFFFFFFFF - 4; + const uint32_t ALT = 0xFFFFFFFF - 5; + const uint32_t F1 = 0xFFFFFFFF - 6; + const uint32_t F2 = 0xFFFFFFFF - 7; + const uint32_t F3 = 0xFFFFFFFF - 8; + const uint32_t F4 = 0xFFFFFFFF - 9; + const uint32_t F5 = 0xFFFFFFFF - 10; + const uint32_t F6 = 0xFFFFFFFF - 11; + const uint32_t F7 = 0xFFFFFFFF - 12; + const uint32_t F8 = 0xFFFFFFFF - 13; + const uint32_t F9 = 0xFFFFFFFF - 14; + const uint32_t F10 = 0xFFFFFFFF - 15; + const uint32_t F11 = 0xFFFFFFFF - 16; + const uint32_t F12 = 0xFFFFFFFF - 17; + const uint32_t SCRLCK = 0xFFFFFFFF - 18; + const uint32_t HOME = 0xFFFFFFFF - 19; + const uint32_t UP = 0xFFFFFFFF - 20; + const uint32_t LEFT = 0xFFFFFFFF - 21; + const uint32_t RIGHT = 0xFFFFFFFF - 22; + const uint32_t DOWN = 0xFFFFFFFF - 23; + const uint32_t PGUP = 0xFFFFFFFF - 24; + const uint32_t PGDOWN = 0xFFFFFFFF - 25; + const uint32_t END = 0xFFFFFFFF - 26; + const uint32_t INS = 0xFFFFFFFF - 27; + const uint32_t DEL = 0xFFFFFFFF - 28; + const uint32_t CAPS = 0xFFFFFFFF - 29; + const uint32_t NONE = 0xFFFFFFFF - 30; + const uint32_t ALTGR = 0xFFFFFFFF - 31; + const uint32_t NUMLCK = 0xFFFFFFFF - 32; + + namespace US + { + uint32_t sg[128] = + { + UNKNOWN, + ESC, + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '0', + '-', + '=', + '\b', + '\t', + 'q', + 'w', + 'e', + 'r', + 't', + 'y', + 'u', + 'i', + 'o', + 'p', + '[', + ']', + '\n', + CTRL, + 'a', + 's', + 'd', + 'f', + 'g', + 'h', + 'j', + 'k', + 'l', + ';', + '\'', + '`', + LSHFT, + '\\', + 'z', + 'x', + 'c', + 'v', + 'b', + 'n', + 'm', + ',', + '.', + '/', + RSHFT, + '*', + ALT, + ' ', + CAPS, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + NUMLCK, + SCRLCK, + HOME, + UP, + PGUP, + '-', + LEFT, + UNKNOWN, + RIGHT, + '+', + END, + DOWN, + PGDOWN, + INS, + DEL, + UNKNOWN, + UNKNOWN, + UNKNOWN, + F11, + F12, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + }; + + uint32_t Sg[128] = + { + UNKNOWN, + ESC, + '!', + '@', + '#', + '$', + '%', + '^', + '&', + '*', + '(', + ')', + '_', + '+', + '\b', + '\t', // TODO: Make it de-tab! + 'Q', + 'W', + 'E', + 'R', + 'T', + 'Y', + 'U', + 'I', + 'O', + 'P', + '{', + '}', + '\n', + CTRL, + 'A', + 'S', + 'D', + 'F', + 'G', + 'H', + 'J', + 'K', + 'L', + ':', + '"', + '~', + LSHFT, + '|', + 'Z', + 'X', + 'C', + 'V', + 'B', + 'N', + 'M', + '<', + '>', + '?', + RSHFT, + '*', + ALT, + ' ', + CAPS, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + NUMLCK, + SCRLCK, + HOME, + UP, + PGUP, + '-', + LEFT, + UNKNOWN, + RIGHT, + '+', + END, + DOWN, + PGDOWN, + INS, + DEL, + UNKNOWN, + UNKNOWN, + UNKNOWN, + F11, + F12, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + }; + + uint32_t sG[128] = + { + UNKNOWN, + ESC, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + '\b', + '\t', + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + '\n', + CTRL, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + LSHFT, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + RSHFT, + UNKNOWN, + ALT, + ' ', + CAPS, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + NUMLCK, + SCRLCK, + HOME, + UP, + PGUP, + '-', + LEFT, + UNKNOWN, + RIGHT, + '+', + END, + DOWN, + PGDOWN, + INS, + DEL, + UNKNOWN, + UNKNOWN, + UNKNOWN, + F11, + F12, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + }; + + uint32_t SG[128] = + { + UNKNOWN, + ESC, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + '\b', + '\t', + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + '\n', + CTRL, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + LSHFT, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + RSHFT, + UNKNOWN, + ALT, + ' ', + CAPS, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + NUMLCK, + SCRLCK, + HOME, + UP, + PGUP, + '-', + LEFT, + UNKNOWN, + RIGHT, + '+', + END, + DOWN, + PGDOWN, + INS, + DEL, + UNKNOWN, + UNKNOWN, + UNKNOWN, + F11, + F12, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + UNKNOWN, + }; + + uint32_t* Layout[4] = { sg, Sg, sG, SG }; + } + + uint32_t** Layout = US::Layout; + + nat Mask = 0; + nat LockMask = 0; + + const nat Shift = (1<<0); + const nat AltGr = (1<<1); + const nat ScrLck = (1<<2); + const nat LEDScrLck = (1<<0); + const nat LEDNumLck = (1<<1); + const nat LEDCapsLck = (1<<2); + + uint32_t GetCodePoint(uint8_t Scancode) + { + nat TableIndex = 0x3 & (Mask ^ LockMask); + + //Log::PrintF("[m=%x,lm=%x,ti=%x]", Mask, LockMask, TableIndex); + + uint32_t CodePoint = Layout[TableIndex][Scancode & 0x7F]; + + if ( CodePoint == UNKNOWN ) { return UNKNOWN; } + if ( Scancode & 0x80 ) + { + if ( CodePoint == LSHFT ) { Mask &= ~Shift; } + if ( CodePoint == ALTGR ) { Mask &= ~AltGr; } + if ( CodePoint == SCRLCK ) { Mask &= ~ScrLck; } + } + else + { + if ( CodePoint == LSHFT ) { Mask |= Shift; } + if ( CodePoint == ALTGR ) { Mask |= AltGr; } + if ( CodePoint == SCRLCK ) { Mask |= ScrLck; } + if ( CodePoint == CAPS ) { LockMask ^= Shift; SetLEDs(LEDCapsLck); } + } + + return CodePoint; + } + } + + uint8_t LEDs; + + void Init() + { + // Initialize variables. + LEDs = 0; + + // Register our keystroke callback. + register_interrupt_handler(IRQ1, OnIRQ1); + + // If any scancodes were already pending, our interrupt handler + // will never be called. Let's just discard anything pending. + CPU::InPortB(0x60); + } + + void OnIRQ1(CPU::InterruptRegisters* Regs) + { + // Read the scancode from the data register. + uint8_t Scancode = CPU::InPortB(0x60); + + //Log::PrintF("[%u]", Scancode); + + uint32_t CodePoint = Layouts::GetCodePoint(Scancode); + + bool KeyUp = (Scancode & 0x80) > 0; + +#if PONG + Pong::OnKeystroke(CodePoint, KeyUp); return; +#endif + +#if 1 + return; +#endif + //if ( Reader != NULL ) { Reader->OnKeystroke(CodePoint, KeyUp); return; } + + // Use this to debug the exact scancodes you receive! + //Log::PrintF("[%u/U+%x]", Scancode, CodePoint); + + if ( CodePoint == Layouts::UNKNOWN ) { Log::PrintF("^%u", Scancode);return; } + + if ( CodePoint & (1<<31) ) { return; } + + // The high bit of the scancode is set if the key is released. + if ( Scancode & 0x80 ) { return; } + + if ( CodePoint & 0xFFFFFF80 ) { Log::PrintF("U+%x", CodePoint); return; } + + Log::PrintF("%s", &CodePoint); // Little endian hack! + } + + void SetLEDs(uint8_t Toggle) + { + LEDs ^= Toggle; + + while ( (CPU::InPortB(0x64) & (1<<1)) != 0 ) { } //loop Until zero + CPU::OutPortB(0x60, 0xED); + while ( (CPU::InPortB(0x64) & (1<<1)) != 0 ) { } //loop Until zero + CPU::OutPortB(0x60, LEDs); + } + } +} + diff --git a/sortix/keyboard.h b/sortix/keyboard.h new file mode 100644 index 00000000..d6068740 --- /dev/null +++ b/sortix/keyboard.h @@ -0,0 +1,48 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + keyboard.h + A driver for the PS2 Keyboard. + +******************************************************************************/ + +#ifndef SORTIX_KEYBOARD_H +#define SORTIX_KEYBOARD_H + +namespace Sortix +{ + /* + class IKeystrokable + { + public: + virtual void OnKeystroke(uint32_t CodePoint, bool KeyUp) = 0; + + }; + */ + + namespace Keyboard + { + void Init(); + void SetLEDs(uint8_t Toggle); + void OnIRQ1(CPU::InterruptRegisters* Regs); + } +} + +#endif + diff --git a/sortix/link.ld b/sortix/link.ld new file mode 100644 index 00000000..bbb2ee00 --- /dev/null +++ b/sortix/link.ld @@ -0,0 +1,33 @@ +/* Link.ld -- Linker script for the kernel - ensure everything goes in the */ +/* Correct place. */ +/* Original file taken from Bran's Kernel Development */ +/* tutorials: http://www.osdever.net/bkerndev/index.php. */ + +ENTRY(start) +SECTIONS +{ + + .text 0x100000 : + { + code = .; _code = .; __code = .; + *(.text) + . = ALIGN(4096); + } + + .data : + { + data = .; _data = .; __data = .; + *(.data) + *(.rodata) + . = ALIGN(4096); + } + + .bss : + { + bss = .; _bss = .; __bss = .; + *(.bss) + . = ALIGN(4096); + } + + end = .; _end = .; __end = .; +} diff --git a/sortix/log.cpp b/sortix/log.cpp new file mode 100644 index 00000000..f883fb52 --- /dev/null +++ b/sortix/log.cpp @@ -0,0 +1,223 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + log.cpp + A system for logging various messages to the kernel log. + +******************************************************************************/ + +#include "platform.h" +#include +#include +#include "globals.h" +#include "iprintable.h" +#include "log.h" + +#ifdef PLATFORM_SERIAL +#include "uart.h" +#endif + +using namespace Maxsi; + +namespace Sortix +{ +#ifdef OLD_LOG + DEFINE_GLOBAL_OBJECT(Log, Log); + + void Log::Init() + { +#ifdef PLATFORM_SERIAL + // Set the cursor to (0,0) + const char InitMessage[] = { String::ASCII_ESCAPE, '[', 'H' }; + UART::Write(InitMessage, sizeof(InitMessage)); + + return; +#endif + + Line = 0; + Column = 0; + + // Empty the screen. + size_t* Msgs = (size_t*) Messages; + size_t Msg = ' '; +#ifdef PLATFORM_X86 + Msg |= Msg << 8; Msg |= Msg << 16; +#elif defined(PLATFORM_X64) + Msg |= Msg << 8; Msg |= Msg << 16; Msg |= Msg << 32; +#endif + for ( nat I = 0; I < (Height*Width) / sizeof(size_t); I++ ) { Msgs[I] = Msg; } + + // Set the color for each line. + for ( nat Y = 0; Y < Height; Y++ ) { Colors[Y] = (COLOR8_LIGHT_GREY << 0) + (COLOR8_BLACK << 4); } + + // Flush to our viewing device. + UpdateScreen(); + } + + void Log::UpdateScreen() + { +#ifdef PLATFORM_SERIAL + return; +#endif + + uint16_t* Destination = (uint16_t*) 0xB8000; + + // Copy and apply colors. + for ( nat Y = 0; Y < Height; Y++ ) + { + uint16_t Color = ((uint16_t) Colors[Y]) << 8; + + for ( nat X = 0; X < Width; X++ ) + { + Destination[X + Y*Width] = ( (uint16_t) Messages[X + Y*Width] ) | Color; + } + } + + SetCursor(Column, Line); + } + +#ifndef PLATFORM_SERIAL + size_t Log::Print(const char* Message) + { + size_t Written; + while ( *Message != '\0' /*&& *Message != 0*/ ) + { + if ( *Message == '\n' ) + { + NewLine(); + } + else if ( *Message == '\t' ) + { + if ( 80 <= Column ) { NewLine(); } + do { Messages[Column + Line * Width] = ' '; Column++; } while ( Column % 4 != 0 ); + } + else if ( *Message == '\r' ) + { + // No need for this driver to support line resets. + } + else if ( *Message == '\b' ) + { + // No need for this driver to support backspaces. + } + else + { + if ( 80 <= Column ) { NewLine(); } + Messages[Column + Line * Width] = *Message; Column++; + } + + Message++; + Written++; + } + + return Written; + } +#else + size_t Log::Print(const char* Message) + { + size_t Written; + while ( *Message != '\0' /*&& *Message != 0*/ ) + { + if ( *Message == '\n' ) + { + UART::WriteChar('\r'); + UART::WriteChar(*Message); + } + //else if ( *Message == '\t' ) + //{ + // if ( 80 <= Column ) { NewLine(); } + // do { Messages[Column + Line * Width] = ' '; Column++; } while ( Column % 4 != 0 ); + //} + else + { + UART::WriteChar(*Message); + } + + Message++; + Written++; + } + + return Written; + } +#endif + + void Log::NewLine() + { +#ifdef PLATFORM_SERIAL + return; +#endif + + if ( Line < Height - 1 ) + { + Line++; + } + else + { + // Scroll down our buffer. + Memory::Copy(Messages, Messages + Width, (Height-1)*Width); + + // Scroll down our color buffer as well. + for ( nat Y = 1; Y < Height; Y++ ) { Colors[Y-1] = Colors[Y]; } + } + + // Reset the new line. + Memory::Set(Messages + Line*Width, ' ', Width); + + // Assume the color of the new line is the same as the previous. + Colors[Line] = Colors[Line-1]; + + Column = 0; + + // Flush our output. + UpdateScreen(); + } + + void Log::SetCursor(nat X, nat Y) + { +#ifdef PLATFORM_SERIAL + return; +#endif + + nat Value = X + Y * Width; + + // This sends a command to indicies 14 and 15 in the + // CRT Control Register of the VGA controller. These + // are the high and low bytes of the index that show + // where the hardware cursor is to be 'blinking'. + CPU::OutPortB(0x3D4, 14); + CPU::OutPortB(0x3D5, (Value >> 8) & 0xFF); + CPU::OutPortB(0x3D4, 15); + CPU::OutPortB(0x3D5, (Value >> 0) & 0xFF); + } + + +#else + namespace Log + { + Maxsi::Format::Callback deviceCallback = NULL; + void* devicePointer = NULL; + + void Init(Maxsi::Format::Callback callback, void* user) + { + deviceCallback = callback; + devicePointer = user; + } + } + +#endif +} diff --git a/sortix/log.h b/sortix/log.h new file mode 100644 index 00000000..95f598d2 --- /dev/null +++ b/sortix/log.h @@ -0,0 +1,98 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + log.h + A system for logging various messages to the kernel log. + +******************************************************************************/ + +#ifndef SORTIX_LOG_H +#define SORTIX_LOG_H + +#include +#include + +namespace Sortix +{ +#ifdef OLD_LOG + class Log : public IPrintable + { + protected: + const static nat Width = 80; + const static nat Height = 25; + char Messages[Width * Height]; + nat Column; + nat Line; + uint8_t Colors[Height]; + + public: + virtual void Init(); + + public: + void UpdateScreen(); + + public: + virtual size_t Print(const char* Message); + + private: + void NewLine(); + + public: + void SetCursor(nat X, nat Y); + }; + + DECLARE_GLOBAL_OBJECT(Log, Log); +#else + namespace Log + { + extern Maxsi::Format::Callback deviceCallback; + extern void* devicePointer; + + void Init(Maxsi::Format::Callback callback, void* user); + + inline void Flush() + { + if ( deviceCallback ) { deviceCallback(devicePointer, NULL, 0); } + } + + inline size_t Print(const char* str) + { + if ( deviceCallback ) { return deviceCallback(devicePointer, str, Maxsi::String::Length(str)); } + return 0; + } + + inline size_t PrintF(const char* format, ...) + { + va_list list; + va_start(list, format); + size_t result = Maxsi::Format::Virtual(deviceCallback, devicePointer, format, list); + va_end(list); + return result; + } + + inline size_t PrintFV(const char* format, va_list list) + { + return Maxsi::Format::Virtual(deviceCallback, devicePointer, format, list); + } + } +#endif +} + +#endif + diff --git a/sortix/memorymanagement.cpp b/sortix/memorymanagement.cpp new file mode 100644 index 00000000..65d3bbef --- /dev/null +++ b/sortix/memorymanagement.cpp @@ -0,0 +1,491 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + memorymanagement.cpp + Handles memory for the x86 architecture. + +******************************************************************************/ + +#include "platform.h" +#include +#include "globals.h" +#include "iprintable.h" +#include "log.h" +#include "panic.h" +#include "multiboot.h" +#include "memorymanagement.h" + +// Debug +#include "iirqhandler.h" +#include "keyboard.h" + +using namespace Maxsi; + +namespace Sortix +{ + const uintptr_t KernelStart = 0x000000; + const size_t KernelLength = 0x200000; + const size_t KernelLeadingPages = KernelLength / 0x1000; + + namespace Page + { + struct UnallocPage // Must like this due to assembly. + { + size_t Magic; + void* Next; + size_t ContinuousPages; + }; + + void Fragmentize(); + + UnallocPage* volatile UnallocatedPage; // Must have this name and namespace due to assembly. + size_t PagesTotal; + //size_t PagesUsed; + //size_t PagesFree; + + const size_t UnallocPageMagic = 0xABBAACDC; // Must this value due to assembly + + // Creates the Great Linked List of All Linked Lists! + void Init(multiboot_info_t* BootInfo) + { + UnallocatedPage = NULL; + PagesTotal = 0; + + if ( !( BootInfo->flags & MULTIBOOT_INFO_MEM_MAP ) ) + { + Panic("memorymanagement.cpp: The memory map flag was't set in the multiboot structure. Are your bootloader multiboot compliant?"); + } + + for ( + multiboot_memory_map_t* MMap = (multiboot_memory_map_t*) BootInfo->mmap_addr; + (uintptr_t) MMap < BootInfo->mmap_addr + BootInfo->mmap_length; + MMap = (multiboot_memory_map_t *) ((uintptr_t) MMap + MMap->size + sizeof(MMap->size)) + ) + { + + // Check that we can use this kind of RAM. + if ( MMap->type != 1 ) { continue; } + + Log::PrintF("RAM at 0x%64x\t of length 0x%64zx\n", MMap->addr, MMap->len); + + // The kernels code may split this memory area into multiple pieces. + struct { uintptr_t Base; size_t Length; } Entries[2]; nat Num = 1; + + // Attempt to crop the entry so that we only map what we can address. + Entries[0].Base = (uintptr_t) MMap->addr; + Entries[0].Length = MMap->len; + #ifdef PLATFORM_X86 + // Figure out if the memory area is addressable (are our pointers big enough?) + if ( 0xFFFFFFFF < MMap->addr ) { continue; } + if ( 0xFFFFFFFF < MMap->addr + MMap->len ) { Entries[0].Length = 0xFFFFFFFF - MMap->addr; } + #endif + + // Detect if this memory is completely covered by the kernel. + if ( KernelStart <= Entries[0].Base && Entries[0].Base + Entries[0].Length <= KernelStart + KernelLength ) { continue; } + + // Detect if this memory is partially covered by the kernel (from somewhere in the memory to somewhere else in the memory) + else if ( Entries[0].Base <= KernelStart && KernelStart + KernelLength <= Entries[0].Base + Entries[0].Length ) + { + Entries[1].Base = KernelStart + KernelLength; + Entries[1].Length = (Entries[0].Base + Entries[0].Length) - Entries[1].Base; + Entries[0].Length = KernelStart - Entries[0].Base; + Num = 2; + } + + // Detect if this memory is partially covered by the kernel (from the left to somewhere in the memory) + else if ( Entries[0].Base <= KernelStart + KernelLength && KernelStart + KernelLength <= Entries[0].Base + Entries[0].Length ) + { + Entries[0].Length = (Entries[0].Base + Entries[0].Length) - (KernelStart + KernelLength); + Entries[0].Base = KernelStart + KernelLength; + } + + // Detect if this memory is partially covered by the kernel (from somewhere in the memory to the right) + else if ( Entries[0].Base <= KernelStart && KernelStart <= Entries[0].Base + Entries[0].Length ) + { + Entries[0].Length = KernelStart - Entries[0].Base; + } + + for ( nat I = 0; I < Num; I++ ) + { + + // Align our entries on page boundaries. + uintptr_t NewBase = (Entries[I].Base + 0xFFF) / 0x1000 * 0x1000; + Entries[I].Length = (Entries[I].Base + Entries[I].Length ) - NewBase; + Entries[I].Length /= 0x1000; + Entries[I].Base = NewBase; + + if ( Entries[I].Length == 0 ) { continue; } + + #ifdef PLATFORM_X64 + Log::Print("Halt: CPU X64 cannot continue as the virtual memory isn't disabled (kernel bug) and the code is about to access non-mapped memory.\n"); + while(true); + #endif + + UnallocPage* Page = (UnallocPage*) Entries[I].Base; + Page->Magic = UnallocPageMagic; + Page->Next = UnallocatedPage; + Page->ContinuousPages = Entries[I].Length - 1; + + PagesTotal += Entries[I].Length; + + UnallocatedPage = Page; + } + } + + if ( PagesTotal == 0 ) { Panic("memorymanagement.cpp: no RAM were available for paging"); } + + // Alright, time to make our linked list into a lot of small entries. + // This speeds up the system when it's fully up and running. It only + // takes a few miliseconds to run this operation on my laptop. + Fragmentize(); + +#ifndef PLATFORM_SERIAL + Log::PrintF("%zu pages are available for paging (%zu MiB RAM)\n", PagesTotal, PagesTotal >> 8 /* * 0x1000 / 1024 / 1024*/); +#endif + } + } + + namespace VirtualMemory + { + #ifdef PLATFORM_X86 + // These structures are always virtually mapped to these addresses. + Dir* CurrentDir = (Dir*) 0xFFBFF000; + Table* CurrentTables = (Table*) 0xFFC00000; + uintptr_t KernelHalfStart = 0x80000000; + uintptr_t KernelHalfEnd = 0xFFBFF000; + #endif + + #ifdef PLATFORM_X64 + // TODO: These are dummy values! + Dir* CurrentDir = (Dir*) 0xFACEB00C; + Table* CurrentTables = (Table*) 0xFACEB00C; + uintptr_t KernelHalfStart = 0xFACEB00C; + uintptr_t KernelHalfEnd = 0xFACEB00C; + #endif + + const size_t PointersPerPage = 4096 / sizeof(uintptr_t); + + size_t KernelLeadingPages; + Dir* CurrentDirPhys; + Dir* KernelDirPhys; + bool Virgin; + + #define ENABLE_PAGING() \ + { \ + size_t cr0; \ + asm volatile("mov %%cr0, %0": "=r"(cr0)); \ + cr0 |= 0x80000000UL; /* Enable paging! */ \ + asm volatile("mov %0, %%cr0":: "r"(cr0)); \ + } + + #define DISABLE_PAGING() \ + { \ + size_t cr0; \ + asm volatile("mov %%cr0, %0": "=r"(cr0)); \ + cr0 &= ~(0x80000000UL); /* Disable paging! */ \ + asm volatile("mov %0, %%cr0":: "r"(cr0)); \ + } + + // Internally used functions + void IdentityPhys(uintptr_t Addr); + void FixupPhys(Dir* D); + Table* GetTablePhys(uintptr_t Addr); + + void DebugTable(char* Base, Table* T) + { + #ifdef PLATFORM_X86 + Log::PrintF("-- Recursing to table at 0x%p spanning [0x%p - 0x%p] --\n", T, Base, Base + 1024 * 0x1000 - 1); + for ( size_t I = 0; I < 1024; I++ ) + { + uintptr_t Entry = T->Page[I]; + if ( Entry == 0 ) { continue; } + Log::PrintF("[0x%p] -> [0x%p] [Flags=0x%x]\n", Base + I * 0x1000, Entry & TABLE_ADDRESS, Entry & TABLE_FLAGS); + + while ( true ) + { + __asm__ ( "hlt" ); + //uint32_t Key = GKeyboard->HackGetKey(); + //if ( Key == '\n' ) { break; } + //if ( Key == 0xFFFFFFFF - 25 ) { I += 23; break; } + } + } + #else + #warning "Virtual Memory is not available on this arch" + while(true); + #endif + } + + void DebugDir(Dir* D) + { + #ifdef PLATFORM_X86 + Log::PrintF("-- Start of debug of page dir at 0x%p --\n", D); + if ( (uintptr_t) D & 1 ) { Log::PrintF("-- SOMETHING IS WRONG! --\n", D); while ( true ) { __asm__ ( "hlt" ); } } + for ( size_t I = 0; I < 1024; I++ ) + { + if ( !(D->Table[I] & DIR_PRESENT) ) { continue; } + Table* T = (Table*) (D->Table[I] & DIR_ADDRESS); + DebugTable((char*) (I * 0x40000), T); + } + Log::PrintF("-- End of debug of page dir at 0x%p --\n", D); + #else + #warning "Virtual Memory is not available on this arch" + while(true); + #endif + } + + void Init() + { + #ifdef PLATFORM_X86 + Virgin = true; + + // Allocate a page dir and reset it. + CurrentDirPhys = (Dir*) Page::Get(); + if ( CurrentDirPhys == NULL ) { Panic("memorymanagement.cpp: Could not allocate page dir"); } + Memory::Set(CurrentDirPhys, 0, sizeof(Dir)); + + //while ( true ) { DebugDir(CurrentDirPhys); } + + // Identity map the kernel. + for ( uintptr_t P = KernelStart; P < KernelStart + KernelLength; P += 0x1000 ) { IdentityPhys(P); } + + GetTablePhys(0x400000UL); + GetTablePhys(0x80000000UL - 4096UL); + + // Initialize all the kernel tables from 0x8000000 to 0xFFFFFFFF here! + for ( uintptr_t P = KernelHalfStart; P < KernelHalfEnd; P += 4096 ) { GetTablePhys(P); } + + // Prepare the page dir for real usage. + FixupPhys(CurrentDirPhys); + + //while ( true ) { DebugDir(CurrentDirPhys); } + + // Now switch to the initial virtual address space. + SwitchDir(CurrentDirPhys); + + // Remember this page dir as it is our base page dir. + KernelDirPhys = CurrentDirPhys; + #else + #warning "Virtual Memory is not available on this arch" + while(true); + #endif + } + + Table* GetTablePhys(uintptr_t Addr) + { + #ifdef PLATFORM_X86 + // Find the desired table entry, if existing. + uintptr_t DirIndex = Addr / 0x400000UL; // 4 MiB + uintptr_t T = CurrentDirPhys->Table[DirIndex] & DIR_ADDRESS; + + // If the table doesn't exist, create it. + if ( T == NULL ) + { + // Allocate a page. + T = (uintptr_t) Page::Get(); + + // Check if anything went wrong. + if ( T == NULL ) { Panic("memorymanagement.cpp: Could not allocate page table"); } + + // Reset the page's contents. + Memory::Set((void*) T, 0, sizeof(Table)); + + // Now add some flags + uintptr_t Flags = DIR_PRESENT | DIR_WRITABLE | DIR_USER_SPACE; + CurrentDirPhys->Table[DirIndex] = T | Flags; + } + + return (Table*) T; + #else + #warning "Virtual Memory is not available on this arch" + while(true); + return NULL; + #endif + } + + void IdentityPhys(uintptr_t Addr) + { + #ifdef PLATFORM_X86 + Table* T = GetTablePhys(Addr); + + uintptr_t Flags = TABLE_PRESENT | TABLE_WRITABLE; + + size_t TableIndex = (Addr % 0x400000) / 0x1000; + T->Page[TableIndex] = Addr | Flags; + #else + #warning "Virtual Memory is not available on this arch" + while(true); + #endif + } + + void FixupPhys(Dir* D) + { + #ifdef PLATFORM_X86 + Table* SecondLastTable = GetTablePhys((uintptr_t) CurrentDir); + + uintptr_t Flags = TABLE_PRESENT | TABLE_WRITABLE; + uintptr_t DirEntry = ((uintptr_t) D) | Flags; + + SecondLastTable->Page[PointersPerPage-1] = DirEntry; + + Table* LastTable = GetTablePhys((uintptr_t) CurrentTables); + + for ( size_t I = 0; I < PointersPerPage; I++ ) + { + LastTable->Page[I] = (D->Table[I] & DIR_ADDRESS) | Flags; + } + #else + #warning "Virtual Memory is not available on this arch" + while(true); + #endif + } + + void Fixup(Dir* D) + { + #ifdef PLATFORM_X86 + uintptr_t Flags = TABLE_PRESENT | TABLE_WRITABLE; + + Table* T = &CurrentTables[PointersPerPage-1]; + + for ( size_t I = 0; I < PointersPerPage; I++ ) + { + T->Page[I] = (D->Table[I] & DIR_ADDRESS) | Flags; + } + #else + #warning "Virtual Memory is not available on this arch" + while(true); + #endif + } + + void SwitchDir(Dir* PhysicalDirAddr) + { + #ifdef PLATFORM_X86 + // Set the new page directory. + CurrentDirPhys = PhysicalDirAddr; + asm volatile("mov %0, %%cr3":: "r"(PhysicalDirAddr)); + + if ( !Virgin ) + { + uintptr_t Entry = ((uintptr_t) PhysicalDirAddr & DIR_ADDRESS) | TABLE_PRESENT | TABLE_WRITABLE; + CurrentTables[PointersPerPage-2].Page[PointersPerPage-1] = Entry; + } + + // Reset the paging flag in the cr0 register to enable paging, and flush the paging cache. + ENABLE_PAGING(); + + Virgin = false; + #else + #warning "Virtual Memory is not available on this arch" + while(true); + #endif + } + + void Flush() + { + #ifdef PLATFORM_X86 + Fixup(CurrentDir); + + ENABLE_PAGING(); + #else + #warning "Virtual Memory is not available on this arch" + while(true); + #endif + } + + Dir* NewDir() + { + #ifdef PLATFORM_X86 + DISABLE_PAGING(); + + // TODO: Is the stack well defined here?! + Dir* Result = (Dir*) Page::Get(); + + if ( Result != NULL ) + { + Memory::Copy(Result, KernelDirPhys, sizeof(Dir)); + } + + ENABLE_PAGING(); + + return Result; + #else + #warning "Virtual Memory is not available on this arch" + while(true); + return NULL; + #endif + } + + void Map(uintptr_t Physical, uintptr_t Virtual, uintptr_t Flags) + { + #ifdef PLATFORM_X86 + // TODO: Possibly validate Physical and Virtual are aligned, and that + // flags uses only legal bits. Should the function then Panic? + + size_t DirIndex = Virtual / 0x400000; // 4 MiB + + // See if the required table in the dir exists. + if ( !(CurrentDir->Table[DirIndex] & DIR_PRESENT) ) + { + Log::PrintF("3-1-1\n"); + //DISABLE_PAGING(); + // TODO: Is the stack well defined here?! + + // This will create the table we need. + GetTablePhys(Virtual); + + //ENABLE_PAGING(); + } + + size_t TableIndex = (Virtual % 0x400000) / 0x1000; + + CurrentTables[DirIndex].Page[TableIndex] = Physical | Flags; + #else + #warning "Virtual Memory is not available on this arch" + while(true); + #endif + } + + // Unsafe version of VirtualMemory::Map. This has no error checking, but is faster. + void MapUnsafe(uintptr_t Physical, uintptr_t Virtual, uintptr_t Flags) + { + #ifdef PLATFORM_X86 + size_t DirIndex = Virtual / 0x400000; // 4 MiB + size_t TableIndex = (Virtual % 0x400000) / 0x1000; + + CurrentTables[DirIndex].Page[TableIndex] = Physical | Flags; + #else + #warning "Virtual Memory is not available on this arch" + while(true); + #endif + } + + void* LookupAddr(uintptr_t Virtual) + { + #ifdef PLATFORM_X86 + size_t DirIndex = Virtual / 0x400000; // 4 MiB + size_t TableIndex = (Virtual % 0x400000) / 0x1000; + + return (void*) (CurrentTables[DirIndex].Page[TableIndex] & TABLE_ADDRESS); + #else + #warning "Virtual Memory is not available on this arch" + while(true); + return NULL; + #endif + } + } +} diff --git a/sortix/memorymanagement.h b/sortix/memorymanagement.h new file mode 100644 index 00000000..31b552ef --- /dev/null +++ b/sortix/memorymanagement.h @@ -0,0 +1,98 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + memorymanagement.h + Handles memory for the x86 architecture. + +******************************************************************************/ + +#ifndef SORTIX_MEMORYMANAGEMENT_H +#define SORTIX_MEMORYMANAGEMENT_H + +namespace Sortix +{ + namespace Page + { +#ifdef MULTIBOOT_HEADER + void Init(multiboot_info_t* BootInfo); +#endif + void* Get(); + void Put(void* Page); + void GetNoCache(); + void PutNoCache(void* Page); + } + + namespace VirtualMemory + { + // TODO: Convert these to constants! + #define TABLE_PRESENT (1<<0) + #define TABLE_WRITABLE (1<<1) + #define TABLE_USER_SPACE (1<<2) + #define TABLE_RESERVED1 (1<<3) // Used internally by the CPU. + #define TABLE_RESERVED2 (1<<4) // Used internally by the CPU. + #define TABLE_ACCESSED (1<<5) + #define TABLE_DIRTY (1<<6) + #define TABLE_RESERVED3 (1<<7) // Used internally by the CPU. + #define TABLE_RESERVED4 (1<<8) // Used internally by the CPU. + #define TABLE_AVAILABLE1 (1<<9) + #define TABLE_AVAILABLE2 (1<<10) + #define TABLE_AVAILABLE3 (1<<11) + #define TABLE_FLAGS (0xFFFUL) // Bits used for the flags. + #define TABLE_ADDRESS (~0xFFFUL) // Bits used for the address. + + #define DIR_PRESENT (1<<0) + #define DIR_WRITABLE (1<<1) + #define DIR_USER_SPACE (1<<2) + #define DIR_WRITE_THROUGH (1<<3) + #define DIR_DISABLE_CACHE (1<<4) + #define DIR_ACCESSED (1<<5) + #define DIR_RESERVED1 (1<<6) + #define DIR_4MIB_PAGES (1<<7) + #define DIR_RESERVED2 (1<<8) + #define DIR_AVAILABLE1 (1<<9) + #define DIR_AVAILABLE2 (1<<10) + #define DIR_AVAILABLE3 (1<<11) + #define DIR_FLAGS (0xFFFUL) // Bits used for the flags. + #define DIR_ADDRESS (~0xFFFUL) // Bits used for the address. + + struct Table + { + uintptr_t Page[4096 / sizeof(uintptr_t)]; + }; + + struct Dir + { + uintptr_t Table[4096 / sizeof(uintptr_t*)]; + }; + + void Init(); + void SwitchDir(Dir* PhysicalDirAddr); + void Map(uintptr_t Physical, uintptr_t Virtual, uintptr_t Flags); + void MapUnsafe(uintptr_t Physical, uintptr_t Virtual, uintptr_t Flags); + void* LookupAddr(uintptr_t Virtual); + void Flush(); + void Fixup(Dir* Dir); + Dir* NewDir(); + } + + bool ValidateUserString(const char* USER string); +} + +#endif + diff --git a/sortix/mount.cpp b/sortix/mount.cpp new file mode 100644 index 00000000..dddcda92 --- /dev/null +++ b/sortix/mount.cpp @@ -0,0 +1,305 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + mount.cpp + Handles system wide mount points and initialization of new file systems. + +******************************************************************************/ + +#include "platform.h" +#include +#include "device.h" +#include "filesystem.h" +#include "thread.h" +#include "process.h" +#include "memorymanagement.h" + +namespace Sortix +{ + namespace Syscall + { + void SysOpen(Thread* thread) + { + struct Parameters + { + struct + { + const char* USER userPath SYSPARAM; + nat openFlags SYSPARAM; + nat mode SYSPARAM; + }; + struct + { + int handle; + bool pending; + FileSystem::SysCallback callbackInfo; + const char* safePath; + }; + }; + + // We store our parameters and data inside the thread object, and we + // are passed parameters in a special way, so make sure it works. + STATIC_ASSERT(0 * sizeof(size_t) == offsetof(Parameters, userPath)); + STATIC_ASSERT(1 * sizeof(size_t) == offsetof(Parameters, openflags)); + STATIC_ASSERT(2 * sizeof(size_t) == offsetof(Parameters, mode)); + STATIC_ASSERT(sizeof(Parameters) <= sizeof(thread->sysParams)); + Parameters* params = (Parameters*) thread->sysParams; + + int handle; + const char* path; + + // Initialize our variables and validate parameters. + if ( !thread->sysParamsInited ) + { + thread->sysParamsInited = true; + params->handle = handle = -1; + params->pending = false; + + // Make sure the path is a valid string in userspace. + params->safePath = path = ValidateUserString(params->userPath) + if ( path == NULL ) { thread->SysReturnError(-1); return; } + + params->openFlags &= O_USERSPACEABLE; + } + else + { + path = params->safePath; + handle = param->handle; + } + + // Get a descriptor for our device. + if ( handle == -1 ) + { + param->handle = handle = thread->GetProcess()->_descs.Reserve(); + if ( handle < 0 ) { thread->SysReturnError(handle); return; } + } + + // Attempt to open the path. If the operation is blocking, this + // function will re-called when it completes, successful or not. + if ( !params->pending ) + { + params->pending = true; + + MountPoint* mount = Mount::GetMountPoint(path); + if ( mount == NULL ) { Error::Set(Error::BADINPUT); thread->SysReturnError(-1); return; } + + if ( !mount->fs->Open(path, params->openFlags, params->mode, ¶ms->callbackInfo, thread) ) { return; } + } + + // Return an error if the open failed. + if ( unlikely(params->callbackInfo.device == NULL) ) + { + handle = thread->GetProcess()->_descs.Free(handle); + Error::Set(params->callbackInfo.deviceError); + thread->SysReturnError(-1); return; + } + + // Bind the device to the descriptor and return it. + handle = thread->GetProcess()->_descs.UseReservation(handle, params->callbackInfo.device); + thread->SysReturn(handle); return; + } + + void SysMount(Thread* thread) + { + struct Parameters + { + struct + { + const char* USER userDevicePath SYSPARAM; + const char* USER userTargetPath SYSPARAM; + const char* USER userDriverName SYSPARAM; + nat mode SYSPARAM; + }; + struct + { + int stage; + DevBuffer* storage; + DevFileSystem* fsDriver; + DevDirectory* directory; + FileSystem::SysCallback callbackInfo; + }; + }; + + // We store our parameters and data inside the thread object, and we + // are passed parameters in a special way, so make sure it works. + STATIC_ASSERT(0 * sizeof(size_t) == offsetof(Parameters, userDevicePath)); + STATIC_ASSERT(1 * sizeof(size_t) == offsetof(Parameters, userTargetPath)); + STATIC_ASSERT(2 * sizeof(size_t) == offsetof(Parameters, userDriverName)); + STATIC_ASSERT(3 * sizeof(size_t) == offsetof(Parameters, mode)); + STATIC_ASSERT(sizeof(Parameters) <= sizeof(thread->sysParams)); + Parameters* params = (Parameters*) thread->sysParams; + + // Initialize our variables and validate parameters. + if ( !thread->sysParamsInited ) + { + thread->sysParamsInited = true; + if ( ValidateUserString(params->userDevicePath) == NULL || + ValidateUserString(params->userTargetPath) == NULL || + ( params->userDriverName != NULL && + ValidateUserString(params->userDriverName) == NULL ) ) + { + thread->SysReturnError(-1); return; + } + + params->mode &= O_USERSPACEABLE; + nat baseMode = params->mode & O_LOWERFLAGS; + nat extMode = params->mode & (~O_LOWERFLAGS); + + // Deny unsupported open modes. + if ( (baseMode != O_RDWR && baseMode != O_RDONLY) || + (extMode != 0 && extMode != O_EXCLUSIVELY && extMode != O_SYNC) ) + { + Error::Set(Error::BADINPUT); + thread->SysReturnError(-1); return; + } + + params->stage = 0; + params->storage = NULL; + params->fsDriver = NULL; + params->directory = NULL; + } + + MountPoint* mount; + Device* device = NULL; + + switch ( params->stage ) + { + // Get a handle to the storage device. + case 0: params->stage++; + + mount = Mount::GetMountPoint(¶ms->userDevicePath); + if ( mount == NULL ) { Error::Set(Error::BADINPUT); break; } + + ASSERT(params->mode & O_USERSPACEABLE == 0); + if ( !mount->fs->Open(params->userDevicePath, params->mode | O_EXCLUSIVELY, 0, ¶ms->callbackInfo, thread) ) { return; } + + // Validate the properness of the storage device. + case 1: params->stage++; + device = params->callbackInfo.device; + + // Did it exist/could we open it/did we have permission? + if ( unlikely(device == NULL) ) { Error::Set(params->callbackInfo.deviceError); break; } + + // Is it a buffer? + if ( unlikely(!device->IsType(Device::BUFFER)) ) { Error::Set(Error::ENOTBLK); break; } + + params->storage = (DevBuffer*) device; device = NULL; + + // Get a handle to the destination directory. + case 2: params->stage++; + + mount = Mount::GetMountPoint(¶ms->userTargetPath); + if ( mount == NULL ) { Error::Set(Error::BADINPUT); break; } + + // TODO: Figure out some good mode flags here! + // TODO: Make sure the FS driver forces the dest dir to be empty! + if ( !mount->fs->Open(params->userTargetPath, O_RDWR | O_DIRECTORY | O_MOUNT, 0, ¶ms->callbackInfo, thread) ) { return; } + + // Validate the properness of the destination directory. + case 2: params->stage++; + device = params->callbackInfo.device; + + // Did it exist/could we open it? + if ( unlikely(device == NULL) ) { Error::Set(params->callbackInfo.deviceError); break; } + + // Is it a directory? + if ( unlikely(!device->IsType(Device::DIRECTORY)) ) { Error::Set(Error::ENOTDIR); break; } + + params->directory = (DevDirectory*) device; device = NULL; + + // Validate that the user owns the directory. + if ( !params->directory->IsOwner(thread->GetProcess()->GetUser()) ) { Error::Set(Error::EPERM); break; } + + // TODO: Add a run-time assertion that the dir is empty! + + // Load the proper driver for this file system type. + case 3: params->stage++; + + // TODO: Make an async interface that can scan a device! + params->fsDriver = FileSystem::CreateDriver(params->userDriverName); + if ( params->fsDriver == NULL ) { Error::Set(Error::ENODEV); break; } + + // Now bind the file system driver to the device and directory. + case 4: params->stage++; + MountPoint* newMount = new MountPoint(); + + newMount->device = params->storage; + newMount->fs = params->fsDriver; + + // TODO: Actually do the mounting! + + // Check if everything went well. + case 4: + // TODO: Check if everything went well! + thread->SysReturn(0); return; + } + + if ( device != NULL ) { device->close(); } + if ( params->storage != NULL ) { params->storage->close(); } + if ( params->directory != NULL ) { params->directory->close(); } + if ( params->fsDriver != NULL ) { params->fsDriver->close(); } + + thread->SysReturnError(-1); return; + } + } + + namespace Mount + { + MountPoint* GetMountPoint(const char** path, Thread* thread) + { + ASSERT(path != NULL); + ASSERT(*path != NULL); + ASSERT(thread != NULL); + + if ( unlikely(**path != '/') ) { return NULL; } (*path)++; + MountPoint* currentFS = thread->GetProcess->GetRootFS(); + + ASSERT(currentFS != NULL); + + // Simply check if path belongs to a child mount point. + for ( MountPoint* considering = currentFS->child; considering != NULL; considering = considering->nextSibling ) + { + ASSERT(considering->IsSane()); + + size_t consideringPathLen = String::Length(considering->path); + if ( String::CompareN(*path, considering->path, consideringPathLen) == 0 ) + { + // Check if this is the right dir! + char lastChar = (*path)[consideringPathLen]; + + if ( lastChar == '/' ) { (*path) += consideringPathLen + 1; } + else if ( lastChar == '\0' ) { (*path) += consideringPathLen + 0; } + else { continue; } + + // Check if the mountpoint isn't ready. + if ( considering->waiting != NULL ) { Error::Set(Error::EBUSY); return NULL; } + + currentFS = considering; + considering = currentFS->child; + } + } + + ASSERT(currentFS->fs != NULL); + + return currentFS; + } + } +} + + diff --git a/sortix/mount.h b/sortix/mount.h new file mode 100644 index 00000000..a56781d8 --- /dev/null +++ b/sortix/mount.h @@ -0,0 +1,75 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + mount.h + Handles system wide mount points and initialization of new file systems. + +******************************************************************************/ + +#ifndef SORTIX_MOUNT_H +#define SORTIX_MOUNT_H + +namespace Sortix +{ + class Device; + class DevFileSystem; + class DevBuffer; + class Process; + + class MountPoint + { + public: + MountPoint(); + ~MountPoint(); + + public: + const char* path; + DevFileSystem* fs; + DevBuffer* device; + nat flags; + + public: + Thread* waiting; + int* waitingResult; + + public: + bool Mount(); + + public: + bool IsSane() { return path != NULL && fs != NULL && device != NULL; } + + }; + + namespace Mount + { + void Init(); + MountPoint* GetMountPoint(const char*& path, Thread* thread); + void OnMountFailure(MountPoint* mountPoint, int cause); + void OnMountSuccess(MountPoint* mountPoint); + } + + namespace Syscall + { + void SysOpen(Thread* thread); + void SysMount(Thread* thread); + } +} + +#endif + diff --git a/sortix/multiboot.h b/sortix/multiboot.h new file mode 100644 index 00000000..937fcb06 --- /dev/null +++ b/sortix/multiboot.h @@ -0,0 +1,224 @@ +/* multiboot.h - Multiboot header file. */ +/* Copyright (C) 1999,2003,2007,2008,2009 Free Software Foundation, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ANY + * DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef MULTIBOOT_HEADER +#define MULTIBOOT_HEADER 1 + +/* How many bytes from the start of the file we search for the header. */ +#define MULTIBOOT_SEARCH 8192 + +/* The magic field should contain this. */ +#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 + +/* This should be in %eax. */ +#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 + +/* The bits in the required part of flags field we don't support. */ +#define MULTIBOOT_UNSUPPORTED 0x0000fffc + +/* Alignment of multiboot modules. */ +#define MULTIBOOT_MOD_ALIGN 0x00001000 + +/* Alignment of the multiboot info structure. */ +#define MULTIBOOT_INFO_ALIGN 0x00000004 + +/* Flags set in the 'flags' member of the multiboot header. */ + +/* Align all boot modules on i386 page (4KB) boundaries. */ +#define MULTIBOOT_PAGE_ALIGN 0x00000001 + +/* Must pass memory information to OS. */ +#define MULTIBOOT_MEMORY_INFO 0x00000002 + +/* Must pass video information to OS. */ +#define MULTIBOOT_VIDEO_MODE 0x00000004 + +/* This flag indicates the use of the address fields in the header. */ +#define MULTIBOOT_AOUT_KLUDGE 0x00010000 + +/* Flags to be set in the 'flags' member of the multiboot info structure. */ + +/* is there basic lower/upper memory information? */ +#define MULTIBOOT_INFO_MEMORY 0x00000001 +/* is there a boot device set? */ +#define MULTIBOOT_INFO_BOOTDEV 0x00000002 +/* is the command-line defined? */ +#define MULTIBOOT_INFO_CMDLINE 0x00000004 +/* are there modules to do something with? */ +#define MULTIBOOT_INFO_MODS 0x00000008 + +/* These next two are mutually exclusive */ + +/* is there a symbol table loaded? */ +#define MULTIBOOT_INFO_AOUT_SYMS 0x00000010 +/* is there an ELF section header table? */ +#define MULTIBOOT_INFO_ELF_SHDR 0X00000020 + +/* is there a full memory map? */ +#define MULTIBOOT_INFO_MEM_MAP 0x00000040 + +/* Is there drive info? */ +#define MULTIBOOT_INFO_DRIVE_INFO 0x00000080 + +/* Is there a config table? */ +#define MULTIBOOT_INFO_CONFIG_TABLE 0x00000100 + +/* Is there a boot loader name? */ +#define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x00000200 + +/* Is there a APM table? */ +#define MULTIBOOT_INFO_APM_TABLE 0x00000400 + +/* Is there video information? */ +#define MULTIBOOT_INFO_VIDEO_INFO 0x00000800 + +#ifndef ASM_FILE + +typedef unsigned short multiboot_uint16_t; +typedef unsigned int multiboot_uint32_t; +typedef unsigned long long multiboot_uint64_t; + +struct multiboot_header +{ + /* Must be MULTIBOOT_MAGIC - see above. */ + multiboot_uint32_t magic; + + /* Feature flags. */ + multiboot_uint32_t flags; + + /* The above fields plus this one must equal 0 mod 2^32. */ + multiboot_uint32_t checksum; + + /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */ + multiboot_uint32_t header_addr; + multiboot_uint32_t load_addr; + multiboot_uint32_t load_end_addr; + multiboot_uint32_t bss_end_addr; + multiboot_uint32_t entry_addr; + + /* These are only valid if MULTIBOOT_VIDEO_MODE is set. */ + multiboot_uint32_t mode_type; + multiboot_uint32_t width; + multiboot_uint32_t height; + multiboot_uint32_t depth; +}; + +/* The symbol table for a.out. */ +struct multiboot_aout_symbol_table +{ + multiboot_uint32_t tabsize; + multiboot_uint32_t strsize; + multiboot_uint32_t addr; + multiboot_uint32_t reserved; +}; +typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t; + +/* The section header table for ELF. */ +struct multiboot_elf_section_header_table +{ + multiboot_uint32_t num; + multiboot_uint32_t size; + multiboot_uint32_t addr; + multiboot_uint32_t shndx; +}; +typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t; + +struct multiboot_info +{ + /* Multiboot info version number */ + multiboot_uint32_t flags; + + /* Available memory from BIOS */ + multiboot_uint32_t mem_lower; + multiboot_uint32_t mem_upper; + + /* "root" partition */ + multiboot_uint32_t boot_device; + + /* Kernel command line */ + multiboot_uint32_t cmdline; + + /* Boot-Module list */ + multiboot_uint32_t mods_count; + multiboot_uint32_t mods_addr; + + union + { + multiboot_aout_symbol_table_t aout_sym; + multiboot_elf_section_header_table_t elf_sec; + } u; + + /* Memory Mapping buffer */ + multiboot_uint32_t mmap_length; + multiboot_uint32_t mmap_addr; + + /* Drive Info buffer */ + multiboot_uint32_t drives_length; + multiboot_uint32_t drives_addr; + + /* ROM configuration table */ + multiboot_uint32_t config_table; + + /* Boot Loader Name */ + multiboot_uint32_t boot_loader_name; + + /* APM table */ + multiboot_uint32_t apm_table; + + /* Video */ + multiboot_uint32_t vbe_control_info; + multiboot_uint32_t vbe_mode_info; + multiboot_uint16_t vbe_mode; + multiboot_uint16_t vbe_interface_seg; + multiboot_uint16_t vbe_interface_off; + multiboot_uint16_t vbe_interface_len; +}; +typedef struct multiboot_info multiboot_info_t; + +struct multiboot_mmap_entry +{ + multiboot_uint32_t size; + multiboot_uint64_t addr; + multiboot_uint64_t len; +#define MULTIBOOT_MEMORY_AVAILABLE 1 +#define MULTIBOOT_MEMORY_RESERVED 2 + multiboot_uint32_t type; +} __attribute__((packed)); +typedef struct multiboot_mmap_entry multiboot_memory_map_t; + +struct multiboot_mod_list +{ + /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */ + multiboot_uint32_t mod_start; + multiboot_uint32_t mod_end; + + /* Module command line */ + multiboot_uint32_t cmdline; + + /* padding to take it to 16 bytes (must be zero) */ + multiboot_uint32_t pad; +}; +typedef struct multiboot_mod_list multiboot_module_t; + +#endif /* ! ASM_FILE */ + +#endif /* ! MULTIBOOT_HEADER */ + diff --git a/sortix/mxfs.cpp b/sortix/mxfs.cpp new file mode 100644 index 00000000..39542a88 --- /dev/null +++ b/sortix/mxfs.cpp @@ -0,0 +1,429 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + mxfs.cpp + A working file system. + +******************************************************************************/ + +#include "platform.h" +#include +#include "mxfs.h" +#include "mount.h" + +using namespace Maxsi; + +namespace Sortix +{ + const size_t blockSize = 4096; + + #define FAIL() Failure(); return; + #define PENDING (Error::Last() != Error::PENDING) + #define ALRIGHT ( _storageStatus == Error::SUCCESS || _storageStatus == Error::PENDING || _storageStatus == Error::NONE ) + + class MXFSNode + { + public: + MXFSNode(); + ~MXFSNode(); + + public: + const char* name; + MXFSNode* prevSibling; + MXFSNode* nextSibling; + MXFSNode* child; + MXFSNode* parent; + + public: + inline bool IsDir() { type == 2; } + + public: + inline bool MatchesNameToken(const char* actual, const char* request, size_t requestLength) + { + return ( String::CompareN(actual, request, requestLength) == 0 ) && ( actual[requestLength] == '\0' ); + } + + MXFSNode* Search(const char* path) + { + ASSERT(IsDir()); + + // Search for the end of the next name token in path. + size_t nameLen = 0; const char* postToken = path; + while ( *postToken != '/' || *postToken != '\0' ) { postToken++; nameLen++; } + // Path must already have been sanitized, where all double slashes + // have been gracefully reduced to single slashes. + ASSERT(nameLen > 0); + + // Search for the next name token in path in this directory. + for ( MXFSNode* current = child; current != NULL; current = current->nextSibling ) + { + // Check if we have a match. + if ( unlikely(MatchesNameToken(current->name, path, nameLen)) ) + { + // Was this node exactly what we requested? + if ( *postToken == '\0' ) { return current; } + + // Was a directory requested? + if ( *postToken == '/' && *(postToken+1) == '\0' ) + { + if ( current->IsDir() ) { return current; } else { Error::Set(Error::NOTDIR); return NULL; } + } + + // Get the next token. + const char* nextTokenStart = path + nameLen + 1; ASSERT(*nextTokeBegin != '\0'); + + // Alright, search the child directory. + return Search(current->child, nextTokenStart); + } + } + + Error::Set(Error::NOTFOUND); + return NULL; + } + + public: + nat type; + uint32_t type; + int32_t owner; + int32_t group; + uint32_t permissions; + uint64_t length; + uint64_t blockId; + uint64_t siblingBlockId; // should only be used for recursive travelling. + + }; + + MXFSNode::MXFSNode() + { + name = NULL; + prevSibling = NULL; + nextSibling = NULL; + parent = NULL; + child = NULL; + type = 0; + owner = 0; + group = 0; + permissions = 0; + length = 0; + blockId = 0; + siblingBlockId = 0; + } + + MXFSNode::MXFSNode() + { + // If nextSibling exists, then we are called from his destructor. + // If parent exists, then we are called from his destructor. + delete[] name; + delete child; + delete nextSibling; + } + + struct MXFSHeader + { + uint32_t magic; + uint32_t version; + uint64_t size; + uint64_t root; + uint64_t unusedBlock; + uint8_t unused[blockSize - (32 + 64 + 64 + 64) / 8]; + } SORTIX_PACKED; + + struct MXFSNodeHeader + { + const uint32_t FILE = 1; + const uint32_t DIR = 2; + + uint32_t magic; + uint32_t type; + uint64_t prevNode; + uint64_t nextNode; + int32_t owner; + int32_t group; + uint32_t permissions; + uint64_t length; + uint64_t nextBlock; + uint32_t continuous; + uint8_t nameLen; + char name[255]; + union + { + struct + { + uint64_t child; + }; + uint8_t data[blockSize - (32 + 32 +32 + 32 + 32 + 64 + 64 + 32) / 8 - 256]; + }; + } SORTIX_PACKED; + + struct MXFSBlock + { + uint64_t node; + uint64_t lastBlock; + uint32_t lastBlockContinuous; + uint64_t nextBlock; + uint32_t continuous; + uint8_t data[blockSize - (64 + 64 + 32 + 64 + 32) / 8]; + } SORTIX_PACKED; + + struct MXFSBlockContinuous + { + uint32_t data[4096]; + } SORTIX_PACKED; + + DevMXFS::DevMXFS() + { + ASSERT( sizeof(MXFSHeader) == blockSize ); + ASSERT( sizeof(MXFSNodeHeader) == blockSize ); + ASSERT( sizeof(MXFSBlock) == blockSize ); + ASSERT( sizeof(MXFSBlockContinuous) == blockSize ); + + _storage = NULL; + _children = NULL; + _mountPoint = NULL; + _block = NULL; + _state = 0; + _root = NULL; + + _storageStatus = Error::NONE; + } + + DevMXFS::~DevMXFS() + { + DevMXFSFile* child = _children; + + while ( child ) + { + child->_parent = NULL; + child = child->nextSibling; + } + + delete[] _block; + delete _root; + + Mount::OnMountFailure(_mountPoint, Error::SUCCESS); + } + + int DevMXFS::Initialize(MountPoint* mountPoint, const char* /*commandLine*/) + { + _block = new uint8_t[blockSize]; + if ( _block == NULL ) { return Error::OUTOFMEM); } + + ASSERT(_storage == NULL); + ASSERT(_mountPoint == NULL); + + _storage = mountPoint->device; + _mountPoint = mountPoint; + + ASSERT(_storage != NULL); + ASSERT(_mountPoint != NULL); + ASSERT(_mountPoint->fs == this); + + requestThink(); + + return Error::PENDING; + } + + uint8_t* DevMXFS::GetBlock(intmax_t blockId) + { + ASSERT( _storageStatus != Error::PENDING || _blockId == blockId ); + + if ( _blockId == blockId ) + { + if ( _storageStatus == Error::SUCCESS ) { return _block; } else { return NULL; } + } + + if ( !_storage->seek(blockId * blockSize) ) { Failure(Error::Last()); } + if ( _storage->read(block, blockSize) == SIZE_MAX ) + { + if ( PENDING ) { return NULL; } else { Failure(Error::Last()); } + } + + return _block; + } + + MXFSNode* DevMXFS::Search(const char* path); + { + if ( unlikely(_storage == NULL) ) { Error::Set(_storageStatus); return NULL; } + ASSERT(_root != NULL); + + // If the root was requested, return it. + if ( *path != '/' ) { Error::Set(Error::NOTFOUND); return NULL; } + if ( *(path+1) == '\0' ) { return _root; } path++; + + return _root->Search(path+1); + } + + void DevMXFS::Think() + { + if ( !_mountPoint ) { return; } + if ( !ALRIGHT ) { FAIL(); } + + // Initialize the filesystem by reading the headers. + if ( _state == 0 ) + { + if ( !ParseHeader ) { return; } + + // The super block looks good, so far. + _state++; + } + + // Load the tree of files and directories. + if ( _state == 1 ) + { + if ( !ParseBlocks() ) { return; } + + // Alright, we now got the tree of everything loaded! + if ( parsingBlock == 0 ) { _state++; } + } + + // Let the mounting system know we are up and running. + if ( _state == 2 ) + { + Mount::OnMountSuccess(_mountPoint); _state++; + } + + // Alright, now handle requests from various file devices. + if ( _state == 3) + { + + } + } + + + bool DevMXFS::ParseHeader() + { + // Get the super block and read the filesystem's headers. + MXFSHeader* fsHeader = (MXFSHeader*) getBlock(0); if ( !fsHeader ) { return false; } + + // Validate that we are dealing with a MXFS. + if ( MXFSHeader->magic != 'M' << 24 | 'X' << 16 | 'F' << 8 | 'S' ) { Failure(Error::BADINPUT); return false; } + + // Retrieve and validate the size of the file system. + if ( _storage.size() < MXFSHeader->size ) { Failure(Error::CORRUPT); return false; } + + // Validate the existence of the root directory. + if ( MXFSHeader->root == 0 ) { Failure(Error::CORRUPT); return false; } + _parsingBlock = MXFSHeader->root; + + // Validate the existence of the root directory. + if ( MXFSHeader->version != 0 ) { Failure(Error::NOSUPPORT); return false;} + + return true; + } + + bool DevMXFS::ParseBlocks() + { + while ( _parsingBlock != 0 ) + { + MXFSNodeHeader* nodeHeader = (MXFSHeader*) getBlock(_parsingBlock); if ( !nodeHeader ) { return false; } + + // Validate that we are dealing with a node header. + if ( MXFSHeader->magic != 'N' << 24 | 'O' << 16 | 'D' << 8 | 'E' ) { Failure(Error::CORRUPT); return false; } + + // Create a node we can put in your FS tree. + MXFSNode* node = new MXFSNode(); + if ( !node ) { Failure(Error::Last()); return false; } + + // Copy information from the header to our tree node. + // TODO: copy other header information. + node->type = nodeHeader->type; + + // Figure out where to insert our node. + if ( unlikely(_root == NULL) ) + { + _root = node; + + // Make sure the root is a directory without siblings. + if ( !MXFSHeader->type == MXFSNodeHeader::DIR ) { Failure(Error::CORRUPT); return false; } + if ( !MXFSHeader->nextNode != 0 ) { Failure(Error::CORRUPT); return false; } + + // Now visit its children. + _parsingBlock = MXFSHeader->child; + _parsingLastNode = NULL; + _parsingParent = node; + } + else + { + // Insert the node in our tree. + if ( _parsingLastNode ) + { + _parsingLastNode->nextSibling = node; + node->prevSibling = _parsingLastNode; + } + + if ( _parsingParent->child == NULL ) { _parsingParent->child = node; } + node->parent = _parsingParent; + + // Retrieve a copy of the new nodes name and validate it. + node->name = new char[nodeHeader->nameLen + 1]; + if ( !node->name ) { Failure(Error::Last()); return false; } + Memory::Copy(node->name, nodeHeader->name, nodeHeader->nameLen); + node->name[nodeHeader->nameLen] = 0; + if ( !legalNodeName ) { Failure(Error::CORRUPT); return false; } + + // If node is a directory, visit its children. + if ( MXFSHeader->type == MXFSNodeHeader::DIR && MXFSHeader->child != 0 ) + { + _parsingLastNode = NULL; + _parsingParent = node; + _parsingBlock = MXFSHeader->child; + node->siblingBlockId = node->nextNode; + + continue; + } + + // If it exists, visit the next node in this directory. + if ( nodeHeader->nextNode != 0 ) + { + _parsingBlock = nodeHeader->nextNode; + _parsingLastNode = node; + + continue; + } + + // If we reached the end of a directory, simply continue from + // the parent directory, until we reached the root or we found + // an unfinished directory. + while ( true ) + { + node = node->parent; + if ( unlikely(node == NULL) ) { _parsingBlock = 0; break; } + if ( node->siblingBlockId != 0 ) { _parsingBlock = siblingBlockId; _parsingParent = node->parent; _parsingLastNode = node->prevSibling; break; } + } + } + } + + return true; + } + + void DevMXFS::Failure(int cause = Error::SUCCESS) + { + if ( cause != Error::SUCCESS ) { _storageStatus = cause; } + Mount::OnMountFailure(_mountPoint, _storageStatus); + + _mountPoint = NULL; + _storage = NULL; + delete[] _block; _block = NULL; + } + + Device* DevMXFS::Open(const char* path, nat flags, nat permissions, nat* type) + { + + } +} diff --git a/sortix/mxfs.h b/sortix/mxfs.h new file mode 100644 index 00000000..2ea2ef59 --- /dev/null +++ b/sortix/mxfs.h @@ -0,0 +1,118 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + mxfs.h + A working file system. + +******************************************************************************/ + +#ifndef SORTIX_MXFS_H +#define SORTIX_MXFS_H + +#include "stream.h" +#include "filesystem.h" + +namespace Sortix +{ + class DevMXFS; + class DevMXFSFile; + class MXFSNode; + + class DevMXFSFile : public DevBuffer + { + friend class DevMXFS; + + private: + DevMXFSFile* _prevSibling; + DevMXFSFile* _nextSibling; + + private: + DevMXFS* _parent; + + private: + intmax_t _beginning; + intmax_t _size; + + public: + virtual size_t Write(const void* buffer, size_t bufferSize) = 0; + virtual size_t ReadSome(const void* buffer, size_t bufferSize) = 0; + + public: + virtual size_t BlockSize() = 0; + virtual intmax_t Size() = 0; + virtual intmax_t Position() = 0; + virtual bool Seek(intmax_t position) = 0; + virtual bool Resize(intmax_t size) = 0; + + }; + + class DevMXFS : public DevFileSystem + { + friend class DevMXFSFile; + + public: + DevMXFS(); + virtual ~DevMXFS(); + + public: + virtual int Initialize(MountPoint* mountPoint, const char* commandLine); + + private: + MountPoint* _mountPoint; + DevBuffer* _storage; + DevMXFSFile* _children; + MXFSNode* _root; + + private: + nat _state; + uint64_t _parsingBlock; + MXFSNode* _parsingLastNode; + MXFSNode* _parsingParent; + + private: + volatile int _storageStatus; + intmax_t _blockId; + uint8_t* _block; + intmax_t _fsSize; + + private: + uint8_t* GetBlock(intmax_t blockId); + + private: + bool ParseHeader(); + bool ParseBlocks(); + void Failure(); + + private: + MXFSNode* Search(const char* path); + + protected: + virtual void Think(); + + public: + virtual bool Sync(); + + public: + virtual Device* Open(const char* path, nat flags, nat permissions, nat* type); + + }; +} + +#endif + diff --git a/sortix/panic.cpp b/sortix/panic.cpp new file mode 100644 index 00000000..4db5614e --- /dev/null +++ b/sortix/panic.cpp @@ -0,0 +1,92 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + panic.cpp + Displays an error whenever something critical happens. + +******************************************************************************/ + +#include "platform.h" +#include +#include +#include "log.h" +#include "panic.h" + +using namespace Maxsi; + +namespace Sortix +{ + bool longpanic = false; + + void PanicInit() + { + if ( longpanic ) + { + Log::Print("\e[m\e[31m\e[2J\e[H"); + Log::Print(" _ "); + Log::Print(" / \\ "); + Log::Print(" /\\ /\\ / \\ "); + Log::Print(" / \\ / \\ | | "); + Log::Print(" / \\/ \\ | | "); + Log::Print(" | X X \\_______________________ / | "); + Log::Print(" | | "); + Log::Print(" | _________ / "); + Log::Print(" \\ / "); + Log::Print(" ------ --------------- ---/ "); + Log::Print(" / \\ / \\ "); + Log::Print(" / \\ / \\ "); + Log::Print(" / \\ / \\ "); + Log::Print(" /_____________\\ /____________\\ "); + Log::Print(" "); + Log::Print(" "); + Log::Print(" RED MAXSI OF DEATH "); + Log::Print(" "); + } + else + { + Log::Print("\e[m\e[31m\e[0J"); + Log::Print("RED MAXSI OF DEATH\n"); + } + } + + void PanicHalt() + { + #ifdef JSSORTIX + JSSortix::Exit(); + #endif + HaltKernel(); + } + + extern "C" void Panic(const char* Error) + { + PanicInit(); + Log::Print(Error); + PanicHalt(); + } + + extern "C" void PanicF(const char* Format, ...) + { + PanicInit(); + va_list list; + va_start(list, Format); + Log::PrintFV(Format, list); + va_end(list); + PanicHalt(); + } +} diff --git a/sortix/panic.h b/sortix/panic.h new file mode 100644 index 00000000..2cae0207 --- /dev/null +++ b/sortix/panic.h @@ -0,0 +1,42 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + panic.h + Displays an error whenever something critical happens. + +******************************************************************************/ + +#ifndef SORTIX_PANIC_H +#define SORTIX_PANIC_H + +namespace Sortix +{ + // This function halts the kernel. If you wish to give an error message first, + // then you ought to call Panic instead. + extern "C" void SORTIX_NORETURN HaltKernel(); + + extern "C" void SORTIX_NORETURN Panic(const char* Error); + extern "C" void SORTIX_NORETURN PanicF(const char* Format, ...); + extern "C" void WaitForInterrupt(); +} + + + +#endif + diff --git a/sortix/pci.cpp b/sortix/pci.cpp new file mode 100644 index 00000000..5cebd557 --- /dev/null +++ b/sortix/pci.cpp @@ -0,0 +1,292 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + pci.h + Handles basic PCI bus stuff. + +******************************************************************************/ + +#include "platform.h" +#include "pci.h" + +#include "globals.h" +#include "iprintable.h" +#include "log.h" + +namespace Sortix +{ + namespace PCI + { + + const uint16_t Config_Address = 0xCF8; + const uint16_t Config_Data = 0xCFC; + + uint32_t SwapBytes(uint32_t I) + { + return (I >> 24) | ((I >> 8) & 0x0000FF00) | ((I << 8) & 0x00FF0000) | (I << 24); + } + + const char* ToDeviceDesc(uint32_t ProductInfo, uint32_t DeviceType) + { + uint32_t Class = (DeviceType) >> 24; + uint32_t SubClass = (DeviceType >> 16) & 0xFF; + uint32_t ProgIF = (DeviceType >> 8) & 0xFF; + uint32_t RevisionID = (DeviceType) & 0xFF; + + if ( Class == 0x00 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "Any device except for VGA-Compatible devices"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "VGA-Compatible Device"; } + } + if ( Class == 0x01 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "SCSI Bus Controller"; } + if ( SubClass == 0x01 ) { return "IDE Controller"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "Floppy Disk Controller"; } + if ( SubClass == 0x03 && ProgIF == 0x00 ) { return "IPI Bus Controller"; } + if ( SubClass == 0x04 && ProgIF == 0x00 ) { return "RAID Controller"; } + if ( SubClass == 0x05 && ProgIF == 0x20 ) { return "ATA Controller (Single DMA)"; } + if ( SubClass == 0x05 && ProgIF == 0x30 ) { return "ATA Controller (Chained DMA)"; } + if ( SubClass == 0x06 && ProgIF == 0x00 ) { return "Serial ATA (Direct Port Access)"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Mass Storage Controller"; } + } + if ( Class == 0x02 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "Ethernet Controller"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "Token Ring Controller"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "FDDI Controller"; } + if ( SubClass == 0x03 && ProgIF == 0x00 ) { return "ATM Controller"; } + if ( SubClass == 0x04 && ProgIF == 0x00 ) { return "ISDN Controller"; } + if ( SubClass == 0x05 && ProgIF == 0x00 ) { return "WorldFip Controller"; } + if ( SubClass == 0x05 && ProgIF == 0x00 ) { return "ATA Controller (Chained DMA)"; } + if ( SubClass == 0x06 ) { return "PICMG 2.14 Multi Computing"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Network Controller"; } + } + if ( Class == 0x03 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "VGA-Compatible Controller"; } + if ( SubClass == 0x00 && ProgIF == 0x01 ) { return "8512-Compatible Controller"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "XGA Controller"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "3D Controller (Not VGA-Compatible)"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Display Controller"; } + } + if ( Class == 0x04 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "Video Device"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "Audio Device"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "Computer Telephony Device"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Multimedia Device"; } + } + if ( Class == 0x05 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "RAM Controller"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "Flash Controller"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Memory Controller"; } + } + if ( Class == 0x06 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "Host Bridge"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "ISA Bridge"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "EISA Bridge"; } + if ( SubClass == 0x03 && ProgIF == 0x00 ) { return "MCA Bridge"; } + if ( SubClass == 0x04 && ProgIF == 0x00 ) { return "PCI-to-PCI Bridge"; } + if ( SubClass == 0x04 && ProgIF == 0x01 ) { return "PCI-to-PCI Bridge (Subtractive Decode)"; } + if ( SubClass == 0x05 && ProgIF == 0x00 ) { return "PCMCIA Bridge"; } + if ( SubClass == 0x06 && ProgIF == 0x00 ) { return "NuBus Bridge"; } + if ( SubClass == 0x07 && ProgIF == 0x00 ) { return "CardBus Bridge"; } + if ( SubClass == 0x08 ) { return "RACEway Bridge"; } + if ( SubClass == 0x09 && ProgIF == 0x40 ) { return "PCI-to-PCI Bridge (Semi-Transparent, Primary)"; } + if ( SubClass == 0x09 && ProgIF == 0x80 ) { return "PCI-to-PCI Bridge (Semi-Transparent, Secondary)"; } + if ( SubClass == 0x0A && ProgIF == 0x00 ) { return "InfiniBrand-to-PCI Host Bridge"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Bridge Device"; } + } + if ( Class == 0x07 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "Generic XT-Compatible Serial Controller"; } + if ( SubClass == 0x00 && ProgIF == 0x01 ) { return "16450-Compatible Serial Controller"; } + if ( SubClass == 0x00 && ProgIF == 0x02 ) { return "16550-Compatible Serial Controller"; } + if ( SubClass == 0x00 && ProgIF == 0x03 ) { return "16650-Compatible Serial Controller"; } + if ( SubClass == 0x00 && ProgIF == 0x04 ) { return "16750-Compatible Serial Controller"; } + if ( SubClass == 0x00 && ProgIF == 0x05 ) { return "16850-Compatible Serial Controller"; } + if ( SubClass == 0x00 && ProgIF == 0x06 ) { return "16950-Compatible Serial Controller"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "Parallel Port"; } + if ( SubClass == 0x01 && ProgIF == 0x01 ) { return "Bi-Directional Parallel Port"; } + if ( SubClass == 0x01 && ProgIF == 0x02 ) { return "ECP 1.X Compliant Parallel Port"; } + if ( SubClass == 0x01 && ProgIF == 0x03 ) { return "IEEE 1284 Controller"; } + if ( SubClass == 0x01 && ProgIF == 0xFE ) { return "IEEE 1284 Target Device"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "Multiport Serial Controller"; } + if ( SubClass == 0x03 && ProgIF == 0x00 ) { return "Generic Modem"; } + if ( SubClass == 0x03 && ProgIF == 0x01 ) { return "Hayes Compatible Modem (16450-Compatible Interface)"; } + if ( SubClass == 0x03 && ProgIF == 0x02 ) { return "Hayes Compatible Modem (16550-Compatible Interface)"; } + if ( SubClass == 0x03 && ProgIF == 0x03 ) { return "Hayes Compatible Modem (16650-Compatible Interface)"; } + if ( SubClass == 0x03 && ProgIF == 0x04 ) { return "Hayes Compatible Modem (16750-Compatible Interface)"; } + if ( SubClass == 0x04 && ProgIF == 0x00 ) { return "IEEE 488.1/2 (GPIB) Controller"; } + if ( SubClass == 0x05 && ProgIF == 0x00 ) { return "Smart Card"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Communications Device"; } + } + if ( Class == 0x08 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "Generic 8259 PIC"; } + if ( SubClass == 0x00 && ProgIF == 0x01 ) { return "ISA PIC"; } + if ( SubClass == 0x00 && ProgIF == 0x02 ) { return "EISA PIC"; } + if ( SubClass == 0x00 && ProgIF == 0x10 ) { return "I/O APIC Interrupt Controller"; } + if ( SubClass == 0x00 && ProgIF == 0x20 ) { return "I/O(x) APIC Interrupt Controller"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "Generic 8237 DMA Controller"; } + if ( SubClass == 0x01 && ProgIF == 0x01 ) { return "ISA DMA Controller"; } + if ( SubClass == 0x01 && ProgIF == 0x02 ) { return "EISA DMA Controller"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "Generic 8254 System Timer"; } + if ( SubClass == 0x02 && ProgIF == 0x01 ) { return "ISA System Timer"; } + if ( SubClass == 0x02 && ProgIF == 0x02 ) { return "EISA System Timer"; } + if ( SubClass == 0x03 && ProgIF == 0x00 ) { return "Generic RTC Controller"; } + if ( SubClass == 0x03 && ProgIF == 0x01 ) { return "ISA RTC Controller"; } + if ( SubClass == 0x04 && ProgIF == 0x01 ) { return "Generic PCI Hot-Plug Controller"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other System Peripheral"; } + } + if ( Class == 0x09 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "Keyboard Controller"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "Digitizer"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "Mouse Controller"; } + if ( SubClass == 0x03 && ProgIF == 0x00 ) { return "Scanner Controller"; } + if ( SubClass == 0x04 && ProgIF == 0x00 ) { return "Gameport Controller (Generic)"; } + if ( SubClass == 0x04 && ProgIF == 0x10 ) { return "Gameport Controller (Legacy)"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Input Controller"; } + } + if ( Class == 0x0A ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "Generic Docking Station"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Docking Station"; } + } + if ( Class == 0x0B ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "386 Processor"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "486 Processor"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "Pentium Processor"; } + if ( SubClass == 0x10 && ProgIF == 0x00 ) { return "Alpha Processor"; } + if ( SubClass == 0x20 && ProgIF == 0x00 ) { return "PowerPC Processor"; } + if ( SubClass == 0x30 && ProgIF == 0x00 ) { return "MIPS Processor"; } + if ( SubClass == 0x40 && ProgIF == 0x00 ) { return "Co-Processor"; } + } + if ( Class == 0x0C ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "IEEE 1394 Controller (FireWire)"; } + if ( SubClass == 0x00 && ProgIF == 0x10 ) { return "IEEE 1394 Controller (1394 OpenHCI Spec)"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "ACCESS.bus"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "SSA"; } + if ( SubClass == 0x03 && ProgIF == 0x00 ) { return "USB (Universal Host Controller Spec)"; } + if ( SubClass == 0x03 && ProgIF == 0x10 ) { return "USB (Open Host Controller Spec)"; } + if ( SubClass == 0x03 && ProgIF == 0x20 ) { return "USB2 Host Controller (Intel Enhanced Host Controller Interface)"; } + if ( SubClass == 0x03 && ProgIF == 0x80 ) { return "USB"; } + if ( SubClass == 0x03 && ProgIF == 0xFE ) { return "USB (Not Host Controller)"; } + if ( SubClass == 0x04 && ProgIF == 0x00 ) { return "Fibre Channel"; } + if ( SubClass == 0x05 && ProgIF == 0x00 ) { return "SMBus"; } + if ( SubClass == 0x06 && ProgIF == 0x00 ) { return "InfiniBand"; } + if ( SubClass == 0x07 && ProgIF == 0x00 ) { return "IPMI SMIC Interface"; } + if ( SubClass == 0x07 && ProgIF == 0x01 ) { return "IPMI Kybd Controller Style Interface"; } + if ( SubClass == 0x07 && ProgIF == 0x02 ) { return "IPMI Block Transfer Interface"; } + if ( SubClass == 0x08 && ProgIF == 0x02 ) { return "SERCOS Interface Standard (IEC 61491)"; } + if ( SubClass == 0x09 && ProgIF == 0x00 ) { return "CANbus"; } + } + if ( Class == 0x0E ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "Message FIFO"; } + if ( SubClass == 0x00 ) { return "I20 Architecture"; } + } + if ( Class == 0x0F ) + { + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "TV Controller"; } + if ( SubClass == 0x02 && ProgIF == 0x00 ) { return "Audio Controller"; } + if ( SubClass == 0x03 && ProgIF == 0x00 ) { return "Voice Controller"; } + if ( SubClass == 0x04 && ProgIF == 0x00 ) { return "Data Controller"; } + } + if ( Class == 0x10 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "Network and Computing Encryption/Decryption"; } + if ( SubClass == 0x10 && ProgIF == 0x00 ) { return "Entertainment Encryption/Decryption"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Encryption/Decryption"; } + } + if ( Class == 0x11 ) + { + if ( SubClass == 0x00 && ProgIF == 0x00 ) { return "DPIO Modules"; } + if ( SubClass == 0x01 && ProgIF == 0x00 ) { return "Performance Counters"; } + if ( SubClass == 0x10 && ProgIF == 0x00 ) { return "Communications Syncrhonization Plus Time and Frequency Test/Measurment"; } + if ( SubClass == 0x20 && ProgIF == 0x00 ) { return "Management Card"; } + if ( SubClass == 0x80 && ProgIF == 0x00 ) { return "Other Data Acquisition/Signal Processing Controller"; } + } + + return NULL; + } + + void Init() + { + Log::Print("PCI Devices: "); + + for ( nat Bus = 0; Bus < 256; Bus++ ) + { + for ( nat Slot = 0; Slot < 32; Slot++ ) + { + for ( nat Function = 0; Function < 8; Function++ ) + { + uint32_t ProductInfo = CheckDevice(Bus, Slot, Function); + + if ( ProductInfo == 0xFFFFFFFF ) { continue; } + + uint32_t DeviceType = ReadLong(Bus, Slot, Function, 0x08); + + const char* DeviceDesc = ToDeviceDesc(ProductInfo, DeviceType); + + if ( DeviceDesc != NULL ) + { + Log::PrintF("%s, ", DeviceDesc); + } + else + { + Log::PrintF("Unknown PCI Device @ %x:%x.%x (ProductInfo=0x%x, DeviceType=0x%x), ", Bus, Slot, Function, ProductInfo, DeviceType); + } + } + } + } + + Log::Print("\b\b\n"); + } + + uint32_t ReadLong(uint8_t Bus, uint8_t Slot, uint8_t Function, uint8_t Offset) + { + unsigned long LBus = (unsigned long) Bus; + unsigned long LSlot = (unsigned long) Slot; + unsigned long LFunc = (unsigned long) Function; + + // create configuration address. + unsigned long Address = (unsigned long) ( (LBus << 16) | (LSlot << 11) | (LFunc << 8) | (Offset & 0xFC) | ((uint32_t) 0x80000000)); + + // Write out the address. + CPU::OutPortL(Config_Address, Address); + + // Read in the data. + return CPU::InPortL(Config_Data); + + } + + uint32_t CheckDevice(uint8_t Bus, uint8_t Slot, uint8_t Function) + { + return ReadLong(Bus, Slot, Function, 0); + } + } +} + diff --git a/sortix/pci.h b/sortix/pci.h new file mode 100644 index 00000000..d545c35f --- /dev/null +++ b/sortix/pci.h @@ -0,0 +1,39 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + pci.h + Handles basic PCI bus stuff. + +******************************************************************************/ + +#ifndef SORTIX_PCI_H +#define SORTIX_PCI_H + +namespace Sortix +{ + namespace PCI + { + void Init(); + uint32_t ReadLong(uint8_t Bus, uint8_t Slot, uint8_t Function, uint8_t Offset); + uint32_t CheckDevice(uint8_t Bus, uint8_t Slot, uint8_t Function = 0); + } +} + +#endif + diff --git a/sortix/platform.h b/sortix/platform.h new file mode 100644 index 00000000..04ab90de --- /dev/null +++ b/sortix/platform.h @@ -0,0 +1,82 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + platform.h + Defines platform specific stuff. + +******************************************************************************/ + +#ifndef SORTIX_PLATFORM_H +#define SORTIX_PLATFORM_H + + // Detect if we are using the GNU Compiler Collection + #if defined(__GNUC__) + #define COMPILER_GCC + #endif + + #ifdef COMPILER_GCC + #define SORTIX_NORETURN __attribute__((noreturn)) + #define SORTIX_MAYALIAS __attribute__((__may_alias__)) + #define SORTIX_PACKED __attribute__((packed)) + #define likely(x) __builtin_expect((x),1) + #define unlikely(x) __builtin_expect((x),0) + #else + #define SORTIX_NORETURN + #define SORTIX_MAYALIAS + #define SORTIX_PACKED + #define likely(x) (x) + #define unlikely(x) (x) + #endif + + + #include + + #ifdef JSSORTIX + namespace Sortix + { + namespace JSSortix + { + inline void __attribute__((noreturn)) Exit() + { + /* send reset command to the keyboard controller */ + asm volatile("out %%al, %%dx" : : "a" (0xfe), "d" (0x64)); + while (1); + } + } + } + #endif + + #if !defined(PLATFORM_SERIAL) && defined(JSSORTIX) + #define PLATFORM_SERIAL + #endif + + #define USER + + // Include some x86 headers. + #ifdef PLATFORM_X86 + #include "x86/x86.h" + #endif + + // Include some x64 headers. + #ifdef PLATFORM_X64 + #include "x64/x64.h" + #endif + +#endif + diff --git a/sortix/pong.cpp b/sortix/pong.cpp new file mode 100644 index 00000000..38d38638 --- /dev/null +++ b/sortix/pong.cpp @@ -0,0 +1,311 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + + with Sortix. If not, see . + + pong.cpp + ROBOT PONG ATTACK! + +******************************************************************************/ + +#include "platform.h" +#include +#include "globals.h" +#include "iirqhandler.h" +#include "iprintable.h" +#include "keyboard.h" +#include "time.h" +#include "vga.h" +#include "sound.h" +#include "pong.h" + +#ifdef JSSORTIX +#include "uart.h" +#endif + +using namespace Maxsi; + +namespace Sortix +{ + namespace Pong + { + const int Height = 25; + const int Width = 80; + const int PadSize = 5; + + nat Time; + nat NextUpdate; + bool InIntro; + + int P1Y; + int P2Y; + bool P1VUP; + bool P2VUP; + bool P1VDOWN; + bool P2VDOWN; + nat P1Score; + nat P2Score; + nat HardCore; + + int BallX; + int BallY; + int VelX; + int VelY; + int OldBallX; + int OldBallY; + + int SoundLeft; + + const nat GoalFreq = 800; + const nat CollisionFreq = 1200; + + void Init() + { + ClearScreen(); + + P1Y = (Height-PadSize) / 5; + P2Y = (Height-PadSize) / 5; + P1VUP = false; + P2VUP = false; + P1VDOWN = false; + P2VDOWN = false; + + Time = 0; + + SoundLeft = -1; + + Reset(); +#ifndef JSSORTIX + Intro(); +#endif + } + + void Intro() + { + InIntro = true; + + ClearScreen(); + + uint16_t* Destination = (uint16_t*) 0xB8000; + + const char* String = "THIS IS SORTIX PONG"; size_t StringLen = String::Length(String); + const char* Warn = "SortixV3-beta Edition"; size_t WarnLen = String::Length(Warn); + const char* Enter = "-- press enter to continue --"; size_t EnterLen = String::Length(Enter); + + // Copy and apply colors. + uint16_t Color = COLOR8_GREEN << 8; + + for ( size_t I = 0; I < StringLen; I++ ) { Destination[Width / 2 - StringLen / 2 + I + (Height/2)*Width] = (uint16_t)(String[I]) | Color; } + for ( size_t I = 0; I < WarnLen; I++ ) { Destination[Width / 2 - WarnLen / 2 + I + (Height/2 + 1)*Width] = (uint16_t)(Warn[I]) | Color; } + for ( size_t I = 0; I < EnterLen; I++ ) { Destination[Width / 2 - EnterLen / 2 + I + (Height/2 + 2)*Width] = (uint16_t)(Enter[I]) | Color; } + + } + + void ClearScreen() + { + uint16_t* Destination = (uint16_t*) 0xB8000; + + // Copy and apply colors. + for ( int Y = 0; Y < Height; Y++ ) + { + uint16_t Color = COLOR8_BLACK << 8; + + for ( int X = 0; X < Width; X++ ) + { + Destination[X + Y*Width] = ' ' | Color; + } + } + } + + void Reset() + { + P1Score = 0; + P2Score = 0; + InIntro = false; + BallX = Width/2; + BallY = Height/2; + OldBallX = BallX; + OldBallY = BallY; + VelX = -1; + VelY = -1; + HardCore = 60; + UpdateUI(); + } + + void Collision() + { + Sound::Play(CollisionFreq); + SoundLeft = 40; + } + + void Goal(nat Player) + { + uint16_t* Destination = (uint16_t*) 0xB8000; + Destination[BallX + BallY*Width] = ' ' | (COLOR8_WHITE << 8); + + BallX = Width/2; + BallY = Height/2; + + if ( Player == 1 ) + { + VelX = 1; + VelY = 1; + P1Score++; + } + else if ( Player == 2 ) + { + VelX = -1; + VelY = -1; + P2Score++; + } + + Sound::Play(GoalFreq); + SoundLeft = 50; + + //HardCore -= 2; + + UpdateUI(); + } + + void UpdateUI() + { + uint16_t* Destination = (uint16_t*) 0xB8000; + + for ( int X = 0; X < Width; X++ ) { Destination[X] = ' ' | (COLOR8_LIGHT_GREY << 12) | (COLOR8_RED << 8); } + + char Num[12]; + int Len; + + Len = UInt32ToString(P1Score, Num); + for ( int I = 0; I < Len; I++ ) { Destination[I] = ( Destination[I] & 0xFF00 ) | Num[I]; } + + Len = UInt32ToString(P2Score, Num); + for ( int I = 0; I < Len; I++ ) { Destination[Width - Len + I] = ( Destination[Width - Len + I] & 0xFF00 ) | Num[I]; } + } + + void Update() + { +#ifdef JSSORTIX + + while ( true ) + { + int C = UART::TryPopChar(); + + if ( C == 'w' || C == 'W' ) { P1VUP = true; P1VDOWN = false; } + if ( C == 's' || C == 'S' ) { P1VDOWN = true; P1VUP = false; } + if ( C == 'o' || C == 'O' ) { P2VUP = true; P1VDOWN = false; } + if ( C == 'l' || C == 'L' ) { P2VDOWN = true; P2VUP = false; } + + if ( C == -1 ) { break; } + } +#endif + + uint16_t* Destination = (uint16_t*) 0xB8000; + + int P1V = 0, P2V = 0; + + if ( P1VUP && !P1VDOWN ) { P1V = -1; } else if ( !P1VUP && P1VDOWN ) { P1V = 1; } + if ( P2VUP && !P2VDOWN ) { P2V = -1; } else if ( !P2VUP && P2VDOWN ) { P2V = 1; } + + if ( P1V < 0 && P1Y > 1 ) { P1Y--; } + if ( P1V > 0 && P1Y + PadSize < Height ) { P1Y++; } + if ( P2V < 0 && P2Y > 1 ) { P2Y--; } + if ( P2V > 0 && P2Y + PadSize < Height ) { P2Y++; } + + for ( int Y = 1; Y < Height; Y++ ) + { + uint16_t Color = ( Y < P1Y || Y >= P1Y + PadSize ) ? COLOR8_BLACK << 12 : COLOR8_RED << 12; Destination[Y*Width] = ' ' | Color; + } + + for ( int Y = 1; Y < Height; Y++ ) + { + uint16_t Color = ( Y < P2Y || Y >= P2Y + PadSize ) ? COLOR8_BLACK << 12 : COLOR8_BLUE << 12; Destination[Width-1 + Y*Width] = ' ' | Color; + } + + if ( BallY + VelY <= 1 ) { VelY = 0 - VelY; Collision(); } + if ( BallY + VelY >= Height ) { VelY = 0 - VelY; Collision(); } + + if ( BallX + VelX < 1 ) { if ( BallY + VelY < P1Y - 1 || BallY + VelY > P1Y + PadSize + 1 ) { Goal(2); } else { VelX = 0 - VelX; Collision(); } } + if ( BallX + VelX >= Width-1 ) { if ( BallY + VelY < P2Y - 1 || BallY + VelY > P2Y + PadSize + 1 ) { Goal(1); } else { VelX = 0 - VelX; Collision(); } } + + Destination[OldBallX + OldBallY*Width] = ' ' | (COLOR8_WHITE << 8); + Destination[BallX + BallY*Width] = '.' | (COLOR8_WHITE << 8); + OldBallX = BallX; OldBallY = BallY; + + BallX += VelX; + BallY += VelY; + + Destination[BallX + BallY*Width] = 'o' | (COLOR8_WHITE << 8); + +#ifdef JSSORTIX + UART::RenderVGA(); + + P1VUP = P1VDOWN = P2VUP = P2VDOWN = false; +#endif + + NextUpdate = Time + HardCore; + } + + void OnKeystroke(uint32_t CodePoint, bool KeyUp) + { + const uint32_t UP = 0xFFFFFFFF - 20; + const uint32_t DOWN = 0xFFFFFFFF - 23; + + if ( CodePoint == '\n' ) + { + ClearScreen(); + Reset(); + Update(); + } + + if ( CodePoint == 'w' || CodePoint == 'W' ) { P1VUP = !KeyUp; } + if ( CodePoint == 's' || CodePoint == 'S' ) { P1VDOWN = !KeyUp; } + if ( CodePoint == UP ) { P2VUP = !KeyUp; } + if ( CodePoint == DOWN ) { P2VDOWN = !KeyUp; } + } + + void OnFuture() + { + const int TimePassed = 10; + + Time += TimePassed; + +#ifdef JSSORTIX + // Artificially display the boot welcome screen. + if ( Time < 2000 ) { return; } +#endif + + if ( SoundLeft > 0 ) + { + if ( SoundLeft <= TimePassed ) + { + Sound::Mute(); + SoundLeft = -1; + } + else + { + SoundLeft -= TimePassed; + } + } + + if ( InIntro ) { return; } + + if ( NextUpdate <= Time ) { Update(); } + } + } +} diff --git a/sortix/pong.h b/sortix/pong.h new file mode 100644 index 00000000..0f992f01 --- /dev/null +++ b/sortix/pong.h @@ -0,0 +1,45 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + pong.h + ROBOT PONG ATTACK! + +******************************************************************************/ + +#ifndef SORTIX_PONG_H +#define SORTIX_PONG_H + +namespace Sortix +{ + namespace Pong + { + void Init(); + void Intro(); + void ClearScreen(); + void Reset(); + void Goal(nat Player); + void Update(); + void UpdateUI(); + void OnKeystroke(uint32_t CodePoint, bool KeyUp); + void OnFuture(); + }; +} + +#endif + diff --git a/sortix/process.h b/sortix/process.h new file mode 100644 index 00000000..9e79f5f4 --- /dev/null +++ b/sortix/process.h @@ -0,0 +1,71 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + process.h + Describes a process belonging to a subsystem. + +******************************************************************************/ + +#ifndef SORTIX_PROCESS_H +#define SORTIX_PROCESS_H + +#include "descriptors.h" + +namespace Sortix +{ + class Thread; + class Process; + class MountPoint; + class User; + class System; + class DevBuffer; + + class Process + { + public: + // TODO: Make this possible from an async syscall! + //bool CreateProcess(System* system, DevBuffer* image); + + public: + DescriptorTable _descs; + + private: + MountPoint* _rootFS; + User* _user; + System* _system; + + public: + MountPoint* GetRootFS() { _rootFS; } + User* GetUser() { _user; } + System* GetSystem() { _system; } + + private: + Process* _parent; + Process* _child; + Process* _prevSibling; + Process* _nextSibling; + + private: + Thread* _firstThread; + + }; +} + +#endif + diff --git a/sortix/scheduler.cpp b/sortix/scheduler.cpp new file mode 100644 index 00000000..6b7abef3 --- /dev/null +++ b/sortix/scheduler.cpp @@ -0,0 +1,506 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + scheduler.h + Handles the creation and management of threads. + +******************************************************************************/ + +#include "platform.h" +#include +#include "panic.h" +#include "scheduler.h" +#include "globals.h" +#include "multiboot.h" +#include "memorymanagement.h" +#include "descriptor_tables.h" + +#include "iprintable.h" +#include "log.h" + +namespace Sortix +{ + const bool LOG_SWITCHING = false; + + namespace Scheduler + { + // This is a very small thread that does absoluting nothing! + char NoopThreadData[sizeof(Thread)]; + Thread* NoopThread; + const size_t NoopThreadStackLength = 8; + size_t NoopThreadStack[NoopThreadStackLength]; + void NoopFunction() { while ( true ) { } } + + // Linked lists that implements a very simple scheduler. + Thread* currentThread; + Thread* firstRunnableThread; + Thread* firstUnrunnableThread; + Thread* firstSleeping; + size_t AllocatedThreadId; + } + + Thread::Thread(Process* process, size_t id, size_t* stack, size_t stackLength) + { + _process = process; + _id = id; + _stack = stack; + _stackLength = stackLength; + _state = INFANT; + _prevThread = this; + _nextThread = this; + _inThisList = NULL; + } + + Thread::~Thread() + { + Unlink(); + + Page::Put(_stack); + } + + void Thread::Unlink() + { + if ( _inThisList != NULL && *_inThisList == this ) + { + *_inThisList = ( _nextThread != this ) ? _nextThread : NULL; + _inThisList = NULL; + } + if ( _nextThread != this ) { _prevThread->_nextThread = _nextThread; _nextThread->_prevThread = _prevThread; _prevThread = this; _nextThread = this; } + } + + void Thread::Relink(Thread** list) + { + Unlink(); + + _inThisList = list; + if ( *list != NULL ) + { + (*list)->_prevThread->_nextThread = this; + _prevThread = (*list)->_prevThread; + (*list)->_prevThread = this; + _nextThread = *list; + } + else + { + *list = this; + } + } + + void Thread::SetState(State newState) + { + if ( newState == _state ) { return; } + + if ( newState == RUNNABLE ) + { + Relink(&Scheduler::firstRunnableThread); + } + else if ( ( newState == UNRUNNABLE ) /*&& ( State != UNRUNNABLE || State != WAITING )*/ ) + { + Relink(&Scheduler::firstUnrunnableThread); + } + + _state = newState; + } + + void Thread::SaveRegisters(CPU::InterruptRegisters* Src) + { +#ifdef PLATFORM_X86 + _registers.eip = Src->eip; _registers.useresp = Src->useresp; _registers.eax = Src->eax; _registers.ebx = Src->ebx; _registers.ecx = Src->ecx; _registers.edx = Src->edx; _registers.edi = Src->edi; _registers.esi = Src->esi; _registers.ebp = Src->ebp; +#else + #warning "No threads are available on this arch" + while(true); +#endif + } + + void Thread::LoadRegisters(CPU::InterruptRegisters* Dest) + { +#ifdef PLATFORM_X86 + Dest->eip = _registers.eip; Dest->useresp = _registers.useresp; Dest->eax = _registers.eax; Dest->ebx = _registers.ebx; Dest->ecx = _registers.ecx; Dest->edx = _registers.edx; Dest->edi = _registers.edi; Dest->esi = _registers.esi; Dest->ebp = _registers.ebp; +#else + #warning "No threads are available on this arch" + while(true); +#endif + } + + void Thread::Sleep(uintmax_t miliseconds) + { + if ( miliseconds == 0 ) { return; } + + Thread* Thread = Scheduler::firstSleeping; + + if ( Thread == NULL ) + { + Scheduler::firstSleeping = this; + } + else if ( miliseconds < Thread->_sleepMilisecondsLeft ) + { + Scheduler::firstSleeping = this; + _nextSleepingThread = Thread; + Thread->_sleepMilisecondsLeft -= miliseconds; + } + else + { + while ( true ) + { + if ( Thread->_nextSleepingThread == NULL ) + { + Thread->_nextSleepingThread = this; break; + } + else if ( miliseconds < Thread->_nextSleepingThread->_sleepMilisecondsLeft ) + { + Thread->_nextSleepingThread->_sleepMilisecondsLeft -= miliseconds; + _nextSleepingThread = Thread->_nextSleepingThread; + Thread->_nextSleepingThread = this; break; + } + else + { + miliseconds -= Thread->_sleepMilisecondsLeft; + Thread = Thread->_nextSleepingThread; + } + } + } + + _sleepMilisecondsLeft = miliseconds; + SetState(UNRUNNABLE); + } + + namespace Scheduler + { + // Initializes the scheduling subsystem. + void Init() + { + currentThread = NULL; + firstRunnableThread = NULL; + firstUnrunnableThread = NULL; + firstSleeping = NULL; + AllocatedThreadId = 1; + + // Initialize the thread that does nothing. + NoopThread = new ((void*) NoopThreadData) Thread(NULL, 0, NULL, 0); + NoopThread->SetState(Thread::State::NOOP); +#ifdef PLATFORM_X86 + NoopThread->_registers.useresp = (uint32_t) NoopThreadStack + NoopThreadStackLength; + NoopThread->_registers.ebp = (uint32_t) NoopThreadStack + NoopThreadStackLength; + NoopThread->_registers.eip = (uint32_t) &NoopFunction; // NoopFunction; +#else + #warning "No scheduler are available on this arch" + while(true); +#endif + + // Allocate and set up a stack for the kernel to use during interrupts. + void* KernelStackPage = Page::Get(); + if ( KernelStackPage == NULL ) { Panic("scheduler.cpp: could not allocate kernel interrupt stack for tss!"); } + +#ifdef PLATFORM_VIRTUAL_MEMORY + uintptr_t MapTo = 0x80000000; + + VirtualMemory::Map((uintptr_t) KernelStackPage, MapTo, TABLE_PRESENT | TABLE_WRITABLE); + VirtualMemory::Flush(); +#endif + + size_t* KernelStack = ((size_t*) KernelStackPage) + 4096 / sizeof(size_t); + GDT::SetKernelStack((size_t*) (MapTo+4096)); + } + + // Once the init process is spawned and IRQ0 is enabled, this process + // simply awaits an IRQ0 and then we shall be scheduling. + void MainLoop() + { + Log::PrintF("Waiting for IRQ0\n"); + // Simply wait for the next IRQ0 and then the OS will run. + while ( true ) { } + } + + Thread* CreateThread(Process* Process, Thread::Entry Start, void* Parameter1, void* Parameter2, size_t StackSize) + { + // The current default stack size is 4096 bytes. + if ( StackSize == SIZE_MAX ) { StackSize = 4096; } + + // TODO: We only support stacks of up to one page! + if ( 4096 < StackSize ) { StackSize = 4096; } + +#ifndef PLATFORM_KERNEL_HEAP + // TODO: Use the proper memory management systems using new and delete instead of these hacks! + // TODO: These allocations might NOT be thread safe! + void* ThreadPage = Page::Get(); + if ( ThreadPage == NULL ) { return NULL; } +#endif + + // Allocate a stack for this thread. + size_t StackLength = StackSize / sizeof(size_t); + size_t* PhysStack = (size_t*) Page::Get(); + if ( PhysStack == NULL ) + { +#ifndef PLATFORM_KERNEL_HEAP + Page::Put(ThreadPage); +#endif + return NULL; + } + + // Create a new thread data structure. + Thread* thread = new +#ifndef PLATFORM_KERNEL_HEAP + (ThreadPage) +#endif + Thread(Process, AllocatedThreadId++, PhysStack, StackLength); + +#ifdef PLATFORM_X86 + +#ifdef PLATFORM_VIRTUAL_MEMORY + uintptr_t StackPos = 0x80000000UL; + uintptr_t MapTo = StackPos - 4096UL; + + VirtualMemory::Map((uintptr_t) PhysStack, MapTo, TABLE_PRESENT | TABLE_WRITABLE | TABLE_USER_SPACE); + VirtualMemory::Flush(); +#else + uintptr_t StackPos = (uintptr_t) PhysStack + 4096; +#endif + size_t* Stack = (size_t*) StackPos; + +#ifdef PLATFORM_X86 + // Prepare the parameters for the entry function (C calling convention). + //Stack[StackLength - 1] = (size_t) 0xFACE; // Parameter2 + Stack[-1] = (size_t) Parameter2; // Parameter2 + Stack[-2] = (size_t) Parameter1; // Parameter1 + Stack[-3] = (size_t) thread->GetId(); // This thread's id. + Stack[-4] = (size_t) 0x0; // Eip + thread->_registers.ebp = thread->_registers.useresp = (uint32_t) (StackPos - 4*sizeof(size_t)); // Point to the last word used on the stack. + thread->_registers.eip = (uint32_t) Start; // Point to our entry function. +#endif + +#else + #warning "No threads are available on this arch" + while(true); +#endif + + // Mark the thread as running, which adds it to the scheduler's linked list. + thread->SetState(Thread::State::RUNNABLE); + + return thread; + } + + Thread* PopNextThread() + { + //Log::PrintF("PopNextThread(): currentThread = 0x%p, firstRunnableThread = 0x%p, firstRunnableThread->PrevThread = 0x%p, firstRunnableThread->NextThread = 0x%p\n", currentThread, firstRunnableThread, firstRunnableThread->PrevThread, firstRunnableThread->NextThread); + + if ( firstRunnableThread == NULL ) + { + return NoopThread; + } + else if ( currentThread == firstRunnableThread ) + { + firstRunnableThread = firstRunnableThread->_nextThread; + } + + return firstRunnableThread; + } + + void Switch(CPU::InterruptRegisters* R, uintmax_t TimePassed) + { + //Log::PrintF("Scheduling while at eip=0x%p...", R->eip); + + WakeSleeping(TimePassed); + + // Find the next thread to be run. + Thread* NextThread = PopNextThread(); + + //if ( NextThread == NoopThread ) { PanicF("Going to NoopThread! Noop=0x%p, First=0x%p -> 0x%p, Unrun=0x%p", NoopThread, firstRunnableThread, firstRunnableThread->NextThread, firstUnrunnableThread); } + + // If the next thread happens to be the current one, simply do nothing. + if ( currentThread != NextThread ) + { + // Save the hardware registers of the current thread. + if ( currentThread != NULL ) + { + currentThread->SaveRegisters(R); + } + + if ( LOG_SWITCHING && NextThread != NoopThread ) + { + Log::PrintF("Switching from thread at 0x%p to thread at 0x%p\n", currentThread); + } + + // TODO: If applicable, switch the virtual address space. + currentThread = NextThread; + + // Load the hardware registers of the next thread. + //Log::PrintF("Switching to thread at 0x%p\n", NextThread); + NextThread->LoadRegisters(R); + } + else + { + if ( LOG_SWITCHING ) + { + //Log::PrintF("Staying in thread 0x%p\n", currentThread); + } + } + +#ifdef PLATFORM_X86 + + if ( currentThread != NoopThread ) + { + uint32_t RPL = 0x3; + + // Jump into user-space! + R->ds = 0x20 | RPL; // Set the data segment and Requested Privilege Level. + R->cs = 0x18 | RPL; // Set the code segment and Requested Privilege Level. + R->ss = 0x20 | RPL; // Set the stack segment and Requested Privilege Level. + } + else + { + uint32_t RPL = 0x0; + + // Jump into kernel-space! + R->ds = 0x10 | RPL; // Set the data segment and Requested Privilege Level. + R->cs = 0x08 | RPL; // Set the code segment and Requested Privilege Level. + R->ss = 0x10 | RPL; // Set the stack segment and Requested Privilege Level. + } + + R->eflags |= 0x200; // Enable the enable interrupts flag in EFLAGS! +#else + #warning "No threads are available on this arch" + while(true); +#endif + + //Log::PrintF("ds=0x%x, edi=0x%x, esi=0x%x, ebp=0x%x, esp=0x%x, ebx=0x%x, edx=0x%x, ecx=0x%x, eax=0x%x, int_no=0x%x, err_code=0x%x, eip=0x%x, cs=0x%x, eflags=0x%x, useresp=0x%x, ss=0x%x\n", R->ds, R->edi, R->esi, R->ebp, R->esp, R->ebx, R->edx, R->ecx, R->eax, R->int_no, R->err_code, R->eip, R->cs, R->eflags, R->useresp, R->ss); + +#if 0 + size_t* Stack = (size_t*) R->useresp; + + + // TODO: HACK: Currently ESP is not properly set after we return + // from the interrupt. So we call a helper function that restores + // it by storing it in EAX, then restoring EAX, and restoring EIP, + // then we should have returned successfully. + + Stack[-1] = (size_t) &PrintRegistersAndDie; // R->eip; + Stack[-2] = (size_t) R->eax; + R->eax = (uint32_t) (Stack - 2); + R->eip = (uint32_t) &RestoreStack; + + Log::PrintF("ds=0x%x, edi=0x%x, esi=0x%x, ebp=0x%x, esp=0x%x, ebx=0x%x, edx=0x%x, ecx=0x%x, eax=0x%x, int_no=0x%x, err_code=0x%x, eip=0x%x, cs=0x%x, eflags=0x%x, useresp=0x%x, ss=0x%x\n", R->ds, R->edi, R->esi, R->ebp, R->esp, R->ebx, R->edx, R->ecx, R->eax, R->int_no, R->err_code, R->eip, R->cs, R->eflags, R->useresp, R->ss); +#endif + + //Log::PrintF("Stack = {0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p, 0x%p}\n", Stack[0], Stack[1], Stack[2], Stack[3], Stack[4], Stack[5], Stack[6], Stack[7], Stack[8], Stack[9], Stack[10], Stack[11], Stack[12], Stack[13], Stack[14], Stack[15]); + + //Log::PrintF(" resuming at eip=0x%p\n", R->eip); + } + + void WakeSleeping(uintmax_t TimePassed) + { + while ( firstSleeping != NULL ) + { + if ( TimePassed < firstSleeping->_sleepMilisecondsLeft ) { firstSleeping->_sleepMilisecondsLeft -= TimePassed; break; } + + TimePassed -= firstSleeping->_sleepMilisecondsLeft; + firstSleeping->_sleepMilisecondsLeft = 0; + firstSleeping->SetState(Thread::State::RUNNABLE); + Thread* Next = firstSleeping->_nextSleepingThread; + firstSleeping->_nextSleepingThread = NULL; + firstSleeping = Next; + } + } + + void ExitThread(Thread* Thread, void* Result) + { + //Log::PrintF("\n", Thread); + // TODO: What do we do with the result parameter? + Thread->~Thread(); + //Log::PrintF("\n", Thread); + Page::Put(Thread); + //Log::PrintF("\n", Thread); + + if ( Thread == currentThread ) { currentThread = NULL; } + } + + + #define ASSERDDD(invariant) \ + if ( unlikely(!(invariant)) ) \ + { \ + Sortix::Log::PrintF("Assertion failure: %s:%u : %s %s\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, #invariant); \ + while ( true ) { } \ + } + + #define LOL(what) #what + + void SysCreateThread(CPU::InterruptRegisters* R) + { +#ifdef PLATFORM_X86 + Thread* Thread = CreateThread(CurrentProcess(), (Thread::Entry) R->ebx, (void*) R->ecx, (void*) R->edx, (size_t) R->edi); + R->eax = (Thread != NULL) ? Thread->GetId() : 0; + //Log::PrintF("\n", Thread); +#else + #warning "This syscall is not supported on this arch" + while(true); +#endif + } + + void SysExitThread(CPU::InterruptRegisters* R) + { + //Log::PrintF("\n", CurrentThread()); +#ifdef PLATFORM_X86 + ExitThread(CurrentThread(), (void*) R->ebx); + Switch(R, 0); +#else + #warning "This syscall is not supported on this arch" + while(true); +#endif + //Log::PrintF("\n", CurrentThread()); + } + + void SysSleep(CPU::InterruptRegisters* R) + { + //Log::PrintF("\n"); +#ifdef PLATFORM_X86 + intmax_t TimeToSleep = ((uintmax_t) R->ebx) * 1000ULL; + if ( TimeToSleep == 0 ) { return; } + CurrentThread()->Sleep(TimeToSleep); + Switch(R, 0); + //Log::PrintF("\n"); +#else + #warning "This syscall is not supported on this arch" + while(true); +#endif + } + + void SysUSleep(CPU::InterruptRegisters* R) + { +#ifdef PLATFORM_X86 + intmax_t TimeToSleep = ((uintmax_t) R->ebx) / 1000ULL; + if ( TimeToSleep == 0 ) { return; } + CurrentThread()->Sleep(TimeToSleep); + Switch(R, 0); +#else + #warning "This syscall is not supported on this arch" + while(true); +#endif + } + } + + Thread* CurrentThread() + { + return Scheduler::currentThread; + } + + Process* CurrentProcess() + { + if ( Scheduler::currentThread != NULL ) { return Scheduler::currentThread->GetProcess(); } else { return NULL; } + } +} + diff --git a/sortix/scheduler.h b/sortix/scheduler.h new file mode 100644 index 00000000..feda1cf9 --- /dev/null +++ b/sortix/scheduler.h @@ -0,0 +1,120 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + scheduler.h + Handles the creation and management of threads. + +******************************************************************************/ + +#ifndef SORTIX_SCHEDULER_H +#define SORTIX_SCHEDULER_H + +namespace Sortix +{ + class Thread; + class Process; + + class Thread + { + public: + enum State { INFANT, RUNNABLE, UNRUNNABLE, NOOP }; + typedef void* (*Entry)(void* Parameter); + + public: + Thread(Process* process, size_t id, size_t* stack, size_t stackLength); + ~Thread(); + + public: + size_t GetId() { return _id; } + Process* GetProcess() { return _process; } + + private: + size_t _id; + size_t* _stack; + size_t _stackLength; + Process* _process; + State _state; + + public: + uintmax_t _sleepMilisecondsLeft; + Thread* _nextSleepingThread; + + public: + void Sleep(uintmax_t Miliseconds); + + public: + Thread* _prevThread; + Thread* _nextThread; + Thread** _inThisList; + + public: + void SaveRegisters(CPU::InterruptRegisters* Src); + void LoadRegisters(CPU::InterruptRegisters* Dest); + + public: + CPU::InterruptRegisters _registers; + + private: + void Relink(Thread** list); + void Unlink(); + + public: + void SetState(State NewState); + State GetState(); + + private: + bool _syscall; + + public: + bool _sysParamsInited; + size_t _sysParams[16]; + + public: + void BeginSyscall(CPU::InterruptRegisters* currentRegisters); + void SysReturn(size_t result); + void SysReturnError(size_t result); + void OnSysReturn(); + + }; + + namespace Scheduler + { + void Init(); + void Switch(CPU::InterruptRegisters* R, uintmax_t TimePassed); + SORTIX_NORETURN void MainLoop(); + void WakeSleeping(uintmax_t TimePassed); + + // Thread management + Thread* CreateThread(Process* Process, Thread::Entry Start, void* Parameter1 = NULL, void* Parameter2 = NULL, size_t StackSize = SIZE_MAX); + void ExitThread(Thread* Thread, void* Result = NULL); + + // System Calls. + void SysCreateThread(CPU::InterruptRegisters* R); + void SysExitThread(CPU::InterruptRegisters* R); + void SysSleep(CPU::InterruptRegisters* R); + void SysUSleep(CPU::InterruptRegisters* R); + } + + // Scheduling + Thread* CurrentThread(); + Process* CurrentProcess(); +} + +#endif + diff --git a/sortix/serialterminal.cpp b/sortix/serialterminal.cpp new file mode 100644 index 00000000..ee1c4ec5 --- /dev/null +++ b/sortix/serialterminal.cpp @@ -0,0 +1,53 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + serialterminal.cpp + A terminal on a serial line. + +******************************************************************************/ + +#include "platform.h" +#include +#include "log.h" +#include "uart.h" +#include "serialterminal.h" + +namespace Sortix +{ + namespace SerialTerminal + { + void Reset() + { + // Set the cursor to (0,0) + const char InitMessage[] = "\e[H"; + UART::Write(InitMessage, Maxsi::String::Length(InitMessage)); + } + + void Init() + { + Reset(); + } + + size_t Print(void* /*user*/, const char* string, size_t stringlen) + { + UART::Write(string, stringlen); + return stringlen; + } + } +} diff --git a/sortix/serialterminal.h b/sortix/serialterminal.h new file mode 100644 index 00000000..be83e550 --- /dev/null +++ b/sortix/serialterminal.h @@ -0,0 +1,39 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + serialterminal.h + A terminal on a serial line. + +******************************************************************************/ + +#ifndef SORTIX_SERIALTERMINAL_H +#define SORTIX_SERIALTERMINAL_H + +namespace Sortix +{ + namespace SerialTerminal + { + void Init(); + void Reset(); + size_t Print(void* user, const char* string, size_t stringlen); + } +} + +#endif + diff --git a/sortix/shell.cpp b/sortix/shell.cpp new file mode 100644 index 00000000..23332887 --- /dev/null +++ b/sortix/shell.cpp @@ -0,0 +1,167 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + shell.cpp + A very basic command line shell. + +******************************************************************************/ + +#include "platform.h" +#include +#include +#include "globals.h" +#include "iprintable.h" +#include "iirqhandler.h" +#include "log.h" +#include "keyboard.h" +#include "shell.h" + +using namespace Maxsi; + +namespace Sortix +{ + DEFINE_GLOBAL_OBJECT(Shell, Shell); + + const char* Prefix = "root@sortix / # "; + + void Shell::Init() + { + BacklogUsed = 0; + Column = 0; + + // Empty the screen. +#ifdef PLATFORM_X86 + size_t Msg = ' '; Msg |= Msg << 8; Msg |= Msg << 16; +#elif defined(PLATFORM_X64) + size_t Msg = ' '; Msg |= Msg << 8; Msg |= Msg << 16; Msg |= Msg << 32; +#endif + for ( nat I = 0; I < (BacklogHeight*Width) / sizeof(size_t); I++ ) { Backlog[I] = Msg; } + for ( nat I = 0; I < (Height*Width) / sizeof(size_t); I++ ) { Command[I] = Msg; } + + // Flush to our viewing device. + UpdateScreen(); + } + + void Shell::ClearScreen() + { + uint16_t* Destination = (uint16_t*) 0xB8000; + + for ( size_t I = 0; I < (Height*Width)/sizeof(size_t); I++ ) { Destination[I] = 0; } + } + + void Shell::UpdateScreen() + { + ClearScreen(); + + uint16_t* Destination = (uint16_t*) 0xB8000; + + uint16_t Color = ((COLOR8_LIGHT_GREY << 0) + (COLOR8_BLACK << 4)) << 8; + + nat CommandLines = (Column + String::Length(Prefix)) / Width + 1; + + nat BacklogLines = Height - CommandLines; if ( BacklogUsed < BacklogLines ) { BacklogLines = BacklogUsed; } + for ( nat I = 0; I < BacklogLines; I++ ) + { + nat Line = BacklogUsed - BacklogLines + I; + + for ( nat X = 0; X < Width; X++ ) { Destination[X + I*Width] = ( (uint16_t) Backlog[X + Line*Width] ) | Color; } + } + + uint16_t* Pos = Destination + Width * BacklogLines; + + size_t PrefixLen = String::Length(Prefix); + for ( size_t I = 0; I < PrefixLen; I++ ) { Pos[I] = ( (uint16_t) Prefix[I] ) | Color; } + Pos += PrefixLen; + for ( size_t I = 0; I < Column; I++ ) { Pos[I] = ( (uint16_t) Command[I] ) | Color; } + + SetCursor((PrefixLen + Column) % Width, BacklogLines + CommandLines - 1); + } + + void Shell::OnKeystroke(uint32_t CodePoint, bool KeyUp) + { + if ( CodePoint == '\n' ) + { + //Execute(); + } + else if ( CodePoint == '\t' ) + { + // No autocompletion yet! + } + else if ( CodePoint == '\r' ) + { + // No need for this driver to support line resets. + } + else if ( CodePoint == '\b' ) + { + if ( 0 < Column ) { Column--; } + } + else + { + if ( CodePoint <= 0xFF ) + { + Command[Column] = CodePoint; Column++; + } + } + + UpdateScreen(); + } + +#if 0 + void Shell::NewLine() + { + if ( Line < Height - 1 ) + { + Line++; + } + else + { + // Scroll down our buffer. + Memory::Copy(Messages, Messages + Width, (Height-1)*Width); + + // Scroll down our color buffer as well. + for ( nat Y = 1; Y < Height; Y++ ) { Colors[Y-1] = Colors[Y]; } + } + + // Reset the new line. + Memory::Set(Messages + Line*Width, ' ', Width); + + // Assume the color of the new line is the same as the previous. + Colors[Line] = Colors[Line-1]; + + Column = 0; + + // Flush our output. + UpdateScreen(); + } +#endif + + void Shell::SetCursor(nat X, nat Y) + { + nat Value = X + Y * Width; + + // This sends a command to indicies 14 and 15 in the + // CRT Control Register of the VGA controller. These + // are the high and low bytes of the index that show + // where the hardware cursor is to be 'blinking'. + X86::OutPortB(0x3D4, 14); + X86::OutPortB(0x3D5, (Value >> 8) & 0xFF); + X86::OutPortB(0x3D4, 15); + X86::OutPortB(0x3D5, (Value >> 0) & 0xFF); + } +} diff --git a/sortix/shell.h b/sortix/shell.h new file mode 100644 index 00000000..1e0d8736 --- /dev/null +++ b/sortix/shell.h @@ -0,0 +1,62 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + shell.h + A very basic command line shell. + +******************************************************************************/ + +#ifndef SORTIX_SHELL_H +#define SORTIX_SHELL_H + +namespace Sortix +{ + class Shell : public IKeystrokable + { + protected: + const static nat Width = 80; + const static nat BacklogHeight = 100; + const static nat Height = 25; + char Backlog[Width * BacklogHeight]; + char Command[Width * Height]; + nat BacklogUsed; + nat Column; + nat Scroll; + + public: + virtual void Init(); + + private: + void ClearScreen(); + + public: + void UpdateScreen(); + + public: + virtual void OnKeystroke(uint32_t CodePoint, bool KeyUp); + + public: + void SetCursor(nat X, nat Y); + }; + + DECLARE_GLOBAL_OBJECT(Shell, Shell); +} + +#endif + diff --git a/sortix/sound.cpp b/sortix/sound.cpp new file mode 100644 index 00000000..c35417f5 --- /dev/null +++ b/sortix/sound.cpp @@ -0,0 +1,57 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + sound.h + Implements a simple sound system. + +******************************************************************************/ + +#include "platform.h" +#include "sound.h" + +namespace Sortix +{ + namespace Sound + { + void Mute() + { + uint8_t TMP = (CPU::InPortB(0x61)) & 0xFC; + + CPU::OutPortB(0x61, TMP); + } + + void Play(nat Frequency) + { + //Set the PIT to the desired frequency + uint32_t Div = 1193180 / Frequency; + CPU::OutPortB(0x43, 0xB6); + CPU::OutPortB(0x42, (uint8_t) (Div) ); + CPU::OutPortB(0x42, (uint8_t) (Div >> 8)); + + // And play the sound using the PC speaker + uint8_t TMP = CPU::InPortB(0x61); + + if ( TMP != (TMP | 3) ) + { + CPU::OutPortB(0x61, TMP | 3); + } + } + } +} + diff --git a/sortix/sound.h b/sortix/sound.h new file mode 100644 index 00000000..9ffa8dd0 --- /dev/null +++ b/sortix/sound.h @@ -0,0 +1,38 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + sound.h + Implements a simple sound system. + +******************************************************************************/ + +#ifndef SORTIX_SOUND_H +#define SORTIX_SOUND_H + +namespace Sortix +{ + namespace Sound + { + void Mute(); + void Play(nat Frequency); + } +} + +#endif + diff --git a/sortix/stream.h b/sortix/stream.h new file mode 100644 index 00000000..97fd31e6 --- /dev/null +++ b/sortix/stream.h @@ -0,0 +1,88 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + stream.h + Various device types that provides a sequence of bytes. + +******************************************************************************/ + +#ifndef SORTIX_STREAM_H +#define SORTIX_STREAM_H + +namespace Sortix +{ + class Device + { + public: + Device() { }; + virtual ~Device() { } + + public: + virtual void close() = 0; + + }; + + class DevStream : public Device + { + public: + DevStream() { }; + virtual ~DevStream() { } + + public: + virtual size_t write(const void* buffer, size_t bufferSize) = 0; + virtual size_t readSome(const void* buffer, size_t bufferSize) = 0; + + public: + inline size_t read(const void* buffer, size_t bufferSize) + { + const uint8_t* bytes = (uint8_t*) buffer; + size_t total = bufferSize; + while ( BufferSize > 0 ) + { + size_t got = readSome(bytes, bufferSize); + if ( got == SIZE_MAX ) { return SIZE_MAX; } + bytes += got; + bufferSize -= got; + } + return total; + } + }; + + class DevBuffer : public DevStream + { + public: + DevBuffer() { }; + virtual ~DevBuffer() { } + + public: + virtual size_t write(const void* buffer, size_t bufferSize) = 0; + virtual size_t readSome(const void* buffer, size_t bufferSize) = 0; + + public: + virtual size_t blockSize() = 0; + virtual intmax_t size() = 0; + virtual intmax_t position() = 0; + virtual bool seek(intmax_t position) = 0; + virtual bool resize(intmax_t size) = 0; + + }; +} + +#endif + diff --git a/sortix/syscall.cpp b/sortix/syscall.cpp new file mode 100644 index 00000000..509decd9 --- /dev/null +++ b/sortix/syscall.cpp @@ -0,0 +1,92 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + syscall.h + Handles system calls from userspace safely. + +******************************************************************************/ + +#include "platform.h" +#include "syscall.h" +#include "scheduler.h" +#include "iirqhandler.h" +#include "isr.h" +#include "globals.h" +#include "iprintable.h" +#include "log.h" +#include "panic.h" + +namespace Sortix +{ + namespace Syscall + { + void SysStdOutPrint(CPU::InterruptRegisters* R) + { +#ifdef PLATFORM_X86 + // TODO: Validate our input pointer is legal for the current thread/process! + R->eax = (uint32_t) Log::Print((const char*) R->ebx); +#else + #warning "This syscall is not supported on this arch" + while(true); +#endif + } + + const size_t NumSyscalls = 5; + const Syscall Syscalls[NumSyscalls] = + { + &Scheduler::SysCreateThread, + &Scheduler::SysExitThread, + &Scheduler::SysSleep, + &Scheduler::SysUSleep, + &SysStdOutPrint, + }; + + void Init() + { + register_interrupt_handler(0x80, &OnCall); + } + + void OnCall(CPU::InterruptRegisters* registers) + { +#ifdef PLATFORM_X86 + size_t callId = registers->eax; + + // Make sure the requested syscall exists. + if ( callId >= NumSyscalls ) { return; } + +#ifdef USING_OLD_SYSCALL + Syscalls[registers->eax](registers); +#else + Thread* thread = CurrentThread(); + + thread->BeginSyscall(registers); + + Syscalls[registers->eax](thread); + + thread->OnSysReturn(); +#endif + +#else + #warning "System calls are not available on this platform" + while(true); +#endif + } + } +} + diff --git a/sortix/syscall.h b/sortix/syscall.h new file mode 100644 index 00000000..246df5eb --- /dev/null +++ b/sortix/syscall.h @@ -0,0 +1,54 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + syscall.h + Handles system calls from userspace safely. + +******************************************************************************/ + +#ifndef SORTIX_SYSCALL_H +#define SORTIX_SYSCALL_H + +#include "scheduler.h" + +#ifdef PLATFORM_X86 + #define SYSPARAM __attribute__ ((aligned (4))); +#elif defined(PLATFORM_X64) + #define SYSPARAM __attribute__ ((aligned (8))); +#endif + +#define USING_OLD_SYSCALL + +namespace Sortix +{ + namespace Syscall + { + void Init(); + void OnCall(CPU::InterruptRegisters* R); + +#ifdef USING_OLD_SYSCALL + typedef void (*Syscall)(CPU::InterruptRegisters* r); +#else + typedef void (*Syscall)(Thread* R); +#endif + } +} + +#endif + diff --git a/sortix/system.h b/sortix/system.h new file mode 100644 index 00000000..9ceaa39e --- /dev/null +++ b/sortix/system.h @@ -0,0 +1,51 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + system.h + Describes a subsystem, thus allowing multiple OSes to run on Sortix. + +******************************************************************************/ + +#ifndef SORTIX_SYSTEM_H +#define SORTIX_SYSTEM_H + +namespace Sortix +{ + class Process; + class Authorization; + + class System + { + private: + int _systemId; + Process* _init; + Authorization* _authorization; + + private: + // TODO: a list of processes belonging to this subsystem. + + private: + int _baseNiceness; + // TODO: stuff like memory limits, etc. + + }; +} + +#endif + diff --git a/sortix/test.cpp b/sortix/test.cpp new file mode 100644 index 00000000..190a66b3 --- /dev/null +++ b/sortix/test.cpp @@ -0,0 +1,12 @@ +#include "platform.h" +#include "globals.h" +#include "iprintable.h" +#include "log.h" + +namespace Sortix +{ + void foo(int bar, unsigned int qux) + { + Log::PrintF("Hello, %i, and %u!", bar, qux); + } +} diff --git a/sortix/thread.h b/sortix/thread.h new file mode 100644 index 00000000..5f2dd91c --- /dev/null +++ b/sortix/thread.h @@ -0,0 +1 @@ +#include "scheduler.h" diff --git a/sortix/time.cpp b/sortix/time.cpp new file mode 100644 index 00000000..4d88cd2d --- /dev/null +++ b/sortix/time.cpp @@ -0,0 +1,106 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + time.h + Handles interrupts whenever some time has passed and provides useful + time-related functions to the kernel. + +******************************************************************************/ + +#include "platform.h" +#include "time.h" +#include "iirqhandler.h" +#include "isr.h" +#include "scheduler.h" + +#include "globals.h" +#include "iprintable.h" +#include "log.h" + +#include "pong.h" +#include "conway.h" + +#if !defined(PLATFORM_X86_FAMILY) +#error No time subsystem is available for this CPU +#endif + +namespace Sortix +{ + namespace Time + { + uintmax_t Ticks; + uintmax_t Miliseconds; + + const uint32_t Frequency = 100; // 100 Hz + + void OnInt177(CPU::InterruptRegisters* Regs) + { +#ifdef PLATFORM_X86 + Log::PrintF("ds=0x%x, edi=0x%x, esi=0x%x, ebp=0x%x, esp=0x%x, ebx=0x%x, edx=0x%x, ecx=0x%x, eax=0x%x, int_no=0x%x, err_code=0x%x, eip=0x%x, cs=0x%x, eflags=0x%x, useresp=0x%x, ss=0x%x\n", Regs->ds, Regs->edi, Regs->esi, Regs->ebp, Regs->esp, Regs->ebx, Regs->edx, Regs->ecx, Regs->eax, Regs->int_no, Regs->err_code, Regs->eip, Regs->cs, Regs->eflags, Regs->useresp, Regs->ss); +#else + #warning "INT 177 is not supported on this arch" + while(true); +#endif + } + + void Init() + { + // Initialize our variables. + Ticks = 0; + Miliseconds = 0; + + // First, register our timer callback. + register_interrupt_handler(IRQ0, &OnIRQ0); + register_interrupt_handler(177, &OnInt177); + + // The value we send to the PIT is the value to divide it's input clock + // (1193180 Hz) by, to get our required frequency. Important to note is + // that the divisor must be small enough to fit into 16-bits. + const uint32_t Divisor = 1193180 / Frequency; + + // Send the command byte. + CPU::OutPortB(0x43, 0x36); + + // Divisor has to be sent byte-wise, so split here into upper/lower bytes. + uint8_t L = (uint8_t) (Divisor & 0xFF); + uint8_t H = (uint8_t) ((Divisor>>8) & 0xFF); + + // Send the frequency divisor. + CPU::OutPortB(0x40, L); + CPU::OutPortB(0x40, H); + } + + void OnIRQ0(CPU::InterruptRegisters* Regs) + { + Ticks++; + +#ifdef PONG + Pong::OnFuture(); return; +#elif defined(CONWAY) + Conway::OnFuture(); return; +#endif + + // Let the scheduler switch to the next task. + // TODO: Let the scheduler know how long has passed. + Scheduler::Switch(Regs, 1000/Frequency); + } + + // TODO: Implement all the other useful functions regarding tiem. + } +} diff --git a/sortix/time.h b/sortix/time.h new file mode 100644 index 00000000..a78882c2 --- /dev/null +++ b/sortix/time.h @@ -0,0 +1,41 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + time.h + Handles interrupts whenever some time has passed and provides useful + time-related functions to the kernel. + +******************************************************************************/ + +#ifndef SORTIX_TIME_H +#define SORTIX_TIME_H + +namespace Sortix +{ + namespace Time + { + void Init(); + void OnIRQ0(CPU::InterruptRegisters* Registers); + float GetTimeSinceBoot(); + intmax_t GetMilisecondsSinceBoot(); + } +} + +#endif + diff --git a/sortix/types.h b/sortix/types.h new file mode 100644 index 00000000..7f0d76aa --- /dev/null +++ b/sortix/types.h @@ -0,0 +1,101 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + types.h + Declares the required datatypes for the x86 architecture. + +******************************************************************************/ + +#ifndef SORTIX_TYPES_H +#define SORTIX_TYPES_H + +// TODO: Declare stuff from . + +#undef NULL +#if defined(__cplusplus) + #define NULL 0 +#else + #define NULL ((void*) 0) + typedef int wchar_t; +#endif + +// Define basic signed types. +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef long long int64_t; + +// Define basic unsigned types. +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; + +typedef unsigned int nat; + +// The maximum width integers available on this platform. +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + +// Define an integer able to hold the size of the largest continious memory +// region and define pointer safe integer types. +// TODO: 64-bit datatypes. Need to figure out which ifdef to use! +typedef unsigned int size_t; +typedef signed int ssize_t; +typedef signed int intptr_t; +typedef unsigned int uintptr_t; +typedef signed int ptrdiff_t; + +#define INT8_MIN (0x80) +#define INT16_MIN (0x8000) +#define INT32_MIN (0x80000000) +#define INT64_MIN (0x8000000000000000ULL) +#define INT8_MAX (0x7F) +#define INT16_MAX (0x7FFF) +#define INT32_MAX (0x7FFFFFFF) +#define INT64_MAX (0x7FFFFFFFFFFFFFFFULL) +#define UINT8_MAX (0xFF) +#define UINT16_MAX (0xFFFF) +#define UINT32_MAX (0xFFFFFFFF) +#define UINT64_MAX (0xFFFFFFFFFFFFFFFFULL) + +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +#ifdef PLATFORM_X86 + #define SSIZE_MIN INT32_MIN + #define SSIZE_MAX INT32_MAX + #define SIZE_MAX UINT32_MAX + #define INTPTR_MIN INT32_MIN + #define INTPTR_MAX INT32_MAX + #define UINTPTR_MAX UINT32_MAX +#elif defined(PLATFORM_X64) + #define SSIZE_MIN INT64_MIN + #define SSIZE_MAX INT64_MAX + #define SIZE_MAX UINT64_MAX + #define INTPTR_MIN INT64_MIN + #define INTPTR_MAX INT64_MAX + #define UINTPTR_MAX UINT64_MAX +#endif + +typedef int wint_t; + +#endif + diff --git a/sortix/uart.cpp b/sortix/uart.cpp new file mode 100644 index 00000000..2a6393cb --- /dev/null +++ b/sortix/uart.cpp @@ -0,0 +1,310 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + uart.h + A simple serial terminal driver. + +******************************************************************************/ + +#include "platform.h" +#include +#ifdef PLATFORM_SERIAL +#include "vga.h" +#endif +#include "uart.h" + +using namespace Maxsi; + +namespace Sortix +{ + namespace UART + { + const nat TXR = 0; // Transmit register + const nat RXR = 0; // Receive register + const nat IER = 1; // Interrupt Enable + const nat IIR = 2; // Interrupt ID + const nat FCR = 2; // FIFO control + const nat LCR = 3; // Line control + const nat MCR = 4; // Modem control + const nat LSR = 5; // Line Status + const nat MSR = 6; // Modem Status + const nat DLL = 0; // Divisor Latch Low + const nat DLM = 1; // Divisor latch High + + const nat LCR_DLAB = 0x80; // Divisor latch access bit + const nat LCR_SBC = 0x40; // Set break control + const nat LCR_SPAR = 0x20; // Stick parity (?) + const nat LCR_EPAR = 0x10; // Even parity select + const nat LCR_PARITY = 0x08; // Parity Enable + const nat LCR_STOP = 0x04; // Stop bits: 0=1 bit, 1=2 bits + const nat LCR_WLEN5 = 0x00; // Wordlength: 5 bits + const nat LCR_WLEN6 = 0x01; // Wordlength: 6 bits + const nat LCR_WLEN7 = 0x02; // Wordlength: 7 bits + const nat LCR_WLEN8 = 0x03; // Wordlength: 8 bits + + const nat LSR_TEMT = 0x40; // Transmitter empty + const nat LSR_THRE = 0x20; // Transmit-hold-register empty + const nat LSR_READY = 0x1; + + const nat Port = 0x3f8; + + const nat BASE_BAUD = 1843200/16; + const nat BOTH_EMPTY = LSR_TEMT | LSR_THRE; + +#ifdef SORTIX_VGA_H + VGA::Frame VGALastFrame; +#endif + + nat ProbeBaud(nat Port) + { + uint8_t lcr = CPU::InPortB(Port + LCR); + CPU::OutPortB(Port + LCR, lcr | LCR_DLAB); + uint8_t dll = CPU::InPortB(Port + DLL); + uint8_t dlm = CPU::InPortB(Port + DLM); + CPU::OutPortB(Port + LCR, lcr); + nat quot = (dlm << 8) | dll; + + return BASE_BAUD / quot; + } + + void WaitForEmptyBuffers(nat Port) + { + while ( true ) + { + nat Status = CPU::InPortB(Port + LSR); + + if ( (Status & BOTH_EMPTY) == BOTH_EMPTY ) + { + return; + } + } + } + + nat Baud; + + void Init() + { +#ifdef SORTIX_VGA_H + InvalidateVGA(); +#endif + +#ifdef JSSORTIX + // This crashes the JS VM, so don't do it. + return; +#endif + + Baud = ProbeBaud(Port); + + CPU::OutPortB(Port + LCR, 0x3); // 8n1 + CPU::OutPortB(Port + IER, 0); // No interrupt + CPU::OutPortB(Port + FCR, 0); // No FIFO + CPU::OutPortB(Port + MCR, 0x3); // DTR + RTS + + nat Divisor = 115200 / Baud; + uint8_t C = CPU::InPortB(Port + LCR); + CPU::OutPortB(Port + LCR, C | LCR_DLAB); + CPU::OutPortB(Port + DLL, Divisor & 0xFF); + CPU::OutPortB(Port + DLM, (Divisor >> 8) & 0xFF); + CPU::OutPortB(Port + LCR, C & ~LCR_DLAB); + } + + void Read(uint8_t* Buffer, size_t Size) + { + // Save the IER and disable interrupts. + nat ier = CPU::InPortB(Port + IER); + CPU::OutPortB(Port + IER, 0); + + for ( size_t I = 0; I < Size; I++ ) + { + while ( ! ( CPU::InPortB(Port + LSR) & LSR_READY ) ) { } + + Buffer[I] = CPU::InPortB(Port); + } + + // Wait for transmitter to become empty and restore the IER. + WaitForEmptyBuffers(Port); + CPU::OutPortB(Port + IER, ier); + } + + void Write(const void* B, size_t Size) + { + const uint8_t* Buffer = (const uint8_t*) B; + + // Save the IER and disable interrupts. + nat ier = CPU::InPortB(Port + IER); + CPU::OutPortB(Port + IER, 0); + + for ( size_t I = 0; I < Size; I++ ) + { + WaitForEmptyBuffers(Port); + + CPU::OutPortB(Port, Buffer[I]); + } + + // Wait for transmitter to become empty and restore the IER. + WaitForEmptyBuffers(Port); + CPU::OutPortB(Port + IER, ier); + } + + void WriteChar(char C) + { + // Save the IER and disable interrupts. + nat ier = CPU::InPortB(Port + IER); + CPU::OutPortB(Port + IER, 0); + + WaitForEmptyBuffers(Port); + + CPU::OutPortB(Port, C); + + // Wait for transmitter to become empty and restore the IER. + WaitForEmptyBuffers(Port); + CPU::OutPortB(Port + IER, ier); + } + + int TryPopChar() + { + // Save the IER and disable interrupts. + nat ier = CPU::InPortB(Port + IER); + CPU::OutPortB(Port + IER, 0); + + int Result = -1; + + if ( CPU::InPortB(Port + LSR) & LSR_READY ) + { + Result = CPU::InPortB(Port); + } + + // Wait for transmitter to become empty and restore the IER. + WaitForEmptyBuffers(Port); + CPU::OutPortB(Port + IER, ier); + + return Result; + } + + void WriteNumberAsString(uint8_t Num) + { + if ( Num > 100 ) { WriteChar(Num / 100); } + if ( Num > 10 ) { WriteChar(Num / 10); } + + WriteChar(Num % 10); + } + +#ifdef SORTIX_VGA_H + // Change from VGA color to another color system. + nat ConversionTable[16] = { 0, 4, 2, 6, 1, 5, 3, 7, 0, 4, 2, 6, 1, 5, 3, 7 }; + + void InvalidateVGA() + { + for ( nat I = 0; I < VGALastFrame.Width * VGALastFrame.Height; I++ ) { VGALastFrame.Data[I] = 0; } + } + + void RenderVGA(const VGA::Frame* Frame) + { +#if 0 + // Set the cursor to (0,0) + const char InitMessage[] = { String::ASCII_ESCAPE, '[', 'H' }; + UART::Write(InitMessage, sizeof(InitMessage)); + + const uint16_t* Source = Frame->Data; + + nat LastColor = 1337; + nat SkippedSince = 0; + + for ( nat Y = 0; Y < Frame->Height; Y++) + { + for ( nat X = 0; X < Frame->Width; X++ ) + { + nat Index = Y * Frame->Width + X; + + nat Element = Source[Index]; + nat OldElement = VGALastFrame.Data[Index]; + + if ( Element == OldElement ) { continue; } + + VGALastFrame.Data[Index] = Element; + + // Update the position if we skipped some characters. + if ( Index - SkippedSince > 8 ) + { + const nat LineId = Y + 1; + const nat ColumnId = X + 1; + + if ( ColumnId > 1 ) + { + const char Message[] = { String::ASCII_ESCAPE, '[', '0' + LineId / 10, '0' + LineId % 10, ';', '0' + ColumnId / 10, '0' + ColumnId % 10, 'H' }; + UART::Write(Message, sizeof(Message)); + } + else + { + const char Message[] = { String::ASCII_ESCAPE, '[', '0' + LineId / 10, '0' + LineId % 10, 'H' }; + UART::Write(Message, sizeof(Message)); + } + + SkippedSince = Index; + } + + for ( nat Pos = SkippedSince; Pos <= Index; Pos++ ) + { + Element = Source[Pos]; + + nat NewColor = ConversionTable[ (Element >> 12) & 0xF ] << 3 | ConversionTable[ (Element >> 8) & 0xF ]; + + // Change the color if we need to. + if ( LastColor != NewColor ) + { + nat OldFGColor = LastColor % 8; + nat OldBGColor = LastColor / 8; + nat FGColor = NewColor % 8; + nat BGColor = NewColor / 8; + + if ( (OldFGColor != FGColor) && (OldBGColor != BGColor) ) + { + const char Message[] = { String::ASCII_ESCAPE, '[', '3', '0' + FGColor, ';', '4', '0' + BGColor, 'm' }; + UART::Write(Message, sizeof(Message)); + } + else if ( OldFGColor != FGColor ) + { + const char Message[] = { String::ASCII_ESCAPE, '[', '3', '0' + FGColor, 'm' }; + UART::Write(Message, sizeof(Message)); + } + else if ( OldBGColor != BGColor ) + { + const char Message[] = { String::ASCII_ESCAPE, '[', '4', '0' + BGColor, 'm' }; + UART::Write(Message, sizeof(Message)); + } + + LastColor = NewColor; + } + + Element &= 0x7F; + + // Filter away any non-printable characters. + if ( Element < 32 || Element > 126 ) { Element = '?'; } + + UART::WriteChar(Element); + } + + SkippedSince = Index + 1; + } + } +#endif + } +#endif + } +} diff --git a/sortix/uart.h b/sortix/uart.h new file mode 100644 index 00000000..28cfe228 --- /dev/null +++ b/sortix/uart.h @@ -0,0 +1,45 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + uart.h + A simple serial terminal driver. + +******************************************************************************/ + +#ifndef SORTIX_UART_H +#define SORTIX_UART_H + +namespace Sortix +{ + namespace UART + { + void Init(); + void Read(uint8_t* Buffer, size_t Size); + void Write(const void* Buffer, size_t Size); + void WriteChar(char C); + int TryPopChar(); +#ifdef SORTIX_VGA_H + void InvalidateVGA(); + void RenderVGA(const VGA::Frame* Frame = (const VGA::Frame*) 0xB8000); +#endif + } +} + +#endif + diff --git a/sortix/user.h b/sortix/user.h new file mode 100644 index 00000000..d700d1b6 --- /dev/null +++ b/sortix/user.h @@ -0,0 +1,43 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + user.h + Identifies a users on a system. + +******************************************************************************/ + +#ifndef SORTIX_USER_H +#define SORTIX_USER_H + +namespace Sortix +{ + class System; + + class User + { + private: + const char* accountName; + int accountId; + System* system; + + }; +} + +#endif + diff --git a/sortix/vga.h b/sortix/vga.h new file mode 100644 index 00000000..a5607ae6 --- /dev/null +++ b/sortix/vga.h @@ -0,0 +1,62 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + vga.h + A Video Graphics Array driver. + +******************************************************************************/ + +#ifndef SORTIX_VGA_H +#define SORTIX_VGA_H + +namespace Sortix +{ + namespace VGA + { + // TODO: Move these to a better place + #define COLOR8_BLACK 0 + #define COLOR8_BLUE 1 + #define COLOR8_GREEN 2 + #define COLOR8_CYAN 3 + #define COLOR8_RED 4 + #define COLOR8_MAGENTA 5 + #define COLOR8_BROWN 6 + #define COLOR8_LIGHT_GREY 7 + #define COLOR8_DARK_GREY 8 + #define COLOR8_LIGHT_BLUE 9 + #define COLOR8_LIGHT_GREEN 10 + #define COLOR8_LIGHT_CYAN 11 + #define COLOR8_LIGHT_RED 12 + #define COLOR8_LIGHT_MAGENTA 13 + #define COLOR8_LIGHT_BROWN 14 + #define COLOR8_WHITE 15 + + struct Frame + { + static const nat Mode = 0x3; + static const size_t Width = 80; + static const size_t Height = 25; + + uint16_t Data[80*25]; + }; + } +} + +#endif + diff --git a/sortix/vgaterminal.cpp b/sortix/vgaterminal.cpp new file mode 100644 index 00000000..f025edea --- /dev/null +++ b/sortix/vgaterminal.cpp @@ -0,0 +1,535 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + vgaterminal.cpp + A terminal based on the VGA text mode buffer. + +******************************************************************************/ + +#include "platform.h" +#include "log.h" +#include "vga.h" +#include "vgaterminal.h" + +namespace Sortix +{ + namespace VGATerminal + { + const nat width = 80; + const nat height = 25; + const uint16_t defaultcolor = (COLOR8_LIGHT_GREY << 8) | (COLOR8_BLACK << 12); + uint16_t* const vga = (uint16_t* const) 0xB8000; + nat line; + nat column; + uint16_t currentcolor; + nat ansisavedposx; + nat ansisavedposy; + bool showcursor; + + enum + { + NONE, + CSI, + COMMAND, + } ansimode; + + // Changes the position of the hardware cursor. + void SetCursor(nat x, nat y) + { + nat value = x + y * width; + + // This sends a command to indicies 14 and 15 in the + // CRT Control Register of the VGA controller. These + // are the high and low bytes of the index that show + // where the hardware cursor is to be 'blinking'. + CPU::OutPortB(0x3D4, 14); + CPU::OutPortB(0x3D5, (value >> 8) & 0xFF); + CPU::OutPortB(0x3D4, 15); + CPU::OutPortB(0x3D5, (value >> 0) & 0xFF); + } + + void UpdateCursor() + { + if ( showcursor ) + { + SetCursor(column, line); + } + else + { + SetCursor(width, height-1); + } + } + + // Clear the screen, put the cursor at the top left corner, set default + // text color, and reset ANSI escape sequence state. + void Reset() + { + ansimode = NONE; + + line = 0; + column = 0; + ansisavedposx = 0; + ansisavedposy = 0; + + currentcolor = defaultcolor; + + for ( nat y = 0; y < height; y++ ) + { + for ( nat x = 0; x < width; x++ ) + { + vga[y * width + x] = ' ' | defaultcolor; + } + } + + // Reset the VGA cursor. + showcursor = true; + UpdateCursor(); + } + + // Initialize the terminal driver. + void Init() + { + Reset(); + } + + // Move every line one row up and leaves an empty line at the bottom. + void ScrollUp() + { + for ( nat y = 1; y < height; y++ ) + { + for ( nat x = 0; x < width; x++ ) + { + vga[(y-1) * width + x] = vga[y * width + x]; + } + } + + for ( nat x = 0; x < width; x++ ) + { + vga[(height-1) * width + x] = ' ' | currentcolor; + } + } + + // Move every line one row down and leaves an empty line at the top. + void ScrollDown() + { + for ( nat y = 1; y < height; y++ ) + { + for ( nat x = 0; x < width; x++ ) + { + vga[(y) * width + x] = vga[(y-1) * width + x]; + } + } + + for ( nat x = 0; x < width; x++ ) + { + vga[x] = ' ' | currentcolor; + } + } + + // Move to the next line. If at bottom, scroll one line up. + void Newline() + { + if ( line < height - 1 ) + { + line++; column = 0; + } + else + { + ScrollUp(); column = 0; + } + + UpdateCursor(); + } + + void ANSIReset(); + void ParseANSIEscape(char c); + + // Print text to the vga framebuffer, simulating how a terminal would + // display the text. + size_t Print(void* /*user*/, const char* string, size_t stringlen) + { + // Iterate over each character. + size_t left = stringlen; + while ( (left--) > 0 ) + { + char c = *(string++); + + // If we are parsing an escape sequence, parse another char. + if ( ansimode != NONE ) { ParseANSIEscape(c); continue; } + + switch ( c ) + { + // Move cursor to the next line and scroll up (if needed). + case '\n': + { + Newline(); + break; + } + // Move cursor to start of line. + case '\r': + { + column = 0; + break; + } + // Delete the previous char on this line. + case '\b': + { + // TODO: Properly handle backspace over lines and tabs. + if ( column < 1 ) { break; } + vga[line * width + (--column)] = ' ' | currentcolor; + break; + } + // Expand a tab to a few spaces. + case '\t': + { + if ( column == width ) { Newline(); } + nat until = 4 - (column % 4); + + while ( (until--) != 0 ) + { + vga[line * width + (column++)] = ' ' | currentcolor; + } + break; + } + // Initialize an ANSI escape sequence, allowing much more + // powerful control of the terminal than ASCII does. + case '\e': + { + ANSIReset(); + break; + } + // Print this character at the cursor and increment the cursor. + default: + { + if ( column == width ) { Newline(); } + vga[line * width + (column++)] = c | currentcolor; + break; + } + } + } + + // Update the VGA hardware cursor. + UpdateCursor(); + + return stringlen; + } + + const size_t ANSI_NUM_PARAMS = 16; + nat ansiusedparams; + nat ansiparams[ANSI_NUM_PARAMS]; + nat currentparamindex; + bool paramundefined; + bool ignoresequence; + + // TODO: The ANSI escape code is only partially implemented! + + // Begin an ANSI esacpe sequence. + void ANSIReset() + { + if ( ansimode == NONE ) + { + ansiusedparams = 0; + currentparamindex = 0; + ansiparams[0] = 0; + paramundefined = true; + ignoresequence = false; + ansimode = CSI; + } + } + + // Reads parameters and changes font properties accordingly. + void AnsiSetFont() + { + // Convert from the ANSI color scheme to the VGA color scheme. + nat conversion[8] = { COLOR8_BLACK, COLOR8_RED, COLOR8_GREEN, COLOR8_BROWN, + COLOR8_BLUE, COLOR8_MAGENTA, COLOR8_CYAN, COLOR8_LIGHT_GREY }; + + for ( size_t i = 0; i < ansiusedparams; i++ ) + { + nat cmd = ansiparams[i]; + // Turn all attributes off. + if ( cmd == 0 ) + { + currentcolor = defaultcolor; + } + // Set text color. + else if ( 30 <= cmd && cmd <= 37 ) + { + nat val = cmd - 30; + currentcolor &= (0xF0FF); + currentcolor |= (conversion[val] << 8); + } + // Set background color. + else if ( 40 <= cmd && cmd <= 47 ) + { + nat val = cmd - 40; + currentcolor &= (0x0FFF); + currentcolor |= (conversion[val] << 12); + } + // TODO: There are many other things we don't support. + } + } + + // Executes an ASNI escape command based on given parameters. + void RunANSICommand(char c) + { + switch ( c ) + { + // Cursor up + case 'A': + { + nat dist = ( 0 < ansiusedparams ) ? ansiparams[0] : 1; + if ( line < dist ) { line = 0; } else { line -= dist; } + break; + } + // Cursor down + case 'B': + { + nat dist = ( 0 < ansiusedparams ) ? ansiparams[0] : 1; + if ( height <= line + dist ) { line = height-1; } else { line += dist; } + break; + } + // Cursor forward + case 'C': + { + nat dist = ( 0 < ansiusedparams ) ? ansiparams[0] : 1; + if ( width <= column + dist ) { column = width-1; } else { column += dist; } + break; + } + // Cursor backward + case 'D': + { + nat dist = ( 0 < ansiusedparams ) ? ansiparams[0] : 1; + if ( column < dist ) { line = 0; } else { column -= dist; } + break; + } + // Move to beginning of line N lines down. + case 'E': + { + column = 0; + nat dist = ( 0 < ansiusedparams ) ? ansiparams[0] : 1; + if ( height <= line + dist ) { line = height-1; } else { line += dist; } + break; + } + // Move to beginning of line N lines up. + case 'F': + { + column = 0; + nat dist = ( 0 < ansiusedparams ) ? ansiparams[0] : 1; + if ( line < dist ) { line = 0; } else { line -= dist; } + break; + } + // Move the cursor to column N. + case 'G': + { + nat pos = ( 0 < ansiusedparams ) ? ansiparams[0]-1 : 0; + if ( width <= pos ) { pos = width-1; } + column = pos; + break; + } + // Move the cursor to line Y, column X. + case 'H': + case 'f': + { + nat posy = ( 0 < ansiusedparams ) ? ansiparams[0]-1 : 0; + nat posx = ( 1 < ansiusedparams ) ? ansiparams[1]-1 : 0; + if ( width <= posx ) { posx = width-1; } + if ( height <= posy ) { posy = height-1; } + column = posx; + line = posy; + break; + } + // Erase parts of the screen. + case 'J': + { + nat mode = ( 0 < ansiusedparams ) ? ansiparams[0] : 0; + + nat from = 0; + nat to = 0; + + // From cursor to end. + if ( mode == 0 ) { from = line*width + column; to = height*width - 1; } + + // From start to cursor. + if ( mode == 1 ) { from = 0; to = line*width + column; } + + // Everything. + if ( mode == 2 ) { from = 0; to = height*width - 1; } + + for ( nat i = from; i <= to; i++ ) + { + vga[i] = ' ' | currentcolor; + } + + break; + } + // Erase parts of the current line. + case 'K': + { + nat mode = ( 0 < ansiusedparams ) ? ansiparams[0] : 0; + + nat from = 0; + nat to = 0; + + // From cursor to end. + if ( mode == 0 ) { from = column; to = width - 1; } + + // From start to cursor. + if ( mode == 1 ) { from = 0; to = column; } + + // Everything. + if ( mode == 2 ) { from = 0; to = width - 1; } + + for ( nat i = from; i <= to; i++ ) + { + vga[line * width + i] = ' ' | currentcolor; + } + + break; + } + // Scroll a line up and place a new line at the buttom. + case 'S': + { + ScrollUp(); line = height-1; + break; + } + // Scroll a line up and place a new line at the top. + case 'T': + { + ScrollDown(); line = 0; + break; + } + // Change how the text is rendered. + case 'm': + { + if ( ansiusedparams == 0 ) + { + ansiparams[0] = 0; + ansiusedparams++; + } + AnsiSetFont(); + break; + } + // Request special information from terminal. + case 'n': + { + // TODO: Handle this code. + break; + } + // Save cursor position. + case 's': + { + ansisavedposx = column; + ansisavedposx = line; + break; + } + // Restore cursor position. + case 'u': + { + column = ansisavedposx; + line = ansisavedposx; + if ( width <= column ) { column = width-1; } + if ( height <= line ) { line = height-1; } + break; + } + // Hide cursor. + case 'l': + { + // TODO: This is somehow related to the special char '?'. + if ( 0 < ansiusedparams && ansiparams[0] == 25 ) + { + showcursor = false; + UpdateCursor(); + } + } + // Show cursor. + case 'h': + { + // TODO: This is somehow related to the special char '?'. + if ( 0 < ansiusedparams && ansiparams[0] == 25 ) + { + showcursor = true; + UpdateCursor(); + } + } + // TODO: Handle other cases. + } + + ansimode = NONE; + } + + // Parse another char of an ASNI escape code. + void ParseANSIEscape(char c) + { + // Check the proper prefixes are used. + if ( ansimode == CSI ) + { + if ( c != '[' ) { ansimode = NONE; return; } + ansimode = COMMAND; + } + + // Parse parameters and the command. + else if ( ansimode == COMMAND ) + { + // Read part of a parameter. + if ( '0' <= c && c <= '9' ) + { + if ( paramundefined ) { ansiusedparams++; } + paramundefined = false; + nat val = c - '0'; + ansiparams[currentparamindex] *= 10; + ansiparams[currentparamindex] += val; + } + + // Parameter delimiter. + else if ( c == ';' ) + { + if ( currentparamindex == ANSI_NUM_PARAMS - 1 ) { ansimode = NONE; return; } + paramundefined = true; + ansiparams[++currentparamindex] = 0; + } + + // Left for future standardization, so discard this sequence. + else if ( c == ':' ) + { + ignoresequence = true; + } + + // Run a command. + else if ( 64 <= c && c <= 126 ) + { + if ( !ignoresequence ) { RunANSICommand(c); } + } + + // Something I don't understand, and ignore intentionally. + else if ( c == '?' ) + { + } + + // TODO: There are some rare things that should be supported here. + + // Ignore unknown input. + else + { + ansimode = NONE; + } + } + } + } +} diff --git a/sortix/vgaterminal.h b/sortix/vgaterminal.h new file mode 100644 index 00000000..2fb785ce --- /dev/null +++ b/sortix/vgaterminal.h @@ -0,0 +1,39 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + vgaterminal.h + A terminal based on the VGA text mode buffer. + +******************************************************************************/ + +#ifndef SORTIX_VGATERMINAL_H +#define SORTIX_VGATERMINAL_H + +namespace Sortix +{ + namespace VGATerminal + { + void Init(); + void Reset(); + size_t Print(void* user, const char* string, size_t stringlen); + } +} + +#endif + diff --git a/sortix/x64/base.s b/sortix/x64/base.s new file mode 100644 index 00000000..b8af373d --- /dev/null +++ b/sortix/x64/base.s @@ -0,0 +1,72 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + boot.s + Bootstraps the kernel and passes over control from the boot-loader to the + kernel main function. + +******************************************************************************/ + +.globl beginkernel, _beginkernel +.globl start, _start + +.section .text + +.text 0x110000 +.type _beginkernel, @function +beginkernel: +_beginkernel: +start: +_start: + movw $0x736, 0xB83E8 + movw $0x734, 0xB83EA + movw $0x753, 0xB83EE + movw $0x74F, 0xB83F0 + movw $0x752, 0xB83F2 + movw $0x754, 0xB83F4 + movw $0x749, 0xB83F6 + movw $0x758, 0xB83F8 + + # Initialize the stack pointer. + # TODO: This is very hacky! + movq $0x110000, %rsp + + # Reset EFLAGS. + # pushl $0 + # popf + + # Push the pointer to the Multiboot information structure. + mov %rbx, %rsi + # Push the magic value. + mov %rax, %rdi + + call KernelInit + +.globl HaltKernel +HaltKernel: + cli + hlt + jmp HaltKernel + +.globl WaitForInterrupt +.type WaitForInterrupt, @function # void WaitForInterrupt(); +WaitForInterrupt: + hlt + ret + diff --git a/sortix/x64/bits.h b/sortix/x64/bits.h new file mode 100644 index 00000000..7d1339f3 --- /dev/null +++ b/sortix/x64/bits.h @@ -0,0 +1,130 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + bits.h + Declares the required datatypes for the x64 architecture. + +******************************************************************************/ + +#ifndef SORTIX_BITS_H +#define SORTIX_BITS_H + +/* TODO: Declare stuff from . */ + +#undef __NULL +#if defined(__cplusplus) + #define __NULL 0 +#else + #define __NULL ((void*) 0) + typedef int __wchar_t; +#endif + +/* Define basic signed types. */ +typedef signed char __int8_t; +typedef signed short __int16_t; +typedef signed int __int32_t; +typedef signed long long __int64_t; + +/* Define basic unsigned types. */ +typedef unsigned char __uint8_t; +typedef unsigned short __uint16_t; +typedef unsigned int __uint32_t; +typedef unsigned long long __uint64_t; + +typedef unsigned int __nat; + +/* The maximum width integers available on this platform. */ +typedef __int64_t __intmax_t; +typedef __uint64_t __uintmax_t; + +/* Define an integer able to hold the size of the largest continious memory */ +/* region and define pointer safe integer types. */ +typedef unsigned long __size_t; +typedef signed long __ssize_t; +typedef signed long __intptr_t; +typedef unsigned long __uintptr_t; +typedef signed long __ptrdiff_t; + +#define __INT8_MIN (0x80) +#define __INT16_MIN (0x8000) +#define __INT32_MIN (0x80000000) +#define __INT64_MIN (0x8000000000000000ULL) +#define __INT8_MAX (0x7F) +#define __INT16_MAX (0x7FFF) +#define __INT32_MAX (0x7FFFFFFF) +#define __INT64_MAX (0x7FFFFFFFFFFFFFFFULL) +#define __UINT8_MAX (0xFF) +#define __UINT16_MAX (0xFFFF) +#define __UINT32_MAX (0xFFFFFFFF) +#define __UINT64_MAX (0xFFFFFFFFFFFFFFFFULL) + +#define __INTMAX_MIN __INT64_MIN +#define __INTMAX_MAX __INT64_MAX +#define __UINTMAX_MAX __UINT64_MAX + +#define __CHAR_BIT (8) +#define __SCHAR_MIN __INT8_MIN +#define __SCHAR_MAX __INT8_MAX +#define __UCHAR_MAX __INT8_MAX +#define __CHAR_MIN __SCHAR_MIN +#define __CHAR_MAX __SCHAR_MAX + +#define __WCHAR_MIN __INT_MIN +#define __WCHAR_MAX __INT_MAX + +#define __SHRT_MIN __INT16_MIN +#define __SHRT_MAX __INT16_MAX +#define __USHRT_MAX __UINT16_MAX + +#define __WORD_BIT (32) +#define __INT_MIN __INT32_MIN +#define __INT_MAX __INT32_MAX +#define __UINT_MAX __UINT32_MAX + +#define __LONG_BIT (64) +#define __LONG_MIN __INT64_MIN +#define __LONG_MAX __INT64_MAX +#define __ULONG_MAX __UINT64_MAX + +#define __LLONG_MIN __INT64_MIN +#define __LLONG_MAX __INT64_MAX +#define __ULLONG_MAX __UINT64_MAX + +#define __SSIZE_MIN __LONG_MIN +#define __SSIZE_MAX __LONG_MAX +#define __SIZE_MAX __ULONG_MAX +#define __INTPTR_MIN __LONG_MIN +#define __INTPTR_MAX __LONG_MAX +#define __UINTPTR_MAX __ULONG_MAX + +typedef int __wint_t; + +typedef int __id_t; +typedef int __gid_t; +typedef int __pid_t; +typedef int __uid_t; +typedef int __locale_t; /* TODO: figure out what this does and typedef it properly. This is just a temporary assignment. */ +typedef unsigned int __mode_t; +typedef __intmax_t __off_t; +typedef unsigned int __wctrans_t; /* TODO: figure out what this does and typedef it properly. This is just a temporary assignment. */ +typedef unsigned int __wctype_t; /* TODO: figure out what this does and typedef it properly. This is just a temporary assignment. */ +typedef unsigned int __useconds_t; + +#endif + diff --git a/sortix/x64/boot.s b/sortix/x64/boot.s new file mode 100644 index 00000000..38a2e766 --- /dev/null +++ b/sortix/x64/boot.s @@ -0,0 +1,175 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY# without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + boot.s + Bootstraps the kernel and passes over control from the boot-loader to the + kernel main function. It also jumps into long mode! + +******************************************************************************/ + + +.globl start, _start + +.section .text + +.text 0x100000 +.type _start, @function +.code32 +start: +_start: + jmp multiboot_entry + + # Align 32 bits boundary. + .align 4 + + # Multiboot header. +multiboot_header: + # Magic. + .long 0x1BADB002 + # Flags. + .long 0x00000003 + # Checksum. + .long -(0x1BADB002 + 0x00000003) + +multiboot_entry: + + # We got our multiboot information in various registers. But we are going + # to need these registers. But where can we store them then? Oh hey, let's + # store then in the code already run! + + # Store the pointer to the Multiboot information structure. + mov %ebx, 0x100000 + + # Store the magic value. + mov %eax, 0x100004 + + movl $0x1000, %edi + mov %edi, %cr3 + xorl %eax, %eax + movl $4096, %ecx + rep stosl + movl %cr3, %edi + + movl $0x2003, (%edi) + addl $0x1000, %edi + + movl $0x3003, (%edi) + addl $0x1000, %edi + + movl $0x4003, (%edi) + addl $0x1000, %edi + + movl $0x3, %ebx + movl $512, %ecx + +SetEntry: + mov %ebx, (%edi) + add $0x1000, %ebx + add $8, %edi + loop SetEntry + + mov %cr4, %eax + orl $0x20, %eax + mov %eax, %cr4 + + mov $0xC0000080, %ecx + rdmsr + orl $0x100, %eax + wrmsr + + mov %cr0, %eax + orl $0x80000000, %eax + mov %eax, %cr0 + + mov GDTPointer, %eax + lgdtl GDTPointer + + ljmp $0x10, $Realm64 + +.code64 +Realm64: + + cli + mov $0x18, %ax + mov %ax, %ds + mov %ax, %es + mov %ax, %fs + mov %ax, %gs + + + + # Disable virtual memory + #movq %cr0, %rdi + #movabs $0xffffffff7fffffff, %rbx + #andq %rbx, %rdi + #movq %rdi, %cr0 + + jmp Main + +.section .data +GDT64: # Global Descriptor Table (64-bit). + GDTNull: # The null descriptor. + .word 0 # Limit (low). + .word 0 # Base (low). + .byte 0 # Base (middle) + .byte 0 # Access. + .byte 0 # Granularity. + .byte 0 # Base (high). + GDTUnused: # The null descriptor. + .word 0 # Limit (low). + .word 0 # Base (low). + .byte 0 # Base (middle) + .byte 0 # Access. + .byte 0 # Granularity. + .byte 0 # Base (high). + GDTCode: # The code descriptor. + .word 0xFFFF # Limit (low). + .word 0 # Base (low). + .byte 0 # Base (middle) + .byte 0x9A # Access. + .byte 0xAF # Granularity. + .byte 0 # Base (high). + GDTData: # The data descriptor. + .word 0xFFFF # Limit (low). + .word 0 # Base (low). + .byte 0 # Base (middle) + .byte 0x92 # Access. + .byte 0x8F # Granularity. + .byte 0 # Base (high). + GDTPointer: # The GDT-pointer. + .word GDTPointer - GDT64 - 1 # Limit. + .long GDT64 # Base. + .long 0 + +Main: + # Copy the character B onto the screen so we know it works. + movq $0x242, %r15 + movq %r15, %rax + movw %ax, 0xB8000 + + + # Load the pointer to the Multiboot information structure. + mov 0x100000, %ebx + + # Load the magic value. + mov 0x100004, %eax + + # The linker is kindly asked to put the real 64-bit kernel at 0x110000. + jmp 0x110000 + diff --git a/sortix/x64/gdt.asm b/sortix/x64/gdt.asm new file mode 100644 index 00000000..bb6cb84f --- /dev/null +++ b/sortix/x64/gdt.asm @@ -0,0 +1,43 @@ +; +; Gdt.s -- contains global descriptor table and interrupt descriptor table +; setup code. +; Based on code from Bran's kernel development tutorials. +; Rewritten for JamesM's kernel development tutorials. + +[GLOBAL gdt_flush] ; Allows the C code to call gdt_flush(). + +gdt_flush: + + ; TODO: Actually make this stuff work! + + mov eax, [esp+4] ; Get the pointer to the GDT, passed as a parameter. + lgdt [eax] ; Load the new GDT pointer + + mov ax, 0x10 ; 0x10 is the offset in the GDT to our data segment + mov ds, ax ; Load all data segment selectors + mov es, ax + ; mov fs, ax ; TODO: Not on 64-bit! + mov gs, ax + mov ss, ax + ; TODO: Not on 64-bit! + ; jmp 0x08:.flush ; 0x08 is the offset to our code segment: Far jump! +.flush: + ret + +[GLOBAL idt_flush] ; Allows the C code to call idt_flush(). + +idt_flush: + mov eax, [esp+4] ; Get the pointer to the IDT, passed as a parameter. + lidt [eax] ; Load the IDT pointer. + sti + ret + +[GLOBAL tss_flush] ; Allows our C code to call tss_flush(). +tss_flush: + mov ax, 0x2B ; Load the index of our TSS structure - The index is + ; 0x28, as it is the 5th selector and each is 8 bytes + ; long, but we set the bottom two bits (making 0x2B) + ; so that it has an RPL of 3, not zero. + ltr ax ; Load 0x2B into the task state register. + ret + diff --git a/sortix/x64/interrupt.asm b/sortix/x64/interrupt.asm new file mode 100644 index 00000000..cbe2d2d1 --- /dev/null +++ b/sortix/x64/interrupt.asm @@ -0,0 +1,108 @@ +; +; interrupt.s -- Contains interrupt service routine wrappers. +; Based on Bran's kernel development tutorials. +; Rewritten for JamesM's kernel development tutorials. + +; This macro creates a stub for an ISR which does NOT pass it's own +; error code (adds a dummy errcode byte). +%macro ISR_NOERRCODE 1 + global isr%1 + isr%1: + cli ; Disable interrupts firstly. + push long 0 ; Push a dummy error code. + push long %1 ; Push the interrupt number. + jmp isr_common_stub ; Go to our common handler code. +%endmacro + +; This macro creates a stub for an ISR which passes it's own +; error code. +%macro ISR_ERRCODE 1 + global isr%1 + isr%1: + cli ; Disable interrupts. + push long %1 ; Push the interrupt number + jmp isr_common_stub +%endmacro + +; This macro creates a stub for an IRQ - the first parameter is +; the IRQ number, the second is the ISR number it is remapped to. +%macro IRQ 2 + global irq%1 + irq%1: + cli + push long 0 + push long %2 + jmp irq_common_stub +%endmacro + +ISR_NOERRCODE 0 +ISR_NOERRCODE 1 +ISR_NOERRCODE 2 +ISR_NOERRCODE 3 +ISR_NOERRCODE 4 +ISR_NOERRCODE 5 +ISR_NOERRCODE 6 +ISR_NOERRCODE 7 +ISR_ERRCODE 8 +ISR_NOERRCODE 9 +ISR_ERRCODE 10 +ISR_ERRCODE 11 +ISR_ERRCODE 12 +ISR_ERRCODE 13 +ISR_ERRCODE 14 +ISR_NOERRCODE 15 +ISR_NOERRCODE 16 +ISR_NOERRCODE 17 +ISR_NOERRCODE 18 +ISR_NOERRCODE 19 +ISR_NOERRCODE 20 +ISR_NOERRCODE 21 +ISR_NOERRCODE 22 +ISR_NOERRCODE 23 +ISR_NOERRCODE 24 +ISR_NOERRCODE 25 +ISR_NOERRCODE 26 +ISR_NOERRCODE 27 +ISR_NOERRCODE 28 +ISR_NOERRCODE 29 +ISR_NOERRCODE 30 +ISR_NOERRCODE 31 +ISR_NOERRCODE 128 +ISR_NOERRCODE 177 +IRQ 0, 32 +IRQ 1, 33 +IRQ 2, 34 +IRQ 3, 35 +IRQ 4, 36 +IRQ 5, 37 +IRQ 6, 38 +IRQ 7, 39 +IRQ 8, 40 +IRQ 9, 41 +IRQ 10, 42 +IRQ 11, 43 +IRQ 12, 44 +IRQ 13, 45 +IRQ 14, 46 +IRQ 15, 47 + +; In isr.c +extern isr_handler + +; This is our common ISR stub. It saves the processor state, sets +; up for kernel mode segments, calls the C-level fault handler, +; and finally restores the stack frame. +isr_common_stub: + + ; TODO + +; In isr.c +extern irq_handler + +; This is our common IRQ stub. It saves the processor state, sets +; up for kernel mode segments, calls the C-level fault handler, +; and finally restores the stack frame. +irq_common_stub: + + ; TODO + diff --git a/sortix/x64/memorymanagement-asm.s b/sortix/x64/memorymanagement-asm.s new file mode 100644 index 00000000..223d1c01 --- /dev/null +++ b/sortix/x64/memorymanagement-asm.s @@ -0,0 +1,163 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + memorymanagement-asm.s + Handles memory for the x86 architecture. + +******************************************************************************/ + +.section .text + +.globl _ZN6Sortix4Page11FragmentizeEv +.type _ZN6Sortix4Page11FragmentizeEv, @function # namespace Sortix { namespace Page { void Fragmentize(); } } +_ZN6Sortix4Page11FragmentizeEv: + # Load the front of our linked list. + movq _ZN6Sortix4Page15UnallocatedPageE, %rax # Load UnallocPage* Sortix::Page::UnallocatedPage + +FragLoop: + testq %rax, %rax + je FragDone + + movq 8(%rax), %rdx + movq 16(%rax), %rbx + + testq %rbx, %rbx + je FragNext + + movq %rax, %rcx + addq $0x1000, %rcx + movq %rcx, 8(%rax) + decq %rbx + +FragFixupLoop: + testq %rbx, %rbx + je FragFixupLoopLastSwap + + movl $0xABBAACDC, 0(%rcx) + addq $0x2000, %rax + movq %rax, 8(%rcx) + #movq $0, 16(%rcx) + decq %rbx + + testq %rbx, %rbx + je FragFixupLoopLast + + movl $0xABBAACDC, 0(%rax) + addq $0x2000, %rcx + movq %rcx, 8(%rax) + #movq $0, 16(%rax) + decq %rbx + + jmp FragFixupLoop + +FragFixupLoopLastSwap: + movq %rcx, %rax + +FragFixupLoopLast: + movl $0xABBAACDC, 0(%rax) + movq %rdx, 8(%rax) + +FragNext: + movq %rdx, %rax + jmp FragLoop + +FragDone: + ret + +.globl _ZN6Sortix4Page3GetEv +.type _ZN6Sortix4Page3GetEv, @function # namespace Sortix { void Paging::Allocate(); } +_ZN6Sortix4Page3GetEv: + # Load the front of our linked list. + movq _ZN6Sortix4Page15UnallocatedPageE, %rax # Load UnallocPage* Sortix::Page::UnallocatedPage + + # Test if we are out of memory. + testq %rax, %rax + je OutOfMem + + push %rbx + push %rdi + push %rsi + + # Disable virtual memory + movq %cr0, %rdi + movq %rdi, %rsi + movabs $0xffffffff7fffffff, %rbx + andq %rbx, %rsi + movq %rsi, %cr0 + + # Test if this page is unallocated, as a security measure. + movl (%rax), %ebx + cmpl $0xABBAACDC, %ebx + jne MagicFailure + + # Prepare the next front element in our linked list. + movq 8(%rax), %rdx + jmp Done + +MagicFailure: + # The magic header in our page was invalid! + movq %rax, %rdx + inc %rax # Set the lowest bit to signal a magic failure. + + # Panic the kernel. + mov %rdx, %rsi + mov %rbx, %rdx + mov MagicFailureString, %rdi + call PanicF + +Done: + # Enable virtual memory here + mov %rdi, %cr0 + + # Update the front of our linked list to the next element. + mov %rdx, _ZN6Sortix4Page15UnallocatedPageE # Save Load UnallocPage* Sortix::Page::UnallocatedPage + + ret + +OutOfMem: + # We run out of memory. Return NULL. + movq $0, %rax + ret + +.globl _ZN6Sortix4Page3PutEPv +.type _ZN6Sortix4Page3PutEPv, @function # namespace Sortix { void Paging::Free(void* Page); } +_ZN6Sortix4Page3PutEPv: + movq _ZN6Sortix4Page15UnallocatedPageE, %rax # Load UnallocPage* Sortix::Page::UnallocatedPage + + # Disable virtual memory + movq %cr0, %rcx + movq %rcx, %rsi + movabs $0xffffffff7fffffff, %rbx + andq %rbx, %rsi + movq %rsi, %cr0 + + movl $0xABBAACDC, (%rdi) + movq %rax, 8(%edx) + #movl $0, 16(%edx) + + # Enable virtual memory + movq %rcx, %cr0 + + # Update the front of our linked list to the next element. + movq %rdx, _ZN6Sortix4Page15UnallocatedPageE # Save Load UnallocPage* Sortix::Page::UnallocatedPage + ret + +.section .data +MagicFailureString: + .asciz "A magic failure occured at 0x%p, where 0x%x was found instead of 0xABBAACDC!\n" diff --git a/sortix/x64/x64.cpp b/sortix/x64/x64.cpp new file mode 100644 index 00000000..b19408aa --- /dev/null +++ b/sortix/x64/x64.cpp @@ -0,0 +1,68 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + x64.cpp + CPU stuff for the x64 platform. + +******************************************************************************/ + +#include +#include "x64.h" + +namespace Sortix +{ + namespace X64 + { + void OutPortB(uint16_t Port, uint8_t Value) + { + asm volatile ("outb %1, %0" : : "dN" (Port), "a" (Value)); + } + + void OutPortW(uint16_t Port, uint16_t Value) + { + asm volatile ("outw %1, %0" : : "dN" (Port), "a" (Value)); + } + + void OutPortL(uint16_t Port, uint32_t Value) + { + asm volatile ("outl %1, %0" : : "dN" (Port), "a" (Value)); + } + + uint8_t InPortB(uint16_t Port) + { + uint8_t Result; + asm volatile("inb %1, %0" : "=a" (Result) : "dN" (Port)); + return Result; + } + + uint16_t InPortW(uint16_t Port) + { + uint16_t Result; + asm volatile("inw %1, %0" : "=a" (Result) : "dN" (Port)); + return Result; + } + + uint32_t InPortL(uint16_t Port) + { + uint32_t Result; + asm volatile("inl %1, %0" : "=a" (Result) : "dN" (Port)); + return Result; + } + } +} diff --git a/sortix/x64/x64.h b/sortix/x64/x64.h new file mode 100644 index 00000000..2d245244 --- /dev/null +++ b/sortix/x64/x64.h @@ -0,0 +1,52 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + x64 + CPU stuff for the x64 platform. + +******************************************************************************/ + +#ifndef SORTIX_X64_H +#define SORTIX_X64_H + +namespace Sortix +{ + namespace X64 + { + void OutPortB(uint16_t Port, uint8_t Value); + void OutPortW(uint16_t Port, uint16_t Value); + void OutPortL(uint16_t Port, uint32_t Value); + uint8_t InPortB(uint16_t Port); + uint16_t InPortW(uint16_t Port); + uint32_t InPortL(uint16_t Port); + + struct InterruptRegisters + { + uint64_t cr2; + uint64_t ds; // Data segment selector + uint64_t rdi, rsi, rbp, rsp, rbx, rdx, rcx, rax; // Pushed by pusha. + uint64_t r8, r9, r10, r11, r12, r13, r14, r15; // Pushed by pusha. + uint64_t int_no, err_code; // Interrupt number and error code (if applicable) + uint64_t eip, cs, eflags, useresp, ss; // Pushed by the processor automatically. + }; + } +} + +#endif + diff --git a/sortix/x86/base.s b/sortix/x86/base.s new file mode 100644 index 00000000..509cfa71 --- /dev/null +++ b/sortix/x86/base.s @@ -0,0 +1,61 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + boot.s + Bootstraps the kernel and passes over control from the boot-loader to the + kernel main function. + +******************************************************************************/ + +.globl beginkernel, _beginkernel + +.section .text + +.text 0x100000 +.type _beginkernel, @function +beginkernel: +_beginkernel: + # Initialize the stack pointer. + mov $stackend, %esp + + # Reset EFLAGS. + # pushl $0 + # popf + + # Push the pointer to the Multiboot information structure. + push %ebx + # Push the magic value. + push %eax + + ## Disable interrupts. + cli + + call KernelInit + +.globl HaltKernel +HaltKernel: + cli + hlt + jmp HaltKernel + +.globl WaitForInterrupt +.type WaitForInterrupt, @function # void WaitForInterrupt(); +WaitForInterrupt: + hlt + ret diff --git a/sortix/x86/bits.h b/sortix/x86/bits.h new file mode 100644 index 00000000..25c4df0d --- /dev/null +++ b/sortix/x86/bits.h @@ -0,0 +1,130 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + bits.h + Declares the required datatypes for the x86 architecture. + +******************************************************************************/ + +#ifndef SORTIX_BITS_H +#define SORTIX_BITS_H + +/* TODO: Declare stuff from . */ + +#undef __NULL +#if defined(__cplusplus) + #define __NULL 0 +#else + #define __NULL ((void*) 0) + typedef int __wchar_t; +#endif + +/* Define basic signed types. */ +typedef signed char __int8_t; +typedef signed short __int16_t; +typedef signed int __int32_t; +typedef signed long long __int64_t; + +/* Define basic unsigned types. */ +typedef unsigned char __uint8_t; +typedef unsigned short __uint16_t; +typedef unsigned int __uint32_t; +typedef unsigned long long __uint64_t; + +typedef unsigned int __nat; + +/* The maximum width integers available on this platform. */ +typedef __int64_t __intmax_t; +typedef __uint64_t __uintmax_t; + +/* Define an integer able to hold the size of the largest continious memory */ +/* region and define pointer safe integer types. */ +typedef unsigned int __size_t; +typedef signed long __ssize_t; +typedef signed long __intptr_t; +typedef unsigned long __uintptr_t; +typedef signed long __ptrdiff_t; + +#define __INT8_MIN (0x80) +#define __INT16_MIN (0x8000) +#define __INT32_MIN (0x80000000) +#define __INT64_MIN (0x8000000000000000ULL) +#define __INT8_MAX (0x7F) +#define __INT16_MAX (0x7FFF) +#define __INT32_MAX (0x7FFFFFFF) +#define __INT64_MAX (0x7FFFFFFFFFFFFFFFULL) +#define __UINT8_MAX (0xFF) +#define __UINT16_MAX (0xFFFF) +#define __UINT32_MAX (0xFFFFFFFF) +#define __UINT64_MAX (0xFFFFFFFFFFFFFFFFULL) + +#define __INTMAX_MIN __INT64_MIN +#define __INTMAX_MAX __INT64_MAX +#define __UINTMAX_MAX __UINT64_MAX + +#define __CHAR_BIT (8) +#define __SCHAR_MIN __INT8_MIN +#define __SCHAR_MAX __INT8_MAX +#define __UCHAR_MAX __INT8_MAX +#define __CHAR_MIN __SCHAR_MIN +#define __CHAR_MAX __SCHAR_MAX + +#define __WCHAR_MIN __INT_MIN +#define __WCHAR_MAX __INT_MAX + +#define __SHRT_MIN __INT16_MIN +#define __SHRT_MAX __INT16_MAX +#define __USHRT_MAX __UINT16_MAX + +#define __WORD_BIT (32) +#define __INT_MIN __INT32_MIN +#define __INT_MAX __INT32_MAX +#define __UINT_MAX __UINT32_MAX + +#define __LONG_BIT (32) +#define __LONG_MIN __INT32_MIN +#define __LONG_MAX __INT32_MAX +#define __ULONG_MAX __UINT32_MAX + +#define __LLONG_MIN __INT64_MIN +#define __LLONG_MAX __INT64_MAX +#define __ULLONG_MAX __UINT64_MAX + +#define __SSIZE_MIN __INT_MIN +#define __SSIZE_MAX __INT_MAX +#define __SIZE_MAX __UINT_MAX +#define __INTPTR_MIN __INT_MIN +#define __INTPTR_MAX __INT_MAX +#define __UINTPTR_MAX __UINT_MAX + +typedef int __wint_t; + +typedef int __id_t; +typedef int __gid_t; +typedef int __pid_t; +typedef int __uid_t; +typedef int __locale_t; /* TODO: figure out what this does and typedef it properly. This is just a temporary assignment. */ +typedef unsigned int __mode_t; +typedef __intmax_t __off_t; +typedef unsigned int __wctrans_t; /* TODO: figure out what this does and typedef it properly. This is just a temporary assignment. */ +typedef unsigned int __wctype_t; /* TODO: figure out what this does and typedef it properly. This is just a temporary assignment. */ +typedef unsigned int __useconds_t; + +#endif + diff --git a/sortix/x86/boot.s b/sortix/x86/boot.s new file mode 100644 index 00000000..07394c40 --- /dev/null +++ b/sortix/x86/boot.s @@ -0,0 +1,47 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + boot.s + Bootstraps the kernel and passes over control from the boot-loader to the + kernel main function. + +******************************************************************************/ + +.globl start, _start + +.section .text + +.text 0x100000 +.type _start, @function +start: +_start: + jmp beginkernel + + # Align 32 bits boundary. + .align 4 + + # Multiboot header. +multiboot_header: + # Magic. + .long 0x1BADB002 + # Flags. + .long 0x00000003 + # Checksum. + .long -(0x1BADB002 + 0x00000003) + diff --git a/sortix/x86/gdt.asm b/sortix/x86/gdt.asm new file mode 100644 index 00000000..940526a0 --- /dev/null +++ b/sortix/x86/gdt.asm @@ -0,0 +1,39 @@ +; +; Gdt.s -- contains global descriptor table and interrupt descriptor table +; setup code. +; Based on code from Bran's kernel development tutorials. +; Rewritten for JamesM's kernel development tutorials. + +[GLOBAL gdt_flush] ; Allows the C code to call gdt_flush(). + +gdt_flush: + mov eax, [esp+4] ; Get the pointer to the GDT, passed as a parameter. + lgdt [eax] ; Load the new GDT pointer + + mov ax, 0x10 ; 0x10 is the offset in the GDT to our data segment + mov ds, ax ; Load all data segment selectors + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + jmp 0x08:.flush ; 0x08 is the offset to our code segment: Far jump! +.flush: + ret + +[GLOBAL idt_flush] ; Allows the C code to call idt_flush(). + +idt_flush: + mov eax, [esp+4] ; Get the pointer to the IDT, passed as a parameter. + lidt [eax] ; Load the IDT pointer. + sti + ret + +[GLOBAL tss_flush] ; Allows our C code to call tss_flush(). +tss_flush: + mov ax, 0x2B ; Load the index of our TSS structure - The index is + ; 0x28, as it is the 5th selector and each is 8 bytes + ; long, but we set the bottom two bits (making 0x2B) + ; so that it has an RPL of 3, not zero. + ltr ax ; Load 0x2B into the task state register. + ret + diff --git a/sortix/x86/interrupt.asm b/sortix/x86/interrupt.asm new file mode 100644 index 00000000..83179bc3 --- /dev/null +++ b/sortix/x86/interrupt.asm @@ -0,0 +1,162 @@ +; +; interrupt.s -- Contains interrupt service routine wrappers. +; Based on Bran's kernel development tutorials. +; Rewritten for JamesM's kernel development tutorials. + +; This macro creates a stub for an ISR which does NOT pass it's own +; error code (adds a dummy errcode byte). +%macro ISR_NOERRCODE 1 + global isr%1 + isr%1: + cli ; Disable interrupts firstly. + push long 0 ; Push a dummy error code. + push long %1 ; Push the interrupt number. + jmp isr_common_stub ; Go to our common handler code. +%endmacro + +; This macro creates a stub for an ISR which passes it's own +; error code. +%macro ISR_ERRCODE 1 + global isr%1 + isr%1: + cli ; Disable interrupts. + push long %1 ; Push the interrupt number + jmp isr_common_stub +%endmacro + +; This macro creates a stub for an IRQ - the first parameter is +; the IRQ number, the second is the ISR number it is remapped to. +%macro IRQ 2 + global irq%1 + irq%1: + cli + push long 0 + push long %2 + jmp irq_common_stub +%endmacro + +ISR_NOERRCODE 0 +ISR_NOERRCODE 1 +ISR_NOERRCODE 2 +ISR_NOERRCODE 3 +ISR_NOERRCODE 4 +ISR_NOERRCODE 5 +ISR_NOERRCODE 6 +ISR_NOERRCODE 7 +ISR_ERRCODE 8 +ISR_NOERRCODE 9 +ISR_ERRCODE 10 +ISR_ERRCODE 11 +ISR_ERRCODE 12 +ISR_ERRCODE 13 +ISR_ERRCODE 14 +ISR_NOERRCODE 15 +ISR_NOERRCODE 16 +ISR_NOERRCODE 17 +ISR_NOERRCODE 18 +ISR_NOERRCODE 19 +ISR_NOERRCODE 20 +ISR_NOERRCODE 21 +ISR_NOERRCODE 22 +ISR_NOERRCODE 23 +ISR_NOERRCODE 24 +ISR_NOERRCODE 25 +ISR_NOERRCODE 26 +ISR_NOERRCODE 27 +ISR_NOERRCODE 28 +ISR_NOERRCODE 29 +ISR_NOERRCODE 30 +ISR_NOERRCODE 31 +ISR_NOERRCODE 128 +ISR_NOERRCODE 177 +IRQ 0, 32 +IRQ 1, 33 +IRQ 2, 34 +IRQ 3, 35 +IRQ 4, 36 +IRQ 5, 37 +IRQ 6, 38 +IRQ 7, 39 +IRQ 8, 40 +IRQ 9, 41 +IRQ 10, 42 +IRQ 11, 43 +IRQ 12, 44 +IRQ 13, 45 +IRQ 14, 46 +IRQ 15, 47 + +; In isr.c +extern isr_handler + +; This is our common ISR stub. It saves the processor state, sets +; up for kernel mode segments, calls the C-level fault handler, +; and finally restores the stack frame. +isr_common_stub: + pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax + + mov eax, ds ; Lower 16-bits of eax = ds. + push eax ; save the data segment descriptor + mov eax, cr2 + push eax + + mov ax, 0x10 ; load the kernel data segment descriptor + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + + push esp + + call isr_handler + + add esp, 8 + pop ebx ; reload the original data segment descriptor + mov ds, bx + mov es, bx + mov fs, bx + mov gs, bx + + popa ; Pops edi,esi,ebp... + add esp, 8 ; Cleans up the pushed error code and pushed ISR number + sti + iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP + +; In isr.c +extern irq_handler + +; This is our common IRQ stub. It saves the processor state, sets +; up for kernel mode segments, calls the C-level fault handler, +; and finally restores the stack frame. +irq_common_stub: + pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax + + mov eax, ds ; Lower 16-bits of eax = ds. + push eax ; save the data segment descriptor + mov eax, cr2 + push eax + + mov ax, 0x10 ; load the kernel data segment descriptor + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + + push esp + + call irq_handler + + add esp, 8 + pop ebx ; reload the original data segment descriptor + mov ds, bx + mov es, bx + mov fs, bx + mov gs, bx + + popa ; Pops edi,esi,ebp... + add esp, 8 ; Cleans up the pushed error code and pushed ISR number + sti + iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP + + + diff --git a/sortix/x86/memorymanagement-asm.s b/sortix/x86/memorymanagement-asm.s new file mode 100644 index 00000000..efb106bd --- /dev/null +++ b/sortix/x86/memorymanagement-asm.s @@ -0,0 +1,173 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + memorymanagement-asm.s + Handles memory for the x86 architecture. + +******************************************************************************/ + +.section .text + +.globl _ZN6Sortix4Page11FragmentizeEv +.type _ZN6Sortix4Page11FragmentizeEv, @function # namespace Sortix { namespace Page { void Fragmentize(); } } +_ZN6Sortix4Page11FragmentizeEv: + push %ebx + + # Load the front of our linked list. + mov _ZN6Sortix4Page15UnallocatedPageE, %eax # Load UnallocPage* Sortix::Page::UnallocatedPage + +FragLoop: + testl %eax, %eax + je FragDone + + movl 4(%eax), %edx + movl 8(%eax), %ebx + + testl %ebx, %ebx + je FragNext + + movl %eax, %ecx + addl $0x1000, %ecx + movl %ecx, 4(%eax) + decl %ebx + +FragFixupLoop: + testl %ebx, %ebx + je FragFixupLoopLastSwap + + movl $0xABBAACDC, 0(%ecx) + addl $0x2000, %eax + movl %eax, 4(%ecx) + #movl $0, 8(%ecx) + decl %ebx + + testl %ebx, %ebx + je FragFixupLoopLast + + movl $0xABBAACDC, 0(%eax) + addl $0x2000, %ecx + movl %ecx, 4(%eax) + #movl $0, 8(%eax) + decl %ebx + + jmp FragFixupLoop + +FragFixupLoopLastSwap: + movl %ecx, %eax + +FragFixupLoopLast: + movl $0xABBAACDC, 0(%eax) + movl %edx, 4(%eax) + +FragNext: + movl %edx, %eax + jmp FragLoop + +FragDone: + pop %ebx + ret + +.globl _ZN6Sortix4Page3GetEv +.type _ZN6Sortix4Page3GetEv, @function # namespace Sortix { void Paging::Allocate(); } +_ZN6Sortix4Page3GetEv: + # Load the front of our linked list. + mov _ZN6Sortix4Page15UnallocatedPageE, %eax # Load UnallocPage* Sortix::Page::UnallocatedPage + + # Test if we are out of memory. + testl %eax, %eax + je OutOfMem + + push %ebx + push %edi + push %esi + + # Disable virtual memory + mov %cr0, %edi + mov %edi, %esi + and $0x7FFFFFFF, %esi + mov %esi, %cr0 + + # Test if this page is unallocated, as a security measure. + movl (%eax), %ebx + cmpl $0xABBAACDC, %ebx + jne MagicFailure + + # Prepare the next front element in our linked list. + movl 4(%eax), %edx + jmp Done + +MagicFailure: + # The magic header in our page was invalid! + movl %eax, %edx + inc %eax # Set the lowest bit to signal a magic failure. + + # Panic the kernel. + pushl %ebx + pushl %edx + pushl MagicFailureString + call PanicF + +Done: + # Enable virtual memory here + mov %edi, %cr0 + + # Update the front of our linked list to the next element. + mov %edx, _ZN6Sortix4Page15UnallocatedPageE # Save Load UnallocPage* Sortix::Page::UnallocatedPage + + pop %esi + pop %edi + pop %ebx + + ret + +OutOfMem: + # We run out of memory. Return NULL. + movl $0, %eax + ret + +.globl _ZN6Sortix4Page3PutEPv +.type _ZN6Sortix4Page3PutEPv, @function # namespace Sortix { void Paging::Free(void* Page); } +_ZN6Sortix4Page3PutEPv: + push %esi + mov _ZN6Sortix4Page15UnallocatedPageE, %eax # Load UnallocPage* Sortix::Page::UnallocatedPage + mov 0x8(%esp), %edx + + # Disable virtual memory + mov %cr0, %ecx + mov %ecx, %esi + and $0x7FFFFFFF, %esi + mov %esi, %cr0 + + movl $0xABBAACDC, (%edx) + movl %eax, 4(%edx) + #movl $0, 8(%edx) + + # Enable virtual memory + mov %ecx, %cr0 + + # Update the front of our linked list to the next element. + mov %edx, _ZN6Sortix4Page15UnallocatedPageE # Save Load UnallocPage* Sortix::Page::UnallocatedPage + pop %esi + ret + +.section .data +MagicFailureString: + .asciz "Test!" + .asciz "Test2!\0" + .asciz "A magic failure occured at 0x%p, where 0x%x was found instead of 0xABBAACDC!\n" diff --git a/sortix/x86/x86.cpp b/sortix/x86/x86.cpp new file mode 100644 index 00000000..5d7d5995 --- /dev/null +++ b/sortix/x86/x86.cpp @@ -0,0 +1,68 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + x86.cpp + CPU stuff for the x86 platform. + +******************************************************************************/ + +#include +#include "x86.h" + +namespace Sortix +{ + namespace X86 + { + void OutPortB(uint16_t Port, uint8_t Value) + { + asm volatile ("outb %1, %0" : : "dN" (Port), "a" (Value)); + } + + void OutPortW(uint16_t Port, uint16_t Value) + { + asm volatile ("outw %1, %0" : : "dN" (Port), "a" (Value)); + } + + void OutPortL(uint16_t Port, uint32_t Value) + { + asm volatile ("outl %1, %0" : : "dN" (Port), "a" (Value)); + } + + uint8_t InPortB(uint16_t Port) + { + uint8_t Result; + asm volatile("inb %1, %0" : "=a" (Result) : "dN" (Port)); + return Result; + } + + uint16_t InPortW(uint16_t Port) + { + uint16_t Result; + asm volatile("inw %1, %0" : "=a" (Result) : "dN" (Port)); + return Result; + } + + uint32_t InPortL(uint16_t Port) + { + uint32_t Result; + asm volatile("inl %1, %0" : "=a" (Result) : "dN" (Port)); + return Result; + } + } +} diff --git a/sortix/x86/x86.h b/sortix/x86/x86.h new file mode 100644 index 00000000..573767c8 --- /dev/null +++ b/sortix/x86/x86.h @@ -0,0 +1,51 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along + with Sortix. If not, see . + + x86 + CPU stuff for the x86 platform. + +******************************************************************************/ + +#ifndef SORTIX_X86_H +#define SORTIX_X86_H + +namespace Sortix +{ + namespace X86 + { + void OutPortB(uint16_t Port, uint8_t Value); + void OutPortW(uint16_t Port, uint16_t Value); + void OutPortL(uint16_t Port, uint32_t Value); + uint8_t InPortB(uint16_t Port); + uint16_t InPortW(uint16_t Port); + uint32_t InPortL(uint16_t Port); + + struct InterruptRegisters + { + uint32_t cr2; + uint32_t ds; // Data segment selector + uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha. + uint32_t int_no, err_code; // Interrupt number and error code (if applicable) + uint32_t eip, cs, eflags, useresp, ss; // Pushed by the processor automatically. + }; + } +} + +#endif + diff --git a/subsystem/man b/subsystem/man new file mode 100644 index 00000000..444ceda5 --- /dev/null +++ b/subsystem/man @@ -0,0 +1,64 @@ +NAME: +subsystem - Creates a new instance of an operating system running under the current kernel under a specified root filesystem + +SYNOPSIS: +subsystem [--max-memory=[]] [--nice=] [--access= [--no-access=]] [--inherit= [--no-inherit=]] [--boot] [] + +DESCRIPTION: +Each process under the Sortix kernel belongs to an operating system. An operating system is an abstract object that consists of a filesystem containing programs and configuration, an amount of resources (RAM and CPU) available for use, and an account system that handles permissions and ownership. The Sortix kernel is able to run multiple operating systems (possibly even nested) at the same time. The program subsystem is able to create a new instance of an operating system. It runs in two modes depending on the presence of the --boot flag: + +COMMAND LINE ARGUMENTS: +If is not specified, then the program will default to /bin/init. Any standard IO to this program will be sent to the first process, and any standard IO from the first process echoed by this program. + +If --boot is not specified, then a new operating system is created where is the new root directory, and where is run as the first program, which will be running as the a copy of the current user. + +If --boot is specified, and the current user owns the filesystem of , then a new operating system is created where is the new root directory, and where is run as the first program, which will be running as the root user (in the new operating system's account system). + + +If --access= is specified, then the new OS will only have access to and no other devices. Specifying --access=all is equivalent to specifying all accessable devices (e.g. usable/mounted). If --access is not specified, then the program will default to --access=all. + +If --no-access= is specified, then, if present, all devices in will be removed from --access=. + + +If --inherit= is specified, then the new user will gain ownership of , which will be removed from the current user and returned when the new subsystem is terminated. Specifying --inherit=all is equivalent to specifying all devices the current user owns. If --inherit is not specified, then the new user will not inherit any ownership from the current user. + +If --no-inherit= is specified, then, if present, all devices in will be removed from --inherit=. + +If --nice= is specified, then all programs in new system will have the lowest possible niceness of plus the lowest possible niceness of the current user. + +If --max-memory=[] is specified, then the new system cannot allocate more than of memory. is the unit, e.g. 'B' (bytes), 'KiB' (kibibytes = 1024 bytes), 'MiB' (mibibytes = 1024 kibibytes), etc. If is not specified, then is assumed to be 'B' (bytes). + +EXAMPLES: +An user booting a filesystem system he owns: +$ subsystem --boot /home/myuser/myfs /bin/init + +An user chrooting a filesystem system as himself: +$ subsystem /home/myuser/newroot /bin/bash + +To specify which devices the subsystem inherits ownership of: +$ subsystem --inherit=/dev/sdb1,/dev/sdb4 --boot /mnt/newos /bin/init + +To let the subsystem inherit all ownership: +$ subsystem --inherit=all --boot /mnt/newos /bin/init + +To let the subsystem inherit ownership of all but some devices: +$ subsystem --inherit=all --no-inherit=/dev/sdb1,/dev/sdb4 --boot /mnt/newos /bin/init + +To specify which devices the subsystem can access: +$ subsystem --access=/dev/eth0,/dev/wlan1 --boot /mnt/newos /bin/init + +To let the subsystem access everything (default): +$ subsystem --access=all --boot /mnt/newos /bin/init + +To let the subsystem access everything but some devices: +$ subsystem --access=all --no-access=/dev/eth0 --boot /mnt/newos /bin/init + +To set the memory allocation limit for an subsystem that compiles some program. +$ subsystem --max-memory=256MiB /home/myuser/myprefix /bin/gcc /sources/foo.c -o /bin/foo + +To set some additional niceness while running a makefile in a subsystem: +$ subsystem --nice=20 /home/myuser/myprefix /usr/bin/make -f /sources/Makefile + +The sortix initfs boot script would run something like this: +$ +$ subsystem --inherit=all --boot /fs