From 706243ac48cf646d503a3f1ec9e6a28c916694bd Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Sat, 5 Mar 2011 10:01:45 -0600 Subject: Merge of PowerHAL project up to commit: dd45c30bd53d8e6c123165b83842d08117558a3c --- .gitignore | 6 +- config.mk | 166 ++++- env.bash | 2 +- env.csh | 2 +- img/.gitignore | 10 + makefile | 7 + obj/.gitignore | 0 obj/beam/.gitignore | 1 + obj/cscope/.gitignore | 1 + obj/doxygen/.gitignore | 1 + src/build/beam/compiler_c_config.tcl | 546 ++++++++++++++ src/build/beam/compiler_cpp_config.tcl | 540 ++++++++++++++ src/build/doxygen/doxygen.conf | 1252 ++++++++++++++++++++++++++++++++ src/build/lids/81e00301.lidhdr | 21 + src/build/lids/apyfipshdr | 494 +++++++++++++ src/build/lids/apyruhhdr | Bin 0 -> 210460 bytes src/build/lids/crc32 | Bin 0 -> 5367 bytes src/build/lids/dslid.lidhdr | 10 + src/build/lids/halruntime.lidhdr | 10 + src/build/lids/hbicore.lidhdr | 10 + src/build/lids/phal.vpdinfo | 35 + src/build/linker/linker.C | 181 +++-- src/build/linker/makefile | 3 + src/build/tools/addimgid | 27 + src/build/tools/build | 10 + src/build/tools/builddriver | 207 ++++++ src/build/tools/genlist | 180 +++++ src/build/tools/gensyms | 94 +++ src/include/arch/ppc.H | 174 +++++ src/include/assert.h | 31 + src/include/builtins.h | 95 +++ src/include/kernel/console.H | 3 +- src/include/kernel/cpu.H | 7 +- src/include/kernel/ppcarch.H | 87 --- src/include/kernel/ppcconsts.S | 2 + src/include/kernel/timemgr.H | 4 +- src/include/math.h | 23 + src/include/new | 9 + src/include/stddef.h | 2 + src/include/stdint.h | 5 + src/include/stdio.h | 16 + src/include/string.h | 7 +- src/include/sys/msg.h | 7 +- src/include/sys/vfs.h | 7 +- src/include/util/functor.H | 100 +++ src/include/util/locked/list.H | 1 + src/include/util/sprintf.H | 323 ++++++++ src/kernel.ld | 14 +- src/kernel/console.C | 255 +------ src/kernel/cpumgr.C | 10 +- src/kernel/exception.C | 8 +- src/kernel/spinlock.C | 11 +- src/kernel/start.S | 4 + src/kernel/syscall.C | 2 +- src/kernel/taskmgr.C | 6 +- src/kernel/terminate.S | 18 + src/kernel/vmmmgr.C | 4 +- src/lib/assert.C | 8 + src/lib/makefile | 2 +- src/lib/stdio.C | 44 ++ src/lib/string.C | 144 ++++ src/lib/string.c | 45 -- src/libc++/builtins.C | 10 + src/makefile | 32 +- src/sys/vfs/makefile | 2 +- src/sys/vfs/vfs_init.C | 39 + src/sys/vfs/vfs_main.C | 23 +- src/usr/example/example.C | 17 - src/usr/example/makefile | 1 - src/usr/makefile | 1 + src/usr/module_init.C | 13 + 71 files changed, 4906 insertions(+), 526 deletions(-) delete mode 100644 obj/.gitignore create mode 100644 obj/beam/.gitignore create mode 100644 obj/cscope/.gitignore create mode 100644 obj/doxygen/.gitignore create mode 100644 src/build/beam/compiler_c_config.tcl create mode 100644 src/build/beam/compiler_cpp_config.tcl create mode 100644 src/build/doxygen/doxygen.conf create mode 100644 src/build/lids/81e00301.lidhdr create mode 100755 src/build/lids/apyfipshdr create mode 100755 src/build/lids/apyruhhdr create mode 100755 src/build/lids/crc32 create mode 100644 src/build/lids/dslid.lidhdr create mode 100644 src/build/lids/halruntime.lidhdr create mode 100644 src/build/lids/hbicore.lidhdr create mode 100644 src/build/lids/phal.vpdinfo create mode 100755 src/build/tools/addimgid create mode 100755 src/build/tools/build create mode 100755 src/build/tools/builddriver create mode 100755 src/build/tools/genlist create mode 100755 src/build/tools/gensyms create mode 100644 src/include/arch/ppc.H create mode 100644 src/include/assert.h create mode 100644 src/include/builtins.h delete mode 100644 src/include/kernel/ppcarch.H create mode 100644 src/include/math.h create mode 100755 src/include/new create mode 100644 src/include/stdio.h mode change 100644 => 100755 src/include/string.h create mode 100644 src/include/util/functor.H create mode 100644 src/include/util/sprintf.H create mode 100644 src/kernel/terminate.S create mode 100644 src/lib/assert.C create mode 100644 src/lib/stdio.C create mode 100644 src/lib/string.C delete mode 100644 src/lib/string.c mode change 100644 => 100755 src/libc++/builtins.C create mode 100644 src/sys/vfs/vfs_init.C create mode 100644 src/usr/module_init.C diff --git a/.gitignore b/.gitignore index 39250ddcb..b7bd2c5a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ *.o +*.list +*.dep *.o.hash -*.so *.swp -*.bin -*.elf -*.map diff --git a/config.mk b/config.mk index f9030a4fd..f345d6501 100644 --- a/config.mk +++ b/config.mk @@ -1,69 +1,183 @@ -all: ALL +all: ALL ${EXTRA_PARTS} ifdef MODULE OBJDIR = ${ROOTPATH}/obj/modules/${MODULE} +BEAMDIR = ${ROOTPATH}/obj/beam/${MODULE} IMGDIR = ${ROOTPATH}/img -EXTRACOMMONFLAGS += -fPIC +EXTRACOMMONFLAGS += -fPIC -Bsymbolic -Bsymbolic-functions +LIBS += $(addsuffix .so, $(addprefix lib, ${MODULE})) +MODULE_INIT = ${ROOTPATH}/obj/core/module_init.o else -OBJDIR = ${ROOTPATH}/obj/hbicore +OBJDIR = ${ROOTPATH}/obj/core +BEAMDIR = ${ROOTPATH}/obj/beam/core IMGDIR = ${ROOTPATH}/img endif -CUSTOM_LINKER = i686-mcp6-jail ${ROOTPATH}/src/build/linker/linker TRACEPP = ${ROOTPATH}/src/build/trace/tracepp +CUSTOM_LINKER_EXE = ${ROOTPATH}/src/build/linker/linker +CUSTOM_LINKER = i686-mcp6-jail ${CUSTOM_LINKER_EXE} CC = ${TRACEPP} ppc64-mcp6-gcc CXX = ${TRACEPP} ppc64-mcp6-g++ LD = ppc64-mcp6-ld +OBJDUMP = ppc64-mcp6-objdump +APYFIPSHDR = apyfipshdr +APYRUHHDR = apyruhhdr + +BEAMVER = beam-3.5.2 +BEAMPATH = /afs/rch/projects/esw/beam/${BEAMVER} +BEAMCMD = i686-mcp6-jail ${BEAMPATH}/bin/beam_compile +BEAMFLAGS = \ + --beam::source=${ROOTPATH}/src/build/beam/compiler_c_config.tcl \ + --beam::source=${ROOTPATH}/src/build/beam/compiler_cpp_config.tcl \ + --beam::exit0 \ + -o /dev/null COMMONFLAGS = -O3 -nostdlib ${EXTRACOMMONFLAGS} CFLAGS = ${COMMONFLAGS} -mcpu=power7 -nostdinc -g -msoft-float -mno-altivec \ - -Wall + -Wall -Werror ASMFLAGS = ${COMMONFLAGS} -mcpu=power7 CXXFLAGS = ${CFLAGS} -nostdinc++ -fno-rtti -fno-exceptions -Wall LDFLAGS = --nostdlib --sort-common ${COMMONFLAGS} -LDMAPFLAGS = -Map $@.map INCDIR = ${ROOTPATH}/src/include/ OBJECTS = $(addprefix ${OBJDIR}/, ${OBJS}) LIBRARIES = $(addprefix ${IMGDIR}/, ${LIBS}) -${OBJDIR}/%.o : %.C +ifdef IMGS +IMGS_ = $(addprefix ${IMGDIR}/, ${IMGS}) +LIDS = $(foreach lid,$(addsuffix _LIDNUMBER, $(IMGS)),$(addprefix ${IMGDIR}/,$(addsuffix .ruhx, $($(lid))))) +IMAGES = $(addsuffix .bin, ${IMGS_}) $(addsuffix .elf, ${IMGS_}) ${LIDS} +#$(addsuffix .ruhx, ${IMGS_}) +endif + +ifdef EXTRA_LIDS +EXTRA_LIDS_ = $(foreach lid,$(addsuffix _LIDNUMBER, $(EXTRA_LIDS)),$(addprefix ${IMGDIR}/,$(addsuffix .lidhdr, $($(lid))))) +endif + +${OBJDIR}/%.o ${OBJDIR}/%.list : %.C mkdir -p ${OBJDIR} ${CXX} -c ${CXXFLAGS} $< -o $@ -I ${INCDIR} + ${OBJDUMP} -dCS $@ > $(basename $@).list -${OBJDIR}/%.o : %.c +${OBJDIR}/%.o ${OBJDIR}/%.list : %.c mkdir -p ${OBJDIR} - ${CC} -c ${CFLAGS} $< -o $@ -I ${INCDIR} + ${CC} -c ${CFLAGS} -std=c99 $< -o $@ -I ${INCDIR} + ${OBJDUMP} -dCS $@ > $(basename $@).list ${OBJDIR}/%.o : %.S mkdir -p ${OBJDIR} - ${CC} -c ${ASMFLAGS} $< -o $@ -Wa,-I${INCDIR} + ${CC} -c ${ASMFLAGS} $< -o $@ -Wa,-I${INCDIR} -I${INCDIR} + +${OBJDIR}/%.dep : %.C + mkdir -p ${OBJDIR}; \ + rm -f $@; \ + ${CXX} -M ${CXXFLAGS} $< -o $@.$$$$ -I ${INCDIR}; \ + sed 's,\($*\)\.o[ :]*,${OBJDIR}/\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ + +${OBJDIR}/%.dep : %.c + mkdir -p ${OBJDIR}; \ + rm -f $@; \ + ${CC} -M ${CFLAGS} -std=c99 $< -o $@.$$$$ -I ${INCDIR}; \ + sed 's,\($*\)\.o[ :]*,${OBJDIR}/\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ + +${OBJDIR}/%.dep : %.S + mkdir -p ${OBJDIR}; \ + rm -f $@; \ + ${CC} -M ${ASMFLAGS} $< -o $@.$$$$ -Wa,-I${INCDIR} -I${INCDIR}; \ + sed 's,\($*\)\.o[ :]*,${OBJDIR}/\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ -${IMGDIR}/%.so : ${OBJECTS} ${ROOTPATH}/src/module.ld - ${LD} -shared -z now --gc-sections ${LDFLAGS} $< \ +ifdef MODULE +${IMGDIR}/%.so : ${OBJECTS} ${ROOTPATH}/src/module.ld ${MODULE_INIT} ${SUBDIRS} + ${LD} -shared -z now ${LDFLAGS} \ + $(filter-out ${ROOTPATH}/src/module.ld,$^) \ -T ${ROOTPATH}/src/module.ld -o $@ +endif -${IMGDIR}/%.elf: kernel.ld ${OBJDIR}/*.o ${ROOTPATH}/src/kernel.ld - ${LD} -static ${LDFLAGS} ${LDMAPFLAGS} ${OBJDIR}/*.o \ - -T ${ROOTPATH}/src/kernel.ld -o $@ - -${IMGDIR}/%.bin: ${IMGDIR}/%.elf $(wildcard ${IMGDIR}/*.so) - ${CUSTOM_LINKER} $@ $^ - -%.d: +define ELF_template +$${IMGDIR}/$(1).elf: $$(addprefix $${OBJDIR}/, $$($(1)_OBJECTS)) \ + $${ROOTPATH}/src/kernel.ld + $${LD} -static $${LDFLAGS} \ + $$(addprefix $${OBJDIR}/, $$($(1)_OBJECTS)) \ + $$($(1)_LDFLAGS) -T $${ROOTPATH}/src/kernel.ld -o $$@ +endef +$(foreach img,$(IMGS),$(eval $(call ELF_template,$(img)))) + +${IMGDIR}/%.bin ${IMGDIR}/%.list ${IMGDIR}/%.syms: ${IMGDIR}/%.elf \ + $(wildcard ${IMGDIR}/*.so) ${CUSTOM_LINKER_EXE} + ${CUSTOM_LINKER} $@ $< \ + $(addprefix ${IMGDIR}/lib, $(addsuffix .so, \ + $($*_MODULES))) > ${IMGDIR}/.$*.lnkout + ${ROOTPATH}/src/build/tools/addimgid $@ $< + (cd ${ROOTPATH}; \ + src/build/tools/gensyms $*.bin > ./img/$*.syms ; \ + src/build/tools/genlist $*.bin > ./img/$*.list) + + +define RUHX_template +${IMGDIR}/$$($(1)_LIDNUMBER).ruhx: $${ROOTPATH}/src/build/lids/$(1).lidhdr \ + $${IMGDIR}/$(1).bin + $${APYFIPSHDR} -r $$< -l $${IMGDIR}/$(1).bin -o $${IMGDIR}/$(1).fips + $${APYRUHHDR} -r $$< -l ${IMGDIR}/$(1).fips -o $${IMGDIR}/$$($(1)_LIDNUMBER).ruhx + (rm -f $${IMGDIR}/$(1).fips) + ln -sf $${IMGDIR}/$(1).bin $${IMGDIR}/$$($(1)_LIDNUMBER).lid + ln -sf $${ROOTPATH}/src/build/lids/$(1).lidhdr $${IMGDIR}/$$($(1)_LIDNUMBER).lidhdr +endef +$(foreach img,$(IMGS),$(eval $(call RUHX_template,$(img)))) + +define LIDHDR_template +${IMGDIR}/$$($(1)_LIDNUMBER).lidhdr: $${ROOTPATH}/src/build/lids/$(1).lidhdr + ln -sf $$^ $$@ +endef +$(foreach lid,$(EXTRA_LIDS),$(eval $(call LIDHDR_template,$(lid)))) + +%.d: ${OBJECTS} cd ${basename $@} && ${MAKE} %.clean: cd ${basename $@} && ${MAKE} clean -ALL: ${SUBDIRS} ${OBJECTS} ${LIBRARIES} +%.beamdir: + cd ${basename $@} && ${MAKE} beam + +ALL: ${OBJECTS} ${SUBDIRS} ${LIBRARIES} ${EXTRA_LIDS_} ifdef IMAGES - ${MAKE} ${IMAGES} + ${MAKE} ${IMAGES} endif -clean: $(patsubst %.d,%.clean, ${SUBDIRS}) - (rm -f ${OBJECTS} $(addsuffix .hash, ${OBJECTS}) ${LIBRARIES} \ - ${IMAGES} $(addsuffix .map, ${IMAGES}) ) - +${BEAMDIR}/%.beam : %.C + mkdir -p ${BEAMDIR} + ${BEAMCMD} -I ${INCDIR} ${CXXFLAGS} ${BEAMFLAGS} $< \ + --beam::complaint_file=$@ --beam::parser_file=$@ + +${BEAMDIR}/%.beam : %.c + mkdir -p ${BEAMDIR} + ${BEAMCMD} -I ${INCDIR} ${CXXFLAGS} ${BEAMFLAGS} $< \ + --beam::complaint_file=$@ --beam::parser_file=$@ + +${BEAMDIR}/%.beam : %.S + echo Skipping ASM file. + +BEAMOBJS = $(addprefix ${BEAMDIR}/, ${OBJS:.o=.beam}) +beam: ${SUBDIRS:.d=.beamdir} ${BEAMOBJS} + +clean: ${SUBDIRS:.d=.clean} + (rm -f ${OBJECTS} ${OBJECTS:.o=.dep} ${OBJECTS:.o=.list} \ + ${BEAMOBJS} ${LIBRARIES} \ + ${IMAGES} ${IMAGES:.bin=.list} ${IMAGES:.bin=.syms} \ + ${IMAGES:.bin=.bin.modinfo} ${IMAGES:.ruhx=.lid} \ + ${IMAGES:.ruhx=.lidhdr} ${EXTRA_LIDS_}) + +cscope: ALL + mkdir -p ${ROOTPATH}/obj/cscope + (cd ${ROOTPATH}/obj/cscope ; rm -f cscope.* ; \ + find ../../ -name '*.[CHchS]' -fprint cscope.files; \ + cscope -bqk) + +ifneq ($(MAKECMDGOALS),clean) + include $(OBJECTS:.o=.dep) +endif diff --git a/env.bash b/env.bash index a7068c57e..c5c2c43e3 100644 --- a/env.bash +++ b/env.bash @@ -4,4 +4,4 @@ if [ -e /esw/fakeroot/ ]; then export MCP_PATH=/esw/fakeroot fi -export PATH=${PATH}:${MCP_PATH}/opt/mcp/bin:${MCP_PATH}/usr/bin:`pwd`/src/build/trace +export PATH=${PATH}:${MCP_PATH}/opt/mcp/bin:${MCP_PATH}/usr/bin:`pwd`/src/build/lids:`pwd`/src/build/trace diff --git a/env.csh b/env.csh index 7fe423849..827f52812 100644 --- a/env.csh +++ b/env.csh @@ -4,4 +4,4 @@ if (-e /esw/fakeroot/) then endif -setenv PATH ${PATH}:${MCP_PATH}/opt/mcp/bin:${MCP_PATH}/usr/bin:`pwd`/src/build/trace +setenv PATH ${PATH}:${MCP_PATH}/opt/mcp/bin:${MCP_PATH}/usr/bin:`pwd`/src/build/lids:`pwd`/src/build/trace diff --git a/img/.gitignore b/img/.gitignore index e69de29bb..ee31f4b9c 100644 --- a/img/.gitignore +++ b/img/.gitignore @@ -0,0 +1,10 @@ +*.bin +*.bin.modinfo +*.elf +*.fips +*.lid +*.lidhdr +*.ruhx +*.so +*.syms +.*.lnkout diff --git a/makefile b/makefile index dcb3848e7..2493f2273 100644 --- a/makefile +++ b/makefile @@ -1,3 +1,10 @@ SUBDIRS = src.d +ROOTPATH = . + +EXTRA_PARTS = cscope include ./config.mk + +docs: src/build/doxygen/doxygen.conf + rm -rf obj/doxygen/* + doxygen src/build/doxygen/doxygen.conf diff --git a/obj/.gitignore b/obj/.gitignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/obj/beam/.gitignore b/obj/beam/.gitignore new file mode 100644 index 000000000..72e8ffc0d --- /dev/null +++ b/obj/beam/.gitignore @@ -0,0 +1 @@ +* diff --git a/obj/cscope/.gitignore b/obj/cscope/.gitignore new file mode 100644 index 000000000..72e8ffc0d --- /dev/null +++ b/obj/cscope/.gitignore @@ -0,0 +1 @@ +* diff --git a/obj/doxygen/.gitignore b/obj/doxygen/.gitignore new file mode 100644 index 000000000..72e8ffc0d --- /dev/null +++ b/obj/doxygen/.gitignore @@ -0,0 +1 @@ +* diff --git a/src/build/beam/compiler_c_config.tcl b/src/build/beam/compiler_c_config.tcl new file mode 100644 index 000000000..0c49e4007 --- /dev/null +++ b/src/build/beam/compiler_c_config.tcl @@ -0,0 +1,546 @@ +############################################################ +# Invocation of beam_configure: +# +# '/afs/rchland.ibm.com/projects/esw/beam/beam-3.5.2/bin/beam_configure' '--c' 'ppc64-mcp6-gcc' +# +# Location of compiler: +# +# /esw/fakeroot/opt/mcp/bin/ppc64-mcp6-jailtc +# +############################################################ +# +# This is BEAM configuration file that describes a compiler +# and a target machine. This was generated with beam_configure +# version "4.0". +# +# This information will help BEAM emulate this compiler's +# features, macros, and header file locations, so that BEAM +# can compile the same source code that the original compiler +# could compile, and understand it with respect to the machine's +# sizes and widths of types. +# +# The file format is Tcl, so basic Tcl knowledge may be beneficial +# for anything more than the simplest of modifications. +# +# A quick Tcl primer: +# - Lines starting with "#" or ";#" are comments +# - Things inside balanced curly braces are literal strings {one string literal} +# - Things in square brackets that aren't in curly braces are function calls, +# and will be expanded inline automatically. This causes the most problems in +# double-quoted strings: "this is a function call: [some_func]" +# +# This file contains these sections: +# +# 1) Source language dialect +# 2) Default include paths +# 3) Target machine configuration +# 4) Predefined macros +# 5) Miscellaneous options +# +# Each section has variables that help configure BEAM. They should +# each be commented well. For additional documentation, please +# refer to the local documentation in the install point. +# +# Note that the order of the sections is not important, +# and variables may be set in any order. +# +# All variables are prefixed with name that corresponds to +# which language this configuration is for. +# +# For C compilers, the prefix is "beam::compiler::c" +# For C++, it is "beam::compiler::cpp" +# +############################################################ + +### This is the version of beam_configure that generated this +### configuration file. + +set beam::compiler::c::generated_by_beam_configure "4.0" + + +### This tells BEAM which pre-canned settings to load. +### BEAM comes with some function attributes and argument +### mappers for gcc, xlc, and vac. If unsure, set this to +### "default". + +set beam::compiler::c::cc "gcc" + + +############################################################ +# Section 1: Source language dialect +############################################################ + +### The language_dialect variable selects among the available +### dialects of C and C++. +### +### By default, C files are set up as: +### +### set beam::compiler::c::language_dialect c +### set beam::compiler::c::c99_mode 0 +### set beam::compiler::c::strict_mode 0 +### set beam::compiler::c::gnu_mode 0 +### set beam::compiler::c::msvc_mode 0 +### +### and C++ files are set up as: +### +### set beam::compiler::cpp::language_dialect c++ +### set beam::compiler::cpp::c99_mode 0 +### set beam::compiler::cpp::strict_mode 0 +### set beam::compiler::cpp::gnu_mode 0 +### set beam::compiler::cpp::msvc_mode 0 +### +### Note that the dialect must match the namespace. +### Don't set up the C++ language in the C namespace or +### things will probably fail. +### +### This defaults to be the same as the language being +### compiled (based on the source file extension). +### Normally, it should not be set. + +# set beam::compiler::c::language_dialect old_c ;# K&R +# set beam::compiler::c::language_dialect c ;# ANSI +# set beam::compiler::c::language_dialect c++ + +### In addition to simply using C or C++, different +### modes are provided to enable or disable language +### extensions. Some modes are incompatible with eachother +### or with the language_dialect above, and will produce +### errors. + +### C99 mode enables C99 extensions in C code. It is not +### compatible with C++ code. This overrides old_c, and +### instead forces regular C. + +# set beam::compiler::c::c99_mode 0 +# set beam::compiler::c::c99_mode 1 + +### Strict mode disables all non-ANSI/ISO features. It +### is compatible with C and C++ code, but not with old_c. + +# set beam::compiler::c::strict_mode 0 +# set beam::compiler::c::strict_mode 1 + +### GNU mode enables GNU C extensions in C code and +### GNU C++ extensions in C++ code. This overrides +### old_c, and instead forces regular C. +### +### The value should be a 5 digit number representing +### the version of GCC to emulate. It is of this format: +### +### major_version_num * 10000 + +### minor_version_num * 100 + +### patch_version_num +### +### so, GCC version "3.4.3" should be "30403". +### +### The minimum allowable value is "30200". + +# set beam::compiler::c::gnu_mode 30200 + +set beam::compiler::c::gnu_mode 40304 + + +### MSVC mode enables Microsoft extensions in C code and +### C++ code. +### +### The value should be a 3 or 4 digit number representing +### the version of MSVC to emulate. +### +### The minimum allowable value is "700". + +# set beam::compiler::c::msvc_mode 700 + + + +### Other miscellaneous language settings. The values shown +### here are the defaults if they remain unset. + +# set beam::compiler::c::language_friend_injection_enabled 0 +# set beam::compiler::c::language_use_nonstandard_for_init_scope 0 +# set beam::compiler::c::language_string_literals_are_const 1 +# set beam::compiler::c::language_allow_dollar_in_id_chars 1 +# set beam::compiler::c::language_end_of_line_comments_allowed 1 +# set beam::compiler::c::language_allow_spaces_in_include_directive 0 +# set beam::compiler::c::language_restrict_keyword_enabled 0 +# set beam::compiler::c::language_allow_nonstandard_anonymous_unions 1 +# set beam::compiler::c::language_trigraphs_allowed 1 +# set beam::compiler::c::language_wchar_t_is_keyword 1 +# set beam::compiler::c::language_bool_is_keyword 1 + +set beam::compiler::c::language_trigraphs_allowed "0" + + +############################################################ +# Section 2: Default include paths +############################################################ + +### The system_include_path variable is a list of directories +### that will be searched in for system headers. Parser warnings +### are suppressed in these directories. These will come +### after any directories specified with -I on the command line. + +# lappend beam::compiler::c::system_include_path {/usr/include} +# lappend beam::compiler::c::system_include_path {/usr/vacpp/include} + +### Maybe your include paths are part of the environment + +# if { [::info exists ::env(MY_INCLUDE_PATH)] } { +# set beam::compiler::c::system_include_path \ +# [split $::env(MY_INCLUDE_PATH) $::beam::pathsep] +# } + +lappend beam::compiler::c::system_include_path {/esw/mcp/ppc64/lib/gcc/ppc64-linux/4.3/include} + + +############################################################ +# Section 3: Target machine configuration +############################################################ + +### These variables control the target machine and +### a few individual language options. +### +### Note: These examples do not cover all of the available +### options. For a complete list, refer to the BEAM documentation. +### +### Examples appear below the auto-configured ones. + +set beam::compiler::c::target_alignof_double "8" +set beam::compiler::c::target_alignof_float "4" +set beam::compiler::c::target_alignof_int "4" +set beam::compiler::c::target_alignof_long "8" +set beam::compiler::c::target_alignof_long_double "16" +set beam::compiler::c::target_alignof_long_long "8" +set beam::compiler::c::target_alignof_pointer "8" +set beam::compiler::c::target_alignof_short "2" +set beam::compiler::c::target_char16_t_int_kind "short unsigned int" +set beam::compiler::c::target_char32_t_int_kind "unsigned int" +set beam::compiler::c::target_dbl_max_exp "1024" +set beam::compiler::c::target_dbl_min_exp "-1021" +set beam::compiler::c::target_flt_max_exp "128" +set beam::compiler::c::target_flt_min_exp "-125" +set beam::compiler::c::target_ldbl_max_exp "1024" +set beam::compiler::c::target_ldbl_min_exp "-968" +set beam::compiler::c::target_little_endian "1" +set beam::compiler::c::target_plain_char_is_unsigned "1" +set beam::compiler::c::target_ptrdiff_t_int_kind "long int" +set beam::compiler::c::target_size_t_int_kind "long unsigned int" +set beam::compiler::c::target_sizeof_char16_t "2" +set beam::compiler::c::target_sizeof_char32_t "4" +set beam::compiler::c::target_sizeof_double "8" +set beam::compiler::c::target_sizeof_float "4" +set beam::compiler::c::target_sizeof_int "4" +set beam::compiler::c::target_sizeof_long "8" +set beam::compiler::c::target_sizeof_long_double "16" +set beam::compiler::c::target_sizeof_long_long "8" +set beam::compiler::c::target_sizeof_pointer "8" +set beam::compiler::c::target_sizeof_ptrdiff_t "8" +set beam::compiler::c::target_sizeof_short "2" +set beam::compiler::c::target_sizeof_size_t "8" +set beam::compiler::c::target_sizeof_wchar_t "4" +set beam::compiler::c::target_string_literals_are_readonly "1" +set beam::compiler::c::target_wchar_t_int_kind "int" +set beam::compiler::c::target_wchar_t_is_unsigned "0" +set beam::compiler::c::target_wint_t_int_kind "unsigned int" + + +### Examples ### + +### The number of bits in a char + +# set beam::compiler::c::target_char_bit 8 + +### Default signedness options + +# set beam::compiler::c::target_plain_char_is_unsigned 0 +# set beam::compiler::c::target_plain_char_is_unsigned 1 +# +# set beam::compiler::c::target_string_literals_are_readonly 0 +# set beam::compiler::c::target_string_literals_are_readonly 1 +# +# set beam::compiler::c::target_plain_int_bit_field_is_unsigned 0 +# set beam::compiler::c::target_plain_int_bit_field_is_unsigned 1 +# +# set beam::compiler::c::target_enum_bit_fields_are_always_unsigned 0 +# set beam::compiler::c::target_enum_bit_fields_are_always_unsigned 1 + +### Endianness of target machine + +# set beam::compiler::c::target_little_endian 0 +# set beam::compiler::c::target_little_endian 1 + +### Sizes of basic types in multiples of char. Since +### a char is defined to have size 1, it is not a +### configuration option. + +# set beam::compiler::c::target_sizeof_short 2 +# set beam::compiler::c::target_sizeof_int 4 +# set beam::compiler::c::target_sizeof_long 4 +# set beam::compiler::c::target_sizeof_long_long 8 +# set beam::compiler::c::target_sizeof_float 4 +# set beam::compiler::c::target_sizeof_double 8 +# set beam::compiler::c::target_sizeof_long_double 12 +# set beam::compiler::c::target_sizeof_pointer 4 + +### Alignments of basic types in multiples of char. Since +### a char is defined to have alignment 1, it is not a +### configuration option. + +# set beam::compiler::c::target_alignof_short 2 +# set beam::compiler::c::target_alignof_int 4 +# set beam::compiler::c::target_alignof_long 4 +# set beam::compiler::c::target_alignof_long_long 4 +# set beam::compiler::c::target_alignof_float 4 +# set beam::compiler::c::target_alignof_double 4 +# set beam::compiler::c::target_alignof_long_double 4 +# set beam::compiler::c::target_alignof_pointer 4 + +### Special types + +# set beam::compiler::c::target_sizeof_size_t 4 +# set beam::compiler::c::target_size_t_int_kind {unsigned int} +# +# set beam::compiler::c::target_sizeof_wchar_t 4 +# set beam::compiler::c::target_wchar_t_int_kind {int} +# set beam::compiler::c::target_wchar_t_is_unsigned 0 +# +# set beam::compiler::c::target_sizeof_wint_t 4 +# set beam::compiler::c::target_wint_t_int_kind {int} +# set beam::compiler::c::target_wint_t_is_unsigned 0 +# +# set beam::compiler::c::target_sizeof_char16_t 2 +# set beam::compiler::c::target_char16_t_int_kind {unsigned short} +# +# set beam::compiler::c::target_sizeof_char32_t 4 +# set beam::compiler::c::target_char32_t_int_kind {unsigned int} + +### Floating-point characteristics. The default +### values for these variables depend on the sizes +### set beam::compiler::c::for the types. The examples shown here +### are appropriate if float is size 4, double is +### size 8, and long double is size 12. +### +### Note that these values do not have to be exact +### because BEAM currently has limited floating-point +### support. + +# set beam::compiler::c::target_flt_max_exp 128 +# set beam::compiler::c::target_flt_min_exp -125 +# set beam::compiler::c::target_dbl_max_exp 1024 +# set beam::compiler::c::target_dbl_min_exp -1021 +# set beam::compiler::c::target_ldbl_max_exp 16384 +# set beam::compiler::c::target_ldbl_min_exp -16381 + +### Other miscellaneous options. The values +### shown here are the default values. + +# set beam::compiler::c::target_bit_field_container_size -1 +# set beam::compiler::c::target_zero_width_bit_field_alignment -1 +# set beam::compiler::c::target_zero_width_bit_field_affects_struct_alignment 0 +# set beam::compiler::c::target_unnamed_bit_field_affects_struct_alignment 0 + +############################################################ +# Section 4: Predefined macros +############################################################ + +### The predefined_macro variable is an associated array that +### maps the name of a macro to the value. Be sure that the +### value contains quotes inside the curly braces if the +### expansion should also contain quotes. +### +### Curly braces are allowed in the expansion text as long +### as they are properly balanced. +### +### There is no limit to the number of predefined macros that +### you can define. + +# set beam::compiler::c::predefined_macro(identifier1) {some_literal_value} +# set beam::compiler::c::predefined_macro(identifier2) {"some string value with quotes"} +# set beam::compiler::c::predefined_macro(identifier3(x,y)) { do { code; } while((x) && (y)) } + +set beam::compiler::c::predefined_macro(_ARCH_PPC) {1} +set beam::compiler::c::predefined_macro(_ARCH_PPC64) {1} +set beam::compiler::c::predefined_macro(_ARCH_PPCGR) {1} +set beam::compiler::c::predefined_macro(_BIG_ENDIAN) {1} +set beam::compiler::c::predefined_macro(_CALL_AIX) {1} +set beam::compiler::c::predefined_macro(_CALL_AIXDESC) {1} +set beam::compiler::c::predefined_macro(_LP64) {1} +set beam::compiler::c::predefined_macro(__BIG_ENDIAN__) {1} +set beam::compiler::c::predefined_macro(__CHAR16_TYPE__) {short unsigned int} +set beam::compiler::c::predefined_macro(__CHAR32_TYPE__) {unsigned int} +set beam::compiler::c::predefined_macro(__CHAR_BIT__) {8} +set beam::compiler::c::predefined_macro(__CHAR_UNSIGNED__) {1} +set beam::compiler::c::predefined_macro(__DBL_DENORM_MIN__) {4.9406564584124654e-324} +set beam::compiler::c::predefined_macro(__DBL_DIG__) {15} +set beam::compiler::c::predefined_macro(__DBL_EPSILON__) {2.2204460492503131e-16} +set beam::compiler::c::predefined_macro(__DBL_HAS_DENORM__) {1} +set beam::compiler::c::predefined_macro(__DBL_HAS_INFINITY__) {1} +set beam::compiler::c::predefined_macro(__DBL_HAS_QUIET_NAN__) {1} +set beam::compiler::c::predefined_macro(__DBL_MANT_DIG__) {53} +set beam::compiler::c::predefined_macro(__DBL_MAX_10_EXP__) {308} +set beam::compiler::c::predefined_macro(__DBL_MAX_EXP__) {1024} +set beam::compiler::c::predefined_macro(__DBL_MAX__) {1.7976931348623157e+308} +set beam::compiler::c::predefined_macro(__DBL_MIN_10_EXP__) {(-307)} +set beam::compiler::c::predefined_macro(__DBL_MIN_EXP__) {(-1021)} +set beam::compiler::c::predefined_macro(__DBL_MIN__) {2.2250738585072014e-308} +set beam::compiler::c::predefined_macro(__DEC128_EPSILON__) {1E-33DL} +set beam::compiler::c::predefined_macro(__DEC128_MANT_DIG__) {34} +set beam::compiler::c::predefined_macro(__DEC128_MAX_EXP__) {6145} +set beam::compiler::c::predefined_macro(__DEC128_MAX__) {9.999999999999999999999999999999999E6144DL} +set beam::compiler::c::predefined_macro(__DEC128_MIN_EXP__) {(-6142)} +set beam::compiler::c::predefined_macro(__DEC128_MIN__) {1E-6143DL} +set beam::compiler::c::predefined_macro(__DEC128_SUBNORMAL_MIN__) {0.000000000000000000000000000000001E-6143DL} +set beam::compiler::c::predefined_macro(__DEC32_EPSILON__) {1E-6DF} +set beam::compiler::c::predefined_macro(__DEC32_MANT_DIG__) {7} +set beam::compiler::c::predefined_macro(__DEC32_MAX_EXP__) {97} +set beam::compiler::c::predefined_macro(__DEC32_MAX__) {9.999999E96DF} +set beam::compiler::c::predefined_macro(__DEC32_MIN_EXP__) {(-94)} +set beam::compiler::c::predefined_macro(__DEC32_MIN__) {1E-95DF} +set beam::compiler::c::predefined_macro(__DEC32_SUBNORMAL_MIN__) {0.000001E-95DF} +set beam::compiler::c::predefined_macro(__DEC64_EPSILON__) {1E-15DD} +set beam::compiler::c::predefined_macro(__DEC64_MANT_DIG__) {16} +set beam::compiler::c::predefined_macro(__DEC64_MAX_EXP__) {385} +set beam::compiler::c::predefined_macro(__DEC64_MAX__) {9.999999999999999E384DD} +set beam::compiler::c::predefined_macro(__DEC64_MIN_EXP__) {(-382)} +set beam::compiler::c::predefined_macro(__DEC64_MIN__) {1E-383DD} +set beam::compiler::c::predefined_macro(__DEC64_SUBNORMAL_MIN__) {0.000000000000001E-383DD} +set beam::compiler::c::predefined_macro(__DECIMAL_DIG__) {33} +set beam::compiler::c::predefined_macro(__DEC_EVAL_METHOD__) {2} +set beam::compiler::c::predefined_macro(__ELF__) {1} +set beam::compiler::c::predefined_macro(__FINITE_MATH_ONLY__) {0} +set beam::compiler::c::predefined_macro(__FLT_DENORM_MIN__) {1.40129846e-45F} +set beam::compiler::c::predefined_macro(__FLT_DIG__) {6} +set beam::compiler::c::predefined_macro(__FLT_EPSILON__) {1.19209290e-7F} +set beam::compiler::c::predefined_macro(__FLT_EVAL_METHOD__) {0} +set beam::compiler::c::predefined_macro(__FLT_HAS_DENORM__) {1} +set beam::compiler::c::predefined_macro(__FLT_HAS_INFINITY__) {1} +set beam::compiler::c::predefined_macro(__FLT_HAS_QUIET_NAN__) {1} +set beam::compiler::c::predefined_macro(__FLT_MANT_DIG__) {24} +set beam::compiler::c::predefined_macro(__FLT_MAX_10_EXP__) {38} +set beam::compiler::c::predefined_macro(__FLT_MAX_EXP__) {128} +set beam::compiler::c::predefined_macro(__FLT_MAX__) {3.40282347e+38F} +set beam::compiler::c::predefined_macro(__FLT_MIN_10_EXP__) {(-37)} +set beam::compiler::c::predefined_macro(__FLT_MIN_EXP__) {(-125)} +set beam::compiler::c::predefined_macro(__FLT_MIN__) {1.17549435e-38F} +set beam::compiler::c::predefined_macro(__FLT_RADIX__) {2} +set beam::compiler::c::predefined_macro(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) {1} +set beam::compiler::c::predefined_macro(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) {1} +set beam::compiler::c::predefined_macro(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) {1} +set beam::compiler::c::predefined_macro(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) {1} +set beam::compiler::c::predefined_macro(__GNUC_GNU_INLINE__) {1} +set beam::compiler::c::predefined_macro(__GNUC_MINOR__) {3} +set beam::compiler::c::predefined_macro(__GNUC_PATCHLEVEL__) {4} +set beam::compiler::c::predefined_macro(__GNUC__) {4} +set beam::compiler::c::predefined_macro(__GXX_ABI_VERSION) {1002} +set beam::compiler::c::predefined_macro(__HAVE_BSWAP__) {1} +set beam::compiler::c::predefined_macro(__INTMAX_MAX__) {9223372036854775807L} +set beam::compiler::c::predefined_macro(__INTMAX_TYPE__) {long int} +set beam::compiler::c::predefined_macro(__INT_MAX__) {2147483647} +set beam::compiler::c::predefined_macro(__LDBL_DENORM_MIN__) {4.94065645841246544176568792868221e-324L} +set beam::compiler::c::predefined_macro(__LDBL_DIG__) {31} +set beam::compiler::c::predefined_macro(__LDBL_EPSILON__) {4.94065645841246544176568792868221e-324L} +set beam::compiler::c::predefined_macro(__LDBL_HAS_DENORM__) {1} +set beam::compiler::c::predefined_macro(__LDBL_HAS_INFINITY__) {1} +set beam::compiler::c::predefined_macro(__LDBL_HAS_QUIET_NAN__) {1} +set beam::compiler::c::predefined_macro(__LDBL_MANT_DIG__) {106} +set beam::compiler::c::predefined_macro(__LDBL_MAX_10_EXP__) {308} +set beam::compiler::c::predefined_macro(__LDBL_MAX_EXP__) {1024} +set beam::compiler::c::predefined_macro(__LDBL_MAX__) {1.79769313486231580793728971405301e+308L} +set beam::compiler::c::predefined_macro(__LDBL_MIN_10_EXP__) {(-291)} +set beam::compiler::c::predefined_macro(__LDBL_MIN_EXP__) {(-968)} +set beam::compiler::c::predefined_macro(__LDBL_MIN__) {2.00416836000897277799610805135016e-292L} +set beam::compiler::c::predefined_macro(__LONGDOUBLE128) {1} +set beam::compiler::c::predefined_macro(__LONG_DOUBLE_128__) {1} +set beam::compiler::c::predefined_macro(__LONG_LONG_MAX__) {9223372036854775807LL} +set beam::compiler::c::predefined_macro(__LONG_MAX__) {9223372036854775807L} +set beam::compiler::c::predefined_macro(__LP64__) {1} +set beam::compiler::c::predefined_macro(__NO_INLINE__) {1} +set beam::compiler::c::predefined_macro(__PPC64__) {1} +set beam::compiler::c::predefined_macro(__PPC__) {1} +set beam::compiler::c::predefined_macro(__PTRDIFF_TYPE__) {long int} +set beam::compiler::c::predefined_macro(__REGISTER_PREFIX__) {} +set beam::compiler::c::predefined_macro(__SCHAR_MAX__) {127} +set beam::compiler::c::predefined_macro(__SHRT_MAX__) {32767} +set beam::compiler::c::predefined_macro(__SIZEOF_DOUBLE__) {8} +set beam::compiler::c::predefined_macro(__SIZEOF_FLOAT__) {4} +set beam::compiler::c::predefined_macro(__SIZEOF_INT__) {4} +set beam::compiler::c::predefined_macro(__SIZEOF_LONG_DOUBLE__) {16} +set beam::compiler::c::predefined_macro(__SIZEOF_LONG_LONG__) {8} +set beam::compiler::c::predefined_macro(__SIZEOF_LONG__) {8} +set beam::compiler::c::predefined_macro(__SIZEOF_POINTER__) {8} +set beam::compiler::c::predefined_macro(__SIZEOF_PTRDIFF_T__) {8} +set beam::compiler::c::predefined_macro(__SIZEOF_SHORT__) {2} +set beam::compiler::c::predefined_macro(__SIZEOF_SIZE_T__) {8} +set beam::compiler::c::predefined_macro(__SIZEOF_WCHAR_T__) {4} +set beam::compiler::c::predefined_macro(__SIZEOF_WINT_T__) {4} +set beam::compiler::c::predefined_macro(__SIZE_TYPE__) {long unsigned int} +set beam::compiler::c::predefined_macro(__UINTMAX_TYPE__) {long unsigned int} +set beam::compiler::c::predefined_macro(__USER_LABEL_PREFIX__) {} +set beam::compiler::c::predefined_macro(__VERSION__) {"4.3.4 [gcc-4_3-branch revision 152973]"} +set beam::compiler::c::predefined_macro(__WCHAR_MAX__) {2147483647} +set beam::compiler::c::predefined_macro(__WCHAR_TYPE__) {int} +set beam::compiler::c::predefined_macro(__WINT_TYPE__) {unsigned int} +set beam::compiler::c::predefined_macro(__gnu_linux__) {1} +set beam::compiler::c::predefined_macro(__linux) {1} +set beam::compiler::c::predefined_macro(__linux__) {1} +set beam::compiler::c::predefined_macro(__powerpc64__) {1} +set beam::compiler::c::predefined_macro(__powerpc__) {1} +set beam::compiler::c::predefined_macro(__unix) {1} +set beam::compiler::c::predefined_macro(__unix__) {1} +set beam::compiler::c::predefined_macro(linux) {1} +set beam::compiler::c::predefined_macro(unix) {1} +set beam::compiler::c::predefined_macro(__builtin_expect(_x,_y)) {(_x)} + + +### You can also suppress the standard EDG predefined macros +### like __STDC__ if you set this pattern. By default, +### the pattern is "*", which allows all EDG predefined +### macros to get defined. Setting this to something +### like "* - __STDC__" would suppress the __STDC__ +### macro from being defined by default. This does +### not affect any predefined macros set up in this +### file; it only affects the basic EDG predefined macros. + +# set beam::compiler::c::standard_predefined_macros "*" + +set beam::compiler::c::standard_predefined_macros "* - __STDC_VERSION__" + + +############################################################ +# Section 5: Miscellaneous options +############################################################ + +### The extern variable is an associated array that maps +### unknown extern "string" values to known ones. For example, +### to force BEAM to treat +### +### extern "builtin" void func(); +### +### as +### +### extern "C" void func(); +### +### you should set this option: +### +### set beam::compiler::c::extern(builtin) "C" +### +### There is no limit to the number of strings that you can +### map to the built-in strings of "C" or "C++". + + + +### Some compilers define macro-like symbols that are being replaced +### with the name of the function they appear in. Below are the symbols +### EDG recognizes. Set to 1, if the symbol is replaced with a character +### string (as opposed to a variable). If in doubt define it as "1" +### which is more flexible. +### +### set beam::compiler::c::function_name_is_string_literal(__PRETTY_FUNCTION__) 1 +### set beam::compiler::c::function_name_is_string_literal(__FUNCTION__) 1 +### set beam::compiler::c::function_name_is_string_literal(__FUNCDNAME__) 1 +### set beam::compiler::c::function_name_is_string_literal(__func__) 1 + +set beam::compiler::c::function_name_is_string_literal(__func__) 0 +set beam::compiler::c::function_name_is_string_literal(__FUNCTION__) 0 +set beam::compiler::c::function_name_is_string_literal(__PRETTY_FUNCTION__) 0 + + diff --git a/src/build/beam/compiler_cpp_config.tcl b/src/build/beam/compiler_cpp_config.tcl new file mode 100644 index 000000000..2c2d2f799 --- /dev/null +++ b/src/build/beam/compiler_cpp_config.tcl @@ -0,0 +1,540 @@ +############################################################ +# Invocation of beam_configure: +# +# '/afs/rchland.ibm.com/projects/esw/beam/beam-3.5.2/bin/beam_configure' '--cpp' 'ppc64-mcp6-g++' +# +# Location of compiler: +# +# /esw/fakeroot/opt/mcp/bin/ppc64-mcp6-jailtc +# +############################################################ +# +# This is BEAM configuration file that describes a compiler +# and a target machine. This was generated with beam_configure +# version "4.0". +# +# This information will help BEAM emulate this compiler's +# features, macros, and header file locations, so that BEAM +# can compile the same source code that the original compiler +# could compile, and understand it with respect to the machine's +# sizes and widths of types. +# +# The file format is Tcl, so basic Tcl knowledge may be beneficial +# for anything more than the simplest of modifications. +# +# A quick Tcl primer: +# - Lines starting with "#" or ";#" are comments +# - Things inside balanced curly braces are literal strings {one string literal} +# - Things in square brackets that aren't in curly braces are function calls, +# and will be expanded inline automatically. This causes the most problems in +# double-quoted strings: "this is a function call: [some_func]" +# +# This file contains these sections: +# +# 1) Source language dialect +# 2) Default include paths +# 3) Target machine configuration +# 4) Predefined macros +# 5) Miscellaneous options +# +# Each section has variables that help configure BEAM. They should +# each be commented well. For additional documentation, please +# refer to the local documentation in the install point. +# +# Note that the order of the sections is not important, +# and variables may be set in any order. +# +# All variables are prefixed with name that corresponds to +# which language this configuration is for. +# +# For C compilers, the prefix is "beam::compiler::c" +# For C++, it is "beam::compiler::cpp" +# +############################################################ + +### This is the version of beam_configure that generated this +### configuration file. + +set beam::compiler::cpp::generated_by_beam_configure "4.0" + + +### This tells BEAM which pre-canned settings to load. +### BEAM comes with some function attributes and argument +### mappers for gcc, xlc, and vac. If unsure, set this to +### "default". + +set beam::compiler::cpp::cc "gcc" + + +############################################################ +# Section 1: Source language dialect +############################################################ + +### The language_dialect variable selects among the available +### dialects of C and C++. +### +### By default, C files are set up as: +### +### set beam::compiler::c::language_dialect c +### set beam::compiler::c::c99_mode 0 +### set beam::compiler::c::strict_mode 0 +### set beam::compiler::c::gnu_mode 0 +### set beam::compiler::c::msvc_mode 0 +### +### and C++ files are set up as: +### +### set beam::compiler::cpp::language_dialect c++ +### set beam::compiler::cpp::c99_mode 0 +### set beam::compiler::cpp::strict_mode 0 +### set beam::compiler::cpp::gnu_mode 0 +### set beam::compiler::cpp::msvc_mode 0 +### +### Note that the dialect must match the namespace. +### Don't set up the C++ language in the C namespace or +### things will probably fail. +### +### This defaults to be the same as the language being +### compiled (based on the source file extension). +### Normally, it should not be set. + +# set beam::compiler::cpp::language_dialect old_c ;# K&R +# set beam::compiler::cpp::language_dialect c ;# ANSI +# set beam::compiler::cpp::language_dialect c++ + +### In addition to simply using C or C++, different +### modes are provided to enable or disable language +### extensions. Some modes are incompatible with eachother +### or with the language_dialect above, and will produce +### errors. + +### C99 mode enables C99 extensions in C code. It is not +### compatible with C++ code. This overrides old_c, and +### instead forces regular C. + +# set beam::compiler::cpp::c99_mode 0 +# set beam::compiler::cpp::c99_mode 1 + +### Strict mode disables all non-ANSI/ISO features. It +### is compatible with C and C++ code, but not with old_c. + +# set beam::compiler::cpp::strict_mode 0 +# set beam::compiler::cpp::strict_mode 1 + +### GNU mode enables GNU C extensions in C code and +### GNU C++ extensions in C++ code. This overrides +### old_c, and instead forces regular C. +### +### The value should be a 5 digit number representing +### the version of GCC to emulate. It is of this format: +### +### major_version_num * 10000 + +### minor_version_num * 100 + +### patch_version_num +### +### so, GCC version "3.4.3" should be "30403". +### +### The minimum allowable value is "30200". + +# set beam::compiler::cpp::gnu_mode 30200 + +set beam::compiler::cpp::gnu_mode 40304 + + +### MSVC mode enables Microsoft extensions in C code and +### C++ code. +### +### The value should be a 3 or 4 digit number representing +### the version of MSVC to emulate. +### +### The minimum allowable value is "700". + +# set beam::compiler::cpp::msvc_mode 700 + + + +### Other miscellaneous language settings. The values shown +### here are the defaults if they remain unset. + +# set beam::compiler::cpp::language_friend_injection_enabled 0 +# set beam::compiler::cpp::language_use_nonstandard_for_init_scope 0 +# set beam::compiler::cpp::language_string_literals_are_const 1 +# set beam::compiler::cpp::language_allow_dollar_in_id_chars 1 +# set beam::compiler::cpp::language_end_of_line_comments_allowed 1 +# set beam::compiler::cpp::language_allow_spaces_in_include_directive 0 +# set beam::compiler::cpp::language_restrict_keyword_enabled 0 +# set beam::compiler::cpp::language_allow_nonstandard_anonymous_unions 1 +# set beam::compiler::cpp::language_trigraphs_allowed 1 +# set beam::compiler::cpp::language_wchar_t_is_keyword 1 +# set beam::compiler::cpp::language_bool_is_keyword 1 + +set beam::compiler::cpp::language_trigraphs_allowed "0" + + +############################################################ +# Section 2: Default include paths +############################################################ + +### The system_include_path variable is a list of directories +### that will be searched in for system headers. Parser warnings +### are suppressed in these directories. These will come +### after any directories specified with -I on the command line. + +# lappend beam::compiler::cpp::system_include_path {/usr/include} +# lappend beam::compiler::cpp::system_include_path {/usr/vacpp/include} + +### Maybe your include paths are part of the environment + +# if { [::info exists ::env(MY_INCLUDE_PATH)] } { +# set beam::compiler::cpp::system_include_path \ +# [split $::env(MY_INCLUDE_PATH) $::beam::pathsep] +# } + +lappend beam::compiler::cpp::system_include_path {/esw/mcp/ppc64/lib/gcc/ppc64-linux/4.3/include} + + +############################################################ +# Section 3: Target machine configuration +############################################################ + +### These variables control the target machine and +### a few individual language options. +### +### Note: These examples do not cover all of the available +### options. For a complete list, refer to the BEAM documentation. +### +### Examples appear below the auto-configured ones. + +set beam::compiler::cpp::target_dbl_max_exp "1024" +set beam::compiler::cpp::target_dbl_min_exp "-1021" +set beam::compiler::cpp::target_flt_max_exp "128" +set beam::compiler::cpp::target_flt_min_exp "-125" +set beam::compiler::cpp::target_ldbl_max_exp "1024" +set beam::compiler::cpp::target_ldbl_min_exp "-968" +set beam::compiler::cpp::target_little_endian "1" +set beam::compiler::cpp::target_plain_char_is_unsigned "1" +set beam::compiler::cpp::target_ptrdiff_t_int_kind "long int" +set beam::compiler::cpp::target_size_t_int_kind "long unsigned int" +set beam::compiler::cpp::target_sizeof_double "8" +set beam::compiler::cpp::target_sizeof_float "4" +set beam::compiler::cpp::target_sizeof_int "4" +set beam::compiler::cpp::target_sizeof_long "8" +set beam::compiler::cpp::target_sizeof_long_double "16" +set beam::compiler::cpp::target_sizeof_long_long "8" +set beam::compiler::cpp::target_sizeof_pointer "8" +set beam::compiler::cpp::target_sizeof_ptrdiff_t "8" +set beam::compiler::cpp::target_sizeof_short "2" +set beam::compiler::cpp::target_sizeof_size_t "8" +set beam::compiler::cpp::target_sizeof_wchar_t "4" +set beam::compiler::cpp::target_string_literals_are_readonly "1" +set beam::compiler::cpp::target_wchar_t_int_kind "int" +set beam::compiler::cpp::target_wchar_t_is_unsigned "0" +set beam::compiler::cpp::target_wint_t_int_kind "unsigned int" + + +### Examples ### + +### The number of bits in a char + +# set beam::compiler::cpp::target_char_bit 8 + +### Default signedness options + +# set beam::compiler::cpp::target_plain_char_is_unsigned 0 +# set beam::compiler::cpp::target_plain_char_is_unsigned 1 +# +# set beam::compiler::cpp::target_string_literals_are_readonly 0 +# set beam::compiler::cpp::target_string_literals_are_readonly 1 +# +# set beam::compiler::cpp::target_plain_int_bit_field_is_unsigned 0 +# set beam::compiler::cpp::target_plain_int_bit_field_is_unsigned 1 +# +# set beam::compiler::cpp::target_enum_bit_fields_are_always_unsigned 0 +# set beam::compiler::cpp::target_enum_bit_fields_are_always_unsigned 1 + +### Endianness of target machine + +# set beam::compiler::cpp::target_little_endian 0 +# set beam::compiler::cpp::target_little_endian 1 + +### Sizes of basic types in multiples of char. Since +### a char is defined to have size 1, it is not a +### configuration option. + +# set beam::compiler::cpp::target_sizeof_short 2 +# set beam::compiler::cpp::target_sizeof_int 4 +# set beam::compiler::cpp::target_sizeof_long 4 +# set beam::compiler::cpp::target_sizeof_long_long 8 +# set beam::compiler::cpp::target_sizeof_float 4 +# set beam::compiler::cpp::target_sizeof_double 8 +# set beam::compiler::cpp::target_sizeof_long_double 12 +# set beam::compiler::cpp::target_sizeof_pointer 4 + +### Alignments of basic types in multiples of char. Since +### a char is defined to have alignment 1, it is not a +### configuration option. + +# set beam::compiler::cpp::target_alignof_short 2 +# set beam::compiler::cpp::target_alignof_int 4 +# set beam::compiler::cpp::target_alignof_long 4 +# set beam::compiler::cpp::target_alignof_long_long 4 +# set beam::compiler::cpp::target_alignof_float 4 +# set beam::compiler::cpp::target_alignof_double 4 +# set beam::compiler::cpp::target_alignof_long_double 4 +# set beam::compiler::cpp::target_alignof_pointer 4 + +### Special types + +# set beam::compiler::cpp::target_sizeof_size_t 4 +# set beam::compiler::cpp::target_size_t_int_kind {unsigned int} +# +# set beam::compiler::cpp::target_sizeof_wchar_t 4 +# set beam::compiler::cpp::target_wchar_t_int_kind {int} +# set beam::compiler::cpp::target_wchar_t_is_unsigned 0 +# +# set beam::compiler::cpp::target_sizeof_wint_t 4 +# set beam::compiler::cpp::target_wint_t_int_kind {int} +# set beam::compiler::cpp::target_wint_t_is_unsigned 0 +# +# set beam::compiler::cpp::target_sizeof_char16_t 2 +# set beam::compiler::cpp::target_char16_t_int_kind {unsigned short} +# +# set beam::compiler::cpp::target_sizeof_char32_t 4 +# set beam::compiler::cpp::target_char32_t_int_kind {unsigned int} + +### Floating-point characteristics. The default +### values for these variables depend on the sizes +### set beam::compiler::cpp::for the types. The examples shown here +### are appropriate if float is size 4, double is +### size 8, and long double is size 12. +### +### Note that these values do not have to be exact +### because BEAM currently has limited floating-point +### support. + +# set beam::compiler::cpp::target_flt_max_exp 128 +# set beam::compiler::cpp::target_flt_min_exp -125 +# set beam::compiler::cpp::target_dbl_max_exp 1024 +# set beam::compiler::cpp::target_dbl_min_exp -1021 +# set beam::compiler::cpp::target_ldbl_max_exp 16384 +# set beam::compiler::cpp::target_ldbl_min_exp -16381 + +### Other miscellaneous options. The values +### shown here are the default values. + +# set beam::compiler::cpp::target_bit_field_container_size -1 +# set beam::compiler::cpp::target_zero_width_bit_field_alignment -1 +# set beam::compiler::cpp::target_zero_width_bit_field_affects_struct_alignment 0 +# set beam::compiler::cpp::target_unnamed_bit_field_affects_struct_alignment 0 + +############################################################ +# Section 4: Predefined macros +############################################################ + +### The predefined_macro variable is an associated array that +### maps the name of a macro to the value. Be sure that the +### value contains quotes inside the curly braces if the +### expansion should also contain quotes. +### +### Curly braces are allowed in the expansion text as long +### as they are properly balanced. +### +### There is no limit to the number of predefined macros that +### you can define. + +# set beam::compiler::cpp::predefined_macro(identifier1) {some_literal_value} +# set beam::compiler::cpp::predefined_macro(identifier2) {"some string value with quotes"} +# set beam::compiler::cpp::predefined_macro(identifier3(x,y)) { do { code; } while((x) && (y)) } + +set beam::compiler::cpp::predefined_macro(_ARCH_PPC) {1} +set beam::compiler::cpp::predefined_macro(_ARCH_PPC64) {1} +set beam::compiler::cpp::predefined_macro(_ARCH_PPCGR) {1} +set beam::compiler::cpp::predefined_macro(_BIG_ENDIAN) {1} +set beam::compiler::cpp::predefined_macro(_CALL_AIX) {1} +set beam::compiler::cpp::predefined_macro(_CALL_AIXDESC) {1} +set beam::compiler::cpp::predefined_macro(_GNU_SOURCE) {1} +set beam::compiler::cpp::predefined_macro(_LP64) {1} +set beam::compiler::cpp::predefined_macro(__BIG_ENDIAN__) {1} +set beam::compiler::cpp::predefined_macro(__CHAR16_TYPE__) {short unsigned int} +set beam::compiler::cpp::predefined_macro(__CHAR32_TYPE__) {unsigned int} +set beam::compiler::cpp::predefined_macro(__CHAR_BIT__) {8} +set beam::compiler::cpp::predefined_macro(__CHAR_UNSIGNED__) {1} +set beam::compiler::cpp::predefined_macro(__DBL_DENORM_MIN__) {4.9406564584124654e-324} +set beam::compiler::cpp::predefined_macro(__DBL_DIG__) {15} +set beam::compiler::cpp::predefined_macro(__DBL_EPSILON__) {2.2204460492503131e-16} +set beam::compiler::cpp::predefined_macro(__DBL_HAS_DENORM__) {1} +set beam::compiler::cpp::predefined_macro(__DBL_HAS_INFINITY__) {1} +set beam::compiler::cpp::predefined_macro(__DBL_HAS_QUIET_NAN__) {1} +set beam::compiler::cpp::predefined_macro(__DBL_MANT_DIG__) {53} +set beam::compiler::cpp::predefined_macro(__DBL_MAX_10_EXP__) {308} +set beam::compiler::cpp::predefined_macro(__DBL_MAX_EXP__) {1024} +set beam::compiler::cpp::predefined_macro(__DBL_MAX__) {1.7976931348623157e+308} +set beam::compiler::cpp::predefined_macro(__DBL_MIN_10_EXP__) {(-307)} +set beam::compiler::cpp::predefined_macro(__DBL_MIN_EXP__) {(-1021)} +set beam::compiler::cpp::predefined_macro(__DBL_MIN__) {2.2250738585072014e-308} +set beam::compiler::cpp::predefined_macro(__DEC128_EPSILON__) {1E-33DL} +set beam::compiler::cpp::predefined_macro(__DEC128_MANT_DIG__) {34} +set beam::compiler::cpp::predefined_macro(__DEC128_MAX_EXP__) {6145} +set beam::compiler::cpp::predefined_macro(__DEC128_MAX__) {9.999999999999999999999999999999999E6144DL} +set beam::compiler::cpp::predefined_macro(__DEC128_MIN_EXP__) {(-6142)} +set beam::compiler::cpp::predefined_macro(__DEC128_MIN__) {1E-6143DL} +set beam::compiler::cpp::predefined_macro(__DEC128_SUBNORMAL_MIN__) {0.000000000000000000000000000000001E-6143DL} +set beam::compiler::cpp::predefined_macro(__DEC32_EPSILON__) {1E-6DF} +set beam::compiler::cpp::predefined_macro(__DEC32_MANT_DIG__) {7} +set beam::compiler::cpp::predefined_macro(__DEC32_MAX_EXP__) {97} +set beam::compiler::cpp::predefined_macro(__DEC32_MAX__) {9.999999E96DF} +set beam::compiler::cpp::predefined_macro(__DEC32_MIN_EXP__) {(-94)} +set beam::compiler::cpp::predefined_macro(__DEC32_MIN__) {1E-95DF} +set beam::compiler::cpp::predefined_macro(__DEC32_SUBNORMAL_MIN__) {0.000001E-95DF} +set beam::compiler::cpp::predefined_macro(__DEC64_EPSILON__) {1E-15DD} +set beam::compiler::cpp::predefined_macro(__DEC64_MANT_DIG__) {16} +set beam::compiler::cpp::predefined_macro(__DEC64_MAX_EXP__) {385} +set beam::compiler::cpp::predefined_macro(__DEC64_MAX__) {9.999999999999999E384DD} +set beam::compiler::cpp::predefined_macro(__DEC64_MIN_EXP__) {(-382)} +set beam::compiler::cpp::predefined_macro(__DEC64_MIN__) {1E-383DD} +set beam::compiler::cpp::predefined_macro(__DEC64_SUBNORMAL_MIN__) {0.000000000000001E-383DD} +set beam::compiler::cpp::predefined_macro(__DECIMAL_DIG__) {33} +set beam::compiler::cpp::predefined_macro(__DEC_EVAL_METHOD__) {2} +set beam::compiler::cpp::predefined_macro(__DEPRECATED) {1} +set beam::compiler::cpp::predefined_macro(__ELF__) {1} +set beam::compiler::cpp::predefined_macro(__EXCEPTIONS) {1} +set beam::compiler::cpp::predefined_macro(__FINITE_MATH_ONLY__) {0} +set beam::compiler::cpp::predefined_macro(__FLT_DENORM_MIN__) {1.40129846e-45F} +set beam::compiler::cpp::predefined_macro(__FLT_DIG__) {6} +set beam::compiler::cpp::predefined_macro(__FLT_EPSILON__) {1.19209290e-7F} +set beam::compiler::cpp::predefined_macro(__FLT_EVAL_METHOD__) {0} +set beam::compiler::cpp::predefined_macro(__FLT_HAS_DENORM__) {1} +set beam::compiler::cpp::predefined_macro(__FLT_HAS_INFINITY__) {1} +set beam::compiler::cpp::predefined_macro(__FLT_HAS_QUIET_NAN__) {1} +set beam::compiler::cpp::predefined_macro(__FLT_MANT_DIG__) {24} +set beam::compiler::cpp::predefined_macro(__FLT_MAX_10_EXP__) {38} +set beam::compiler::cpp::predefined_macro(__FLT_MAX_EXP__) {128} +set beam::compiler::cpp::predefined_macro(__FLT_MAX__) {3.40282347e+38F} +set beam::compiler::cpp::predefined_macro(__FLT_MIN_10_EXP__) {(-37)} +set beam::compiler::cpp::predefined_macro(__FLT_MIN_EXP__) {(-125)} +set beam::compiler::cpp::predefined_macro(__FLT_MIN__) {1.17549435e-38F} +set beam::compiler::cpp::predefined_macro(__FLT_RADIX__) {2} +set beam::compiler::cpp::predefined_macro(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) {1} +set beam::compiler::cpp::predefined_macro(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) {1} +set beam::compiler::cpp::predefined_macro(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) {1} +set beam::compiler::cpp::predefined_macro(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) {1} +set beam::compiler::cpp::predefined_macro(__GNUC_GNU_INLINE__) {1} +set beam::compiler::cpp::predefined_macro(__GNUC_MINOR__) {3} +set beam::compiler::cpp::predefined_macro(__GNUC_PATCHLEVEL__) {4} +set beam::compiler::cpp::predefined_macro(__GNUC__) {4} +set beam::compiler::cpp::predefined_macro(__GNUG__) {4} +set beam::compiler::cpp::predefined_macro(__GXX_ABI_VERSION) {1002} +set beam::compiler::cpp::predefined_macro(__GXX_RTTI) {1} +set beam::compiler::cpp::predefined_macro(__GXX_WEAK__) {1} +set beam::compiler::cpp::predefined_macro(__HAVE_BSWAP__) {1} +set beam::compiler::cpp::predefined_macro(__INTMAX_MAX__) {9223372036854775807L} +set beam::compiler::cpp::predefined_macro(__INTMAX_TYPE__) {long int} +set beam::compiler::cpp::predefined_macro(__INT_MAX__) {2147483647} +set beam::compiler::cpp::predefined_macro(__LDBL_DENORM_MIN__) {4.94065645841246544176568792868221e-324L} +set beam::compiler::cpp::predefined_macro(__LDBL_DIG__) {31} +set beam::compiler::cpp::predefined_macro(__LDBL_EPSILON__) {4.94065645841246544176568792868221e-324L} +set beam::compiler::cpp::predefined_macro(__LDBL_HAS_DENORM__) {1} +set beam::compiler::cpp::predefined_macro(__LDBL_HAS_INFINITY__) {1} +set beam::compiler::cpp::predefined_macro(__LDBL_HAS_QUIET_NAN__) {1} +set beam::compiler::cpp::predefined_macro(__LDBL_MANT_DIG__) {106} +set beam::compiler::cpp::predefined_macro(__LDBL_MAX_10_EXP__) {308} +set beam::compiler::cpp::predefined_macro(__LDBL_MAX_EXP__) {1024} +set beam::compiler::cpp::predefined_macro(__LDBL_MAX__) {1.79769313486231580793728971405301e+308L} +set beam::compiler::cpp::predefined_macro(__LDBL_MIN_10_EXP__) {(-291)} +set beam::compiler::cpp::predefined_macro(__LDBL_MIN_EXP__) {(-968)} +set beam::compiler::cpp::predefined_macro(__LDBL_MIN__) {2.00416836000897277799610805135016e-292L} +set beam::compiler::cpp::predefined_macro(__LONGDOUBLE128) {1} +set beam::compiler::cpp::predefined_macro(__LONG_DOUBLE_128__) {1} +set beam::compiler::cpp::predefined_macro(__LONG_LONG_MAX__) {9223372036854775807LL} +set beam::compiler::cpp::predefined_macro(__LONG_MAX__) {9223372036854775807L} +set beam::compiler::cpp::predefined_macro(__LP64__) {1} +set beam::compiler::cpp::predefined_macro(__NO_INLINE__) {1} +set beam::compiler::cpp::predefined_macro(__PPC64__) {1} +set beam::compiler::cpp::predefined_macro(__PPC__) {1} +set beam::compiler::cpp::predefined_macro(__PTRDIFF_TYPE__) {long int} +set beam::compiler::cpp::predefined_macro(__REGISTER_PREFIX__) {} +set beam::compiler::cpp::predefined_macro(__SCHAR_MAX__) {127} +set beam::compiler::cpp::predefined_macro(__SHRT_MAX__) {32767} +set beam::compiler::cpp::predefined_macro(__SIZEOF_DOUBLE__) {8} +set beam::compiler::cpp::predefined_macro(__SIZEOF_FLOAT__) {4} +set beam::compiler::cpp::predefined_macro(__SIZEOF_INT__) {4} +set beam::compiler::cpp::predefined_macro(__SIZEOF_LONG_DOUBLE__) {16} +set beam::compiler::cpp::predefined_macro(__SIZEOF_LONG_LONG__) {8} +set beam::compiler::cpp::predefined_macro(__SIZEOF_LONG__) {8} +set beam::compiler::cpp::predefined_macro(__SIZEOF_POINTER__) {8} +set beam::compiler::cpp::predefined_macro(__SIZEOF_PTRDIFF_T__) {8} +set beam::compiler::cpp::predefined_macro(__SIZEOF_SHORT__) {2} +set beam::compiler::cpp::predefined_macro(__SIZEOF_SIZE_T__) {8} +set beam::compiler::cpp::predefined_macro(__SIZEOF_WCHAR_T__) {4} +set beam::compiler::cpp::predefined_macro(__SIZEOF_WINT_T__) {4} +set beam::compiler::cpp::predefined_macro(__SIZE_TYPE__) {long unsigned int} +set beam::compiler::cpp::predefined_macro(__UINTMAX_TYPE__) {long unsigned int} +set beam::compiler::cpp::predefined_macro(__USER_LABEL_PREFIX__) {} +set beam::compiler::cpp::predefined_macro(__VERSION__) {"4.3.4 [gcc-4_3-branch revision 152973]"} +set beam::compiler::cpp::predefined_macro(__WCHAR_MAX__) {2147483647} +set beam::compiler::cpp::predefined_macro(__WCHAR_TYPE__) {int} +set beam::compiler::cpp::predefined_macro(__WINT_TYPE__) {unsigned int} +set beam::compiler::cpp::predefined_macro(__gnu_linux__) {1} +set beam::compiler::cpp::predefined_macro(__linux) {1} +set beam::compiler::cpp::predefined_macro(__linux__) {1} +set beam::compiler::cpp::predefined_macro(__powerpc64__) {1} +set beam::compiler::cpp::predefined_macro(__powerpc__) {1} +set beam::compiler::cpp::predefined_macro(__unix) {1} +set beam::compiler::cpp::predefined_macro(__unix__) {1} +set beam::compiler::cpp::predefined_macro(linux) {1} +set beam::compiler::cpp::predefined_macro(unix) {1} +set beam::compiler::cpp::predefined_macro(__builtin_expect(_x,_y)) {(_x)} + + +### You can also suppress the standard EDG predefined macros +### like __STDC__ if you set this pattern. By default, +### the pattern is "*", which allows all EDG predefined +### macros to get defined. Setting this to something +### like "* - __STDC__" would suppress the __STDC__ +### macro from being defined by default. This does +### not affect any predefined macros set up in this +### file; it only affects the basic EDG predefined macros. + +# set beam::compiler::cpp::standard_predefined_macros "*" + +set beam::compiler::cpp::standard_predefined_macros "* - __STDC_VERSION__" + + +############################################################ +# Section 5: Miscellaneous options +############################################################ + +### The extern variable is an associated array that maps +### unknown extern "string" values to known ones. For example, +### to force BEAM to treat +### +### extern "builtin" void func(); +### +### as +### +### extern "C" void func(); +### +### you should set this option: +### +### set beam::compiler::cpp::extern(builtin) "C" +### +### There is no limit to the number of strings that you can +### map to the built-in strings of "C" or "C++". + + + +### Some compilers define macro-like symbols that are being replaced +### with the name of the function they appear in. Below are the symbols +### EDG recognizes. Set to 1, if the symbol is replaced with a character +### string (as opposed to a variable). If in doubt define it as "1" +### which is more flexible. +### +### set beam::compiler::cpp::function_name_is_string_literal(__PRETTY_FUNCTION__) 1 +### set beam::compiler::cpp::function_name_is_string_literal(__FUNCTION__) 1 +### set beam::compiler::cpp::function_name_is_string_literal(__FUNCDNAME__) 1 +### set beam::compiler::cpp::function_name_is_string_literal(__func__) 1 + +set beam::compiler::cpp::function_name_is_string_literal(__func__) 0 +set beam::compiler::cpp::function_name_is_string_literal(__FUNCTION__) 0 +set beam::compiler::cpp::function_name_is_string_literal(__PRETTY_FUNCTION__) 0 + + diff --git a/src/build/doxygen/doxygen.conf b/src/build/doxygen/doxygen.conf new file mode 100644 index 000000000..fb53618ae --- /dev/null +++ b/src/build/doxygen/doxygen.conf @@ -0,0 +1,1252 @@ +# Doxyfile 1.4.7 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = PowerHAL + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = obj/doxygen/ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, +# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, +# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES +# forces the Windows encoding (this is the default for the Windows binary), +# whereas setting the tag to NO uses a Unix-style encoding (the default for +# all platforms other than Windows). + +USE_WINDOWS_ENCODING = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = obj img + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that a graph may be further truncated if the graph's +# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH +# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), +# the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/src/build/lids/81e00301.lidhdr b/src/build/lids/81e00301.lidhdr new file mode 100644 index 000000000..a1777f8da --- /dev/null +++ b/src/build/lids/81e00301.lidhdr @@ -0,0 +1,21 @@ +(* BEGIN_VPD +:RUNAME.AJSFA236 +:RULOADID.81E00301 +:BASELOAD.N +:RUCHGLID.N +:RUFLASH.Y +:RUAREA.USER +:COMMONNAME.81E00301 +:NUCSEQCTL.00 +:BNDRYRQMT.PAGE +:LLBYPASS.N +:RUDEST.*MCG +:DELETERU.N +:VPDINFONM.phal +:RUSFGID.0000 +:RUPFGID.5050 +:RUSLFLOD.N +:FIPSCLASS.8000 +:PHYLUM.000FF800 +:LIDINFO. +END_VPD *) diff --git a/src/build/lids/apyfipshdr b/src/build/lids/apyfipshdr new file mode 100755 index 000000000..1eb318455 --- /dev/null +++ b/src/build/lids/apyfipshdr @@ -0,0 +1,494 @@ +#!/usr/bin/perl -w +#$sec = "IBM INTERNAL USE ONLY"; $sec; +# Author: Randal Allen Anderson III +# +# change history: +# --------------- +# 2004/02/18 v2cib526 Created from stripfipshdr shell +# +# enhancment suggestions: +# ----------------------- + +select (STDERR);$| = 1; # Make all prints to STDERR flush the buffer immediately +select (STDOUT);$| = 1; # Make all prints to STDOUT flush the buffer immediately +require 'ctime.pl'; + +#global variables +my $pgmrc = 0; +my $Debug = 0; +my $inputImage; +my $inputLidhdr; +my $outFips; +my $magicn = 0x0222; # indicates fips header +my $version = 3; # header version # +my @lidnumber = (0x0000, 0x0000); # eight digit hex value +my $bcddate1; +my $bcddate2; +my $bcdtime; +my $fipsclass; +my $lidsize; +my $hdrsize; +my $phylength = 4; +my @phylum = (0xff00, 0x0000); # default to all known platforms +my $lidinfomax = 64; +my $lidinfo = ""; +my $mtd = 0; +my $binfile = ""; # binary image file +my $crc = 0; + +# matrix values for crc calculation +my @crctl = (0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, + 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005, + 0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, 0x2B4BCB61, + 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD); + +my @crcth = (0x00000000, 0x4C11DB70, 0x9823B6E0, 0xD4326D90, + 0x34867077, 0x7897AB07, 0xACA5C697, 0xE0B41DE7, + 0x690CE0EE, 0x251D3B9E, 0xF12F560E, 0xBD3E8D7E, + 0x5D8A9099, 0x119B4BE9, 0xC5A92679, 0x89B8FD09); + +$ProgName = "apyfipshdr"; +&ParseArgs(); +chomp($msgdate = `date`); +OutputMessage("Start of $ProgName $msgdate",4,__LINE__); +OutputMessage("Applying fips header to $inputImage using $inputLidhdr to create $outFips",4,__LINE__); +&readLidhdr(); # read lidhdr configuration information from lidhdr file +&readImage(); # read in the binary file to add header to +$crc = qx(crc32 $inputImage); # calculate crc for the file +$crc = hex($crc); +if ($crc <= 0) { + OutputMessage("$ProgName was NOT successful. crc=0. Command crc32 is needed - is it in your path?",2,__LINE__); + exit 99; +} +&putFips(); # create new file with fips header +if ($pgmrc) { + OutputMessage("$ProgName was NOT successful rc=$pgmrc",2,__LINE__); +} +else { + OutputMessage("$ProgName was successful.",4,__LINE__); +} +chomp($msgdate = `date`); +OutputMessage("$ProgName complete. $msgdate",4,__LINE__); +exit($pgmrc); + + +#---------------------------------------------------- +# Convert number to four digit BCD +#---------------------------------------------------- +sub bcd { + my $intval = shift; + my $text = sprintf( "%04d", $intval ); + my $hexval = hex( $text ); + return $hexval; +} # end of sub bcd + + + +#---------------------------------------------------- +# Get FipS lid class information from lidhdr file +#---------------------------------------------------- +sub getfipsclass { + my $text = shift; + my $hexval = hex( $text ); # either hex value or mnemonic + if( $hexval == 0 ){ + if( $text =~ m/FIPS_GENUS/i ){ + $hexval = 0x1301; + } + elsif( $text =~ m/MASTERLIST/i ){ + $hexval = 0x1311; + } + elsif( $text =~ m/MARKER_LID/i ){ + $hexval = 0x1321; + } + elsif( $text =~ m/MARKER_DS/i ){ + $hexval = 0x1331; + } + elsif( $text =~ m/KEY_LID/i ){ + $hexval = 0x1341; + } + elsif( $text =~ m/FLASH_CODE/i ){ + $hexval = 0x2000; + } + elsif( $text =~ m/FLASH_DATA/i ){ + $hexval = 0x2001; + } + elsif( $text =~ m/BOOT_CODE/i ){ + $hexval = 0x2100; + } + elsif( $text =~ m/BOOT_KEEP/i ){ + $hexval = 0x2110; + } + elsif( $text =~ m/FIPS_CODE/i ){ + $hexval = 0x2200; + } + elsif( $text =~ m/FIPS_DATA/i ){ + $hexval = 0x2301; + } + elsif( $text =~ m/KEEP_TGZ/i ){ + $hexval = 0x2310; + } + elsif( $text =~ m/LANGUAGE/i ){ + $hexval = 0x2311; + } + elsif( $text =~ m/NORM_TGZ/i ){ + $hexval = 0x2320; + } + elsif( $text =~ m/FIPS_DS/i ){ + $hexval = 0x2331; + } + elsif( $text =~ m/TBALL_KEEP/i ){ + $hexval = 0x2400; + } + elsif( $text =~ m/TBALL_DISC/i ){ + $hexval = 0x2500; + } + elsif( $text =~ m/PHYP_CODE/i ){ + $hexval = 0x3000; + } + elsif( $text =~ m/PHYP_DATA/i ){ + $hexval = 0x3001; + } + elsif( $text =~ m/PHYP_DS/i ){ + $hexval = 0x3031; + } + elsif( $text =~ m/SPCN_CODE/i ){ + $hexval = 0x4000; + } + elsif( $text =~ m/SPCN_DATA/i ){ + $hexval = 0x4001; + } + elsif( $text =~ m/PFW_CODE/i ){ + $hexval = 0x5000; + } + elsif( $text =~ m/PFW_DATA/i ){ + $hexval = 0x5001; + } + elsif( $text =~ m/PFW_DS/i ){ + $hexval = 0x5031; + } + elsif( $text =~ m/SMA_CODE/i ){ + $hexval = 0x6000; + } + elsif( $text =~ m/SMA_DATA/i ){ + $hexval = 0x6001; + } + elsif( $text =~ m/SLDR_CODE/i ){ + $hexval = 0x7000; + } + elsif( $text =~ m/SLDR_DATA/i ){ + $hexval = 0x7001; + } + } + return $hexval; +} # end of sub getfipsclass + + +#---------------------------------------------------- +# Get lid number from lidhdr file +#---------------------------------------------------- +sub getlidnum { + my $text = shift; + $text =~ s/^\s*//; + $text =~ s/\s*$//; + my $count = ($text =~ tr/0-9A-Fa-f//); # either all hex or mnemonic + if( $count == 8 ){ + my $first = substr( $text, 0, 4 ); + my $secnd = substr( $text, 4 ); + $lidnum[0] = hex( $first ); + $lidnum[1] = hex( $secnd ); + } + else { + OutputMessage("RULOADID: lid number is not recognizable", 2, __LINE__); + } +} # end of sub getlidnum + + +#---------------------------------------------------- +# Get platform phylum information from lidhdr file +#---------------------------------------------------- +sub getphylum { + my $text = shift; + $text =~ s/^\s*//; + $text =~ s/\s*$//; + my $count = ($text =~ tr/0-9A-Fa-f//); # either all hex or mnemonic + if( $count == length( $text )){ + $phylength = int(( length( $text ) + 1 ) / 2 ); + if( $phylength < 4 ){ + $phylength = 4; # default 4 bytes for phylum data + } + while( length( $text ) < ( $phylength * 2 )){ + $text .= "0"; # expand input to proper length + } + @phylum = (); + do { + if( length( $text ) > 4 ){ + $convt = substr( $text, 0, 4 ); + $text = substr( $text, 4 ); + } + else { + $convt = $text; + $text = ""; + } + while( length( $convt ) < 4 ){ + $convt .= "0"; # four digit integer - forces bits to high end + } + my $hexval = hex( $convt ); + push @phylum, $hexval; + } while( length( $text ) > 0 ); + } + else { + @phylum = (0x0000, 0x0000); # default to no platforms + my @platforms = split( ',', $text ); # separate by commas + while( my $pltfrm = shift( @platforms )){ + my @plats = split( ' ', $pltfrm ); # separage by spaces + while( my $pform = shift( @plats )){ + $pform =~ s/^\s*//; + $pform =~ s/\s*$//; + if( $pform =~ m/CRP/i ){ + $phylum[0] |= 0x8000; + } + elsif( $pform =~ m/ALPHA/i ){ + $phylum[0] |= 0x4000; + } + elsif( $pform =~ m/QLA1/i ){ + $phylum[0] |= 0x2000; + } + elsif( $pform =~ m/HE/i ){ + $phylum[0] |= 0x0800; + } + elsif( $pform =~ m/SC/i ){ + $phylum[0] |= 0x0800; + } + elsif( $pform =~ m/MR/i ){ + $phylum[0] |= 0x0400; + } + elsif( $pform =~ m/ML/i ){ + $phylum[0] |= 0x0400; + } + elsif( $pform =~ m/LE/i ){ + $phylum[0] |= 0x0200; + } + elsif( $pform =~ m/BPC/i ){ + $phylum[0] |= 0x0100; + } + } + } + } +} # end of sub getphylum + + +#---------------------------------------------------- +# Display help text for this program +#---------------------------------------------------- +sub help { + print STDERR "$ProgName, Version $version\n"; + print STDERR "Description: This program will apply a fips header to a file.\n"; + print STDERR "Usage:\n\t$ProgName -r -l [-o ] [-debug] [-help]\n"; + print STDERR "Where:\n"; + print STDERR "\t -debug\t\t\t- display debug messages.\n"; + print STDERR "\t -help\t\t\t- this help display.\n"; + print STDERR "Example:\n"; + print STDERR "\t$ProgName -r 80a00001.lidhdr -l 80a00001.img -o 80a00001.fips\n"; + print "\n"; + exit(0); +} # end of sub help + + +#---------------------------------------------------- +# Generate an error message +#---------------------------------------------------- +sub OutputMessage { + local($message, $sevLevel, $lineNum) = @_; + + # Set the severity tag + if ($sevLevel == 1) { + $tag = "(S)"; + } elsif ($sevLevel == 2) { + $tag = "(E)"; + } elsif ($sevLevel == 3) { + $tag = "(W)"; + } elsif ($sevLevel == 4) { + $tag = "(I)"; + } else { + $tag = "(?)"; + } + + # print the user message + print "$tag [$ProgName-$lineNum] $message\n"; + + # Exit upon a severe message + exit(-1) if ($sevLevel == 1); +} # end of sub OutputMessage + + +#---------------------------------------------------- +# Parse the program input arguments +#---------------------------------------------------- +sub ParseArgs { + local(@args) = @ARGV; + local($Arg); + my $oops; + while ($Arg = shift(@args)) { + if ($Arg =~ m/^-debug$/) { #debug flag for more verbose output + $Debug = 1; + next; + } + elsif ($Arg =~ m/^-h/) { #display help + &help; + exit(0); + } + elsif ($Arg =~ m/-r/) { #set name of VPD info file + $inputLidhdr = shift(@args); + next; + } + elsif ($Arg =~ m/-l/) { #set name of image input file + $inputImage = shift(@args); + next; + } + elsif ($Arg =~ m/-o/) { #set name of output file + $outFips = shift(@args); + next; + } + else { + $oops .= "$Arg is not a valid parameter."; + } + } + if( !$inputImage ){ + $oops .= "You must supply an input image file.\n"; + } + if( !$inputLidhdr ){ + if( $inputImage ){ + $inputLidhdr = $inputImage; + if( $inputLidhdr =~ m/(.*)\..*/ ){ + $inputLidhdr = $1; + } + $inputLidhdr .= ".lidhdr"; + } + } + if( !$outFips ){ + if( $inputImage ){ + $outFips = $inputImage; + if( $outFips =~ m/(.*)\..*/ ){ + $outFips = $1; + } + $outFips .= ".fips"; + } + } + if( $oops ){ + OutputMessage( $oops, 2, __LINE__ ); + &help; + } +} # end of sub ParseArgs + + +#---------------------------------------------------- +# Put the FipS header and file data to a new file +#---------------------------------------------------- +sub putFips { + OutputMessage("Creating $outFips file",4,__LINE__); + if (open(FIPS,">$outFips")) { + binmode(FIPS); + # n fields H8 fields C fields lidinfo n fields phylum + $hdrsize = ( 8 * 2 ) + ( 3 * 4 ) + ( 4 * 1 ) + 64 + ( 4 * 2 ) + $phylength; + print FIPS pack('n',$magicn); # fips file magic # + print FIPS pack('n',$version); # version + print FIPS pack('n',$lidnum[0]); # high lid # nibble + print FIPS pack('n',$lidnum[1]); # low lid # nibble + print FIPS pack('n',$bcddate1); # bcd year + print FIPS pack('n',$bcddate2); # bcd mm/dd + print FIPS pack('n',$bcdtime); # bcd hh:mm + print FIPS pack('n',$fipsclass); # fips lid class + $crchex = sprintf( "%08x", $crc ); + print FIPS pack('H8',$crchex); # 32 bit IEEE standard crc + $lidsizehex = sprintf( "%08x", $lidsize ); + print FIPS pack('H8',$lidsizehex); # lid size + $hdrsizehex = sprintf( "%08x", $hdrsize ); + print FIPS pack('H8',$hdrsizehex); # header size + print FIPS pack('C',$mtd); # mtd # + print FIPS pack('C',1); # valid=1, invalid=0 + print FIPS pack('C',0); # alignment + print FIPS pack('C',$lidinfomax); # lid info size + print FIPS pack('a64',$lidinfo); # lid info string (64 bytes) + print FIPS pack('n',0); # bcd update date year + print FIPS pack('n',0); # bcd update date mm/dd + print FIPS pack('n',0); # bcd update time hh:mm + print FIPS pack('n',$phylength); # size of phylum field + if( $phylength > 0 ){ + my $phytemp = ""; + foreach my $phy ( @phylum ){ + $phytemp .= sprintf( "%04x", $phy ); + } + for( my $iTemp = 0; $iTemp < $phylength; $iTemp++ ){ + my $hoot = substr( $phytemp, $iTemp*2, 2 ); + my $ttemp = hex( $hoot ); + print FIPS pack('C',$ttemp); + } + } + print FIPS $binfile; + close(FIPS); + } + else { + OutputMessage("failed to open $outFips for output",1,__LINE__); + } +} # end of sub putFips + + +#---------------------------------------------------- +# Get the lidhdr information from the lidhdr file +#---------------------------------------------------- +sub readLidhdr { + if (open(LIDHDR,"<$inputLidhdr")) { + while( my $line = ) { + if( $line =~ m/ruloadid\.(.*)/i ){ + &getlidnum( $1 ); + } + elsif( $line =~ m/fipsclass\.(.*)/i ){ + $fipsclass = &getfipsclass( $1 ); + } + elsif( $line =~ m/phylum\.(.*)/i ){ + &getphylum( $1 ); + } + elsif( $line =~ m/lidinfo\.(.*)/i ){ + $lidinfo = $1; + $lidinfo =~ s/\s//g; + if( length( $lidinfo ) > $lidinfomax ){ + $lidinfo = substr( $lidinfo, 0, $lidinfomax ); + } + } + elsif( $line =~ m/mtd\.(.*)/i ){ + $mtd = $1; + } + } + close(LIDHDR); + } + else { + OutputMessage( "lidhdr file $inputLidhdr could not be opened.", 1, __LINE__); + } +} # end of sub readLidhdr + + +#---------------------------------------------------- +# Get the image file as binary data +#---------------------------------------------------- +sub readImage { + my $readsize = 512; + my $bytesread; + if (open(LID,"<$inputImage")) { + binmode(LID); + $bytesread = $readsize; + while ($bytesread == $readsize) { + $bytesread = read(LID,$binfile,$readsize,length($binfile)); + } + close(LID); + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdef, $size, $atime, $mtime, $ctime, + $blksize, $blocks) = stat("$inputImage"); + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime( $ctime ); + $bcddate1 = bcd( $year + 1900 ); + $bcddate2 = bcd((( $mon + 1 ) * 100 ) + $mday ); + $bcdtime = bcd(( $hour * 100 ) + $min ); + $lidsize = $size; + } + else { + OutputMessage( "Input file $inputImage could not be opened.", 1, __LINE__); + } +} # end of sub readImage diff --git a/src/build/lids/apyruhhdr b/src/build/lids/apyruhhdr new file mode 100755 index 000000000..dae3e8eff Binary files /dev/null and b/src/build/lids/apyruhhdr differ diff --git a/src/build/lids/crc32 b/src/build/lids/crc32 new file mode 100755 index 000000000..b795274b4 Binary files /dev/null and b/src/build/lids/crc32 differ diff --git a/src/build/lids/dslid.lidhdr b/src/build/lids/dslid.lidhdr new file mode 100644 index 000000000..54c86f159 --- /dev/null +++ b/src/build/lids/dslid.lidhdr @@ -0,0 +1,10 @@ +(* BEGIN_VPD +:RUNAME.AJDFG498 +:RULOADID.80F001FE +:RUFLASH.Y +:RUDEST.*MCG +:VPDINFONM.phal +:FIPSCLASS.8031 +:PHYLUM.00020000 +:LIDINFO. +END_VPD *) diff --git a/src/build/lids/halruntime.lidhdr b/src/build/lids/halruntime.lidhdr new file mode 100644 index 000000000..bf89326ba --- /dev/null +++ b/src/build/lids/halruntime.lidhdr @@ -0,0 +1,10 @@ +(* BEGIN_VPD +:RUNAME.AJDFG491 +:RULOADID.80F00101 +:RUFLASH.Y +:RUDEST.*MCG +:VPDINFONM.phal +:FIPSCLASS.8000 +:PHYLUM.00020000 +:LIDINFO. +END_VPD *) diff --git a/src/build/lids/hbicore.lidhdr b/src/build/lids/hbicore.lidhdr new file mode 100644 index 000000000..43eaa88ae --- /dev/null +++ b/src/build/lids/hbicore.lidhdr @@ -0,0 +1,10 @@ +(* BEGIN_VPD +:RUNAME.AJDFG490 +:RULOADID.80F00100 +:RUFLASH.Y +:RUDEST.*MCG +:VPDINFONM.phal +:FIPSCLASS.8000 +:PHYLUM.00020000 +:LIDINFO. +END_VPD *) diff --git a/src/build/lids/phal.vpdinfo b/src/build/lids/phal.vpdinfo new file mode 100644 index 000000000..1f75530f8 --- /dev/null +++ b/src/build/lids/phal.vpdinfo @@ -0,0 +1,35 @@ +!* BEGIN_VPD +!*:PRODUCTID.AJDG401 +!*:RUNAME.AJDG4010 +!*:VERLEVEL.0001 +!*:RELMODLVL.0100 +!*:DEVELBY.Y +!*:DEVLABID.10 +!*:DEVELFOR.Y +!*:INSTRSET. +!*:SWRTYPE.MCG +!*:VENDORID. +!*:DIVISION.ABS +!*:STRADDR.HWY 52 NORTH & 37TH STREET +!*:CITY.ROCHESTER +!*:STATEPROV.MINNESOTA +!*:COUNTRY.USA +!*:POCODE.55901 +!*:COPYRIGHT1.9400LIC (C) COPYRIGHT IBM CORP 1980, 1988 +!*:COPYRIGHT2.ALL RIGHTS RESERVED, LIC. INT. CODE, IBM PROP. +!*:MCGPARTNUM. +!*:INTPCLVL. +!*:PTFPRFIXID. +!*:CODEPFGID.5050 +!*:RUAREA.USER +!*:NUCSEQCTL.00 +!*:BNDRYRQMT.PAGE +!*:LLBYPASS.N +!*:RUDEST.LD91 +!*:DELETERU.N +!*:GROUP IDF='PFGLIST' LEN=4 COLHDR1='PFG Identification'. +!*:EGROUP. +!*:PFGRUNAME.AJDG4011 +!*:SFGRUNAME.AJDG4012 +!*:LPPTYPE.PP +!* END_VPD diff --git a/src/build/linker/linker.C b/src/build/linker/linker.C index 6371a9f4d..e7c7aa622 100644 --- a/src/build/linker/linker.C +++ b/src/build/linker/linker.C @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -14,6 +15,7 @@ #include "../../include/sys/vfs.h" using std::cout; +using std::cerr; using std::endl; using std::string; using std::vector; @@ -21,6 +23,7 @@ using std::map; using std::for_each; using std::mem_fun_ref; using std::bind1st; +using std::ofstream; struct Symbol { @@ -28,6 +31,7 @@ struct Symbol uint8_t type; uint64_t address; uint64_t addend; + uint64_t base; enum SymbolType { @@ -75,6 +79,8 @@ struct Object vector objects; FILE* output; +ofstream modinfo; +vector all_relocations; int main(int argc, char** argv) { @@ -92,6 +98,8 @@ int main(int argc, char** argv) cout << "Error opening " << argv[1] << endl; cout << strerror(error) << endl; } + // Open modinfo file. + modinfo.open((string(argv[1])+".modinfo").c_str()); // Read input objects. for (int files = 2; files < argc; files++) @@ -108,6 +116,12 @@ int main(int argc, char** argv) for_each(objects.begin(), objects.end(), bind2nd(mem_fun_ref(&Object::write_object), output)); uint64_t last_address = ftell(output); + if (0 != (last_address % 8)) + { + char zero = 0; + fwrite(&zero, 0, 8 - (last_address % 8), output); + last_address = ftell(output); + } cout << "Local relocations..." << endl; for_each(objects.begin(), objects.end(), @@ -149,9 +163,13 @@ int main(int argc, char** argv) uint64_t start_symbol = i->find_start_symbol(); char data[sizeof(uint64_t)]; - + + if (0 != init_symbol) + all_relocations.push_back(ftell(output)); bfd_putb64(init_symbol, data); fwrite(data, sizeof(uint64_t), 1, output); + if (0 != start_symbol) + all_relocations.push_back(ftell(output)); bfd_putb64(start_symbol, data); fwrite(data, sizeof(uint64_t), 1, output); @@ -169,9 +187,25 @@ int main(int argc, char** argv) char last_addr_data[sizeof(uint64_t)]; bfd_putb64(last_address, last_addr_data); fwrite(last_addr_data, sizeof(uint64_t), 1, output); - + cout << last_address << " to " << last_address_entry_address << endl; + // Output relocation data. + { + fseek(output, 0, SEEK_END); + char temp64[sizeof(uint64_t)]; + + uint64_t count = all_relocations.size(); + bfd_putb64(count, temp64); + fwrite(temp64, sizeof(uint64_t), 1, output); + + for (int i = 0; i < all_relocations.size(); i++) + { + bfd_putb64(all_relocations[i], temp64); + fwrite(temp64, sizeof(uint64_t), 1, output); + } + } + return 0; } @@ -254,6 +288,8 @@ bool Object::write_object(FILE* file) cout << "Error writing to output." << endl; cout << strerror(error) << endl; } + + modinfo << &name[(name.find_last_of("/")+1)] << ",0x" << std::hex << offset << endl; } bool Object::read_relocation() @@ -292,6 +328,7 @@ bool Object::read_relocation() Symbol s; s.name = syms[i]->name; s.address = syms[i]->value; + s.base = syms[i]->section->vma; s.type = 0; cout << "\tSymbol: " << syms[i]->name << endl; @@ -362,6 +399,15 @@ bool Object::read_relocation() { s.type = Symbol::UNRESOLVED; } + + if (loc[i]->howto->name == string("R_PPC64_ADDR64")) + { + s.type |= Symbol::VARIABLE; + } + else if (loc[i]->howto->name == string("R_PPC64_JMP_SLOT")) + { + s.type |= Symbol::FUNCTION; + } this->relocs.push_back(s); cout << "\tSymbol: " << loc[i]->sym_ptr_ptr[0]->name; @@ -401,17 +447,30 @@ bool Object::perform_local_relocations(FILE* file) address = bfd_getb64(data); if (address != i->addend) { - cout << "Expected " << i->addend << " found " << address << endl; - continue; + cout << "Expected " << i->addend << " found " << address + << " at " << (offset + i->address) << endl; + cerr << "Expected " << i->addend << " found " << address + << " at " << (offset + i->address) << endl; + exit(-1); + } + + // If it is a non-ABS relocation, also need to add the symbol addr. + if (i->name != BFD_ABS_SECTION_NAME) + { + Symbol& s = this->symbols[i->name]; + uint64_t symbol_addr = s.base + s.address; + i->addend += symbol_addr; + relocation += symbol_addr; } address = relocation; bfd_putb64(address, data); + all_relocations.push_back(offset + i->address); fseek(file, offset + i->address, SEEK_SET); fwrite(data, sizeof(uint64_t), 1, file); - cout << "\tRelocated " << i->addend << " to " + cout << "\tRelocated " << i->addend << " at " << i->address << " to " << relocation << endl; } } @@ -424,55 +483,93 @@ bool Object::perform_global_relocations(FILE* file) i != relocs.end(); ++i) { + bool found_symbol = false; + if (!(i->type & Symbol::UNRESOLVED)) continue; cout << "\tSymbol: " << i->name << endl; char data[sizeof(uint64_t)*3]; - - for(vector::iterator j = objects.begin(); - j != objects.end(); - ++j) + + for(int allow_local = 0; + ((allow_local < 2) && (!found_symbol)); + allow_local++) { - if (j->symbols.find(i->name) != j->symbols.end()) + for(vector::iterator j = objects.begin(); + j != objects.end(); + ++j) { - Symbol s = j->symbols[i->name]; - uint64_t symbol_addr = - j->offset + s.address + j->data.vma_offset; - - if (s.type & Symbol::UNRESOLVED) - continue; - if (s.type & Symbol::LOCAL) - continue; - if (!(s.type & Symbol::GLOBAL)) - continue; - - if (s.type & Symbol::FUNCTION) + if (j->symbols.find(i->name) != j->symbols.end()) { - fseek(file, symbol_addr, SEEK_SET); - fread(data, sizeof(uint64_t), 3, file); - - fseek(file, offset + i->address, SEEK_SET); - fwrite(data, sizeof(uint64_t), 3, file); - - cout << "\tCopied relocation from " << std::hex - << symbol_addr << " to " - << offset + i->address << "." << endl; + Symbol s = j->symbols[i->name]; + uint64_t symbol_addr = + j->offset + s.address + s.base; + + if (s.type & Symbol::UNRESOLVED) + continue; + if ((s.type & Symbol::LOCAL) && (!allow_local)) + continue; + if ((!(s.type & Symbol::GLOBAL)) && (!allow_local)) + continue; + + found_symbol = true; + + if ((s.type & Symbol::FUNCTION) && + (i->type & Symbol::FUNCTION)) + { + if (i->addend != 0) + { + cerr << "Can't handle offset unresolved function." + << endl; + exit(-1); + } + + fseek(file, symbol_addr, SEEK_SET); + fread(data, sizeof(uint64_t), 3, file); + + fseek(file, offset + i->address, SEEK_SET); + fwrite(data, sizeof(uint64_t), 3, file); + all_relocations.push_back(offset + i->address); + all_relocations.push_back(offset + i->address + 8); + all_relocations.push_back(offset + i->address + 16); + + cout << "\tCopied relocation from " << std::hex + << symbol_addr << " to " + << offset + i->address << "." << endl; + } + else + { + if (s.type & Symbol::FUNCTION) + { + cout << "\tTOC link for function: " << s.name + << endl; + } + if (i->addend != 0) + { + cout << "\tOffset to " << i->addend << endl; + symbol_addr += i->addend; + } + bfd_putb64(symbol_addr, data); + fseek(file, offset + i->address, SEEK_SET); + fwrite(data, sizeof(uint64_t), 1, file); + all_relocations.push_back(offset + i->address); + + cout << "\tRelocated from " << std::hex + << symbol_addr << " to " + << offset + i->address << "." << endl; + } + break; } - else - { - bfd_putb64(symbol_addr, data); - fseek(file, offset + i->address, SEEK_SET); - fwrite(data, sizeof(uint64_t), 1, file); - - cout << "\tRelocated from " << std::hex - << symbol_addr << " to " - << offset + i->address << "." << endl; - } - break; } } + + if (!found_symbol) + { + cout << "Could not find symbol " << i->name << std::endl; + cerr << "Could not find symbol " << i->name << std::endl; + exit(-1); + } } } diff --git a/src/build/linker/makefile b/src/build/linker/makefile index 0ea104b28..02789ef10 100644 --- a/src/build/linker/makefile +++ b/src/build/linker/makefile @@ -5,3 +5,6 @@ all: linker clean: (rm -f linker) + +beam: + diff --git a/src/build/tools/addimgid b/src/build/tools/addimgid new file mode 100755 index 000000000..ab2bdd04a --- /dev/null +++ b/src/build/tools/addimgid @@ -0,0 +1,27 @@ +#!/usr/bin/perl + +use strict; + +my $imageIdSym = "hbi_ImageId"; + +my $img = shift; +my $src = shift; + +my $imgBase = $img; +$imgBase =~ s/.*\///; + +my $address = hex `ppc64-mcp6-nm $src -C | grep $imageIdSym | colrm 17`; +my $imageId = `git describe --dirty || echo Unknown-Image \`git rev-parse --short HEAD\``; + +chomp $imageId; +$imageId = $imageId."/".$imgBase; + +if (($imageId =~ m/Unknown-Image/) || # Couldn't find git describe tag. + ($imageId =~ m/dirty/) || # Find 'dirty' commit. + ($imageId =~ m/^.{15}-[1-9]+/)) # Found commits after a tag. +{ + $imageId = $imageId."/".$ENV{"USER"}; +} + +system("echo -n $imageId | dd of=$img conv=notrunc bs=1 seek=$address count=127"); +exit $? diff --git a/src/build/tools/build b/src/build/tools/build new file mode 100755 index 000000000..37832afc9 --- /dev/null +++ b/src/build/tools/build @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ -f 'env.bash' ]; then + . env.bash +else + echo "env.bash does not exist, are you running from your repository home?" + exit 1; +fi + +make && make docs diff --git a/src/build/tools/builddriver b/src/build/tools/builddriver new file mode 100755 index 000000000..2618bc930 --- /dev/null +++ b/src/build/tools/builddriver @@ -0,0 +1,207 @@ +#!/usr/bin/perl + +# This script builds and publishes drivers. +# It does: +# 1) creates a git repository +# 2) checks out from the powerhal repository +# 3) builds +# 4) tags the driver +# +# This assumes: +# 1) you have current GSA credentials +# 2) you are in powerhal/writers GSA group +# 3) git is in your path +# 4) you are running this on gfwr801 or other suitable build machine + +use strict; +use Getopt::Long; +use Cwd; + +my $POWERHAL_HOME = "/gsa/rchgsa/projects/p/powerhal"; +my $POWERHAL_REPO = $POWERHAL_HOME."/git"; +my $DEFAULT_DRIVERS_HOME = $POWERHAL_HOME."/drivers"; +my $DEFAULT_PUBLISH_HOME = $POWERHAL_HOME."/builds"; +my $BUILD_SCRIPT = "src/build/tools/build"; + +my $FIRST_SPIN_NAME = "a"; +my $DEFAULT_RELEASE ="110"; +my $DEFAULT_BRANCH = "devel"; + + +# Constructs a build name in the format bMMDDx_YYWW.rrr +# Example: b0126a_1104.110 +sub constructBuildName +{ + my ($spin, $release) = @_; + + # TODO Rewrite this to avoid the date call and build it in perl? + my $dateCmd = "/bin/date +b%m%d".$spin."_%y%W.".$release; + + my $buildName = `$dateCmd`; + chomp $buildName; + + return $buildName; +} + +# Return the build name to use +# This looks in the $driverHome for existing spins on this date and updates the spin name accordingly +sub getBuildName +{ + my ($driverHome, $release) = @_; + + my $driverNamePattern = constructBuildName(".", $release); + my $dir; + opendir ($dir, $driverHome) or die "Cannot open $driverHome."; + my @matches = sort grep { /^$driverNamePattern/ } readdir ($dir); + closedir ($dir); + + my $buildName; + if (scalar(@matches) > 0) + { + print "Existing spins for this build date and release:\n"; + foreach (@matches) + { + print "\t".$_."\n"; + } + + my $lastSpin = $matches[-1]; + print "Last spin was $lastSpin\n"; + $lastSpin =~ /^b\d\d\d\d([a-z])/ or die "Found driver matches, but spin name match failed."; + $lastSpin = $1; + die "Too many spins today!!!" if ($lastSpin eq "z"); + $lastSpin++; + $buildName = constructBuildName($lastSpin, $release); + } + else + { + print "First spin for this build date and release.\n"; + $buildName = constructBuildName($FIRST_SPIN_NAME, $release); + } + + print "This build will be: $buildName\n"; + + return $buildName; +} + +# Creates a directory with the $dir name +# Creates a git repository +# Adds $remoteRepository as the remote repository +# Checks out $branch +# Creates a tag $tag +# Pushes the tag to the remote repository +sub createRepo +{ + my ($dir, $remoteRepository, $branch, $tag) = @_; + die "createRepo: dir is required" unless (defined $dir); + die "createRepo: remoteRepository is required" unless (defined $remoteRepository); + die "createRepo: branch is required" unless (defined $branch); + die "createRepo: tag is required" unless (defined $tag); + + mkdir $dir or die "Cannot mkdir $dir"; + chdir $dir or die "Cannot chdir to $dir"; + + my $cmd = "git init"; + system "$cmd"; + my $rc = $?; + die "Failed running '$cmd' with rc $rc" unless ($rc == 0); + + $cmd = "git remote add origin ".$remoteRepository; + system "$cmd"; + $rc = $?; + die "Failed running '$cmd' with rc $rc" unless ($rc == 0); + + $cmd = "git fetch origin"; + system "$cmd"; + $rc = $?; + die "Failed running '$cmd' with rc $rc" unless ($rc == 0); + + $cmd = "git checkout -b ".$branch." origin/".$branch; + system "$cmd"; + $rc = $?; + die "Failed running '$cmd' with rc $rc" unless ($rc == 0); + + $cmd = "git tag -a -m \"Build ".$tag."\" ".$tag; + system "$cmd"; + $rc = $?; + die "Failed running '$cmd' with rc $rc" unless ($rc == 0); + + $cmd = "git push --tags origin"; + system "$cmd"; + $rc = $?; + die "Failed running '$cmd' with rc $rc" unless ($rc == 0); +} + +# Builds the driver +# Assumes the current working directory is the root of the git repository +sub build +{ + die "Cannot find build script \"$BUILD_SCRIPT\"" unless (-e $BUILD_SCRIPT); + + system "$BUILD_SCRIPT | /usr/bin/tee build.log"; + my $rc = $?; + print "Compile output in ".cwd()."/build.log\n"; + die "Compile failed with rc $rc" unless ($rc == 0); +} + +sub publish +{ + my ($dir) = @_; + die "publish: dir is required" unless (defined $dir); + + mkdir $dir or die "Cannot mkdir $dir"; + + system "cp -p img/*.lid img/*.ruhx img/*.lidhdr $dir"; + my $rc = $?; + die "Could not copy lids to $dir" unless ($rc == 0); + + mkdir $dir."/include" or die "Cannot mkdir include"; + mkdir $dir."/include/hal" or die "Cannot mkdir include/hal"; + system "cp -p src/include/hal/hal.h obj/doxygen/html/hal_8h.html obj/doxygen/html/*.css $dir"."/include/hal/"; + $rc = $?; + die "Could not copy hal.h and doxygen files" unless ($rc == 0); +} + + +# main +my $startTime = time(); +my $currentTime = localtime(); +print "Build starting at $currentTime.\n"; + +my $driversHome = $DEFAULT_DRIVERS_HOME; +my $release = $DEFAULT_RELEASE; +my $remoteRepository = $POWERHAL_REPO; +my $branch = $DEFAULT_BRANCH; +my $tag; # Default tag is the build name +my $publishHome = $DEFAULT_PUBLISH_HOME; + +GetOptions("home=s" => \$driversHome, + "release=s" => \$release, + "remote=s" => \$remoteRepository, + "branch=s" => \$branch, + "tag=s" => \$tag, + "publishhome=s" => \$publishHome); + +die "Unsupported parameters: @ARGV" unless (scalar(@ARGV) == 0); + +print "Drivers home = $driversHome\n"; +print "Release = $release\n"; +print "Remote repository = $remoteRepository\n"; +print "Branch = $branch\n"; + +my $buildName = getBuildName($driversHome, $release); +print "Build name = $buildName\n"; + +$tag = (defined $tag) ? $tag : $buildName; +print "Tag = $tag\n"; +print "Publish home = $publishHome\n"; + + +# This changes the current working directory to the new repository +createRepo($driversHome."/".$buildName, $remoteRepository, $branch, $tag); +build(); +publish($publishHome."/".$buildName); + +$currentTime = localtime(); +print "Build $buildName completed successfully at $currentTime.\n"; +print "Duration: ".(time() - $startTime)." seconds\n"; + diff --git a/src/build/tools/genlist b/src/build/tools/genlist new file mode 100755 index 000000000..a77082fe3 --- /dev/null +++ b/src/build/tools/genlist @@ -0,0 +1,180 @@ +#!/usr/bin/perl + +use strict; + +sub add_image_subdir +{ + my $image = shift; + if (!($image =~ m/\/img/)) { $image = "./img/".$image }; + return $image; +} + +sub find_symbol_name +{ + my $offset = shift; + my $require_function = shift; + my $symbol_addrs = shift; + my $symbol_funcs = shift; + + if (defined $symbol_addrs->{$offset}) + { + for my $sym (@{$symbol_addrs->{$offset}}) + { + if ($symbol_funcs->{$sym}) + { + return $sym; + } + } + if ($require_function) + { + return 0; + } + return @{$symbol_addrs->{$offset}}[0]; + } + if ($require_function) + { + return 0; + } + + my $prevoffset = 0; + foreach my $off (keys %$symbol_addrs) + { + if (($off > $prevoffset) and ($off <= $offset)) + { + $prevoffset = $off; + } + } + if (defined $symbol_addrs->{$prevoffset}) + { + for my $sym (@{$symbol_addrs->{$prevoffset}}) + { + if ($symbol_funcs->{$sym}) + { + return sprintf "%s+0x%x", $sym, ($offset - $prevoffset); + } + } + return sprintf "%s+0x%x", @{$symbol_addrs->{$prevoffset}}[0], + ($offset - $prevoffset); + } + return sprintf "Unknown @ 0x%x", $offset; +} + +use FindBin qw($Bin); + +my $image_offset = $ENV{"HAL_IMAGE_OFFSET"}; +if (not $image_offset) { $image_offset = "0x0"; }; +$image_offset = hex $image_offset; + +my $image; +my $all_modules = 0; +my @modules = (); + +if ($#ARGV == -1) +{ + die "genlist [modules]\n"; +} +if ($#ARGV == 0) +{ + $all_modules = 1; +} +else +{ + @modules = @ARGV[1..$#ARGV]; +} + +$image = add_image_subdir($ARGV[0]); + +my %module_offsets = (); +open MODINFO, "< $image.modinfo"; + +while (my $modline = ) +{ + chomp $modline; + my @splitline = split /,/, $modline; + $module_offsets{@splitline[0]} = (hex @splitline[1]) + $image_offset; + if ($all_modules) + { + push @modules, @splitline[0]; + } +} + +my %symbol_address = (); +my %symbol_isfunc = (); + +my $cmd = "$Bin/gensyms ".$image; +foreach my $module (@modules) +{ + $cmd = $cmd." ".$module; +} +open GENSYMS, $cmd."|"; +while (my $line = ) +{ + chomp $line; + my ($is_func,$code_addr,$addr,$function); + + $line =~ m/(.*?),(.*?),(.*?),(.*?),(.*)/; + $is_func = "F" eq $1; + $addr = hex $2; + $function = $5; + + if (not defined $symbol_address{$addr}) + { + $symbol_address{$addr} = (); + } + push @{$symbol_address{$addr}}, $function; + $symbol_isfunc{$function} = $is_func; +} + + +foreach my $module (@modules) +{ + print "BEGIN MODULE ---- ".$module." ----\n"; + my $enabled = 0; + open OBJDUMP, ("ppc64-mcp6-objdump -DCS ".add_image_subdir($module)."|"); + while (my $line = ) + { + if ($line =~ m/Disassembly of section/) + { + if (($line =~ m/.text/) || ($line =~ m/.data/)) + { + $enabled = 1; + } + else + { + $enabled = 0; + } + } + elsif ($enabled) + { + if ($line =~ s/(^[\s]*)([0-9a-f]+)(:)/$1__HEXVALUE__$3/) + { + my $value = hex $2; + my $offset = $value + $module_offsets{$module}; + my $format = sprintf "%x\t%08x", $value, $offset; + $line =~ s/__HEXVALUE__/$format/; + + my $symname = find_symbol_name($offset, 1, \%symbol_address, + \%symbol_isfunc); + if ($symname) + { + printf "%016x <%s>:\n", $offset, $symname; + } + + if ($line =~ s/(b[a-z]*[+-]*[\s]*(.*,){0,1})([0-9a-f]+)([\s]*<)(.*)(>)/$1__HEXVALUE__$4__FUNCREF__$6/) + { + $value = hex $3; + $offset = $value + $module_offsets{$module}; + $format = sprintf "%x", $offset; + $line =~ s/__HEXVALUE__/$format/; + + my $refname = find_symbol_name($offset, 0, + \%symbol_address, \%symbol_isfunc); + $line =~ s/__FUNCREF__/$refname/ + } + } + print $line; + } + } + close OBJDUMP; + print "\n"; +} diff --git a/src/build/tools/gensyms b/src/build/tools/gensyms new file mode 100755 index 000000000..f69e64d37 --- /dev/null +++ b/src/build/tools/gensyms @@ -0,0 +1,94 @@ +#!/usr/bin/perl + +use strict; + +sub add_image_subdir +{ + my $image = shift; + if (!($image =~ m/\/img/)) { $image = "./img/".$image }; + return $image; +} + +my $image_offset = $ENV{"HAL_IMAGE_OFFSET"}; +if (not $image_offset) { $image_offset = "0x0"; }; +$image_offset = hex $image_offset; + +my $image; +my $all_modules = 0; +my @modules = (); + +if ($#ARGV == -1) +{ + die "gensyms [modules]\n"; +} +if ($#ARGV == 0) +{ + $all_modules = 1; +} +else +{ + @modules = @ARGV[1..$#ARGV]; +} + +$image = add_image_subdir($ARGV[0]); + +my %module_offsets = (); +open MODINFO, "< $image.modinfo"; + +while (my $modline = ) +{ + chomp $modline; + my @splitline = split /,/, $modline; + $module_offsets{@splitline[0]} = (hex @splitline[1]) + $image_offset; + if ($all_modules) + { + push @modules, @splitline[0]; + } +} + +my %output = (); +foreach my $module (@modules) +{ + open OBJDUMP, ("ppc64-mcp6-objdump --syms -C ".add_image_subdir($module)."|"); + while (my $line = ) + { + if (($line =~ m/\*ABS\*/) || ($line =~ m/\*UND\*/)) + { + next; + } + if ("d" eq substr($line, 22, 1)) + { + next; + } + if (!($line =~ m/^[0-9a-f]{16}/)) + { + next; + } + + $line =~ s/[\s]*$//; + + my $address = (hex substr($line, 0, 16)) + $module_offsets{$module}; + my $is_function = ("F" eq substr($line, 23, 1)); + my $size = (hex substr($line, 32, 16)); + my $name = substr($line, 48); + my $code_loc = 0; + if ($is_function) + { + open XXD, ("/usr/bin/xxd -p -s ".($address - $image_offset)." -l 8 -g 8 ".add_image_subdir($image)."|"); + $code_loc = (hex ) + $image_offset; + close XXD; + + my $tmp = $code_loc; $code_loc = $address; $address = $tmp; + } + my $outstring = ""; + $outstring = sprintf "%s,%08x,%08x,%08x,%s\n", ($is_function?"F":"V"),$address,$code_loc,$size,$name; + + $output{$outstring} = $outstring; + } + close OBJDUMP; +} + +foreach my $outstring (sort { substr($a,2,8) cmp substr($b,2,8) } keys %output) +{ + print $outstring; +} diff --git a/src/include/arch/ppc.H b/src/include/arch/ppc.H new file mode 100644 index 000000000..003f804a3 --- /dev/null +++ b/src/include/arch/ppc.H @@ -0,0 +1,174 @@ +#ifndef __KERNEL_PPCARCH_H +#define __KERNEL_PPCARCH_H + +#include +#include + +ALWAYS_INLINE +inline uint64_t getSRR0() +{ + register uint64_t srr0 = 0; + asm volatile("mfsrr0 %0" : "=r" (srr0)); + return srr0; +} + +ALWAYS_INLINE +inline uint64_t getSRR1() +{ + register uint64_t srr1 = 0; + asm volatile("mfsrr1 %0" : "=r" (srr1)); + return srr1; +} + +ALWAYS_INLINE +inline void setSRR0(uint64_t _srr0) +{ + register uint64_t srr0 = _srr0; + asm volatile("mtsrr0 %0" : : "r" (srr0)); +} + +ALWAYS_INLINE +inline void setSRR1(uint64_t _srr1) +{ + register uint64_t srr1 = _srr1; + asm volatile("mtsrr1 %0" : : "r" (srr1)); +} + +ALWAYS_INLINE +inline uint64_t getPVR() +{ + register uint64_t pvr = 0; + asm volatile("mfspr %0, 287" : "=r" (pvr)); + return pvr; +} + +ALWAYS_INLINE +inline uint64_t getPIR() +{ + register uint64_t pir = 0; + asm volatile("mfspr %0, 1023" : "=r" (pir)); + return pir; +} + +ALWAYS_INLINE +inline uint64_t getSPRG3() +{ + register uint64_t sprg3 = 0; + asm volatile("mfsprg3 %0" : "=r" (sprg3)); + return sprg3; +} + +ALWAYS_INLINE +inline void setSPRG3(uint64_t _sprg3) +{ + register uint64_t sprg3 = _sprg3; + asm volatile("mtsprg3 %0" : : "r" (sprg3)); + return; +} + +ALWAYS_INLINE +inline uint64_t getMSR() +{ + register uint64_t msr = 0; + asm volatile("mfmsr %0" : "=r" (msr)); + return msr; +} + +ALWAYS_INLINE +inline void setMSR(uint64_t _msr) +{ + register uint64_t msr = _msr; + asm volatile("mtmsr %0; isync" :: "r" (msr)); +} + +ALWAYS_INLINE +inline uint64_t getDSISR() +{ + register uint64_t dsisr = 0; + asm volatile("mfspr %0, 18" : "=r" (dsisr)); + return dsisr; +} + +ALWAYS_INLINE +inline uint64_t getDAR() +{ + register uint64_t dar = 0; + asm volatile("mfspr %0, 19" : "=r" (dar)); + return dar; +} + +ALWAYS_INLINE +inline uint64_t getTB() +{ + register uint64_t tb = 0; + asm volatile("mfspr %0, 268" : "=r" (tb)); + return tb; +} + +ALWAYS_INLINE +inline void sync() +{ + asm volatile("sync"); +} + +ALWAYS_INLINE +inline void lwsync() +{ + asm volatile("lwsync"); +} + +ALWAYS_INLINE +inline void isync() +{ + asm volatile("isync"); +} + +ALWAYS_INLINE +inline void eieio() +{ + asm volatile("eieio"); +} + +ALWAYS_INLINE +inline uint64_t getHMER() +{ + register uint64_t hmer = 0; + asm volatile("mfspr %0, 336" : "=r" (hmer)); + return hmer; +} + +ALWAYS_INLINE +inline void setHMER(uint64_t _hmer) +{ + register uint64_t hmer = _hmer; + asm volatile("mtspr 336, %0" : : "r" (hmer)); + return; +} + +ALWAYS_INLINE +inline void setThreadPriorityLow() +{ + asm volatile("or 1,1,1"); +} + +ALWAYS_INLINE +inline void setThreadPriorityHigh() +{ + asm volatile("or 3,3,3"); +} + +ALWAYS_INLINE +inline void dcbf(void* _ptr) +{ + register void* ptr = _ptr; + asm volatile("dcbf 0, %0" : : "b" (ptr) : "memory"); +} + +ALWAYS_INLINE +inline void icbi(void* _ptr) +{ + register void* ptr = _ptr; + asm volatile("icbi 0, %0" : : "b" (ptr) : "memory"); +} + +#endif diff --git a/src/include/assert.h b/src/include/assert.h new file mode 100644 index 000000000..13888bee8 --- /dev/null +++ b/src/include/assert.h @@ -0,0 +1,31 @@ +#include + +#ifndef _ASSERT_H +#define _ASSERT_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +NO_RETURN +void __assert(bool expr, const char *exprStr, const char *file, int line); + +#define assert(expr) \ +{\ + if (!(expr))\ + {\ + __assert((expr), #expr, __FILE__, __LINE__);\ + }\ +}\ + +#ifdef NDEBUG +#undef assert +#define assert(expr) { } +#endif + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/src/include/builtins.h b/src/include/builtins.h new file mode 100644 index 000000000..5126b6114 --- /dev/null +++ b/src/include/builtins.h @@ -0,0 +1,95 @@ +#include + +#ifndef _BUILTINS_H +#define _BUILTINS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * This file should be the home of any use of gcc compiler builtins + */ + +/** + * Use of this macro will ensure that the functions object code never gets generated without being inlined + */ +#define ALWAYS_INLINE __attribute__((always_inline)) + +/** + * Use of this macro will ensure a data structure is aligned on a cacheline boundary + */ +#define ALIGN_CACHELINE __attribute__((aligned (128))) + +/** + * Function declaration macro that tells the compiler to use printf format checking semantics + * + * TODO Could make this a function macro and pass in the 3 args rather than hard coding + */ +#define FORMAT_PRINTF __attribute__((format(printf, 1, 2))) + +/** + * Function delaration macro that tells the compiler that this function never returns. + */ +#define NO_RETURN __attribute__((noreturn)) + +/** + * Function / variable declaration macro that tells the compiler what section this symbol should go into. + */ +#define SYMB_SECTION(x) __attribute__((section(#x))) + +/** + * Get the value of the link register + * + * @return the value of the link register + */ +ALWAYS_INLINE +static inline void *linkRegister() +{ + return __builtin_return_address(1); +} + +/** + * Get the value of the stack-frame pointer + * + * @return The value of the frame pointer. + */ +ALWAYS_INLINE +static inline void *framePointer() +{ + return __builtin_frame_address(0); +} + +/** + * Counts leading zeros of a uint64_t value + * + * @param value to check + * + * @return the number of leading zeros + */ +ALWAYS_INLINE +static inline uint64_t cntlzd(uint64_t value) +{ + return __builtin_clzl(value); +} + +/** + * Counts trailing zeros of a uint64_t value + * + * @param value to check + * + * @return the number of trailing zeros + */ +ALWAYS_INLINE +static inline uint64_t cnttzd(uint64_t value) +{ + return __builtin_ctzl(value); +} + +#ifdef __cplusplus +}; +#endif + + +#endif diff --git a/src/include/kernel/console.H b/src/include/kernel/console.H index e12f66a62..964882a66 100644 --- a/src/include/kernel/console.H +++ b/src/include/kernel/console.H @@ -3,8 +3,9 @@ #include #include +#include -void printk(const char*, ...) __attribute__((format (printf, 1, 2))); +void printk(const char*, ...) FORMAT_PRINTF; class Console { diff --git a/src/include/kernel/cpu.H b/src/include/kernel/cpu.H index 81b43a57c..2f012700c 100644 --- a/src/include/kernel/cpu.H +++ b/src/include/kernel/cpu.H @@ -2,7 +2,8 @@ #define __KERNEL_CPU_H #include -#include +#include +#include // Thread ID support only, Power7 (4 threads). #define KERNEL_MAX_SUPPORTED_CPUS 4 @@ -18,10 +19,10 @@ struct cpu_t task_t* idle_task; }; -__attribute__((always_inline)) +ALWAYS_INLINE inline uint64_t getCpuId() { - return ppc_getPIR() & (KERNEL_MAX_SUPPORTED_CPUS - 1); + return getPIR() & (KERNEL_MAX_SUPPORTED_CPUS - 1); } #endif diff --git a/src/include/kernel/ppcarch.H b/src/include/kernel/ppcarch.H deleted file mode 100644 index 3d34bf888..000000000 --- a/src/include/kernel/ppcarch.H +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef __KERNEL_PPCARCH_H -#define __KERNEL_PPCARCH_H - -#include - -__attribute__((always_inline)) -inline uint64_t ppc_getSRR1() -{ - register uint64_t srr1 = 0; - asm volatile("mfsrr1 %0" : "=r" (srr1)); - return srr1; -} - -__attribute__((always_inline)) -inline uint64_t ppc_getPVR() -{ - register uint64_t pvr = 0; - asm volatile("mfspr %0, 287" : "=r" (pvr)); - return pvr; -} - -__attribute__((always_inline)) -inline uint64_t ppc_getPIR() -{ - register uint64_t pir = 0; - asm volatile("mfspr %0, 1023" : "=r" (pir)); - return pir; -} - -__attribute__((always_inline)) -inline uint64_t ppc_getSPRG3() -{ - register uint64_t sprg3 = 0; - asm volatile("mfsprg3 %0" : "=r" (sprg3)); - return sprg3; -} - -__attribute__((always_inline)) -inline void ppc_setSPRG3(uint64_t _sprg3) -{ - register uint64_t sprg3 = _sprg3; - asm volatile("mtsprg3 %0" : : "r" (sprg3)); - return; -} - -__attribute__((always_inline)) -inline uint64_t ppc_getMSR() -{ - register uint64_t msr = 0; - asm volatile("mfmsr %0" : "=r" (msr)); - return msr; -} - -__attribute__((always_inline)) -inline void ppc_setMSR(uint64_t _msr) -{ - register uint64_t msr = _msr; - asm volatile("mtmsr %0; isync" :: "r" (msr)); -} - -__attribute__((always_inline)) -inline uint64_t ppc_getDSISR() -{ - register uint64_t dsisr = 0; - asm volatile("mfspr %0, 18" : "=r" (dsisr)); - return dsisr; -} - -__attribute__((always_inline)) -inline uint64_t ppc_getDAR() -{ - register uint64_t dar = 0; - asm volatile("mfspr %0, 19" : "=r" (dar)); - return dar; -} - -__attribute__((always_inline)) -inline uint64_t ppc_getTB() -{ - register uint64_t tb = 0; - asm volatile("mfspr %0, 268" : "=r" (tb)); - return tb; -} - - - -#endif diff --git a/src/include/kernel/ppcconsts.S b/src/include/kernel/ppcconsts.S index 0c5e1dc3d..be7162b88 100644 --- a/src/include/kernel/ppcconsts.S +++ b/src/include/kernel/ppcconsts.S @@ -86,6 +86,8 @@ .set SDR1,25 .set SRR0,26 .set SRR1,27 + .set HSRR0,314 + .set HSRR1,315 .set SPRG0,272 .set SPRG1,273 .set SPRG2,274 diff --git a/src/include/kernel/timemgr.H b/src/include/kernel/timemgr.H index 78de82216..acd4361c2 100644 --- a/src/include/kernel/timemgr.H +++ b/src/include/kernel/timemgr.H @@ -2,7 +2,7 @@ #define __KERNEL_TIMEMGR_H #include -#include +#include #include #include @@ -33,7 +33,7 @@ class TimeManager static uint64_t getCurrentTimeBase() { - return ppc_getTB(); + return getTB(); }; static uint64_t convertSecToTicks(uint64_t i_sec, uint64_t i_nsec); diff --git a/src/include/math.h b/src/include/math.h new file mode 100644 index 000000000..eddb92f64 --- /dev/null +++ b/src/include/math.h @@ -0,0 +1,23 @@ +#include +#include + +#ifndef _MATH_H +#define _MATH_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +ALWAYS_INLINE +static inline int64_t log2(uint64_t s) +{ + int64_t n = cntlzd(s); + return 63-n; +} + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/src/include/new b/src/include/new new file mode 100755 index 000000000..3496d75ee --- /dev/null +++ b/src/include/new @@ -0,0 +1,9 @@ +#ifndef __NEW_H +#define __NEW_H + +#ifdef __cplusplus +extern void *operator new(size_t, void*); +extern void *operator new[](size_t, void*); +#endif + +#endif diff --git a/src/include/stddef.h b/src/include/stddef.h index 10c28e361..49cef0832 100644 --- a/src/include/stddef.h +++ b/src/include/stddef.h @@ -9,4 +9,6 @@ #endif #endif +#define offsetof(type, member) __builtin_offsetof(type, member) + #endif diff --git a/src/include/stdint.h b/src/include/stdint.h index 1b7328d80..64d4e5b2a 100644 --- a/src/include/stdint.h +++ b/src/include/stdint.h @@ -16,4 +16,9 @@ typedef unsigned long int uint64_t; typedef uint64_t size_t; typedef int64_t ssize_t; +#define UINT8_MAX (255U) +#define UINT16_MAX (65535U) +#define UINT32_MAX (4294967295U) +#define UINT64_MAX (18446744073709551615U) + #endif diff --git a/src/include/stdio.h b/src/include/stdio.h new file mode 100644 index 000000000..87244b3be --- /dev/null +++ b/src/include/stdio.h @@ -0,0 +1,16 @@ +#ifndef __STDIO_H +#define __STDIO_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +int sprintf(char *str, const char * format, ...); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/string.h b/src/include/string.h old mode 100644 new mode 100755 index 30c878d65..af535832f --- a/src/include/string.h +++ b/src/include/string.h @@ -8,10 +8,15 @@ extern "C" { #endif - void* memset(void* s, int c, size_t n); + void *memset(void* s, int64_t c, size_t n); + void bzero(void *vdest, size_t len); + void *memcpy(void *dest, const void *src, size_t num); + void *memmove(void *vdest, const void *vsrc, size_t len); + int64_t memcmp(const void *p1, const void *p2, size_t len); char* strcpy(char* d, const char* s); int strcmp(const char* s1, const char* s2); + size_t strlen(const char* s1); #ifdef __cplusplus }; diff --git a/src/include/sys/msg.h b/src/include/sys/msg.h index d7c42f4e3..eec71ea4e 100644 --- a/src/include/sys/msg.h +++ b/src/include/sys/msg.h @@ -3,6 +3,7 @@ #include #include +#include #ifdef __cplusplus extern "C" @@ -26,9 +27,9 @@ int msg_q_register(msg_q_t q, const char* name); msg_q_t msg_q_resolve(const char* name); // Message interfaces. -__attribute__((always_inline)) +ALWAYS_INLINE inline msg_t* msg_allocate() { return (msg_t*)malloc(sizeof(msg_t)); } -__attribute__((always_inline)) +ALWAYS_INLINE inline void msg_free(msg_t* m) { free(m); } int msg_send(msg_q_t q, msg_t* msg); @@ -36,7 +37,7 @@ int msg_sendrecv(msg_q_t q, msg_t* msg); int msg_respond(msg_q_t q, msg_t* msg); msg_t* msg_wait(msg_q_t q); -__attribute__((always_inline)) +ALWAYS_INLINE inline uint32_t msg_is_async(msg_t* msg) { return 0 == msg->__reserved__async; } diff --git a/src/include/sys/vfs.h b/src/include/sys/vfs.h index d55a44710..3b2575139 100644 --- a/src/include/sys/vfs.h +++ b/src/include/sys/vfs.h @@ -10,6 +10,12 @@ #define VFS_STRINGIFY(X) #X #define VFS_TOSTRING(X) VFS_STRINGIFY(X) +#define VFS_MODULE_DEFINE_START(f) \ + extern "C" void VFS_SYMBOL_START(void* args) \ + { \ + f(args); \ + } + #ifdef __cplusplus extern "C" { @@ -37,7 +43,6 @@ struct VfsSystemModule extern VfsSystemModule VFS_MODULES[VFS_MODULE_MAX]; extern uint64_t VFS_LAST_ADDRESS; - #ifdef __cplusplus } #endif diff --git a/src/include/util/functor.H b/src/include/util/functor.H new file mode 100644 index 000000000..a9320f292 --- /dev/null +++ b/src/include/util/functor.H @@ -0,0 +1,100 @@ +#ifndef __UTIL_FUNCTOR_H +#define __UTIL_FUNCTOR_H + +#include + +namespace Util +{ + template + class unary_functor + { + public: + typedef _ARG argument_type; + typedef _RESULT result_type; + + public: + virtual ~unary_functor() {}; + virtual result_type operator()(argument_type) = 0; + }; + + template + class binary_functor + { + public: + typedef _ARG1 first_argument_type; + typedef _ARG2 second_argument_type; + typedef _RESULT result_type; + + public: + virtual ~binary_functor() {}; + virtual result_type operator() + (first_argument_type, second_argument_type) = 0; + }; + + // Function pointer wrappers for functors. + + template + class ptr_to_unary_function : public unary_functor<_ARG, _RESULT> + { + public: + typedef _RESULT(*function_type)(_ARG); + + private: + function_type function; + + public: + ptr_to_unary_function(function_type f) : function(f) {}; + + + _RESULT operator()(_ARG t) + { + return function(t); + } + }; + + template + ALWAYS_INLINE + ptr_to_unary_function<_ARG, _RESULT> ptr_fun(_RESULT (*f)(_ARG)) + { + return ptr_to_unary_function<_ARG,_RESULT>(f); + } + +#define PTR_FUN1_T(ARG_T, RESULT_T) \ + ptr_to_unary_function<_ARG, _RESULT> + + + template + class mem_ptr_to_unary_function : public unary_functor<_ARG, _RESULT> + { + public: + typedef _CLASS member_type; + typedef _RESULT(member_type::*function_type)(_ARG); + + private: + member_type& object; + function_type function; + + public: + mem_ptr_to_unary_function(member_type& o, function_type f) + : object(o), function(f) {}; + + _RESULT operator()(_ARG t) + { + return (object.*function)(t); + } + }; + + template + ALWAYS_INLINE + mem_ptr_to_unary_function<_ARG, _RESULT, _CLASS> + mem_ptr_fun(_CLASS& o, _RESULT (_CLASS::*f)(_ARG)) + { + return mem_ptr_to_unary_function<_ARG,_RESULT,_CLASS>(o, f); + } + +#define MEM_PTR_FUN1_T(CLASS_T, ARG_T, RESULT_T) \ + mem_ptr_to_unary_function + +}; + +#endif diff --git a/src/include/util/locked/list.H b/src/include/util/locked/list.H index e4bc0f99c..ad5b06a3b 100644 --- a/src/include/util/locked/list.H +++ b/src/include/util/locked/list.H @@ -1,6 +1,7 @@ #ifndef __UTIL_LOCKED_LIST_H #define __UTIL_LOCKED_LIST_H +#include #include namespace Util diff --git a/src/include/util/sprintf.H b/src/include/util/sprintf.H new file mode 100644 index 000000000..6246b72a0 --- /dev/null +++ b/src/include/util/sprintf.H @@ -0,0 +1,323 @@ +#ifndef __UTIL_SPRINTF_H +#define __UTIL_SPRINTF_H + +#include +#include +#include + +class Console; + +namespace Util +{ + + class ConsoleTraits + { + public: + enum trait { NONE, HEX, DEC, }; + }; + + template + class ConsoleDisplay + { + public: + template + ALWAYS_INLINE + static size_t display(_F& c, _T value) { return 0; }; + }; + + template + class ConsoleDisplay + { + public: + template + ALWAYS_INLINE + static size_t display(_F& c, char* value) + { + size_t count = 0; + while(*value != '\0') + { + c(*value); + value++; + count++; + } + return count; + } + }; + + template <> + class ConsoleDisplay + { + public: + template + ALWAYS_INLINE + static size_t display(_F& c, char value) + { + c(value); + return 1; + } + }; + + template + class ConsoleDisplay<_T, ConsoleTraits::DEC> + { + public: + template + ALWAYS_INLINE + static size_t display(_F& c, _T value) + { + size_t count = 0; + if (value == 0) + { + c('0'); count++; + } + else if (value < 0) + { + c('-'); count++; + value *= -1; + count += subdisplay(c, value); + } + else + count += subdisplay(c, value); + return count; + } + + template + static size_t subdisplay(_F& c, _T value) + { + size_t count = 0; + if (value != 0) + { + count += subdisplay(c, value / 10); + c('0' + (value % 10)); + count++; + } + return count; + } + }; + + template + class ConsoleDisplay<_T, ConsoleTraits::HEX> + { + public: + template + ALWAYS_INLINE + static size_t display(_F& c, _T value) + { + size_t length = sizeof(_T) * 2; + subdisplay(c, value, length); + return length; + } + + template + static void subdisplay(_F& c, _T value, size_t length) + { + if (length == 0) return; + subdisplay(c, value / 16, length-1); + char nibble = value % 16; + if (nibble >= 0x0a) + c('A' + (nibble - 0x0a)); + else + c('0' + nibble); + } + }; + + template + size_t vasprintf(_F output_func, const char* fmt_str, va_list& args) + { + size_t count = 0; + + bool format = false; + int size = 0; + + while('\0' != *fmt_str) + { + if (('%' == *fmt_str) || (format)) + switch (*fmt_str) + { + case '%': + { + if (format) + { + count += + ConsoleDisplay::display(output_func, + '%'); + format = false; + } + else + { + format = true; + size = 2; + } + break; + } + case 'c': + { + format = false; + count += ConsoleDisplay + ::display(output_func, (char)va_arg(args,int)); + break; + } + case 'h': + { + size--; + break; + } + case 'l': + { + size++; + break; + } + case 'z': // size_t or ssize_t + { + size = 4; + break; + } + case 'd': // decimal + { + format = false; + switch(size) + { + case 0: + count += ConsoleDisplay + ::display(output_func, + (char)va_arg(args,int)); + break; + + case 1: + count += ConsoleDisplay + ::display(output_func, + (short)va_arg(args,int)); + break; + + case 2: + count += ConsoleDisplay + ::display(output_func, + va_arg(args,int)); + break; + + case 3: + case 4: + count += ConsoleDisplay + ::display(output_func, + va_arg(args,long)); + break; + } + break; + } + case 'u': // unsigned decimal + { + format = false; + switch(size) + { + case 0: + count += ConsoleDisplay + ::display(output_func, + (unsigned char) + va_arg(args,unsigned int)); + break; + + case 1: + count += ConsoleDisplay + ::display(output_func, + (unsigned short) + va_arg(args,unsigned int)); + break; + + case 2: + count += ConsoleDisplay + ::display(output_func, + va_arg(args,unsigned int)); + break; + + case 3: + case 4: + count += ConsoleDisplay + ::display(output_func, + va_arg(args,unsigned long)); + break; + } + break; + } + case 'x': // unsigned hex + case 'X': + { + format = false; + switch(size) + { + case 0: + count += ConsoleDisplay + ::display(output_func, + (unsigned char) + va_arg(args,unsigned int)); + break; + + case 1: + count += ConsoleDisplay + ::display(output_func, + (unsigned short) + va_arg(args,unsigned int)); + break; + + case 2: + count += ConsoleDisplay + ::display(output_func, + va_arg(args,unsigned int)); + break; + + case 3: + case 4: + count += ConsoleDisplay + ::display(output_func, + va_arg(args,unsigned long)); + break; + } + break; + } + case 's': // string + { + format = false; + count += ConsoleDisplay + ::display(output_func, + (char*) va_arg(args,void*)); + break; + } + case 'p': // pointer + { + format = false; + count += ConsoleDisplay + ::display(output_func, + '0'); + count += ConsoleDisplay + ::display(output_func, + 'x'); + count += ConsoleDisplay + ::display(output_func, + va_arg(args,unsigned long)); + break; + } + } + else + count += ConsoleDisplay::display(output_func, *fmt_str); + + fmt_str++; + } + + return count; + } + +}; + +#endif diff --git a/src/kernel.ld b/src/kernel.ld index 1078122c8..c39a5d125 100644 --- a/src/kernel.ld +++ b/src/kernel.ld @@ -1,4 +1,3 @@ -rom_offset = 0xfff00000; base_load_address = 0x00000000; text_load_address = 0x00003000; @@ -6,7 +5,7 @@ SECTIONS { . = base_load_address; - .text ALIGN(0x1000): AT(base_load_address + rom_offset) { + .text ALIGN(0x1000): { *(.text.intvects) . = text_load_address; *(.text) @@ -27,7 +26,6 @@ SECTIONS toc_load_address = .; *(.toc) - opd_load_address = .; *(.opd) *(.got) @@ -37,11 +35,21 @@ SECTIONS } end_load_address = .; + + .dynstr : { + *(.dynstr) + } + + .rela : { + *(.rela.*) + } + /DISCARD/ : { *(.comment) *(.gnu.attributes) *(.dtors) + *(.interp) } } diff --git a/src/kernel/console.C b/src/kernel/console.C index 6cc2d1dac..6912b8450 100644 --- a/src/kernel/console.C +++ b/src/kernel/console.C @@ -1,5 +1,7 @@ #include #include +#include +#include #include char kernel_printk_buffer[Console::BUFFER_SIZE]; @@ -22,260 +24,17 @@ int Console::putc(int c) return c; } -class ConsoleTraits -{ - public: - enum trait { NONE, HEX, DEC, }; -}; - -template -class ConsoleDisplay -{ - public: - static void display(Console& c, _T value) {}; -}; - -template -class ConsoleDisplay -{ - public: - static void display(Console&c, char* value) - { - while(*value != '\0') - { - c.putc(*value); - value++; - } - } -}; - -template <> -class ConsoleDisplay -{ - public: - static void display(Console&c, char value) - { - c.putc(value); - } -}; - -template -class ConsoleDisplay<_T, ConsoleTraits::DEC> -{ - public: - static void display(Console&c, _T value) - { - if (value == 0) - { - c.putc('0'); - } - else if (value < 0) - { - c.putc('-'); - value *= -1; - } - else - subdisplay(c, value); - } - - static void subdisplay(Console&c, _T value) - { - if (value != 0) - { - subdisplay(c, value / 10); - c.putc('0' + (value % 10)); - } - } -}; - -template -class ConsoleDisplay<_T, ConsoleTraits::HEX> -{ - public: - static void display(Console&c, _T value) - { - size_t length = sizeof(_T) * 2; - subdisplay(c, value, length); - } - - static void subdisplay(Console&c, _T value, size_t length) - { - if (length == 0) return; - subdisplay(c, value / 16, length-1); - char nibble = value % 16; - if (nibble >= 0x0a) - c.putc('A' + (nibble - 0x0a)); - else - c.putc('0' + nibble); - } -}; - void printk(const char* str, ...) { + using Util::mem_ptr_fun; + using Util::vasprintf; + va_list args; va_start(args, str); Console& console = Singleton::instance(); - - bool format = false; - int size = 0; - - while('\0' != *str) - { - if (('%' == *str) || (format)) - switch (*str) - { - case '%': - { - if (format) - { - ConsoleDisplay::display(console, '%'); - format = false; - } - else - { - format = true; - size = 2; - } - break; - } - case 'c': - { - format = false; - ConsoleDisplay - ::display(console, - (char)va_arg(args,int)); - break; - } - case 'h': - { - size--; - break; - } - case 'l': - { - size++; - break; - } - case 'z': // size_t or ssize_t - { - size = 4; - break; - } - case 'd': // decimal - { - format = false; - switch(size) - { - case 0: - ConsoleDisplay - ::display(console, - (char)va_arg(args,int)); - break; - - case 1: - ConsoleDisplay - ::display(console, - (short)va_arg(args,int)); - break; - - case 2: - ConsoleDisplay - ::display(console, - va_arg(args,int)); - break; - - case 3: - case 4: - ConsoleDisplay - ::display(console, - va_arg(args,long)); - break; - } - break; - } - case 'u': // unsigned decimal - { - format = false; - switch(size) - { - case 0: - ConsoleDisplay - ::display(console, - (unsigned char) - va_arg(args,unsigned int)); - break; - - case 1: - ConsoleDisplay - ::display(console, - (unsigned short) - va_arg(args,unsigned int)); - break; - - case 2: - ConsoleDisplay - ::display(console, - va_arg(args,unsigned int)); - break; - - case 3: - case 4: - ConsoleDisplay - ::display(console, - va_arg(args,unsigned long)); - break; - } - break; - } - case 'x': // unsigned hex - case 'X': - { - format = false; - switch(size) - { - case 0: - ConsoleDisplay - ::display(console, - (unsigned char) - va_arg(args,unsigned int)); - break; - - case 1: - ConsoleDisplay - ::display(console, - (unsigned short) - va_arg(args,unsigned int)); - break; - - case 2: - ConsoleDisplay - ::display(console, - va_arg(args,unsigned int)); - break; - - case 3: - case 4: - ConsoleDisplay - ::display(console, - va_arg(args,unsigned long)); - break; - } - break; - } - case 's': // string - { - format = false; - ConsoleDisplay::display(console, - (char*)va_arg(args,void*)); - break; - } - } - else - ConsoleDisplay::display(console, *str); - - str++; - } + vasprintf(mem_ptr_fun(console, &Console::putc), + str, args); va_end(args); } diff --git a/src/kernel/cpumgr.C b/src/kernel/cpumgr.C index 6d58b5b72..0f225fc13 100644 --- a/src/kernel/cpumgr.C +++ b/src/kernel/cpumgr.C @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include cpu_t* CpuManager::cv_cpus[CpuManager::MAXCPUS] = { NULL }; @@ -19,7 +19,7 @@ CpuManager::CpuManager() cpu_t* CpuManager::getCurrentCPU() { - register task_t* current_task = (task_t*) ppc_getSPRG3(); + register task_t* current_task = (task_t*) getSPRG3(); return current_task->cpu; } @@ -50,7 +50,7 @@ void CpuManager::startCPU(ssize_t i) // Initialize CPU structure. if (NULL == cv_cpus[i]) { - printk("Starting CPU %d...", i); + printk("Starting CPU %ld...", i); cpu_t* cpu = cv_cpus[i] = new cpu_t; // Initialize CPU. @@ -68,7 +68,7 @@ void CpuManager::startCPU(ssize_t i) if (currentCPU) { - ppc_setSPRG3((uint64_t) cv_cpus[i]->idle_task); + setSPRG3((uint64_t) cv_cpus[i]->idle_task); register uint64_t decrementer = TimeManager::getTimeSliceCount(); asm volatile("mtdec %0" :: "r"(decrementer)); @@ -78,7 +78,7 @@ void CpuManager::startCPU(ssize_t i) void CpuManager::startSlaveCPU(cpu_t* cpu) { - ppc_setSPRG3((uint64_t) cpu->idle_task); + setSPRG3((uint64_t) cpu->idle_task); register uint64_t decrementer = TimeManager::getTimeSliceCount(); asm volatile("mtdec %0" :: "r"(decrementer)); diff --git a/src/kernel/exception.C b/src/kernel/exception.C index 568d80842..cbbf3cf89 100644 --- a/src/kernel/exception.C +++ b/src/kernel/exception.C @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include namespace Systemcalls { void TaskEnd(task_t*); } @@ -18,7 +18,7 @@ extern "C" void kernel_execute_prog_ex() { task_t* t = TaskManager::getCurrentTask(); - uint64_t exception = ppc_getSRR1() & EXCEPTION_SRR1_MASK; + uint64_t exception = getSRR1() & EXCEPTION_SRR1_MASK; bool handled = false; switch(exception) @@ -41,7 +41,7 @@ extern "C" void kernel_execute_data_storage() { task_t* t = TaskManager::getCurrentTask(); - uint64_t exception = ppc_getDSISR() & EXCEPTION_DSISR_MASK; + uint64_t exception = getDSISR() & EXCEPTION_DSISR_MASK; bool handled = false; switch(exception) @@ -53,7 +53,7 @@ void kernel_execute_data_storage() if (!handled) { printk("Data Storage exception on %d: %lx, %lx\n", - t->tid, ppc_getDAR(), ppc_getDSISR()); + t->tid, getDAR(), getDSISR()); Systemcalls::TaskEnd(t); } } diff --git a/src/kernel/spinlock.C b/src/kernel/spinlock.C index bfada05c4..5c67d8ad9 100644 --- a/src/kernel/spinlock.C +++ b/src/kernel/spinlock.C @@ -1,9 +1,18 @@ #include +#include void Spinlock::lock() { uint64_t reservation = __sync_fetch_and_add(&iv_reserve, 1); - while(iv_ready != reservation); + if (iv_ready != reservation) + { + do + { + setThreadPriorityLow(); + } + while(iv_ready != reservation); + setThreadPriorityHigh(); + } } void Spinlock::unlock() diff --git a/src/kernel/start.S b/src/kernel/start.S index 538c5dbb5..785d86ac4 100644 --- a/src/kernel/start.S +++ b/src/kernel/start.S @@ -309,3 +309,7 @@ kernel_stack: .global kernel_other_thread_spinlock kernel_other_thread_spinlock: .space 8 + +.global hbi_ImageId +hbi_ImageId: + .space 128 diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C index d9ac13b17..4d9cc7b4b 100644 --- a/src/kernel/syscall.C +++ b/src/kernel/syscall.C @@ -81,7 +81,7 @@ void kernel_execute_system_call() if (syscall > SYSCALL_MAX) { // TODO : kill task. - printk("Invalid syscall : %lld\n", syscall); + printk("Invalid syscall : %ld\n", syscall); while(1); } else diff --git a/src/kernel/taskmgr.C b/src/kernel/taskmgr.C index c21a19d97..866a00eae 100644 --- a/src/kernel/taskmgr.C +++ b/src/kernel/taskmgr.C @@ -2,7 +2,7 @@ #include #include #include -#include +#include void TaskManager::idleTaskLoop(void* unused) { @@ -13,14 +13,14 @@ void TaskManager::idleTaskLoop(void* unused) task_t* TaskManager::getCurrentTask() { - register task_t* current_task = (task_t*) ppc_getSPRG3(); + register task_t* current_task = (task_t*) getSPRG3(); return current_task; } void TaskManager::setCurrentTask(task_t* t) { t->cpu = getCurrentTask()->cpu; - ppc_setSPRG3((uint64_t)t); + setSPRG3((uint64_t)t); return; } diff --git a/src/kernel/terminate.S b/src/kernel/terminate.S new file mode 100644 index 000000000..4088a6e0e --- /dev/null +++ b/src/kernel/terminate.S @@ -0,0 +1,18 @@ +.include "kernel/ppcconsts.S" + +.global hal_p7_terminate_immediate +hal_p7_terminate_immediate: + li r0, 1 + mfspr r9, HID0 + insrdi r9,r0,1,31 /* Turn on bit 31. */ + sync + mtspr HID0,r9 /* Enable attentions */ + mfspr r9, HID0 + mfspr r9, HID0 + mfspr r9, HID0 + mfspr r9, HID0 + mfspr r9, HID0 + mfspr r9, HID0 + isync + attn + b 0 diff --git a/src/kernel/vmmmgr.C b/src/kernel/vmmmgr.C index 51e26e60b..f47b92059 100644 --- a/src/kernel/vmmmgr.C +++ b/src/kernel/vmmmgr.C @@ -1,7 +1,7 @@ #include #include #include -#include +#include extern void* data_load_address; @@ -102,7 +102,7 @@ bool VmmManager::_pteMiss(task_t* t) { lock.lock(); - uint64_t effAddr = ppc_getDAR(); + uint64_t effAddr = getDAR(); uint64_t effPid = effAddr / FULL_MEM_SIZE; diff --git a/src/lib/assert.C b/src/lib/assert.C new file mode 100644 index 000000000..edf4ea0d4 --- /dev/null +++ b/src/lib/assert.C @@ -0,0 +1,8 @@ + +extern "C" void __assert(bool expr, const char *exprStr, + const char *file, int line) +{ + // TODO + while (true); +} + diff --git a/src/lib/makefile b/src/lib/makefile index ee750951a..d15ca3bef 100644 --- a/src/lib/makefile +++ b/src/lib/makefile @@ -1,6 +1,6 @@ ROOTPATH = ../.. -OBJS = string.o stdlib.o +OBJS = string.o stdlib.o assert.o stdio.o OBJS += syscall_stub.o syscall_task.o syscall_mutex.o syscall_msg.o OBJS += syscall_mmio.o syscall_time.o diff --git a/src/lib/stdio.C b/src/lib/stdio.C new file mode 100644 index 000000000..2cdd23d85 --- /dev/null +++ b/src/lib/stdio.C @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +class SprintfBuffer +{ + public: + int putc(int c) + { + if ('\b' == c) + { + iv_pos--; + } + else + { + iv_buffer[iv_pos++] = c; + } + return c; + } + + explicit SprintfBuffer(char* buf) : iv_pos(0), iv_buffer(buf) {}; + + private: + size_t iv_pos; + char * iv_buffer; +}; + +int sprintf(char *str, const char * format, ...) +{ + using Util::mem_ptr_fun; + using Util::vasprintf; + + va_list args; + va_start(args, format); + + SprintfBuffer console(str); + size_t count = vasprintf(mem_ptr_fun(console, &SprintfBuffer::putc), + format, args); + + va_end(args); + + return count; +} diff --git a/src/lib/string.C b/src/lib/string.C new file mode 100644 index 000000000..0444a19bc --- /dev/null +++ b/src/lib/string.C @@ -0,0 +1,144 @@ +#include + +extern "C" void *memset(void *vdest, int64_t ch, size_t len) +{ + // TODO: align to an 8-byte boundary + // Loop, storing 8 bytes every 3 instructions + long *ldest = reinterpret_cast(vdest); + if (len >= sizeof(long)) + { + long lch = ch & 0xFF; + lch |= lch<<8; + lch |= lch<<16; + lch |= lch<<32; + size_t len8 = len / sizeof(long); + size_t i = len8; + do + { + ldest[--i] = lch; + } + while( i > 0 ); + ldest += len8; + len -= len8 * sizeof(long); + } + + // Loop, storing 1 byte every 3 instructions + char *cdest = reinterpret_cast(ldest); + while (len >= sizeof(char)) + { + *cdest++ = ch; + len -= sizeof(char); + } + + return vdest; +} + +extern "C" void bzero(void *vdest, size_t len) +{ + memset(vdest, 0, len); +} + +extern "C" void *memcpy(void *vdest, const void *vsrc, size_t len) +{ + // TODO: align to an 8-byte boundary? + + // Loop, copying 8 bytes every 5 instructions (TODO: 8/4 should be possible) + long *ldest = reinterpret_cast(vdest); + const long *lsrc = reinterpret_cast(vsrc); + + while (len >= sizeof(long)) + { + *ldest++ = *lsrc++; + len -= sizeof(long); + } + + // Loop, copying 1 byte every 4 instructions + char *cdest = reinterpret_cast(ldest); + const char *csrc = reinterpret_cast(lsrc); + for (size_t i = 0; i < len; ++i) + { + cdest[i] = csrc[i]; + } + + return vdest; +} + +extern "C" void *memmove(void *vdest, const void *vsrc, size_t len) +{ + // Copy first-to-last + if (vdest <= vsrc) + { + return memcpy(vdest,vsrc,len); + } + + // Copy last-to-first (TO_DO: optimize) + char *dest = reinterpret_cast(vdest); + const char *src = reinterpret_cast(vsrc); + for (size_t i = len; i > 0;) + { + --i; + dest[i] = src[i]; + } + + return vdest; +} + +extern "C" int64_t memcmp(const void *p1, const void *p2, size_t len) +{ + const char *c1 = reinterpret_cast(p1); + const char *c2 = reinterpret_cast(p2); + + for (size_t i = 0; i < len; ++i) + { + long n = static_cast(c1[i]) - static_cast(c2[i]); + if (n != 0) + { + return n; + } + } + + return 0; +} + +extern "C" char* strcpy(char* d, const char* s) +{ + char* d1 = d; + + do + { + *d1 = *s; + if (*s == '\0') return d; + d1++; s++; + } while(1); +} + +extern "C" int strcmp(const char* a, const char* b) +{ + while((*a != '\0') && (*b != '\0')) + { + if (*a == *b) + { + a++; b++; + } + else + { + return (*a > *b) ? 1 : -1; + } + } + if (*a == *b) + return 0; + if (*a == '\0') + return -1; + else + return 1; +} + +extern "C" size_t strlen(const char* a) +{ + size_t length = 0; + while(*a++) + { + length++; + } + return length; +} diff --git a/src/lib/string.c b/src/lib/string.c deleted file mode 100644 index c267c11d7..000000000 --- a/src/lib/string.c +++ /dev/null @@ -1,45 +0,0 @@ -#include - -void* memset(void* s, int c, size_t n) -{ - char* _s = s; - while(n) - { - *_s = c; - _s++; n--; - } - return s; -} - -char* strcpy(char* d, const char* s) -{ - char* d1 = d; - - do - { - *d1 = *s; - if (*s == '\0') return d; - d1++; s++; - } while(1); -} - -int strcmp(const char* a, const char* b) -{ - while((*a != '\0') && (*b != '\0')) - { - if (*a == *b) - { - a++; b++; - } - else - { - return (*a > *b) ? 1 : -1; - } - } - if (*a == *b) - return 0; - if (*a == '\0') - return -1; - else - return 1; -} diff --git a/src/libc++/builtins.C b/src/libc++/builtins.C old mode 100644 new mode 100755 index c2fffa816..a336c46c3 --- a/src/libc++/builtins.C +++ b/src/libc++/builtins.C @@ -11,6 +11,16 @@ void* operator new[](size_t s) return malloc(s); }; +void* operator new(size_t s, void *place) +{ + return place; +} + +void* operator new[](size_t s, void *place) +{ + return place; +} + void operator delete(void* p) { return free(p); diff --git a/src/makefile b/src/makefile index ca4f797ae..4e70dabc2 100644 --- a/src/makefile +++ b/src/makefile @@ -1,7 +1,35 @@ ROOTPATH = .. SUBDIRS = kernel.d lib.d libc++.d sys.d usr.d build.d -IMAGES += ${IMGDIR}/hbicore.elf -IMAGES += ${IMGDIR}/hbicore.bin +IMGS = hbicore +EXTRA_LIDS = dslid + +BASE_OBJECTS = console.o spinlock.o string.o stdlib.o assert.o stdio.o \ + builtins.o vfs_init.o heapmgr.o pagemgr.o + +DIRECT_BOOT_OBJECTS = start.o kernel.o taskmgr.o cpumgr.o syscall.o \ + scheduler.o exception.o vmmmgr.o timemgr.o \ + syscall_stub.o syscall_task.o syscall_mutex.o \ + syscall_msg.o syscall_mmio.o syscall_time.o \ + init_main.o vfs_main.o + +RUNTIME_OBJECTS = + +BASE_MODULES = +DIRECT_BOOT_MODULES = example +RUNTIME_MODULES = + +RELOCATABLE_IMAGE_LDFLAGS = -pie --export-dynamic + +hbicore_OBJECTS = ${BASE_OBJECTS} ${DIRECT_BOOT_OBJECTS} +hbicore_MODULES = ${BASE_MODULES} ${DIRECT_BOOT_MODULES} +hbicore_LIDNUMBER = 80f00100 + +#halruntime_OBJECTS = ${BASE_OBJECTS} ${RUNTIME_OBJECTS} +#halruntime_MODULES = ${BASE_MODULES} ${RUNTIME_MODULES} +#halruntime_LDFLAGS = ${RELOCATABLE_IMAGE_LDFLAGS} +#halruntime_LIDNUMBER = 80f00101 + +dslid_LIDNUMBER = 80f001fe include ${ROOTPATH}/config.mk diff --git a/src/sys/vfs/makefile b/src/sys/vfs/makefile index 767b09204..3567870da 100644 --- a/src/sys/vfs/makefile +++ b/src/sys/vfs/makefile @@ -1,5 +1,5 @@ ROOTPATH = ../../.. -OBJS = vfs_main.o +OBJS = vfs_main.o vfs_init.o include ${ROOTPATH}/config.mk diff --git a/src/sys/vfs/vfs_init.C b/src/sys/vfs/vfs_init.C new file mode 100644 index 000000000..24c55fda9 --- /dev/null +++ b/src/sys/vfs/vfs_init.C @@ -0,0 +1,39 @@ +#include +#include + +VfsSystemModule VFS_MODULES[VFS_MODULE_MAX]; +uint64_t VFS_LAST_ADDRESS; + +void vfs_module_init() +{ + printk("Initializing modules.\n"); + + VfsSystemModule* module = &VFS_MODULES[0]; + while ('\0' != module->module[0]) + { + printk("\tIniting module %s...", module->module); + if (NULL != module->init) + (module->init)(NULL); + printk("done.\n"); + + module++; + } + + printk("Modules initialized."); +} + +void (*vfs_module_find_start(const char* modName))(void*) +{ + VfsSystemModule* module = &VFS_MODULES[0]; + while ('\0' != module->module[0]) + { + if (0 == strcmp(modName, module->module)) + { + return module->start; + } + + module++; + } + + return NULL; +} diff --git a/src/sys/vfs/vfs_main.C b/src/sys/vfs/vfs_main.C index 3efb99002..417a8ae14 100644 --- a/src/sys/vfs/vfs_main.C +++ b/src/sys/vfs/vfs_main.C @@ -11,8 +11,8 @@ const char* VFS_ROOT = "/"; const char* VFS_ROOT_BIN = "/bin/"; const char* VFS_ROOT_DATA = "/data/"; const char* VFS_ROOT_MSG = "/msg/"; -VfsSystemModule VFS_MODULES[VFS_MODULE_MAX]; -uint64_t VFS_LAST_ADDRESS; + +void vfs_module_init(); struct VfsPath { @@ -31,23 +31,6 @@ struct VfsEntry VfsEntry* prev; }; -void vfs_module_init() -{ - printk("Initializing modules.\n"); - - VfsSystemModule* module = &VFS_MODULES[0]; - while ('\0' != module->module[0]) - { - printk("\tIniting module %s...", module->module); - (module->init)(NULL); - printk("done.\n"); - - module++; - } - - printk("Modules initialized."); -} - void vfs_main(void* unused) { // Create message queue, register with kernel. @@ -75,7 +58,7 @@ void vfs_main(void* unused) e->msg_q = (msg_q_t) msg->data[0]; vfsContents.insert(e); - printk("VFS: Registering %lx as %s\n", + printk("VFS: Registering %p as %s\n", e->msg_q, e->key.key); msg_respond(vfsMsgQ, msg); } diff --git a/src/usr/example/example.C b/src/usr/example/example.C index 0965bcfd2..97c8d5cbb 100644 --- a/src/usr/example/example.C +++ b/src/usr/example/example.C @@ -6,23 +6,6 @@ static mutex_t value = mutex_create(); -extern "C" -void _init(void*) -{ - // Call default constructors for any static objects. - extern void (*ctor_start_address)(); - extern void (*ctor_end_address)(); - void(**ctors)() = &ctor_start_address; - while(ctors != &ctor_end_address) - { - (*ctors)(); - ctors++; - } - - printk("Here! %lx, %s\n", (uint64_t) value, VFS_ROOT); - TRACFCOMP(NULL, "This is a test %lx, %s", (uint64_t) value, VFS_ROOT); -} - extern "C" void _start(void*) { diff --git a/src/usr/example/makefile b/src/usr/example/makefile index 16df1e37d..10a249ff9 100644 --- a/src/usr/example/makefile +++ b/src/usr/example/makefile @@ -2,6 +2,5 @@ ROOTPATH = ../../.. MODULE = example OBJS = example.o -LIBS = libexample.so include ${ROOTPATH}/config.mk diff --git a/src/usr/makefile b/src/usr/makefile index 609815f94..b734fab3b 100644 --- a/src/usr/makefile +++ b/src/usr/makefile @@ -1,5 +1,6 @@ ROOTPATH = ../.. +OBJS = module_init.o SUBDIRS = example.d include ${ROOTPATH}/config.mk diff --git a/src/usr/module_init.C b/src/usr/module_init.C new file mode 100644 index 000000000..93c3f35a7 --- /dev/null +++ b/src/usr/module_init.C @@ -0,0 +1,13 @@ +extern "C" +void _init(void*) +{ + // Call default constructors for any static objects. + extern void (*ctor_start_address)(); + extern void (*ctor_end_address)(); + void(**ctors)() = &ctor_start_address; + while(ctors != &ctor_end_address) + { + (*ctors)(); + ctors++; + } +} -- cgit v1.2.1