mirror of https://github.com/tailix/libkernaux.git
Do not include arch-dependent code
This commit is contained in:
parent
fbfd178f59
commit
2e0bd0ac57
|
@ -27,7 +27,7 @@ jobs:
|
||||||
- name: autogen
|
- name: autogen
|
||||||
run: ./autogen.sh
|
run: ./autogen.sh
|
||||||
- name: configure
|
- name: configure
|
||||||
run: ./configure --with-arch ${{matrix.assert}} ${{matrix.null_guard}} ${{matrix.werror.mb2}} CC='${{matrix.cc}}' CFLAGS='${{matrix.opt}} ${{matrix.werror.cflag}}'
|
run: ./configure ${{matrix.assert}} ${{matrix.null_guard}} ${{matrix.werror.mb2}} CC='${{matrix.cc}}' CFLAGS='${{matrix.opt}} ${{matrix.werror.cflag}}'
|
||||||
- name: make
|
- name: make
|
||||||
run: make
|
run: make
|
||||||
- name: check
|
- name: check
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
|
|
||||||
/tests/multiboot2_print1
|
/tests/multiboot2_print1
|
||||||
/tests/multiboot2_print2
|
/tests/multiboot2_print2
|
||||||
/tests/test_arch_i386_paging
|
|
||||||
/tests/test_cmdline
|
/tests/test_cmdline
|
||||||
/tests/test_elf
|
/tests/test_elf
|
||||||
/tests/test_itoa
|
/tests/test_itoa
|
||||||
|
|
10
Makefile.am
10
Makefile.am
|
@ -25,19 +25,13 @@ libkernaux_a_SOURCES = \
|
||||||
src/libc.c \
|
src/libc.c \
|
||||||
src/printf.c
|
src/printf.c
|
||||||
|
|
||||||
if WITH_ARCH_I386
|
|
||||||
if ARCH_I386
|
if ARCH_I386
|
||||||
libkernaux_a_SOURCES += src/arch/i386/asm.S
|
libkernaux_a_SOURCES += src/arch/i386/asm.S
|
||||||
endif
|
endif
|
||||||
libkernaux_a_SOURCES += src/arch/i386/paging.c
|
|
||||||
TESTS += tests/test_arch_i386_paging
|
|
||||||
endif
|
|
||||||
|
|
||||||
if WITH_ARCH_X86_64
|
|
||||||
if ARCH_X86_64
|
if ARCH_X86_64
|
||||||
libkernaux_a_SOURCES += src/arch/x86_64/asm.S
|
libkernaux_a_SOURCES += src/arch/x86_64/asm.S
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
if WITH_CMDLINE
|
if WITH_CMDLINE
|
||||||
libkernaux_a_SOURCES += src/cmdline.c
|
libkernaux_a_SOURCES += src/cmdline.c
|
||||||
|
@ -112,10 +106,6 @@ examples_units_human_SOURCES = \
|
||||||
$(libkernaux_a_SOURCES) \
|
$(libkernaux_a_SOURCES) \
|
||||||
examples/units_human.c
|
examples/units_human.c
|
||||||
|
|
||||||
tests_test_arch_i386_paging_SOURCES = \
|
|
||||||
$(libkernaux_a_SOURCES) \
|
|
||||||
tests/test_arch_i386_paging.c
|
|
||||||
|
|
||||||
tests_multiboot2_print1_SOURCES = \
|
tests_multiboot2_print1_SOURCES = \
|
||||||
$(libkernaux_a_SOURCES) \
|
$(libkernaux_a_SOURCES) \
|
||||||
tests/multiboot2_print1.c
|
tests/multiboot2_print1.c
|
||||||
|
|
|
@ -77,10 +77,6 @@ are some non-default options:
|
||||||
doesn't have effect if your assetion function was set and ends execution of
|
doesn't have effect if your assetion function was set and ends execution of
|
||||||
application (kernel). However it prevents crashes because of NULL pointer
|
application (kernel). However it prevents crashes because of NULL pointer
|
||||||
dereference in other cases.
|
dereference in other cases.
|
||||||
* `--with-arch` - includes architecture-specific code (except assembly). May be
|
|
||||||
useful for testing. You can also separately enable or disable components:
|
|
||||||
* `--with[out]-arch-i386`
|
|
||||||
* `--with[out]-arch-x86-64`
|
|
||||||
* `--with-libc` - provides the replacement for some standard C functions. Useful
|
* `--with-libc` - provides the replacement for some standard C functions. Useful
|
||||||
in freestanding environment, where no libc is present. You can also separately
|
in freestanding environment, where no libc is present. You can also separately
|
||||||
enable or disable components:
|
enable or disable components:
|
||||||
|
@ -104,7 +100,7 @@ environment.
|
||||||
|
|
||||||
```
|
```
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
./configure --enable-assert --enable-null-guard --with-arch
|
./configure --enable-assert --enable-null-guard
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
23
configure.ac
23
configure.ac
|
@ -25,9 +25,6 @@ AC_ARG_WITH( [pfa], AS_HELP_STRING([--without-pfa], [without Pag
|
||||||
AC_ARG_WITH( [units], AS_HELP_STRING([--without-units], [without measurement units utils]))
|
AC_ARG_WITH( [units], AS_HELP_STRING([--without-units], [without measurement units utils]))
|
||||||
|
|
||||||
dnl Packages (disabled by default)
|
dnl Packages (disabled by default)
|
||||||
AC_ARG_WITH( [arch], AS_HELP_STRING([--with-arch], [with architecture-specific code]))
|
|
||||||
AC_ARG_WITH( [arch-i386], AS_HELP_STRING([--with-arch-i386], [with i386-specific code]))
|
|
||||||
AC_ARG_WITH( [arch-x86-64], AS_HELP_STRING([--with_arch-x86-64], [with x86_64-specific code]))
|
|
||||||
AC_ARG_WITH( [libc], AS_HELP_STRING([--with-libc], [with libc replacement]))
|
AC_ARG_WITH( [libc], AS_HELP_STRING([--with-libc], [with libc replacement]))
|
||||||
AC_ARG_WITH( [libc-memset], AS_HELP_STRING([--with-libc-memset], [with memset replacement]))
|
AC_ARG_WITH( [libc-memset], AS_HELP_STRING([--with-libc-memset], [with memset replacement]))
|
||||||
AC_ARG_WITH( [libc-strcpy], AS_HELP_STRING([--with-libc-strcpy], [with strcpy replacement]))
|
AC_ARG_WITH( [libc-strcpy], AS_HELP_STRING([--with-libc-strcpy], [with strcpy replacement]))
|
||||||
|
@ -35,20 +32,6 @@ AC_ARG_WITH( [libc-strlen], AS_HELP_STRING([--with-libc-strlen], [with strlen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AC_DEFUN([do_arch],
|
|
||||||
[
|
|
||||||
if test -z "$with_arch_i386" -a "$host_cpu" = i386; then with_arch_i386=yes; fi
|
|
||||||
if test -z "$with_arch_x86_64" -a "$host_cpu" = x86_64; then with_arch_x86_64=yes; fi
|
|
||||||
])
|
|
||||||
AS_IF([true], do_arch)
|
|
||||||
|
|
||||||
AC_DEFUN([do_with_arch],
|
|
||||||
[
|
|
||||||
if test -z "$with_arch_i386"; then with_arch_i386=yes; fi
|
|
||||||
if test -z "$with_arch_x86_64"; then with_arch_x86_64=yes; fi
|
|
||||||
])
|
|
||||||
AS_IF([test "$with_arch" = yes], do_with_arch)
|
|
||||||
|
|
||||||
AC_DEFUN([do_with_libc],
|
AC_DEFUN([do_with_libc],
|
||||||
[
|
[
|
||||||
if test -z "$with_libc_memset"; then with_libc_memset=yes; fi
|
if test -z "$with_libc_memset"; then with_libc_memset=yes; fi
|
||||||
|
@ -76,9 +59,6 @@ AM_CONDITIONAL([WITH_PFA], [test "$with_pfa" != no])
|
||||||
AM_CONDITIONAL([WITH_UNITS], [test "$with_units" != no])
|
AM_CONDITIONAL([WITH_UNITS], [test "$with_units" != no])
|
||||||
|
|
||||||
dnl Packages (disabled by default)
|
dnl Packages (disabled by default)
|
||||||
AM_CONDITIONAL([WITH_ARCH], [test "$with_arch" = yes])
|
|
||||||
AM_CONDITIONAL([WITH_ARCH_I386], [test "$with_arch_i386" = yes])
|
|
||||||
AM_CONDITIONAL([WITH_ARCH_X86_64], [test "$with_arch_x86_64" = yes])
|
|
||||||
AM_CONDITIONAL([WITH_LIBC], [test "$with_libc" = yes])
|
AM_CONDITIONAL([WITH_LIBC], [test "$with_libc" = yes])
|
||||||
AM_CONDITIONAL([WITH_LIBC_MEMSET], [test "$with_libc_memset" = yes])
|
AM_CONDITIONAL([WITH_LIBC_MEMSET], [test "$with_libc_memset" = yes])
|
||||||
AM_CONDITIONAL([WITH_LIBC_STRCPY], [test "$with_libc_strcpy" = yes])
|
AM_CONDITIONAL([WITH_LIBC_STRCPY], [test "$with_libc_strcpy" = yes])
|
||||||
|
@ -103,9 +83,6 @@ AS_IF([test "$with_pfa" != no], [AC_DEFINE([WITH_PFA],
|
||||||
AS_IF([test "$with_units", != no], [AC_DEFINE([WITH_UNITS], [1], [with measurement units utils])])
|
AS_IF([test "$with_units", != no], [AC_DEFINE([WITH_UNITS], [1], [with measurement units utils])])
|
||||||
|
|
||||||
dnl Packages (disabled by default)
|
dnl Packages (disabled by default)
|
||||||
AS_IF([test "$with_arch" = yes], [AC_DEFINE([WITH_ARCH], [1], [with architecture-specific code])])
|
|
||||||
AS_IF([test "$with_arch_i386" = yes], [AC_DEFINE([WITH_ARCH_I386], [1], [with i386-specific code])])
|
|
||||||
AS_IF([test "$with_arch_x86_64" = yes], [AC_DEFINE([WITH_ARCH_X86_64], [1], [with x86_64-specific code])])
|
|
||||||
AS_IF([test "$with_libc" = yes], [AC_DEFINE([WITH_LIBC], [1], [with libc replacement])])
|
AS_IF([test "$with_libc" = yes], [AC_DEFINE([WITH_LIBC], [1], [with libc replacement])])
|
||||||
AS_IF([test "$with_libc_memset" = yes], [AC_DEFINE([WITH_LIBC_MEMSET], [1], [with memset replacement])])
|
AS_IF([test "$with_libc_memset" = yes], [AC_DEFINE([WITH_LIBC_MEMSET], [1], [with memset replacement])])
|
||||||
AS_IF([test "$with_libc_strcpy" = yes], [AC_DEFINE([WITH_LIBC_STRCPY], [1], [with strcpy replacement])])
|
AS_IF([test "$with_libc_strcpy" = yes], [AC_DEFINE([WITH_LIBC_STRCPY], [1], [with strcpy replacement])])
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
#include <kernaux/arch/i386.h>
|
|
||||||
|
|
||||||
// TODO: There are some static asserts just for example.
|
|
||||||
|
|
||||||
__attribute__((unused))
|
|
||||||
static const int assert0[
|
|
||||||
sizeof(struct KernAux_Arch_I386_PDE) == sizeof(uint32_t) ? 1 : -1
|
|
||||||
];
|
|
||||||
|
|
||||||
__attribute__((unused))
|
|
||||||
static const int assert1[
|
|
||||||
sizeof(struct KernAux_Arch_I386_PTE) == sizeof(uint32_t) ? 1 : -1
|
|
||||||
];
|
|
||||||
|
|
||||||
__attribute__((unused))
|
|
||||||
static const int assert1[
|
|
||||||
sizeof(struct KernAux_Arch_I386_PageDir) == 1024 * sizeof(uint32_t) ? 1 : -1
|
|
||||||
];
|
|
||||||
|
|
||||||
__attribute__((unused))
|
|
||||||
static const int assert1[
|
|
||||||
sizeof(struct KernAux_Arch_I386_PageTable) == 1024 * sizeof(uint32_t) ? 1 : -1
|
|
||||||
];
|
|
|
@ -17,7 +17,7 @@ void kernaux_console_print(const char *const s)
|
||||||
|
|
||||||
void kernaux_console_putc(const char c __attribute__((unused)))
|
void kernaux_console_putc(const char c __attribute__((unused)))
|
||||||
{
|
{
|
||||||
#if defined(ARCH_I386) && defined(WITH_ARCH_I386)
|
#ifdef ARCH_I386
|
||||||
kernaux_arch_i386_outportb(0x3F8, c);
|
kernaux_arch_i386_outportb(0x3F8, c);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <kernaux/arch/i386.h>
|
|
||||||
|
|
||||||
// TODO: There are some static asserts just for example.
|
|
||||||
|
|
||||||
__attribute__((unused))
|
|
||||||
static const int assert0[
|
|
||||||
sizeof(struct KernAux_Arch_I386_PDE) == sizeof(uint32_t) ? 1 : -1
|
|
||||||
];
|
|
||||||
|
|
||||||
__attribute__((unused))
|
|
||||||
static const int assert1[
|
|
||||||
sizeof(struct KernAux_Arch_I386_PTE) == sizeof(uint32_t) ? 1 : -1
|
|
||||||
];
|
|
||||||
|
|
||||||
__attribute__((unused))
|
|
||||||
static const int assert1[
|
|
||||||
sizeof(struct KernAux_Arch_I386_PageDir) == 1024 * sizeof(uint32_t) ? 1 : -1
|
|
||||||
];
|
|
||||||
|
|
||||||
__attribute__((unused))
|
|
||||||
static const int assert1[
|
|
||||||
sizeof(struct KernAux_Arch_I386_PageTable) == 1024 * sizeof(uint32_t) ? 1 : -1
|
|
||||||
];
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in New Issue