summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
Diffstat (limited to 'userspace')
-rw-r--r--userspace/Makefile23
-rw-r--r--userspace/cpp/Makefile6
-rw-r--r--userspace/cpp/testcpp.cpp34
-rw-r--r--userspace/crt0.s39
-rw-r--r--userspace/xterm/Makefile6
-rw-r--r--userspace/xterm/crt0.s39
-rw-r--r--userspace/xterm/vesa.c2
7 files changed, 55 insertions, 94 deletions
diff --git a/userspace/Makefile b/userspace/Makefile
index af799fb..f7d0ae5 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -1,38 +1,41 @@
-IMAGESIZE=30000 #ext2.img size in Kb
+IMAGESIZE=40000 #ext2.img size in Kb
#######################
GIT_REVISION=$(shell git rev-parse HEAD)
CC=i686-foolos-gcc
-CC=i686-elf-gcc
-AS=i686-elf-as
+AS=i686-foolos-as
-CC = @echo "Compiling (i686-elf-gcc) $<..."; i686-elf-gcc
-AS = @echo "Assembling (i686-elf-as) $<..."; i686-elf-as
+#CC=i686-elf-gcc
+#AS=i686-elf-as
+
+#CC = @echo "Compiling (i686-elf-gcc) $<..."; $(CC)
+#AS = @echo "Assembling (i686-elf-as) $<..."; $(AS)
CFLAGS=
CFLAGS+=-DGIT_REVISION=\"$(GIT_REVISION)\"
CFLAGS+=-w
CFLAGS+=-I..
-CFLAGS+=-I/home/miguel/temp/foolos/usr/i686-foolos/include
+#CFLAGS+=-I/home/miguel/temp/foolos/usr/i686-foolos/include
CFLAGS+=-O0
CFLAGS+=-g
CFLAGS+= -Werror=implicit-function-declaration
-LDFLAGS=-L/home/miguel/temp/foolos/usr/i686-foolos/lib/
-LDLIBS=-lc -lm -lg -lnosys
+#LDFLAGS=-L/home/miguel/temp/foolos/usr/i686-foolos/lib/
+#LDLIBS=-lc -lm -lg -lnosys
PROGS_C=$(wildcard *.c)
PROGS=$(patsubst %.c,%,$(PROGS_C))
include ../Makefile.common
-all: crt0.o ext2.img
+all: ext2.img
ext2.img: $(PROGS)
make -C fonts
make -C xterm
+ make -C cpp
@echo "----------------------"
@echo "Creating ext2.img ...."
@dd if=/dev/zero of=ext2.img bs=1024 count=$(IMAGESIZE)
@@ -50,6 +53,7 @@ ext2.img: $(PROGS)
@cp $(PROGS) mnt/bin
@cp fonts/binfont.bin mnt/doc/fonts
@cp xterm/xterm mnt/bin
+ @cp cpp/testcpp mnt/bin
# cp ~/temp/fool-os-stuff/binutils-build-host-foolos/binutils/readelf mnt/bin
# cp ../font/binfont.bin mnt/
@@ -72,6 +76,7 @@ ext2.img: $(PROGS)
clean:
make -C fonts clean
make -C xterm clean
+ make -C cpp clean
@echo "Cleaning userspace ..."; rm -f *.o $(PROGS) ext2.img *.d
new: clean all
diff --git a/userspace/cpp/Makefile b/userspace/cpp/Makefile
new file mode 100644
index 0000000..7623325
--- /dev/null
+++ b/userspace/cpp/Makefile
@@ -0,0 +1,6 @@
+CXX=i686-foolos-g++
+
+testcpp:
+
+clean:
+ rm -f testcpp
diff --git a/userspace/cpp/testcpp.cpp b/userspace/cpp/testcpp.cpp
new file mode 100644
index 0000000..0e89276
--- /dev/null
+++ b/userspace/cpp/testcpp.cpp
@@ -0,0 +1,34 @@
+// constructing vectors
+#include <iostream>
+#include <vector>
+#include <cstring>
+#include <reent.h>
+
+//#undef _REENT_GLOBAL_STDIO_STREAMS
+
+int main()
+{
+ _REENT_INIT_PTR(_impure_ptr);
+
+
+
+
+ // constructors used in the same order as described above:
+ std::vector<int> first; // empty vector of ints
+ std::vector<int> second (4,100); // four ints with value 100
+ std::vector<int> third (second.begin(),second.end()); // iterating through second
+ std::vector<int> fourth (third); // a copy of third
+
+ // the iterator constructor can also be used to construct from arrays:
+ int myints[] = {16,2,77,29};
+ std::vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) );
+
+ std::cout << "The contents of fifth are:";
+ for (std::vector<int>::iterator it = fifth.begin(); it != fifth.end(); ++it)
+ std::cout << ' ' << *it;
+ std::cout << '\n';
+
+
+
+ return 0;
+}
diff --git a/userspace/crt0.s b/userspace/crt0.s
deleted file mode 100644
index dedc86c..0000000
--- a/userspace/crt0.s
+++ /dev/null
@@ -1,39 +0,0 @@
-.global _start
-
-_start:
-
-# copy reent to this page
-push %ebx
-push %ecx
-
-mov _impure_ptr,%eax
-mov $0xf5000000,%ebx
-copy:
-mov (%eax),%ecx
-mov %ecx,(%ebx)
-add $4, %ebx
-add $4, %eax
-cmp $0xf5001000,%ebx
-jne copy
-
-pop %ecx
-pop %ebx
-
-movl $0xf5000000, _impure_ptr
-
-# environment adress was passed on stack
-
-pop %eax
-mov %eax, environ
-
-# call main (argc and argv are on the stack)
-call main
-
-# push exit code and pass to _exit syscall
-push %eax
-call exit
-
-# this should never be reached!
-.wait:
- hlt
-jmp .wait
diff --git a/userspace/xterm/Makefile b/userspace/xterm/Makefile
index 3056094..b6bac6e 100644
--- a/userspace/xterm/Makefile
+++ b/userspace/xterm/Makefile
@@ -1,12 +1,6 @@
CC=i686-foolos-gcc
AS=i686-foolos-as
-CFLAGS=-I/home/miguel/temp/foolos/usr/i686-foolos/include
-
-LDFLAGS=-L/home/miguel/temp/foolos/usr/i686-foolos/lib/
-
-all: crt0.o xterm
-
xterm: vesa.o terminal.o
clean:
diff --git a/userspace/xterm/crt0.s b/userspace/xterm/crt0.s
deleted file mode 100644
index dedc86c..0000000
--- a/userspace/xterm/crt0.s
+++ /dev/null
@@ -1,39 +0,0 @@
-.global _start
-
-_start:
-
-# copy reent to this page
-push %ebx
-push %ecx
-
-mov _impure_ptr,%eax
-mov $0xf5000000,%ebx
-copy:
-mov (%eax),%ecx
-mov %ecx,(%ebx)
-add $4, %ebx
-add $4, %eax
-cmp $0xf5001000,%ebx
-jne copy
-
-pop %ecx
-pop %ebx
-
-movl $0xf5000000, _impure_ptr
-
-# environment adress was passed on stack
-
-pop %eax
-mov %eax, environ
-
-# call main (argc and argv are on the stack)
-call main
-
-# push exit code and pass to _exit syscall
-push %eax
-call exit
-
-# this should never be reached!
-.wait:
- hlt
-jmp .wait
diff --git a/userspace/xterm/vesa.c b/userspace/xterm/vesa.c
index e795cc8..085d1b0 100644
--- a/userspace/xterm/vesa.c
+++ b/userspace/xterm/vesa.c
@@ -4,7 +4,7 @@
#include "../newcalls.h"
#include "vesa.h"
-#define VMEM_USER_FRAMEBUFFER 0xfa000000
+#define VMEM_USER_FRAMEBUFFER 0xfc000000
typedef struct foolfont_struct
{