DEADSOFTWARE

HostPackedFiles implemented; DevPacked added; loader simplified
authorAlexander Shiryaev <aixp@mail.ru>
Fri, 16 Nov 2012 15:47:16 +0000 (19:47 +0400)
committerAlexander Shiryaev <aixp@mail.ru>
Fri, 16 Nov 2012 15:47:16 +0000 (19:47 +0400)
35 files changed:
new/Dev/Docu/Packer.odc [new file with mode: 0644]
new/Dev/Mod/Packer.odc [new file with mode: 0644]
new/_LinuxOpenBSD_/Host/Mod/PackedFiles.odc
new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox-dl.c [deleted file]
new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox.c [deleted file]
new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox1.c [deleted file]
new/_LinuxOpenBSD_/Lin/Rsrc/loader/dev0.c [deleted file]
new/_LinuxOpenBSD_/Lin/Rsrc/loader/loader.c [new file with mode: 0644]
new/_LinuxOpenBSD_GUI/Port.odc
new/_LinuxOpenBSD_GUI/TODO.odc
new/_Linux_/BlackBox [deleted symlink]
new/_Linux_/Lin/Rsrc/loader/BlackBox [deleted file]
new/_Linux_/Lin/Rsrc/loader/Makefile
new/_Linux_/Lin/Rsrc/loader/dev0 [deleted file]
new/_Linux_/Lin/Rsrc/loader/libBB.so [deleted symlink]
new/_Linux_/Lin/Rsrc/loader/libBB0.so [deleted symlink]
new/_Linux_/Lin/Rsrc/loader/loader [new file with mode: 0755]
new/_Linux_/dev0 [deleted symlink]
new/_Linux_/loader [new symlink]
new/_OpenBSD_/BlackBox [deleted symlink]
new/_OpenBSD_/Lin/Rsrc/loader/BlackBox [deleted file]
new/_OpenBSD_/Lin/Rsrc/loader/Makefile
new/_OpenBSD_/Lin/Rsrc/loader/dev0 [deleted file]
new/_OpenBSD_/Lin/Rsrc/loader/libBB.so [deleted symlink]
new/_OpenBSD_/Lin/Rsrc/loader/libBB0.so [deleted symlink]
new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.c [deleted file]
new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.so [deleted file]
new/_OpenBSD_/Lin/Rsrc/loader/loader [new file with mode: 0755]
new/_OpenBSD_/dev0 [deleted symlink]
new/_OpenBSD_/libdlobsdwrap.so [deleted symlink]
new/_OpenBSD_/loader [new symlink]
new/build
new/run-BlackBox
new/run-dev0
new/switch-target

