Author: bonefish Date: 2010-06-05 20:32:44 +0200 (Sat, 05 Jun 2010) New Revision: 37019 Changeset: http://dev.haiku-os.org/changeset/37019/haiku Added: haiku/trunk/src/system/kernel/arch/ppc/asm_offsets.cpp Modified: haiku/trunk/src/system/kernel/arch/ppc/Jamfile Log: Patch by Andreas Faerber: Generate an assembler compatible header with structure offset definitions for PPC as well. Modified: haiku/trunk/src/system/kernel/arch/ppc/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/arch/ppc/Jamfile 2010-06-05 14:56:15 UTC (rev 37018) +++ haiku/trunk/src/system/kernel/arch/ppc/Jamfile 2010-06-05 18:32:44 UTC (rev 37019) @@ -33,3 +33,5 @@ : $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused ; + +CreateAsmStructOffsetsHeader asm_offsets.h : asm_offsets.cpp ; Added: haiku/trunk/src/system/kernel/arch/ppc/asm_offsets.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/ppc/asm_offsets.cpp (rev 0) +++ haiku/trunk/src/system/kernel/arch/ppc/asm_offsets.cpp 2010-06-05 18:32:44 UTC (rev 37019) @@ -0,0 +1,33 @@ +/* + * Copyright 2007-2009, Ingo Weinhold, ingo_weinhold@xxxxxxx + * Copyright 2010 Andreas Faerber, andreas.faerber@xxxxxx + * Distributed under the terms of the MIT License. + */ + +// This file is used to get C structure offsets into assembly code. +// The build system assembles the file and processes the output to create +// a header file with macro definitions, that can be included from assembly +// code. + + +#include <computed_asm_macros.h> + +#include <cpu.h> + + +#define DEFINE_MACRO(macro, value) DEFINE_COMPUTED_ASM_MACRO(macro, value) + +#define DEFINE_OFFSET_MACRO(prefix, structure, member) \ + DEFINE_MACRO(prefix##_##member, offsetof(struct structure, member)); + +#define DEFINE_SIZEOF_MACRO(prefix, structure) \ + DEFINE_MACRO(prefix##_sizeof, sizeof(struct structure)); + + +void +dummy() +{ + // struct cpu_ent + DEFINE_OFFSET_MACRO(CPU_ENT, cpu_ent, fault_handler); + DEFINE_OFFSET_MACRO(CPU_ENT, cpu_ent, fault_handler_stack_pointer); +}