summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-10-04 02:17:13 +0200
committerMiguel <m.i@gmx.at>2018-10-04 02:17:13 +0200
commit81a8252db679351f5ba388b420519724c9c2c2be (patch)
treed21bb88fb36f9492c0daf14d67c46f0b22b66def /userspace
parentce16fe524c14ccaae67fb634105da5aef08ead48 (diff)
reverting userspace idea
Diffstat (limited to 'userspace')
-rw-r--r--userspace/init.c29
-rw-r--r--userspace/pain1.c49
-rw-r--r--userspace/pain2.c4
-rw-r--r--userspace/pain3.c49
4 files changed, 123 insertions, 8 deletions
diff --git a/userspace/init.c b/userspace/init.c
index d130bc8..7237fdc 100644
--- a/userspace/init.c
+++ b/userspace/init.c
@@ -5,18 +5,35 @@
int main(int argc, char **argv)
{
- // int x=10/0; // provoke divide by zero
+ // loop forever and spawn shells if the top-shell exits
+
+ int pid=_fork();
- uint8_t *mem=0xf6000000;
- *mem='a';
- while(1);
+ if(pid==0)
+ {
+ _execve("/bin/pain1",NULL,NULL);
+ }
+ else
+ {
+ int pid=_fork();
+ if(pid==0)
+ {
+ _execve("/bin/pain2",NULL,NULL);
+ }
+ else
+ {
+ _execve("/bin/pain3",NULL,NULL);
+ }
+ }
+
+
+ return 0;
+ //
char *argv1[]={"/bin/fsh",0};
char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
-
-
// loop forever and spawn shells if the top-shell exits
while(1)
{
diff --git a/userspace/pain1.c b/userspace/pain1.c
new file mode 100644
index 0000000..c486636
--- /dev/null
+++ b/userspace/pain1.c
@@ -0,0 +1,49 @@
+#include "put_pixel.h"
+#include "newcalls.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#define dimx 640
+#define dimy 480
+
+/*
+void doscolor(int color,int color2)
+{
+ int i=0;
+
+ for (int y = 0; y < dimy; y++)
+ for (int x = 0; x < dimx; x++)
+ {
+ {
+ if(x%2&&y%2)put_pixel(x,y,color);
+ else put_pixel(x,y,color2);
+ }
+ }
+}
+*/
+
+int main(int argc,char **argv)
+{
+ _gui_win();
+
+ for(int i=0;i<2000;i++)
+ {
+ for(int i=0;i<380;i+=40)
+ {
+ put_rect(0,0,640,480,0x0000ff);
+ put_rect(640-i,i,100,100,0xff00ff);
+ _gui_rect();
+ }
+
+ for(int i=380;i>0;i-=80)
+ {
+ put_rect(0,0,640,480,0x0000ff);
+ put_rect(640-i,i,100,100,0x00ffff);
+ _gui_rect();
+ }
+ }
+
+ return EXIT_SUCCESS;
+}
+
diff --git a/userspace/pain2.c b/userspace/pain2.c
index 69784ce..259f00e 100644
--- a/userspace/pain2.c
+++ b/userspace/pain2.c
@@ -27,7 +27,7 @@ int main(int argc,char **argv)
{
_gui_win();
- for(int i=0;i<atoi(argv[1]);i++)
+ for(int i=0;i<2000;i++)
{
for(int i=0;i<380;i+=40)
{
@@ -44,6 +44,6 @@ int main(int argc,char **argv)
}
}
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
diff --git a/userspace/pain3.c b/userspace/pain3.c
new file mode 100644
index 0000000..2633c73
--- /dev/null
+++ b/userspace/pain3.c
@@ -0,0 +1,49 @@
+#include "put_pixel.h"
+#include "newcalls.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#define dimx 640
+#define dimy 480
+
+/*
+void doscolor(int color,int color2)
+{
+ int i=0;
+
+ for (int y = 0; y < dimy; y++)
+ for (int x = 0; x < dimx; x++)
+ {
+ {
+ if(x%2&&y%2)put_pixel(x,y,color);
+ else put_pixel(x,y,color2);
+ }
+ }
+}
+*/
+
+int main(int argc,char **argv)
+{
+ _gui_win();
+
+ for(int i=0;i<2000;i++)
+ {
+ for(int i=0;i<380;i+=40)
+ {
+ put_rect(0,0,640,480,0xffff00);
+ put_rect(i,i,100,100,0x00ffff);
+ _gui_rect();
+ }
+
+ for(int i=380;i>0;i-=80)
+ {
+ put_rect(0,0,640,480,0xffff00);
+ put_rect(i,i,100,100,0xffffff);
+ _gui_rect();
+ }
+ }
+
+ return EXIT_SUCCESS;
+}
+