diff --git a/new/Dev/Docu/Packer.odc b/new/Dev/Docu/Packer.odc
new file mode 100644 (file)
index 0000000..70a04f4
Binary files /dev/null and b/new/Dev/Docu/Packer.odc differ
diff --git a/new/Dev/Mod/Packer.odc b/new/Dev/Mod/Packer.odc
new file mode 100644 (file)
index 0000000..a8afd4f
Binary files /dev/null and b/new/Dev/Mod/Packer.odc differ
index 24afbb440e43904d6a457634f24076dbdf5e1f97..0fcdfe2fcf8e02433e507c4011be797369620f8a 100644 (file)
Binary files a/new/_LinuxOpenBSD_/Host/Mod/PackedFiles.odc and b/new/_LinuxOpenBSD_/Host/Mod/PackedFiles.odc differ
diff --git a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox-dl.c b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox-dl.c
deleted file mode 100644 (file)
index c4ac847..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <dlfcn.h>
-#include <stdio.h>
-
-int main (int argc, char *argv[])
-{
-       void * h;
-       /*
-       void * h1;
-       void (*SetKernelBaseStack) (int);
-       void (*Init) (void);
-       */
-       int res;
-
-       h = dlopen("libBB.so", RTLD_LAZY | RTLD_GLOBAL);
-       if (h != NULL) {
-               /*
-               h1 = dlsym(h, "SetKernelBaseStack");
-               if (h1 != NULL) {
-                       *(void **) (&SetKernelBaseStack) = h1;
-                       h1 = dlsym(h, "Init");
-                       if (h1 != NULL) {
-                               *(void **) (&Init) = h1;
-
-                               asm ("movl %%esp, %[res]" : [res] "=m" (res) );
-                               SetKernelBaseStack(res - 8);
-
-                               printf("before Init()\n");
-                               Init();
-                               printf("after Init()\n");
-
-                               res = 0;
-                       } else {
-                               perror(dlerror());
-                               res = 3;
-                       }
-               } else {
-                       perror(dlerror());
-                       res = 2;
-               }
-               */
-               res = 0;
-       } else {
-               perror(dlerror());
-               res = 1;
-       }
-
-       return res;
-}
diff --git a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox.c b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox.c
deleted file mode 100644 (file)
index 1e77b70..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-int main (int argc, char *argv[])
-{
-       return 0;
-}
diff --git a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox1.c b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox1.c
deleted file mode 100644 (file)
index 155069f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// #include <stdio.h>
-
-// extern void SetKernelBaseStack (int);
-extern void Init (void);
-
-int main (int argc, char *argv[])
-{
-       // int res;
-
-       // printf("START\n");
-
-       /* 2012.09.02: This is from oberoncore.ru
-               2012.09.05: not required in case of static linking of shared library (-lBB) */
-       // asm ("movl %%esp, %[res]" : [res] "=m" (res) );
-       // SetKernelBaseStack(res - 8);
-       // printf("SetKernelBaseStack(0x%02x): done\n", res - 8);
-       // <return adr> <caller ebp> -> base stack = locals of main proc
-
-       Init();
-
-       // printf("END\n");
-
-       return 0;
-}
diff --git a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/dev0.c b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/dev0.c
deleted file mode 100644 (file)
index 64bddd7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <dlfcn.h>
-#include <stdio.h>
-
-int main (int argc, char *argv[])
-{
-       void * h;
-       int res;
-
-       h = dlopen("libBB0.so", RTLD_LAZY | RTLD_GLOBAL);
-       if (h != NULL) {
-               res = 0;
-       } else {
-               perror(dlerror());
-               res = 1;
-       }
-
-       return res;
-}
diff --git a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/loader.c b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/loader.c
new file mode 100644 (file)
index 0000000..74bb6c2
--- /dev/null
@@ -0,0 +1,23 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+int main (int argc, char *argv[])
+{
+       void * h;
+       int res;
+
+       if (argc == 2) {
+               h = dlopen(argv[1], RTLD_LAZY | RTLD_GLOBAL);
+               if (h != NULL) {
+                       res = 0;
+               } else {
+                       perror(dlerror());
+                       res = 2;
+               }
+       } else {
+               fprintf(stderr, "usage: %s file.so\n", argv[0]);
+               res = 1;
+       }
+
+       return res;
+}
index f7789eddf9024d411efd147b723d03ea9fbbfe7e..433bef490c7713a231bc1d615a29a166f7143d56 100644 (file)
Binary files a/new/_LinuxOpenBSD_GUI/Port.odc and b/new/_LinuxOpenBSD_GUI/Port.odc differ
index dd0a76016c5feb2ab20ea0740aa952f67b462e31..b6c96419659520e9d36686557564b72cb2b20369 100644 (file)
Binary files a/new/_LinuxOpenBSD_GUI/TODO.odc and b/new/_LinuxOpenBSD_GUI/TODO.odc differ
diff --git a/new/_Linux_/BlackBox b/new/_Linux_/BlackBox
deleted file mode 120000 (symlink)
index b4db3bb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Lin/Rsrc/loader/BlackBox
\ No newline at end of file
diff --git a/new/_Linux_/Lin/Rsrc/loader/BlackBox b/new/_Linux_/Lin/Rsrc/loader/BlackBox
deleted file mode 100755 (executable)
index c456d0e..0000000
Binary files a/new/_Linux_/Lin/Rsrc/loader/BlackBox and /dev/null differ
index 16b78c9c8fb71f72c2451cd8591bcd3abca99b27..4af1536d5bd229a84b583dae1431a9da1397df74 100644 (file)
@@ -4,18 +4,12 @@
 # ${.ALLSRC}    $^
 # ${.IMPSRC}    $<
 
-all: dev0 BlackBox
+all: loader
 
 CFLAGS += -Wall -O0 -g -m32
 
-#BlackBox: BlackBox.c
-#      ${CC} ${CFLAGS} -o $@ $^ -L. -lBB
-
-BlackBox: BlackBox-dl.c
-       ${CC} ${CFLAGS} -o $@ $^ -ldl
-
-dev0: dev0.c
+loader: loader.c
        ${CC} ${CFLAGS} -o $@ $^ -ldl
 
 clean:
