Skip to content

Commit

Permalink
atratus-0.5.tar.gz
Browse files Browse the repository at this point in the history
  • Loading branch information
cheako committed May 18, 2015
1 parent 582eb39 commit f30dc79
Show file tree
Hide file tree
Showing 83 changed files with 6,375 additions and 1,875 deletions.
7 changes: 7 additions & 0 deletions ANNOUNCE
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Announcement & Release notes

Fri Jan 18 17:47:58 EST 2013
0.5 - January release

- robotfindskitten working
- bsdgames robots, hangman, snake working
- start of support for IPv4 sockets

Fri Dec 14 09:27:28 EST 2012
0.4 - December release

Expand Down
1,130 changes: 479 additions & 651 deletions COPYING

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
#
# Atratus top level Makefile
#
# Copyright (C) 2012 Mike McCormack
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#

all:
cd lib && make
cd server && make
Expand Down
6 changes: 3 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

atratus v0.3
atratus

Run Linux binaries on Windows!

Expand Down Expand Up @@ -38,8 +38,8 @@ LIMITATIONS?
It may not work correctly on Windows 7 or Windows 8, and will
definitely not work on Windows 2000 in its current state.

* v0.1 is a proof of concept to show that fork() and exec(), which
have been a stubling block of previous Linux-binary-on-Windows
* This version is a proof of concept to show that fork() and exec(),
which have been a stubling block of previous Linux-binary-on-Windows
projects can work.

* programs statically linked with glibc will not work
Expand Down
150 changes: 150 additions & 0 deletions include/linux-defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#define _l_O_RDWR 2
#define _l_O_CREAT 0x100

#define _l_O_NONBLOCK (0x800)

#define _l_WNOHANG (1)

#define _l_SIGCHLD (17)
Expand All @@ -38,13 +40,75 @@
#define _l_F_DUPFD 0
#define _l_F_GETFD 1
#define _l_F_SETFD 2
#define _l_F_GETFL 3
#define _l_F_SETFL 4

#define _l_SIGABRT 6

#define _l_DT_DIR 4
#define _l_DT_REG 8
#define _l_DT_LNK 10

#define _l_F_OK 0
#define _l_X_OK 1
#define _l_W_OK 2
#define _l_R_OK 4

#define _l_PF_UNIX 1
#define _l_PF_INET 2
#define _l_PF_INET6 10

#define _l_AF_INET _l_PF_INET
#define _l_AF_INET6 _l_PF_INET6

#define _l_SYS_SOCKET 1
#define _l_SYS_BIND 2
#define _l_SYS_CONNECT 3
#define _l_SYS_LISTEN 4
#define _l_SYS_ACCEPT 5
#define _l_SYS_GETSOCKNAME 6
#define _l_SYS_GETPEERNAME 7
#define _l_SYS_SOCKETPAIR 8
#define _l_SYS_SEND 9
#define _l_SYS_SENDTO 10
#define _l_SYS_RECV 11
#define _l_SYS_RECVFROM 12
#define _l_SYS_SHUTDOWN 13
#define _l_SYS_GETSOCKOPT 14
#define _l_SYS_SETSOCKOPT 15
#define _l_SYS_SENDMSG 16
#define _l_SYS_RECVMSG 17

#define _l_SOCK_STREAM 1
#define _l_SOCK_DGRAM 2

#define _l_SOL_SOCKET 1

#define _l_SO_DEBUG 1
#define _l_SO_REUSEADDR 2
#define _l_SO_TYPE 3
#define _l_SO_ERROR 4
#define _l_SO_DONTROUTE 5
#define _l_SO_BROADCAST 6
#define _l_SO_SNDBUF 7
#define _l_SO_RCVBUF 8
#define _l_SO_KEEPALIVE 9
#define _l_SO_OOBINLINE 10
#define _l_SO_NO_CHECK 11
#define _l_SO_PRIORITY 12
#define _l_SO_LINGER 13
#define _l_SO_BSDCOMPAT 14
#define _l_SO_SNDBUFFORCE 32
#define _l_SO_RCVBUFFORCE 33

#define _l_TCP_NODELAY 1
#define _l_TCP_MAXSEG 2
#define _l_TCP_CORK 3

#define _l_SHUT_RD 0
#define _l_SHUT_WR 1
#define _l_SHUT_RDWR 2

#define TIOCGPGRP 0x540F
#define TIOCSPGRP 0x5410
#define TIOCGWINSZ 0x5413
Expand All @@ -62,6 +126,7 @@
#define INPCK (1 << 4)
#define ISTRIP (1 << 5)
#define INLCR (1 << 6)
#define IGNCR (1 << 7)
#define ICRNL (1 << 8)
#define IUCLC (1 << 9)
#define IXON (1 << 10)
Expand All @@ -78,6 +143,13 @@
#define ECHOK (1 << 5)
#define ECHONL (1 << 6)
#define NOFLSH (1 << 7)
#define TOSTOP (1 << 8)
#define ECHOCTL (1 << 9)
#define ECHOPRT (1 << 10)
#define ECHOKE (1 << 11)
#define FLUSHO (1 << 12)
#define PENDIN (1 << 14)
#define IEXTEN (1 << 15)

#define OPOST (1 << 0)
#define OLCUC (1 << 1)
Expand All @@ -86,6 +158,14 @@
#define ONOCR (1 << 4)
#define ONLRET (1 << 5)

