Add frigg bindings
This commit is contained in:
parent
2bf62af087
commit
2d131b0e91
|
@ -5,7 +5,7 @@ $c_LIBRARY_OBJS :=
|
|||
|
||||
$c_LDFLAGS := -nostdlib
|
||||
|
||||
$c_TARGETS := clean-$c install-$c $($c_BINDIR)/libc.so
|
||||
$c_TARGETS := clean-$c gen-$c install-$c $($c_BINDIR)/libc.so
|
||||
|
||||
.PHONY: all-$c install-$c
|
||||
|
||||
|
@ -38,6 +38,10 @@ all-$c: all-$c/platform/x86_64-managarm
|
|||
clean-$c: clean-$c/platform/x86_64-managarm
|
||||
install-$c: install-$c/platform/x86_64-managarm
|
||||
|
||||
$(call include_dir,$c/frigg-bindings)
|
||||
$c_LIBRARY_OBJS += $($c/frigg-bindings_OBJECT_PATHS)
|
||||
clean-$c: clean-$c/frigg-bindings
|
||||
|
||||
$($c_BINDIR):
|
||||
mkdir -p $@
|
||||
|
||||
|
|
30
libc/frigg-bindings/dir.makefile
Normal file
30
libc/frigg-bindings/dir.makefile
Normal file
|
@ -0,0 +1,30 @@
|
|||
|
||||
$c_OBJDIR := $(BUILD_PATH)/$c/obj
|
||||
|
||||
$c_OBJECTS := debug.o
|
||||
$c_OBJECT_PATHS := $(addprefix $($c_OBJDIR)/,$($c_OBJECTS))
|
||||
|
||||
$c_CXX := x86_64-managarm-g++
|
||||
$c_CPPFLAGS := -std=c++11 -Wall
|
||||
$c_CPPFLAGS += -I$(FRIGG_PATH)/include
|
||||
$c_CPPFLAGS += -DFRIGG_HAVE_LIBC
|
||||
$c_CXXFLAGS := $($c_CPPFLAGS) -fPIC -O2
|
||||
|
||||
$c_TARGETS := clean-$c install-$c $($c_OBJECT_PATHS)
|
||||
|
||||
.PHONY: clean-$c install-$c
|
||||
|
||||
clean-$c:
|
||||
rm -f $($c_OBJECT_PATHS)
|
||||
rm -f $($c_OBJECT_PATHS:%.o=%.d)
|
||||
|
||||
$($c_OBJDIR):
|
||||
mkdir -p $@
|
||||
|
||||
$($c_OBJDIR)/%.o: $(FRIGG_PATH)/src/%.cpp | $($c_OBJDIR)
|
||||
$($c_CXX) -c -o $@ $($c_CXXFLAGS) $<
|
||||
$($c_CXX) $($c_CPPFLAGS) -MM -MP -MF $(@:%.o=%.d) -MT "$@" -MT "$(@:%.o=%.d)" $<
|
||||
|
||||
-include $($c_OBJECT_PATHS:%.o=%.d)
|
||||
|
||||
|
|
@ -3,11 +3,12 @@ $c_SRCDIR = $(TREE_PATH)/$c/src
|
|||
$c_OBJDIR := $(BUILD_PATH)/$c/obj
|
||||
$c_BINDIR := $(BUILD_PATH)/$c/bin
|
||||
|
||||
$c_OBJECTS := entry.o ensure.o
|
||||
$c_OBJECTS := entry.o ensure.o frigg-support.o
|
||||
$c_OBJECT_PATHS := $(addprefix $($c_OBJDIR)/,$($c_OBJECTS))
|
||||
|
||||
$c_CXX := x86_64-managarm-g++
|
||||
$c_CPPFLAGS := -std=c++11 -Wall
|
||||
$c_CPPFLAGS += -I$(FRIGG_PATH)/include
|
||||
$c_CPPFLAGS += -I$(TREE_PATH)/libc/generic/ansi/include
|
||||
$c_CPPFLAGS += -I$(TREE_PATH)/libc/compilers/gcc/include
|
||||
$c_CXXFLAGS := $($c_CPPFLAGS) -fPIC -O2
|
||||
|
|
|
@ -3,13 +3,21 @@
|
|||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#pragma GCC visibility push(hidden)
|
||||
|
||||
#include <mlibc/ensure.h>
|
||||
|
||||
#include <frigg/debug.hpp>
|
||||
|
||||
#include <hel.h>
|
||||
#include <hel-syscalls.h>
|
||||
|
||||
#pragma GCC visibility pop
|
||||
|
||||
void __ensure_fail(const char *assertion, const char *file, unsigned int line,
|
||||
const char *function) {
|
||||
helPanic("x", 1);
|
||||
frigg::panicLogger.log() << "In function " << function
|
||||
<< ", file " << file << ":" << line << "\n"
|
||||
<< "__ensure(" << assertion << ") failed" << frigg::EndLog();
|
||||
}
|
||||
|
||||
|
|
33
libc/platform/x86_64-managarm/src/frigg-support.cpp
Normal file
33
libc/platform/x86_64-managarm/src/frigg-support.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#pragma GCC visibility push(hidden)
|
||||
|
||||
#include <frigg/support.hpp>
|
||||
|
||||
#include <hel.h>
|
||||
#include <hel-syscalls.h>
|
||||
|
||||
void friggPrintCritical(char c) {
|
||||
helLog(&c, 1);
|
||||
}
|
||||
|
||||
void friggPrintCritical(const char *str) {
|
||||
int len = 0;
|
||||
for(int i = 0; str[i]; i++)
|
||||
len++;
|
||||
helLog(str, len);
|
||||
}
|
||||
|
||||
void friggPanic() {
|
||||
const char *str = "Panic in mlibc";
|
||||
int len = 0;
|
||||
for(int i = 0; str[i]; i++)
|
||||
len++;
|
||||
helPanic(str, len);
|
||||
}
|
||||
|
||||
#pragma GCC visibility pop
|
||||
|
Loading…
Reference in a new issue