-       rm -f dev0 BlackBox
+       rm -f loader
diff --git a/new/_Linux_/Lin/Rsrc/loader/dev0 b/new/_Linux_/Lin/Rsrc/loader/dev0
deleted file mode 100755 (executable)
index 2ea46b7..0000000
Binary files a/new/_Linux_/Lin/Rsrc/loader/dev0 and /dev/null differ
diff --git a/new/_Linux_/Lin/Rsrc/loader/libBB.so b/new/_Linux_/Lin/Rsrc/loader/libBB.so
deleted file mode 120000 (symlink)
index 85c28c4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../libBB.so
\ No newline at end of file
diff --git a/new/_Linux_/Lin/Rsrc/loader/libBB0.so b/new/_Linux_/Lin/Rsrc/loader/libBB0.so
deleted file mode 120000 (symlink)
index 6319f6b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../libBB0.so
\ No newline at end of file
diff --git a/new/_Linux_/Lin/Rsrc/loader/loader b/new/_Linux_/Lin/Rsrc/loader/loader
new file mode 100755 (executable)
index 0000000..91423d9
Binary files /dev/null and b/new/_Linux_/Lin/Rsrc/loader/loader differ
diff --git a/new/_Linux_/dev0 b/new/_Linux_/dev0
deleted file mode 120000 (symlink)
index b787eae..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Lin/Rsrc/loader/dev0
\ No newline at end of file
diff --git a/new/_Linux_/loader b/new/_Linux_/loader
new file mode 120000 (symlink)
index 0000000..dc66ef1
--- /dev/null
@@ -0,0 +1 @@
+Lin/Rsrc/loader/loader
\ No newline at end of file
diff --git a/new/_OpenBSD_/BlackBox b/new/_OpenBSD_/BlackBox
deleted file mode 120000 (symlink)
index b4db3bb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Lin/Rsrc/loader/BlackBox
\ No newline at end of file
diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/BlackBox b/new/_OpenBSD_/Lin/Rsrc/loader/BlackBox
deleted file mode 100755 (executable)
index 8090ec9..0000000
Binary files a/new/_OpenBSD_/Lin/Rsrc/loader/BlackBox and /dev/null differ
index b3bdcd540175bb536a9c1dd915553a02b4c8aef4..f4104ddc8803543a96cede957feedf94343ded8b 100644 (file)
@@ -6,28 +6,12 @@
 
 CFLAGS += -Wall -O0 -g
 
-all: libdlobsdwrap.so dev0 BlackBox
-
-# libdlobsdwrap.so: universal method of correct access to dl* functions
-#      in case of dynamic loading of libBB*.so "ld.so" in LibDl may be used instead of "libc.so", but not in case of static linking
-#      wrapper method is universal
+all: loader
 
 # -pthread required to dlopen libraries that depends on pthread
 
-#BlackBox: BlackBox.c
-#      ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -L. -lBB -pthread
-
-BlackBox: BlackBox-dl.c
+loader: loader.c
        ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -pthread
 
-#dev0: BlackBox1.c
-#      ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -L . -lBB0
-
-dev0: dev0.c
-       ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC}
-
-libdlobsdwrap.so: libdlobsdwrap.c
-       ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -fPIC -shared
-
 clean:
-       rm -f dev0 BlackBox libdlobsdwrap.so
+       rm -f loader
diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/dev0 b/new/_OpenBSD_/Lin/Rsrc/loader/dev0
deleted file mode 100755 (executable)
index b145e7a..0000000
Binary files a/new/_OpenBSD_/Lin/Rsrc/loader/dev0 and /dev/null differ
diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/libBB.so b/new/_OpenBSD_/Lin/Rsrc/loader/libBB.so
deleted file mode 120000 (symlink)
index 85c28c4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../libBB.so
\ No newline at end of file
diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/libBB0.so b/new/_OpenBSD_/Lin/Rsrc/loader/libBB0.so
deleted file mode 120000 (symlink)
index 6319f6b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../libBB0.so
\ No newline at end of file
diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.c b/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.c
deleted file mode 100644 (file)
index 22c437b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <dlfcn.h>
-
-void * __dlopen (const char *path, int mode)
-{
-       return dlopen(path, mode);
-}
-
-int __dlclose (void *handle)
-{
-       return dlclose(handle);
-}
-
-void * __dlsym (void *handle, const char *symbol)
-{
-       return dlsym(handle, symbol);
-}
-
-const char * __dlerror (void)
-{
-       return dlerror();
-}
diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.so b/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.so
deleted file mode 100755 (executable)
index 8874e67..0000000
Binary files a/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.so and /dev/null differ
diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/loader b/new/_OpenBSD_/Lin/Rsrc/loader/loader
new file mode 100755 (executable)
index 0000000..745fb08
Binary files /dev/null and b/new/_OpenBSD_/Lin/Rsrc/loader/loader differ
diff --git a/new/_OpenBSD_/dev0 b/new/_OpenBSD_/dev0
deleted file mode 120000 (symlink)
index b787eae..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Lin/Rsrc/loader/dev0
\ No newline at end of file
diff --git a/new/_OpenBSD_/libdlobsdwrap.so b/new/_OpenBSD_/libdlobsdwrap.so
deleted file mode 120000 (symlink)
index 7c1e1bb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Lin/Rsrc/loader/libdlobsdwrap.so
\ No newline at end of file
diff --git a/new/_OpenBSD_/loader b/new/_OpenBSD_/loader
new file mode 120000 (symlink)
index 0000000..dc66ef1
--- /dev/null
@@ -0,0 +1 @@
+Lin/Rsrc/loader/loader
\ No newline at end of file
index 44a52bd0faf6872b12dc71e907f83aee4b1aca89..d0e52238c32bf79ce3b629e990fb432bb80b6a26 100755 (executable)
--- a/new/build
+++ b/new/build
@@ -118,15 +118,15 @@ DevCompiler.CompileThis ConsCompiler
 DATA
 
 ./run-BlackBox <<DATA
