Permalink
Browse files

Implemented platform support for Linux (x86).

  • Loading branch information...
bendiken committed Nov 18, 2014
1 parent 270bfdd commit 7e44c11b3f07820486ccc6c945ed595ba15743be
Showing with 66 additions and 4 deletions.
  1. +2 −1 README.rst
  2. +4 −1 configure.ac
  3. +1 −1 doc/manual/install.rst
  4. +1 −1 sys/linux/Makefile.am
  5. +10 −0 sys/linux/x86/Makefile.am
  6. +13 −0 sys/linux/x86/__sys_exit.S
  7. +23 −0 sys/linux/x86/__sys_write.S
  8. +12 −0 sys/linux/x86/crt0.S
View
@@ -19,7 +19,7 @@ Features
========
* Supports the Linux, FreeBSD, OpenBSD, NetBSD, Solaris, and Mac OS X platforms.
* Currently targets the x86-64 (AMD64) System V ABI and the ARM EABI.
* Currently targets the System V ABI for x86 and x86-64, and the EABI for ARM.
* Clean and modular design, most features can be omitted when building.
* No build prerequisites beyond a GNU-compatible toolchain and a C99 compiler.
* 100% free and unencumbered `public domain <http://unlicense.org/>`_ software,
@@ -80,6 +80,7 @@ Platform Architecture Binary Interface Compilers
=============== =============== ======================= ========================
Bare metal any N/A Clang, GCC
Linux ARMv6+ [4]_ ARM EABI Clang, GCC
Linux x86 i386 SysV ABI Clang, GCC
Linux x86-64 AMD64 SysV ABI Clang, GCC
FreeBSD x86-64 AMD64 SysV ABI Clang, GCC
OpenBSD x86-64 AMD64 SysV ABI Clang, GCC
View
@@ -160,7 +160,9 @@ AS_CASE([$host_cpu],
[amd64], [host_cpu="x86_64"],
[armv6l], [host_cpu="arm" AM_CFLAGS="$AM_CFLAGS -marm -march=armv6"],
[armv7l], [host_cpu="arm" AM_CFLAGS="$AM_CFLAGS -marm -march=armv6"],
[x86_64], [],
[i?86], [host_cpu="x86"],
[x86], [host_cpu="x86"],
[x86_64], [host_cpu="x86_64"],
[AC_MSG_ERROR([unsupported CPU architecture: $host_cpu])])
AS_CASE([$host_os],
[darwin*], [host_os="darwin" AM_CPPFLAGS="$AM_CPPFLAGS -DHOST_DARWIN"],
@@ -239,6 +241,7 @@ AC_CONFIG_FILES([
sys/darwin/x86_64/Makefile
sys/linux/Makefile
sys/linux/arm/Makefile
sys/linux/x86/Makefile
sys/linux/x86_64/Makefile
sys/none/Makefile
test/Makefile
View
@@ -34,7 +34,7 @@ NetBSD 6.1.5 | GCC 4.5.3 | x86-64
OpenBSD 5.6 | GCC 4.2.1 | x86-64
OpenBSD 5.3 | GCC 4.2.1 | x86-64
Solaris 11.2 | GCC 4.8.2 | x86-64
Ubuntu 14.04 | Clang 3.5 | x86-64, ARMv6+ (armhf)
Ubuntu 14.04 | Clang 3.5 | x86-64, x86, armhf
| GCC 4.9.2 | x86-64
Ubuntu 12.10 | Clang 3.2 PPA | x86-64
| GCC 4.7.2 | x86-64
View
@@ -1,2 +1,2 @@
SUBDIRS = $(HOST_CPU)
DIST_SUBDIRS = arm x86_64
DIST_SUBDIRS = arm x86 x86_64
View
@@ -0,0 +1,10 @@
crt0dir = $(pkglibdir)
crt0_DATA = crt0.o
noinst_LTLIBRARIES = libcsys.la
libcsys_la_SOURCES =
libcsys_la_LIBADD =
libcsys_la_SOURCES += \
__sys_exit.S \
__sys_write.S
View
@@ -0,0 +1,13 @@
/* This is free and unencumbered software released into the public domain. */
#define SYS_exit 1
.section .text
.global __sys_exit
__sys_exit:
/* 4(%esp) = status */
movl 4(%esp), %ebx
movl $SYS_exit, %eax
int $0x80
hlt
@@ -0,0 +1,23 @@
/* This is free and unencumbered software released into the public domain. */
#define SYS_write 4
.section .text
.global __sys_write
__sys_write:
/* 4(%esp) = fd */
/* 8(%esp) = buffer */
/* 12(%esp)= count */
pushl %ebp
movl %esp, %ebp
pushl %ebx
movl 8(%ebp), %ebx
movl 12(%ebp), %ecx
movl 16(%ebp), %edx
movl $SYS_write, %eax
int $0x80
pop %ebx
pop %ebp
ret
/* %eax = result */
View
@@ -0,0 +1,12 @@
/* This is free and unencumbered software released into the public domain. */
.section .text
.extern _Exit
.global _start
_start:
call main
pushl %eax
call _Exit
hlt

0 comments on commit 7e44c11

Please sign in to comment.