summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2015-05-24 23:30:12 +0200
committerMichal Idziorek <m.i@gmx.at>2015-05-24 23:30:12 +0200
commit8ea3e244d44190e44a092ffb004e13ad94174c68 (patch)
tree2365b0ec35b4fbdc82d49bcefc014fc8af59b251 /userspace
parent1b64f1e69bfbffc0e70ba3a1baff00ed3fd8cb51 (diff)
porting ncurses...
Diffstat (limited to 'userspace')
-rw-r--r--userspace/Makefile4
-rw-r--r--userspace/foolshell.c16
-rw-r--r--userspace/init.c1
-rw-r--r--userspace/snake.c16
-rw-r--r--userspace/sys/Makefile1
-rw-r--r--userspace/sys/crt0.S3
-rw-r--r--userspace/sys/crt0.obin660 -> 660 bytes
-rw-r--r--userspace/sys/libfool.abin37292 -> 37550 bytes
-rw-r--r--userspace/sys/sys.c10
-rw-r--r--userspace/sys/sys.obin17956 -> 18236 bytes
-rw-r--r--userspace/sys/syscalls.c3
-rw-r--r--userspace/sys/syscalls.obin18572 -> 18544 bytes
-rw-r--r--userspace/sys/termios.h18
13 files changed, 65 insertions, 7 deletions
diff --git a/userspace/Makefile b/userspace/Makefile
index 801326b..1f562ab 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -18,7 +18,7 @@ PROGS=foolshell ls simple brainfuck add checker clear task1 task2 init cat snake
include ../Makefile.common
ext2.img: $(PROGS) ../mp/mp.bin
- dd if=/dev/zero of=ext2.img bs=512 count=10000
+ dd if=/dev/zero of=ext2.img bs=512 count=50000
sudo mkfs.ext2 -O none ext2.img -F
mkdir mnt
sudo mount ext2.img mnt
@@ -31,7 +31,7 @@ ext2.img: $(PROGS) ../mp/mp.bin
echo "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++." > mnt/home/miguel/hello.brain
# cp ~/temp/fool-os-stuff/binutils-build-host-foolos/binutils/readelf mnt/bin
# cp ../font/binfont.bin mnt/
- cp ~/temp/fool-os-stuff/ncurses-5.9/progs/tput mnt/bin
+ cp ~/temp/fool-os-stuff/ncurses-5.9-foolos-new/progs/* mnt/bin/
cp ../mp/mp.bin mnt/boot/
mkdir -p mnt/etc
echo "127.0.0.1 localhost" > mnt/etc/hosts
diff --git a/userspace/foolshell.c b/userspace/foolshell.c
index 0ec7e88..fa62094 100644
--- a/userspace/foolshell.c
+++ b/userspace/foolshell.c
@@ -3,7 +3,17 @@
#include <stdbool.h>
#include <string.h>
+#include <reent.h>
+
extern char **environ;
+extern struct _reent *_impure_ptr;
+
+
+
+uint8_t buf_test[1024*300];
+
+
+
//
void hello()
@@ -50,6 +60,7 @@ void prompt()
int main(int argc, char **argv)
{
/*
+ printf("_impure_ptr: 0x%08x\n",_impure_ptr);
printf("argv= 0x%08x \n",argv);
printf("environ= 0x%08x \n",environ);
*/
@@ -62,7 +73,8 @@ int main(int argc, char **argv)
if(!silent)hello();
- char *buf=malloc(256);
+ //char *buf=malloc(256);
+ char buf[256];
while(1)
{
@@ -89,7 +101,7 @@ char **tokenize(char *buf)
for(i=0;i<l;i++)
{
// init space for next token
- token[c]=malloc(256);
+ token[c]=calloc(sizeof(char),256);
//skip all the whitespace
while(buf[i]==' '&&i<l)i++;
diff --git a/userspace/init.c b/userspace/init.c
index 73848f5..d3ab751 100644
--- a/userspace/init.c
+++ b/userspace/init.c
@@ -15,6 +15,7 @@ int main(int argc, char **argv)
char *argv[]={"/bin/foolshell",0};
char *env[]={"PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=linux",0};
execve("/bin/foolshell",argv,env); // replace process with our foolshell :)
+ //execve("/bin/clear",argv,env); // replace process with our foolshell :)
puts("FATAL ERROR: Something terrible happened. Unable to Execute SHELL!");
while(1);// hang
diff --git a/userspace/snake.c b/userspace/snake.c
index 7deaa6c..4eb5b5e 100644
--- a/userspace/snake.c
+++ b/userspace/snake.c
@@ -1,8 +1,22 @@
#include <stdio.h>
+int data4[100];
+
+int data1=1;
+int data2=2;
+int data3=3;
+
int main()
{
- printf("Hello I am FoolSnake 0.1\n");
+ printf("Hello I am FoolSnake 0.1\n some data test: %i %i %i", data1,data2,data3 );
+
+ puts("+++");
+ for(int i=0;i<100;i++)
+ {
+ if(data4[i]!=0)printf("WOW");
+ }
+ puts("+++");
+
printf("setvbuf returned %i\n",setvbuf(stdin,NULL,_IONBF,0));
fool_tune(1,0,0); // activate gaming mode
diff --git a/userspace/sys/Makefile b/userspace/sys/Makefile
index cdcd3b7..2e71714 100644
--- a/userspace/sys/Makefile
+++ b/userspace/sys/Makefile
@@ -17,7 +17,6 @@ crt0.o: crt0.S
crt_install: crt0.o
cp crt0.o $(SYSROOT)/usr/lib/
-
header_install:
cp termios.h $(SYSROOT)/usr/include/sys/
diff --git a/userspace/sys/crt0.S b/userspace/sys/crt0.S
index 025c21b..d09f8ca 100644
--- a/userspace/sys/crt0.S
+++ b/userspace/sys/crt0.S
@@ -5,6 +5,9 @@ _start:
pop %eax
mov %eax, environ
+pop %eax
+#mov %eax, _impure_ptr
+
call main
push environ
diff --git a/userspace/sys/crt0.o b/userspace/sys/crt0.o
index db292b0..1b71404 100644
--- a/userspace/sys/crt0.o
+++ b/userspace/sys/crt0.o
Binary files differ
diff --git a/userspace/sys/libfool.a b/userspace/sys/libfool.a
index 81a4f16..0823595 100644
--- a/userspace/sys/libfool.a
+++ b/userspace/sys/libfool.a
Binary files differ
diff --git a/userspace/sys/sys.c b/userspace/sys/sys.c
index adf6ff9..7639307 100644
--- a/userspace/sys/sys.c
+++ b/userspace/sys/sys.c
@@ -169,3 +169,13 @@ char *getlogin(void)
return NULL;
}
+int gtty()
+{
+ return -1;
+}
+
+int stty()
+{
+ return -1;
+}
+
diff --git a/userspace/sys/sys.o b/userspace/sys/sys.o
index d04089e..dc5a2e3 100644
--- a/userspace/sys/sys.o
+++ b/userspace/sys/sys.o
Binary files differ
diff --git a/userspace/sys/syscalls.c b/userspace/sys/syscalls.c
index 4b29451..c3ff909 100644
--- a/userspace/sys/syscalls.c
+++ b/userspace/sys/syscalls.c
@@ -1,6 +1,7 @@
#include "kernel/syscalls.h"
-char **environ;
+extern char **environ;
+//struct _reent *_impure_ptr;
// generic syscall interface!
int syscall(int call, int p1, int p2, int p3)
diff --git a/userspace/sys/syscalls.o b/userspace/sys/syscalls.o
index f8fd94b..a0a4265 100644
--- a/userspace/sys/syscalls.o
+++ b/userspace/sys/syscalls.o
Binary files differ
diff --git a/userspace/sys/termios.h b/userspace/sys/termios.h
index ff1e838..b6625be 100644
--- a/userspace/sys/termios.h
+++ b/userspace/sys/termios.h
@@ -1,2 +1,20 @@
typedef uint32_t speed_t;
typedef uint32_t DIR;
+
+#define B0 0000000 /* hang up */
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+