#define CSIZE (0x30)
#define CS5 (0)
#define CS6 (0x10)
#define CS7 (0x20)
#define CS8 (0x30)
#define PARENB (0x100)
#define PARODD (0x200)

#define NCCS 32

struct termios
Expand All @@ -107,6 +187,14 @@ struct winsize {
unsigned short ws_ypixel;
};

#ifdef WIN32
struct timespec
{
unsigned int tv_sec;
long tv_nsec;
};
#endif

struct fdset
{
unsigned long fds_bits[1024/32];
Expand Down Expand Up @@ -174,4 +262,66 @@ struct linux_dirent64 {
char d_name[];
};

#define SECSPERDAY 86400
#define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY)

#define SYSCALL0(num) \
__asm__ __volatile__ ( \
"\tint $0x80\n" \
:"=a"(r) \
:"a"(num) \
:"memory") \

#define SYSCALL_ASM(N) \
"\tpushl %%ebx\n" \
"\tmovl %%eax, %%ebx\n" \
"\tmov $" #N ", %%eax\n" \
"\tint $0x80\n" \
"\tpopl %%ebx\n" \

#define SYSCALL1(num, a1) \
__asm__ __volatile__ ( \
SYSCALL_ASM(num) \
:"=a"(r) \
:"a"(a1) \
:"memory")

#define SYSCALL2(num, a1, a2) \
__asm__ __volatile__ ( \
SYSCALL_ASM(num) \
:"=a"(r) \
:"a"(a1), \
"c"(a2) \
:"memory")

#define SYSCALL3(num, a1, a2, a3) \
__asm__ __volatile__ ( \
SYSCALL_ASM(num) \
:"=a"(r) \
:"a"(a1), \
"c"(a2), \
"d"(a3) \
:"memory")

#define SYSCALL4(num, a1, a2, a3, a4) \
__asm__ __volatile__ ( \
SYSCALL_ASM(num) \
:"=a"(r) \
:"a"(a1), \
"c"(a2), \
"d"(a3), \
"S"(a4) \
:"memory")

#define SYSCALL5(num, a1, a2, a3, a4, a5) \
__asm__ __volatile__ ( \
SYSCALL_ASM(num) \
:"=a"(r) \
:"a"(a1), \
"c"(a2), \
"d"(a3), \
"S"(a4), \
"D"(a5) \
:"memory")

#endif
10 changes: 10 additions & 0 deletions include/linux-errno.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@
#define _l_EBADF 9
#define _l_ECHILD 10
#define _l_EAGAIN 11
#define _l_EWOULDBLOCK _l_EAGAIN
#define _l_ENOMEM 12
#define _l_EACCES 13
#define _l_EFAULT 14
#define _l_ENOTDIR 20
#define _l_EINVAL 22
#define _l_EMFILE 24
#define _l_ERANGE 34
#define _l_ENOSYS 38
#define _l_ENOTSOCK 88
#define _l_EAFNOSUPPORT 97
#define _l_ETIMEDOUT 110
#define _l_EISCONN 106
#define _l_ENOTCONN 107
#define _l_ECONNREFUSED 111
#define _l_EALREADY 114
#define _l_EINPROGRESS 115

#endif
1 change: 1 addition & 0 deletions lib/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.so.2
*.so.6
*.o
57 changes: 53 additions & 4 deletions lib/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# C library and shared object loader
#
# Copyright (C) 2012 Mike McCormack
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#

all:
CFLAGS = -Wall -fno-stack-protector
CC = gcc
CFLAGS = -Wall -O2
CFLAGS += -fno-stack-protector
Expand All @@ -11,18 +32,46 @@ LDFLAGS += -shared -Wl,-Bsymbolic -Wl,-Bsymbolic-functions
LDFLAGS += -Wl,--no-undefined -nostartfiles -nodefaultlibs
LDFLAGS += -fpic -g

TARGET = ld-linux.so.2
all: ld-linux.so.2 libc.so.6 libm.so.6 libdl.so.2 librt.so.1 libpthread.so.0

LIBC_OBJECTS = \
main.c

LIBM_OBJECTS = \
main.c

LIBDL_OBJECTS = \
main.c

all: $(TARGET)
LIBRT_OBJECTS = \
main.c

OBJECTS = \
LIBPTHREAD_OBJECTS = \
main.c

LDSO_OBJECTS = \
c.o \
loader.o \
stub.o

-include $(OBJECTS:%=$(dir %).$(notdir %).d)

$(TARGET): $(OBJECTS)
ld-linux.so.2: $(LDSO_OBJECTS)
$(CC) -o $@ $(LDFLAGS) -e _start $^

libc.so.6: $(LIBC_OBJECTS)
$(CC) -o $@ $(LDFLAGS) -e _start $^

libm.so.6: $(LIBM_OBJECTS)
$(CC) -o $@ $(LDFLAGS) -e _start $^

libdl.so.2: $(LIBM_OBJECTS)
$(CC) -o $@ $(LDFLAGS) -e _start $^

librt.so.1: $(LIBRT_OBJECTS)
$(CC) -o $@ $(LDFLAGS) -e _start $^

libpthread.so.0: $(LIBPTHREAD_OBJECTS)
$(CC) -o $@ $(LDFLAGS) -e _start $^

clean:
Expand Down
Loading

0 comments on commit f30dc79

Please sign in to comment.