diff options
| -rw-r--r-- | Makefile | 11 | ||||
| -rw-r--r-- | fs/elf.c | 1 | ||||
| -rw-r--r-- | interface/Makefile | 4 | ||||
| -rw-r--r-- | interface/crt0.s | 20 | ||||
| -rw-r--r-- | kernel/kernel.h | 11 | ||||
| -rw-r--r-- | kernel/vmem.c | 2 | ||||
| -rw-r--r-- | userspace/Makefile | 23 | ||||
| -rw-r--r-- | userspace/cpp/Makefile | 6 | ||||
| -rw-r--r-- | userspace/cpp/testcpp.cpp | 34 | ||||
| -rw-r--r-- | userspace/crt0.s | 39 | ||||
| -rw-r--r-- | userspace/xterm/Makefile | 6 | ||||
| -rw-r--r-- | userspace/xterm/crt0.s | 39 | ||||
| -rw-r--r-- | userspace/xterm/vesa.c | 2 | ||||
| -rw-r--r-- | xxx/packages/ncurses-5.9/README | 4 |
14 files changed, 94 insertions, 108 deletions
@@ -17,8 +17,8 @@ CC=i686-foolos-gcc AS=i686-foolos-as #sorry just this -CC=i686-elf-gcc -AS=i686-elf-as +#CC=i686-elf-gcc +#AS=i686-elf-as #try arm #CC=arm-none-eabi-gcc @@ -65,6 +65,7 @@ CFLAGS+= -Wno-implicit-int CFLAGS+= -Wno-incompatible-pointer-types CFLAGS+= -Wno-discarded-qualifiers CFLAGS+= -Wno-unused-but-set-variable +CFLAGS+= -Wno-pointer-sign #CFLAGS+ = -Wall -Wextra -std=c89 -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition @@ -79,7 +80,7 @@ ASFLAGS+=-gstabs ########## verbosity ##################3 V = 0 #CC = @echo "Compiling (i686-elf-gcc) $<..."; i686-elf-gcc -AS = @echo "Assembling (i686-elf-as) $<..."; i686-elf-as +#AS = @echo "Assembling (i686-elf-as) $<..."; i686-elf-as #CC_1 = $(CCC) #CC = $(CC_$(V)) @@ -196,9 +197,9 @@ qemu-run: all -net nic,model=e1000 \ -net tap,ifname=tap0,script=no,downscript=no \ -vga virtio \ - -nographic \ - -vnc :0 \ -m 1024 + #-nographic \ + #-vnc :0 \ #-net dump,file=./netfool @@ -184,6 +184,7 @@ uint32_t load_elf(char *name, uint32_t *alloc) } klog("heap starts at: 0x%08X",*alloc); + klog("entry point: 0x%08X",elf->e_entry); return elf->e_entry; } diff --git a/interface/Makefile b/interface/Makefile new file mode 100644 index 0000000..1cefd39 --- /dev/null +++ b/interface/Makefile @@ -0,0 +1,4 @@ +AS=i686-foolos-as + +clean: + rm -f *.o diff --git a/interface/crt0.s b/interface/crt0.s index dedc86c..0b833c0 100644 --- a/interface/crt0.s +++ b/interface/crt0.s @@ -2,12 +2,26 @@ _start: -# copy reent to this page push %ebx push %ecx +cmp $0,_impure_ptr +jne skipzero + +movl $0xf5000000, _impure_ptr +mov $0xf5000000,%ebx + +allzero: +movl $0, (%ebx) +add $4, %ebx +cmp $0xf5001000,%ebx +jne allzero + +skipzero: + mov _impure_ptr,%eax mov $0xf5000000,%ebx + copy: mov (%eax),%ecx mov %ecx,(%ebx) @@ -16,11 +30,11 @@ add $4, %eax cmp $0xf5001000,%ebx jne copy +movl $0xf5000000, _impure_ptr + pop %ecx pop %ebx -movl $0xf5000000, _impure_ptr - # environment adress was passed on stack pop %eax diff --git a/kernel/kernel.h b/kernel/kernel.h index fad803c..acd3451 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -63,15 +63,16 @@ REFERENCES // minimal space between user and kernel pages 1024 pages! #define VMEM_KERNEL 0x00000000 // 8192 pages (32megs) / identity mapped -#define VMEM_KERNEL_PAGES (1024*8) +#define VMEM_KERNEL_PAGES (1024*16) // VMEM_KERNEL END 0x02000000 #define VMEM_USER_ENV 0x07000000 // 1 page / per user process -#define VMEM_USER_PROG_PAGES (256*16) +//#define VMEM_USER_PROG_PAGES (256*16) +#define VMEM_USER_PROG_PAGES (1024*16) #define VMEM_USER_PROG 0x08048000 // ? pages / per user process (usual entry: 0x8048080) -#define VMEM_USER_STACK_PAGES 4 // 4 pages / per thread +#define VMEM_USER_STACK_PAGES (1024*16) // 4 pages / per thread #define VMEM_USER_STACK_TOP 0xF0000000 // 4 pages / per thread #define VMEM_LAPIC 0xF0005000 // 1 pages / identity mapped @@ -88,9 +89,11 @@ REFERENCES #define VMEM_FRAMEBUFFER 0xF6000000 // 8192 pages (32megs) / identity mapped #define VMEM_FRAMEBUFFER_PAGES (1024*8) + #define VMEM_EXT2_RAMIMAGE 0xF8000000 // 8192 pages (32megs) / identity mapped +#define VMEM_EXT2_PAGES (1024*16) -#define VMEM_USER_FRAMEBUFFER 0xFA000000 +#define VMEM_USER_FRAMEBUFFER 0xFC000000 #define VMEM_USER_FRAMEBUFFER_PAGES 300// 4*320*480 bytes per app (one extra?) #endif diff --git a/kernel/vmem.c b/kernel/vmem.c index 704b45e..30109ba 100644 --- a/kernel/vmem.c +++ b/kernel/vmem.c @@ -350,7 +350,7 @@ pdirectory* vmem_kernel_dir() // we create thie once for each cpu vmem_add_remap(dir,local_apic_addr,VMEM_LAPIC,1,false); //apic addr should be at pagestart, right? TODO: check. vmem_add_remap(dir,io_apic_addr,VMEM_IOAPIC,1,false); - vmem_add_remap(dir,mod_start,VMEM_EXT2_RAMIMAGE,1024*8,false);//32megs for ramimage: TODO: check if enough? + vmem_add_remap(dir,mod_start,VMEM_EXT2_RAMIMAGE,VMEM_EXT2_PAGES,false);//32megs for ramimage: TODO: check if enough? vmem_add_alloc(dir,VMEM_CPU_PRIVATE,4,false); vmem_add_alloc(dir,VMEM_CPU_STACK_TOP-4096*VMEM_CPU_STACK_PAGES,VMEM_CPU_STACK_PAGES,false); 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 { diff --git a/xxx/packages/ncurses-5.9/README b/xxx/packages/ncurses-5.9/README index 78b9cd4..c7c5f6f 100644 --- a/xxx/packages/ncurses-5.9/README +++ b/xxx/packages/ncurses-5.9/README @@ -3,7 +3,9 @@ .. tic foolterm.ti (to install locally) 3. build in seperate directory -$ ../ncurses-xxx/configure --host=i686-foolos --without-tests --with-fallbacks=fool-term --with-debug CFLAGS="-gstabs -O0" CXXFLAGS="-gstabs -O0" --prefix=/home/miguel/opt/foolos/usr/ --with-termlib CC=i686-foolos-gcc +$ ../ncurses-xxx/configure --host=i686-foolos --without-tests --with-fallbacks=fool-term + --with-debug CFLAGS="-gstabs -O0" CXXFLAGS="-gstabs -O0" --prefix=/home/miguel/opt/foolos/usr/ + --with-termlib CC=i686-foolos-gcc symlink /usr/include/curses.h to ./ncurses/curses.h |
