diff options
Diffstat (limited to 'userspace/sys')
| -rw-r--r-- | userspace/sys/Makefile | 37 | ||||
| -rw-r--r-- | userspace/sys/crt0.S (renamed from userspace/sys/crt.S) | 17 | ||||
| -rw-r--r-- | userspace/sys/linker.ld | 37 | ||||
| -rw-r--r-- | userspace/sys/sys.c | 3 | ||||
| -rw-r--r-- | userspace/sys/syscalls.c | 6 |
5 files changed, 35 insertions, 65 deletions
diff --git a/userspace/sys/Makefile b/userspace/sys/Makefile index 05177a6..289da1e 100644 --- a/userspace/sys/Makefile +++ b/userspace/sys/Makefile @@ -1,23 +1,28 @@ -SYSROOT=/home/miguel/opt/foolos -CC=i686-foolos-gcc -LD=i686-foolos-ld +CC=i686-elf-gcc +LD=i686-elf-ld -CFLAGS= -CFLAGS+=-w -CFLAGS+=-I../.. -CFLAGS+=-gstabs +#CFLAGS= +#CFLAGS+=-w +#CFLAGS+=-I../.. +#CFLAGS+=-gstabs +#CFLAGS+=-I. -install: crt_install header_install +#LDFLAGS=-L/home/miguel/foolos/usr/i686-foolos/lib/ -lc -lm -lg -lnosys +#CFLAGS+=-I/home/miguel/foolos/usr/i686-foolos/include -crt_install: crt0.o - cp crt0.o $(SYSROOT)/usr/lib/ +#install: crt_install header_install -crt0.o: crt.o sys.o syscalls.o - $(LD) -r $^ -o $@ +#crt_install: crt0.o +# cp crt0.o $(SYSROOT)/usr/lib/ -header_install: - cp *.h $(SYSROOT)/usr/include/ - cp sys/*.h $(SYSROOT)/usr/include/sys/ +#crt0.o: crt.o sys.o #syscalls.o +# $(LD) -r $^ -o $@ + +#header_install: +# cp *.h $(SYSROOT)/usr/include/ +# cp sys/*.h $(SYSROOT)/usr/include/sys/ + +crt0.o: crt0.S clean: - -rm *.o *.a + -rm -f *.o *.a diff --git a/userspace/sys/crt.S b/userspace/sys/crt0.S index d09f8ca..2d6cbbd 100644 --- a/userspace/sys/crt.S +++ b/userspace/sys/crt0.S @@ -2,17 +2,20 @@ _start: -pop %eax -mov %eax, environ +jmp . -pop %eax +##pop %eax +##mov %eax, environ + +##pop %eax #mov %eax, _impure_ptr -call main +##call main + -push environ -push %eax -call _exit2 +##push environ +##push %eax +##call _exit2 # this should never be reached anyway! .wait: diff --git a/userspace/sys/linker.ld b/userspace/sys/linker.ld deleted file mode 100644 index 7c1c4bf..0000000 --- a/userspace/sys/linker.ld +++ /dev/null @@ -1,37 +0,0 @@ -ENTRY(_start) - -SECTIONS -{ - . = 1M; - - kernel_start = .; - - .text BLOCK(4K) : ALIGN(4K) - { - *(.multiboot) - *(.text) - } - - /* Read-only data. */ - .rodata BLOCK(4K) : ALIGN(4K) - { - *(.rodata) - } - - /* Read-write data (initialized) */ - .data BLOCK(4K) : ALIGN(4K) - { - *(.data) - } - - /* Read-write data (uninitialized) and stack */ - .bss BLOCK(4K) : ALIGN(4K) - { - *(COMMON) - *(.bss) - *(.bootstrap_stack) - } - - kernel_end = .; - -} diff --git a/userspace/sys/sys.c b/userspace/sys/sys.c index 5cd4396..4ff77f3 100644 --- a/userspace/sys/sys.c +++ b/userspace/sys/sys.c @@ -1,8 +1,7 @@ #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> -#include <termios.h> - +#include <sys/termios.h> // CODE FOR Stack Smashing Protector, TODO: MOVE / and do not duplicate // with kernel.c diff --git a/userspace/sys/syscalls.c b/userspace/sys/syscalls.c index c3ff909..10e035c 100644 --- a/userspace/sys/syscalls.c +++ b/userspace/sys/syscalls.c @@ -4,16 +4,16 @@ extern char **environ; //struct _reent *_impure_ptr; // generic syscall interface! -int syscall(int call, int p1, int p2, int p3) + +int __attribute__ ((noinline)) syscall(int call, int p1, int p2, int p3) { int ebx; // will hold return value; + // select syscall and pass params asm("pusha"); - // select syscall asm("mov %0, %%eax"::"m"(call)); - // pass params asm("mov %0,%%edx"::"m"(p1)); asm("mov %0,%%ecx"::"m"(p2)); asm("mov %0,%%ebx"::"m"(p3)); |
