diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..292b80c --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +*.la +*.lo +*.o +*.pc +.deps/ +.dirstamp +.libs/ +/aclocal.m4 +/autom4te.cache/ +/build-aux/ +/config.cache +/config.h +/config.h.in +/config.log +/config.status +/configure +/libtool +/m4/ +/stamp-h1 +Makefile +Makefile.in +/nopd diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..1632652 --- /dev/null +++ b/COPYING @@ -0,0 +1,23 @@ +Copyright (c) 2011, Michał Górny +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..d8b4d0b --- /dev/null +++ b/Makefile.am @@ -0,0 +1,15 @@ +ACLOCAL_AMFLAGS = -I m4 + +pkgconfigdir = $(libdir)/pkgconfig + +lib_LTLIBRARIES = libnop.la +include_HEADERS = lib/nop.h +sbin_PROGRAMS = nopd +pkgconfig_DATA = libnop.pc + +libnop_la_SOURCES = lib/x86.s +libnop_la_LDFLAGS = -version-info 0:0:0 + +nopd_SOURCES = src/nopd.c lib/nop.h +nopd_CPPFLAGS = -Ilib +nopd_LDFLAGS = libnop.la diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..fc30c4a --- /dev/null +++ b/configure.ac @@ -0,0 +1,17 @@ +AC_PREREQ([2.60]) +AC_INIT([nopd], [0]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE([1.6 foreign dist-bzip2 -Wall]) + +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) + +AC_PROG_CC +AM_PROG_AS +AM_PROG_CC_C_O +AC_USE_SYSTEM_EXTENSIONS +LT_INIT([disable-static]) + +AC_CONFIG_HEADER([config.h]) +AC_CONFIG_FILES([Makefile libnop.pc]) +AC_OUTPUT diff --git a/lib/nop.h b/lib/nop.h new file mode 100644 index 0000000..bd1051d --- /dev/null +++ b/lib/nop.h @@ -0,0 +1,7 @@ +#pragma once +#ifndef _NOP_H +#define _NOP_H + +void nop(void); + +#endif diff --git a/lib/x86.s b/lib/x86.s new file mode 100644 index 0000000..20fc500 --- /dev/null +++ b/lib/x86.s @@ -0,0 +1,8 @@ +.section .text + .global nop + .type nop, @function + + nop: + nop + ret + .end diff --git a/libnop.pc.in b/libnop.pc.in new file mode 100644 index 0000000..6f2e6ee --- /dev/null +++ b/libnop.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: @PACKAGE@ +Description: A portable implementation of NOP instruction +Version: @VERSION@ +Libs: -L${libdir} -lnop +Cflags: -I${includedir} diff --git a/m4/.keep b/m4/.keep new file mode 100644 index 0000000..e69de29 diff --git a/src/nopd.c b/src/nopd.c new file mode 100644 index 0000000..faa2bad --- /dev/null +++ b/src/nopd.c @@ -0,0 +1,8 @@ +#include "nop.h" + +int main(int argc, char *argv[]) { + while (1) + nop(); + + return 0; +}