-DevCompiler.CompileThis CommStreams
-DevCompiler.CompileThis XhtmlEntitySets XhtmlWriters XhtmlStdFileWriters XhtmlTextTableMarkers XhtmlExporter
-
-DevCompiler.CompileThis ObxHello0 ObxPi ObxRandom ObxTrap
-DATA
+DevCompiler.CompileThis HostPackedFiles DevPacker
 
-./run-BlackBox <<DATA
+DevCompiler.CompileThis CommStreams
 ConsCompiler.Compile('Lin/Mod', 'Termios.txt')
 ConsCompiler.Compile('Lin/Mod', 'Ioctl.txt')
 ConsCompiler.Compile('Lin/Mod', 'Net.txt')
 DevCompiler.CompileThis CommV24 CommTCP
+
+DevCompiler.CompileThis XhtmlEntitySets XhtmlWriters XhtmlStdFileWriters XhtmlTextTableMarkers XhtmlExporter
+
+DevCompiler.CompileThis ObxHello0 ObxPi ObxRandom ObxTrap
 DATA
index abaf6c6af8fede722cf2b98cd76e6934391cfcee..f0b8b5f7f9e8e2f620dfb9cefe6da8d3a4d52e4a 100755 (executable)
@@ -4,9 +4,14 @@
 # ulimit -a
 
 rn=`readlink -f "${0}"`
-d=`dirname "${rn}"`
+pd=`dirname "${rn}"`
+sd=`readlink -f .`
 
-exe="BlackBox"
+loader="loader"
+lib="libBB.so"
 
 # export LD_DEBUG=all
-env LD_LIBRARY_PATH="${d}" BB_PRIMARY_DIR="${d}" BB_SECONDARY_DIR=. "${d}"/${exe}
+env \
+       BB_PRIMARY_DIR="${pd}" BB_SECONDARY_DIR="${sd}" \
+       BB_PACKED_NAME="${lib}" \
+       "${pd}"/${loader} "${pd}"/${lib}
index bffae58883408613f856787b0f6dd1a3b6af1df8..486e03636d0c140ad786d71b664338d1e3e63ba9 100755 (executable)
@@ -1,4 +1,17 @@
 #!/bin/sh
 
-# env LD_LIBRARY_PATH=. env LD_DEBUG=1 ./dev0
-env LD_LIBRARY_PATH=. ./dev0
+# ulimit -s 32000
+# ulimit -a
+
+rn=`readlink -f "${0}"`
+pd=`dirname "${rn}"`
+sd=`readlink -f .`
+
+loader="loader"
+lib="libBB0.so"
+
+# export LD_DEBUG=all
+env \
+       BB_PRIMARY_DIR="${pd}" BB_SECONDARY_DIR="${sd}" \
+       BB_PACKED_NAME="${lib}" \
+       "${pd}"/${loader} "${pd}"/${lib}
index 4bf8e6aa71db64298cf6ed6aff4de0f0c67dad25..4b0845404be2d2a42c81318c9ee78f505f776dd0 100755 (executable)
@@ -16,7 +16,7 @@ checkAndRm () {
 none() {
        checkAndRm || exit 2
 
-       rm -rf *.exe *.so BlackBox dev0
+       rm -rf *.exe *.so loader
 #              System/Code/Kernel.ocf System/Sym/Kernel.osf Code/Kernel.ocf Sym/Kernel.osf \
 #              System/Code/Init.ocf System/Sym/Init.osf Code/Init.ocf Sym/Init.osf \
 #              System/Code/Config.ocf System/Sym/Config.osf Code/Config.ocf Sym/Config.osf \