summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bochs.cfg20
-rw-r--r--src/common.make10
-rwxr-xr-xsrc/tools/makeinitrd/makeinitrdbin16457 -> 16358 bytes
-rw-r--r--src/user/app/init/Makefile2
-rw-r--r--src/user/app/init/main.c24
-rw-r--r--src/user/app/init/main.cpp23
-rw-r--r--src/user/app/prime/Makefile2
-rw-r--r--src/user/app/prime/main.c19
-rw-r--r--src/user/app/prime/main.cpp18
-rw-r--r--src/user/lib/fwik/main.cpp2
-rw-r--r--src/user/lib/libc/std/readline.c2
11 files changed, 62 insertions, 60 deletions
diff --git a/bochs.cfg b/bochs.cfg
index d80600d..cd9ad71 100644
--- a/bochs.cfg
+++ b/bochs.cfg
@@ -20,25 +20,25 @@ com1: enabled=1, mode=null, dev=""
com2: enabled=0
com3: enabled=0
com4: enabled=0
-usb_uhci: enabled=0
-usb_ohci: enabled=0
-usb_xhci: enabled=0
+#usb_uhci: enabled=0
+#usb_ohci: enabled=0
+#usb_xhci: enabled=0
pci: enabled=0
vga: extension=vbe, update_freq=25
cpu: count=1, ips=2000000, model=bx_generic, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1
-cpuid: family=6, model=0x03, stepping=3, mmx=1, apic=xapic, sse=sse2, sse4a=0, sep=1, aes=0, xsave=0, xsaveopt=0, movbe=0, smep=0, mwait=1, mwait_is_nop=0
-cpuid: vendor_string="AuthenticAMD"
-cpuid: brand_string="AMD Athlon(tm) processor"
+#cpuid: family=6, model=0x03, stepping=3, mmx=1, apic=xapic, sse=sse2, sse4a=0, sep=1, aes=0, xsave=0, xsaveopt=0, movbe=0, smep=0, mwait=1, mwait_is_nop=0
+#cpuid: vendor_string="AuthenticAMD"
+#cpuid: brand_string="AMD Athlon(tm) processor"
print_timestamps: enabled=0
port_e9_hack: enabled=0
private_colormap: enabled=0
clock: sync=none, time0=local
# no cmosimage
-ne2k: enabled=0
-pnic: enabled=0
-sb16: enabled=0
-es1370: enabled=0
+#ne2k: enabled=0
+#pnic: enabled=0
+#sb16: enabled=0
+#es1370: enabled=0
# no loader
log: -
logprefix: %t%e%d
diff --git a/src/common.make b/src/common.make
index 96a1a7f..71cea37 100644
--- a/src/common.make
+++ b/src/common.make
@@ -1,15 +1,15 @@
+.PHONY: clean, mrproper
+
# ============== ENVIRONMENT VARIABLES
CC = i586-elf-gcc
-CFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Werror -g -Wno-error=main
+CFLAGS = -m32 -nostdlib -nostdinc -nostartfiles -nodefaultlibs -fno-builtin -ffreestanding -fno-stack-protector -Wall -Werror -g -Wno-error=main
CCFLAGS =
CXX = i586-elf-g++
-CXXFLAGS = -fno-rtti -fno-exceptions -Wall -Werror -Wno-write-strings -Wno-main -Wno-error=unused-parameter -Wno-error=main -g
+CXXFLAGS = -fno-rtti -fno-exceptions -Wno-write-strings -Wno-main -Wno-error=unused-parameter
LD = i586-elf-ld
-.PHONY: clean, mrproper
-
-LDFLAGS = -oformat=elf32-i386
+LDFLAGS = -oformat=elf32-i386 -m elf_i386
ASM = nasm
AFLAGS = -f elf
diff --git a/src/tools/makeinitrd/makeinitrd b/src/tools/makeinitrd/makeinitrd
index afb042c..6ad60bb 100755
--- a/src/tools/makeinitrd/makeinitrd
+++ b/src/tools/makeinitrd/makeinitrd
Binary files differ
diff --git a/src/user/app/init/Makefile b/src/user/app/init/Makefile
index 6ab7cf8..3486f0d 100644
--- a/src/user/app/init/Makefile
+++ b/src/user/app/init/Makefile
@@ -1,6 +1,6 @@
Obj = main.o
Out = init.elf
-include $(SrcPath)/user/app/fwik.make
+include $(SrcPath)/user/app/common.make
LDFLAGS += -Map init.map
diff --git a/src/user/app/init/main.c b/src/user/app/init/main.c
new file mode 100644
index 0000000..92fb8f7
--- /dev/null
+++ b/src/user/app/init/main.c
@@ -0,0 +1,24 @@
+#include <tce/syscall.h>
+#include <stdio.h>
+
+int main(char **args) {
+ FILE home_term = open("/.ui/home", 0);
+ int i, pid;
+ if (home_term < 0) return -1;
+
+ printf("(init) Trivial/Computing Environment says hello. Press super to go home.\n");
+
+ for (i = 0; args[i]; i++) {
+ if (i == 0) continue;
+ printf("(init) Spawning %s...\n", args[i]);
+
+ pid = run(args[i], 0, home_term);
+ if (pid < 0) {
+ printf("(init) Error. Sorry.\n");
+ } else {
+ waitpid(pid, 1);
+ }
+ }
+ printf("(init) Goodbye.\n");
+ return 0;
+}
diff --git a/src/user/app/init/main.cpp b/src/user/app/init/main.cpp
deleted file mode 100644
index 759d804..0000000
--- a/src/user/app/init/main.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <tce/syscall.h>
-#include <IO/IOStream.h>
-#include <String.h>
-
-int Main(String *args) {
- FILE home_term = libc::open("/.ui/home", 0);
- if (home_term < 0) return -1;
-
- stdio << "(init) Trivial/Computing Environment says hello. Press super to go home.\n";
-
- for (int i = 0; args[i]; i++) {
- if (i == 0) continue;
- stdio.printf("(init) Spawning %s...\n", args[i].c_str());
- int pid = libc::run(args[i].c_str(), 0, home_term);
- if (pid < 0) {
- stdio << "(init) Error. Sorry.\n";
- } else {
- libc::waitpid(pid, 1);
- }
- }
- stdio << "(init) Goodbye.\n";
- return 0;
-}
diff --git a/src/user/app/prime/Makefile b/src/user/app/prime/Makefile
index 0e86c31..3a524e9 100644
--- a/src/user/app/prime/Makefile
+++ b/src/user/app/prime/Makefile
@@ -1,6 +1,6 @@
Obj = main.o
Out = prime.elf
-include $(SrcPath)/user/app/fwik.make
+include $(SrcPath)/user/app/common.make
LDFLAGS += -Map prime.map
diff --git a/src/user/app/prime/main.c b/src/user/app/prime/main.c
new file mode 100644
index 0000000..d3ebb7d
--- /dev/null
+++ b/src/user/app/prime/main.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+int is_prime(int i) {
+ int j;
+ for (j = 2; j*j <= i; j++) {
+ if (i % j == 0) return 0;
+ }
+ return 1;
+}
+
+int main(char **args) {
+ int i;
+ for (i = 2; i < 1000000; i++) {
+ if (is_prime(i)) printf("%d\t", i);
+ }
+ printf("\nThat's all prime numbers for today.\n");
+
+ return 0;
+}
diff --git a/src/user/app/prime/main.cpp b/src/user/app/prime/main.cpp
deleted file mode 100644
index be8780f..0000000
--- a/src/user/app/prime/main.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <IO/IOStream.h>
-#include <String.h>
-
-bool is_prime(int i) {
- for (int j = 2; j*j <= i; j++) {
- if (i % j == 0) return false;
- }
- return true;
-}
-
-int Main(String *args) {
- for (int i = 2; i < 1000000; i++) {
- if (is_prime(i)) stdio.printf("%d\t", i);
- }
- stdio.printf("\nThat's all prime numbers for today.\n");
-
- return 0;
-}
diff --git a/src/user/lib/fwik/main.cpp b/src/user/lib/fwik/main.cpp
index e26cb46..e7c40c4 100644
--- a/src/user/lib/fwik/main.cpp
+++ b/src/user/lib/fwik/main.cpp
@@ -20,7 +20,7 @@ extern "C" int main(char **args) {
String s_args[argc+1];
for (int i = 0; i < argc; i++) s_args[i] = args[i];
- Main(s_args);
+ return Main(s_args);
}
diff --git a/src/user/lib/libc/std/readline.c b/src/user/lib/libc/std/readline.c
index 5cd9119..50e4f0d 100644
--- a/src/user/lib/libc/std/readline.c
+++ b/src/user/lib/libc/std/readline.c
@@ -149,7 +149,7 @@ char *freadline(FILE f, readline_history *h) {
i = h->n - 1;
while (h->str[i] != str) {
if (i == 0) {
- fprint(f, "READLINE FAIL");
+ fprint(f, "readline: internal error");
return 0;
}
i--;