summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-08-18 16:20:26 +0200
committerMiguel <m.i@gmx.at>2018-08-18 16:20:26 +0200
commit639c3d47b09114628f8e1f8817c27c10bf1fb28c (patch)
treef0381de25cc8f2de96a87b47cc76f7d09548bf7e /userspace
parent7b0d88b2dff9b635d9ff69f6d51b6832c1ca4c40 (diff)
reviving old drivers: mouse, pci, e1000
Diffstat (limited to 'userspace')
-rw-r--r--userspace/cat.c9
-rw-r--r--userspace/crt0.S4
-rw-r--r--userspace/err.c6
3 files changed, 12 insertions, 7 deletions
diff --git a/userspace/cat.c b/userspace/cat.c
index 8980546..688ebcc 100644
--- a/userspace/cat.c
+++ b/userspace/cat.c
@@ -3,13 +3,16 @@
int main()
{
+ char c;
- char buf[256];
+ printf("-- read from stderr byte by byte --\n");
while(has_data_waiting(2)){
- fread(buf,1,5,stderr); // read stderr;
- printf("[%s]\n",buf);
+ fread(&c,1,1,stderr);
+ printf("%c",c);
}
+ printf("\n-- no more data on stderr --\n");
+
return 0;
}
diff --git a/userspace/crt0.S b/userspace/crt0.S
index 87f1995..30b56a9 100644
--- a/userspace/crt0.S
+++ b/userspace/crt0.S
@@ -6,7 +6,8 @@ pop %eax
mov %eax, environ
pop %eax
-#mov %eax, _impure_ptr
+# mov %eax, _impure_ptr # TODO: use this !
+
call main
push environ
@@ -14,6 +15,7 @@ push %eax
call _exit2
# this should never be reached anyway!
+
.wait:
hlt
jmp .wait
diff --git a/userspace/err.c b/userspace/err.c
index b8dc8ed..7a33e69 100644
--- a/userspace/err.c
+++ b/userspace/err.c
@@ -2,8 +2,8 @@
int main()
{
- char buf[]="errrrrrro\n";
- printf("writing some err\n");
- fwrite(buf,1,10,stderr); // write stderr;
+ char buf[]="This is a line written to stderr.\n";
+ int l=fwrite(buf,sizeof(char),strlen(buf),stderr); // write stderr;
+ printf("Written %i chars to stderr.\n",l);
return 0;
}