Changeset 5af6cf3d in mainline


Ignore:
Timestamp:
2018-03-05T15:55:34Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
db3c8834
Parents:
d5e5fd1
Message:

todo

Files:
9 added
6 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rd5e5fd1 r5af6cf3d  
    99*.so.*
    1010*.d
    11 *.ag.probe.s
    12 *.ag.probe.c
    1311*.pyc
    1412tag
     
    1614common.h.new
    1715deps.mk
    18 Makefile.ag.depend
    1916/Makefile.config
    2017/Makefile.common
     
    4643boot/image.raw
    4744kernel/arch/amd64/_link.ld
    48 kernel/arch/amd64/include/arch/boot/memmap_struct.h
    49 kernel/arch/amd64/include/arch/common.h
    50 kernel/arch/amd64/include/arch/context_struct.h
    51 kernel/arch/amd64/include/arch/istate_struct.h
    52 kernel/arch/amd64/include/arch/kseg_struct.h
    5345kernel/arch/arm32/_link.ld
    54 kernel/arch/arm32/include/arch/context_struct.h
    55 kernel/arch/arm32/include/arch/istate_struct.h
    5646kernel/arch/ia32/_link.ld
    57 kernel/arch/ia32/include/arch/boot/memmap_struct.h
    58 kernel/arch/ia32/include/arch/context_struct.h
    59 kernel/arch/ia32/include/arch/istate_struct.h
    6047kernel/arch/ia64/_link.ld
    61 kernel/arch/ia64/include/arch/context_struct.h
    62 kernel/arch/ia64/include/arch/istate_struct.h
    6348kernel/arch/mips32/_link.ld
    64 kernel/arch/mips32/include/arch/context_struct.h
    65 kernel/arch/mips32/include/arch/fpu_context_struct.h
    66 kernel/arch/mips32/include/arch/istate_struct.h
    6749kernel/arch/ppc32/_link.ld
    68 kernel/arch/ppc32/include/arch/context_struct.h
    69 kernel/arch/ppc32/include/arch/fpu_context_struct.h
    70 kernel/arch/ppc32/include/arch/istate_struct.h
    7150kernel/arch/sparc64/_link.ld
    72 kernel/arch/sparc64/include/arch/context_struct.h
    73 kernel/arch/sparc64/include/arch/istate_struct.h
    7451kernel/arch/abs32le/_link.ld
    75 kernel/genarch/include/genarch/multiboot/multiboot_info_struct.h
    76 kernel/genarch/include/genarch/multiboot/multiboot_memmap_struct.h
    7752kernel/generic/src/debug/real_map.bin
    7853kernel/kernel.bin
     
    344319uspace/lib/c/arch/amd64/_link-shlib.ld
    345320uspace/lib/c/arch/amd64/_link.ld
    346 uspace/lib/c/arch/amd64/include/libarch/common.h
    347 uspace/lib/c/arch/amd64/include/libarch/fibril_context.h
    348 uspace/lib/c/arch/amd64/include/libarch/istate_struct.h
    349321uspace/lib/c/arch/arm32/_link-dlexe.ld
    350322uspace/lib/c/arch/arm32/_link-loader.ld
    351323uspace/lib/c/arch/arm32/_link-shlib.ld
    352324uspace/lib/c/arch/arm32/_link.ld
    353 uspace/lib/c/arch/arm32/include/libarch/fibril_context.h
    354 uspace/lib/c/arch/arm32/include/libarch/istate_struct.h
    355325uspace/lib/c/arch/ia32/_link-dlexe.ld
    356326uspace/lib/c/arch/ia32/_link-loader.ld
    357327uspace/lib/c/arch/ia32/_link-shlib.ld
    358328uspace/lib/c/arch/ia32/_link.ld
    359 uspace/lib/c/arch/ia32/include/libarch/fibril_context.h
    360 uspace/lib/c/arch/ia32/include/libarch/istate_struct.h
    361329uspace/lib/c/arch/ia64/_link-dlexe.ld
    362330uspace/lib/c/arch/ia64/_link-loader.ld
    363331uspace/lib/c/arch/ia64/_link-shlib.ld
    364332uspace/lib/c/arch/ia64/_link.ld
    365 uspace/lib/c/arch/ia64/include/libarch/fibril_context.h
    366 uspace/lib/c/arch/ia64/include/libarch/istate_struct.h
    367333uspace/lib/c/arch/mips32/_link-dlexe.ld
    368334uspace/lib/c/arch/mips32/_link-loader.ld
    369335uspace/lib/c/arch/mips32/_link-shlib.ld
    370336uspace/lib/c/arch/mips32/_link.ld
    371 uspace/lib/c/arch/mips32/include/libarch/fibril_context.h
    372 uspace/lib/c/arch/mips32/include/libarch/istate_struct.h
    373337uspace/lib/c/arch/mips32eb/_link-dlexe.ld
    374338uspace/lib/c/arch/mips32eb/_link-loader.ld
    375339uspace/lib/c/arch/mips32eb/_link-shlib.ld
    376340uspace/lib/c/arch/mips32eb/_link.ld
    377 uspace/lib/c/arch/mips32eb/include/libarch/fibril_context.h
    378 uspace/lib/c/arch/mips32eb/include/libarch/istate_struct.h
    379341uspace/lib/c/arch/ppc32/_link-dlexe.ld
    380342uspace/lib/c/arch/ppc32/_link-loader.ld
    381343uspace/lib/c/arch/ppc32/_link-shlib.ld
    382344uspace/lib/c/arch/ppc32/_link.ld
    383 uspace/lib/c/arch/ppc32/include/libarch/fibril_context.h
    384 uspace/lib/c/arch/ppc32/include/libarch/istate_struct.h
    385345uspace/lib/c/arch/sparc64/_link-dlexe.ld
    386346uspace/lib/c/arch/sparc64/_link-loader.ld
    387347uspace/lib/c/arch/sparc64/_link-shlib.ld
    388348uspace/lib/c/arch/sparc64/_link.ld
    389 uspace/lib/c/arch/sparc64/include/libarch/fibril_context.h
    390 uspace/lib/c/arch/sparc64/include/libarch/istate_struct.h
    391349uspace/lib/c/arch/abs32le/_link-dlexe.ld
    392350uspace/lib/c/arch/abs32le/_link-loader.ld
  • kernel/Makefile

    rd5e5fd1 r5af6cf3d  
    4848#
    4949
     50AUTOGEN = $(ROOT_PATH)/tools/autogen2.sh
    5051AGDEPEND = Makefile.ag.depend
    5152RAW = kernel.raw
     
    7374
    7475.PHONY: all clean autogen_clean depend
     76.DELETE_ON_ERROR:
    7577
    7678all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BIN) $(DISASM)
     
    354356GENARCH_DEPENDS := $(addsuffix .d,$(basename $(GENARCH_SOURCES)))
    355357
    356 GENARCH_AUTOGENS_H := $(addsuffix .h,$(basename $(GENARCH_AUTOGENS_AG)))
    357 GENARCH_AUTOGENS_PROBE_C := $(addsuffix .ag.probe.c,$(basename $(GENARCH_AUTOGENS_AG)))
    358 GENARCH_AUTOGENS_PROBE_S := $(addsuffix .ag.probe.s,$(basename $(GENARCH_AUTOGENS_AG)))
    359 
    360 ARCH_AUTOGENS_H := $(addsuffix .h,$(basename $(ARCH_AUTOGENS_AG)))
    361 ARCH_AUTOGENS_PROBE_C := $(addsuffix .ag.probe.c,$(basename $(ARCH_AUTOGENS_AG)))
    362 ARCH_AUTOGENS_PROBE_S := $(addsuffix .ag.probe.s,$(basename $(ARCH_AUTOGENS_AG)))
    363 
    364 AUTOGENS_H := $(ARCH_AUTOGENS_H) $(GENARCH_AUTOGENS_H)
    365358AUTOGENS_AG := $(ARCH_AUTOGENS_AG) $(GENARCH_AUTOGENS_AG)
     359AUTOGEN_DEPENDS := $(addsuffix .d,$(AUTOGENS_AG))
    366360
    367361AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
     
    371365-include $(ARCH_DEPENDS)
    372366-include $(GENARCH_DEPENDS)
     367-include $(AUTOGEN_DEPENDS)
    373368
    374369ifeq ($(COMPILER),clang)
     
    402397        $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
    403398
    404 %.h: %.ag
    405         $(AUTOGEN) probe $< >$<.probe.c
    406         $(CC_AUTOGEN) $(DEFS) $(CFLAGS) -S -o $<.probe.s $<.probe.c
    407         $(AUTOGEN) generate $< <$<.probe.s >$@
     399%.ag.h %.ag.s %.ag.c %.ag.d: %.h
     400        CC="$(CC)" CFLAGS="$(CFLAGS)" $(AUTOGEN) $< $@
    408401
    409402%.o: %.S | depend
     
    441434        $(GENMAP) $(MAP_PREV) $(DUMP) $@
    442435
    443 $(AUTOGENS_H): $(AGDEPEND)
    444 
    445 $(AGDEPEND): $(AUTOGENS_AG)
    446         echo "# DO NOT EDIT" >$@
    447         for g in $^; do \
    448                 h=`dirname $$g`/`basename $$g .ag`.h; \
    449                 for l in `$(AUTOGEN) depend $$g`; do \
    450                         echo "$$h: $$l" >>$@; \
    451                 done \
    452         done
    453 
    454 depend: $(AUTOGENS_H)
     436depend: $(AUTOGENS_AG)
    455437
    456438autogen_clean:
    457         -rm $(ARCH_AUTOGENS_H) $(ARCH_AUTOGENS_PROBE_C) $(ARCH_AUTOGENS_PROBE_S)
    458         -rm $(GENARCH_AUTOGENS_H) $(GENARCH_AUTOGENS_PROBE_C) $(GENARCH_AUTOGENS_PROBE_S)
    459         -rm $(AGDEPEND)
     439        -rm $(AUTOGENS_AG) $(AUTOGEN_DEPENDS) $(AUTOGENS_AG)
  • kernel/arch/amd64/Makefile.inc

    rd5e5fd1 r5af6cf3d  
    8686
    8787ARCH_AUTOGENS_AG = \
    88         arch/$(KARCH)/include/arch/istate_struct.ag \
    89         arch/$(KARCH)/include/arch/context_struct.ag \
    90         arch/$(KARCH)/include/arch/kseg_struct.ag \
    91         arch/$(KARCH)/include/arch/boot/memmap_struct.ag
     88        arch/$(KARCH)/include/arch/istate_struct.ag.h \
     89        arch/$(KARCH)/include/arch/context_struct.ag.h \
     90        arch/$(KARCH)/include/arch/kseg_struct.ag.h \
     91        arch/$(KARCH)/include/arch/boot/memmap_struct.ag.h
  • kernel/arch/amd64/src/asm.S

    rd5e5fd1 r5af6cf3d  
    3030#include <arch/pm.h>
    3131#include <arch/mm/page.h>
    32 #include <arch/istate_struct.h>
    33 #include <arch/kseg_struct.h>
     32#include <arch/istate_struct.ag.h>
     33#include <arch/kseg_struct.ag.h>
    3434#include <arch/cpu.h>
    3535#include <arch/smp/apic.h>
     
    541541        ret
    542542FUNCTION_END(early_putchar)
     543
  • kernel/arch/amd64/src/boot/multiboot.S

    rd5e5fd1 r5af6cf3d  
    720720status_main:
    721721        .asciz "[main] "
     722
  • kernel/arch/amd64/src/context.S

    rd5e5fd1 r5af6cf3d  
    2828
    2929#include <abi/asmtool.h>
    30 #include <arch/context_struct.h>
     30#include <arch/context_struct.ag.h>
    3131#include <arch/vreg.h>
    3232
  • kernel/arch/amd64/src/smp/ap.S

    rd5e5fd1 r5af6cf3d  
    3939#include <arch/cpu.h>
    4040#include <arch/cpuid.h>
    41 #include <arch/context_struct.h>
     41#include <arch/context_struct.ag.h>
    4242
    4343.section K_TEXT_START, "ax"
  • kernel/arch/ia32/include/arch/boot/memmap.h

    rd5e5fd1 r5af6cf3d  
    3636#define KERN_ia32_MEMMAP_H_
    3737
    38 #include <arch/boot/memmap_struct.h>
     38
    3939
    4040/* E820h memory range types */
     
    6161#define MEMMAP_E820_MAX_RECORDS  32
    6262
    63 #ifndef __ASM__
     63#ifdef __ASM__
     64
     65#include <arch/boot/memmap_struct.ag.h>
     66
     67#else
    6468
    6569#include <stdint.h>
     70#include <arch/boot/memmap_struct.h>
    6671
    6772extern e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
  • kernel/genarch/Makefile.inc

    rd5e5fd1 r5af6cf3d  
    173173        genarch/src/multiboot/multiboot2.c
    174174GENARCH_AUTOGENS_AG += \
    175         genarch/include/genarch/multiboot/multiboot_memmap_struct.ag \
    176         genarch/include/genarch/multiboot/multiboot_info_struct.ag
     175        genarch/include/genarch/multiboot/multiboot_memmap_struct.ag.h \
     176        genarch/include/genarch/multiboot/multiboot_info_struct.ag.h
    177177endif
    178178
  • kernel/genarch/include/genarch/multiboot/multiboot.h

    rd5e5fd1 r5af6cf3d  
    3636#define KERN_MULTIBOOT_H_
    3737
    38 #include <genarch/multiboot/multiboot_memmap_struct.h>
    39 #include <genarch/multiboot/multiboot_info_struct.h>
    4038
    4139#define MULTIBOOT_HEADER_MAGIC  0x1badb002
     
    5250#define MULTIBOOT_INFO_FLAGS_MMAP       0x40
    5351
    54 #ifndef __ASM__
     52#ifdef __ASM__
     53
     54#include <genarch/multiboot/multiboot_memmap_struct.ag.h>
     55#include <genarch/multiboot/multiboot_info_struct.ag.h>
     56
     57#else
     58
     59#include <genarch/multiboot/multiboot_memmap_struct.h>
     60#include <genarch/multiboot/multiboot_info_struct.h>
    5561
    5662#include <typedefs.h>
  • tools/autogen2.sh

    rd5e5fd1 r5af6cf3d  
    11#!/bin/sh
    22
    3 filename="$1"
    4 struct_name="$2"
     3# There's a bunch of restriction. The script assumes that the structure definition begins with "typedef struct struct_name {",
     4# ends with "struct_name_t;", and that every word in between that ends with ";" is a struct member name with optional
     5# array subscript. Error handling is mostly omitted for simplicity, so any input that does not follow these rules will result
     6# in cryptic errors.
    57
    6 members=`cat $filename | sed -n -e "1,/typedef struct $struct_name {/d" -e "/} ${struct_name}_t;/,$$d" -e "s/.* \([^ ]\+\);/\1/p"`
     8echo $PWD
    79
    8 ustruct_name=`echo "$struct_name" | awk '{print toupper($0)}'`
    9 dmembers=`echo "$members" | awk '{print "DEFINE_MEMBER(" $0 ", " toupper($0) ")" }'`
     10input="$1"
     11output="$2"
     12toolsdir="$(readlink -f $(dirname "$0"))"
     13awkscript="$toolsdir/autogen2.awk"
    1014
     15# Set default value for $CC.
    1116if [ -z "${CC}" ]; then
    1217        CC=cc
    1318fi
    1419
     20# If $CC is clang, we need to make sure integrated assembler is not used.
    1521if ( ${CC} --version | grep clang > /dev/null ) ; then
    1622        CFLAGS="${CFLAGS} -no-integrated-as"
    1723fi
    1824
    19 echo "/* Autogenerated file, do not modify. */"
    20 echo "#pragma once"
     25# Tell the compiler to generate makefile dependencies.
     26CFLAGS="${CFLAGS} -MD -MP -MT $output -MF $output.d"
    2127
    22 ( ${CC} ${CFLAGS} -w -S -x c - -o - | sed -n 's/^.* #define \([^ ]\+\) [^0-9]*\([0-9]\+\) .*/#define \1 \2/p' ) <<- EOF
     28# Generate defines
     29defs=`$awkscript -- $input || exit 1`
    2330
    24 #include "$filename"
     31# Generate C file.
     32cat > $output.c <<- EOF
    2533
    26 #define DEFINE_MEMBER(lc, uc) \
    27         asm volatile ("/* #define ${ustruct_name}_OFFSET_"#uc" %0 */" :: "i" (__builtin_offsetof(struct $struct_name, lc))); \
    28         asm volatile ("/* #define ${ustruct_name}_SIZE_"#uc" %0 */" :: "i" (sizeof((struct $struct_name){}.lc)));
     34#include "`basename $input`"
     35
     36#define DEFINE_MEMBER(ls, us, lm, um) \
     37        asm volatile ("/* #define "#us"_OFFSET_"#um" %0 */" :: "i" (__builtin_offsetof(struct ls, lm))); \
     38        asm volatile ("/* #define "#us"_SIZE_"#um" %0 */" :: "i" (sizeof((struct ls){}.lm)));
     39
     40#define DEFINE_STRUCT(ls, us) \\
     41        asm volatile ("/* #define "#us"_SIZE %0 */" :: "i" (sizeof(struct ls)));
    2942
    3043void autogen()
    3144{
    32         $dmembers
     45        $defs
    3346}
    3447
    3548EOF
     49
     50# Turn the C file into assembly.
     51${CC} ${CFLAGS} -w -S -o $output.s $output.c || exit 1
     52
     53# Process the output.
     54
     55echo "/* Autogenerated file, do not modify. */" > $output
     56echo "#pragma once" >> $output
     57sed -n 's/^.* #define \([^ ]\+\) [^0-9]*\([0-9]\+\) .*/#define \1 \2/p' < $output.s > $output || exit 1
  • tools/autotool.py

    rd5e5fd1 r5af6cf3d  
    681681                sandbox_leave(owd)
    682682
    683         common['AUTOGEN'] = "%s/autogen.py" % os.path.dirname(os.path.abspath(sys.argv[0]))
    684 
    685683        create_makefile(MAKEFILE, common)
    686684        create_header(HEADER, macros)
Note: See TracChangeset for help on using the changeset viewer.