Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Commit

Permalink
Introducing nopd.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgorny committed Dec 25, 2011
0 parents commit d122f68
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .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
23 changes: 23 additions & 0 deletions 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.
15 changes: 15 additions & 0 deletions 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
17 changes: 17 additions & 0 deletions 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
7 changes: 7 additions & 0 deletions lib/nop.h
@@ -0,0 +1,7 @@
#pragma once
#ifndef _NOP_H
#define _NOP_H

void nop(void);

#endif
8 changes: 8 additions & 0 deletions lib/x86.s
@@ -0,0 +1,8 @@
.section .text
.global nop
.type nop, @function

nop:
nop
ret
.end
10 changes: 10 additions & 0 deletions 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}
Empty file added m4/.keep
Empty file.
8 changes: 8 additions & 0 deletions src/nopd.c
@@ -0,0 +1,8 @@
#include "nop.h"

int main(int argc, char *argv[]) {
while (1)
nop();

return 0;
}

0 comments on commit d122f68

Please sign in to comment.