001/* 002 * This file is part of the Jikes RVM project (http://jikesrvm.org). 003 * 004 * This file is licensed to You under the Eclipse Public License (EPL); 005 * You may not use this file except in compliance with the License. You 006 * may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/eclipse-1.0.php 009 * 010 * See the COPYRIGHT.txt file distributed with this work for information 011 * regarding copyright ownership. 012 */ 013package org.jikesrvm.tools.header_gen; 014 015import static org.jikesrvm.ppc.RegisterConstants.FIRST_VOLATILE_GPR; 016import static org.jikesrvm.ppc.RegisterConstants.FRAME_POINTER; 017import static org.jikesrvm.ppc.RegisterConstants.JTOC_POINTER; 018import static org.jikesrvm.ppc.RegisterConstants.THREAD_REGISTER; 019import static org.jikesrvm.ppc.StackframeLayoutConstants.STACKFRAME_ALIGNMENT; 020import static org.jikesrvm.ppc.StackframeLayoutConstants.STACKFRAME_RETURN_ADDRESS_OFFSET; 021import static org.jikesrvm.ppc.TrapConstants.ARRAY_INDEX_MASK; 022import static org.jikesrvm.ppc.TrapConstants.ARRAY_INDEX_REG_MASK; 023import static org.jikesrvm.ppc.TrapConstants.ARRAY_INDEX_REG_SHIFT; 024import static org.jikesrvm.ppc.TrapConstants.ARRAY_INDEX_TRAP; 025import static org.jikesrvm.ppc.TrapConstants.CHECKCAST_MASK; 026import static org.jikesrvm.ppc.TrapConstants.CHECKCAST_TRAP; 027import static org.jikesrvm.ppc.TrapConstants.CONSTANT_ARRAY_INDEX_INFO; 028import static org.jikesrvm.ppc.TrapConstants.CONSTANT_ARRAY_INDEX_MASK; 029import static org.jikesrvm.ppc.TrapConstants.CONSTANT_ARRAY_INDEX_TRAP; 030import static org.jikesrvm.ppc.TrapConstants.DIVIDE_BY_ZERO_MASK; 031import static org.jikesrvm.ppc.TrapConstants.DIVIDE_BY_ZERO_TRAP; 032import static org.jikesrvm.ppc.TrapConstants.JNI_STACK_TRAP; 033import static org.jikesrvm.ppc.TrapConstants.JNI_STACK_TRAP_MASK; 034import static org.jikesrvm.ppc.TrapConstants.MUST_IMPLEMENT_MASK; 035import static org.jikesrvm.ppc.TrapConstants.MUST_IMPLEMENT_TRAP; 036import static org.jikesrvm.ppc.TrapConstants.NULLCHECK_MASK; 037import static org.jikesrvm.ppc.TrapConstants.NULLCHECK_TRAP; 038import static org.jikesrvm.ppc.TrapConstants.REGENERATE_MASK; 039import static org.jikesrvm.ppc.TrapConstants.REGENERATE_TRAP; 040import static org.jikesrvm.ppc.TrapConstants.STACK_OVERFLOW_HAVE_FRAME_TRAP; 041import static org.jikesrvm.ppc.TrapConstants.STACK_OVERFLOW_MASK; 042import static org.jikesrvm.ppc.TrapConstants.STACK_OVERFLOW_TRAP; 043import static org.jikesrvm.ppc.TrapConstants.STACK_OVERFLOW_TRAP_INFO_SET_HAVE_FRAME; 044import static org.jikesrvm.ppc.TrapConstants.STORE_CHECK_MASK; 045import static org.jikesrvm.ppc.TrapConstants.STORE_CHECK_TRAP; 046import static org.jikesrvm.ppc.TrapConstants.WRITE_BUFFER_OVERFLOW_MASK; 047import static org.jikesrvm.ppc.TrapConstants.WRITE_BUFFER_OVERFLOW_TRAP; 048 049import org.jikesrvm.ppc.RegisterConstants.GPR; 050import org.jikesrvm.runtime.ArchEntrypoints; 051import org.vmmagic.unboxed.Offset; 052 053/** 054 * Emit the architecture-specific part of a header file containing declarations 055 * required to access VM data structures from C. 056 */ 057final class GenArch_ppc extends GenArch { 058 059 static void pln(String s, GPR gp) { 060 out.print("#define " + s + " 0x" + Integer.toHexString(gp.value()) + "\n"); 061 } 062 063 @Override 064 public void emitArchVirtualMachineDeclarations() { 065 Offset offset; 066 offset = ArchEntrypoints.registersLRField.getOffset(); 067 pln("Registers_lr_offset", offset); 068 069 pln("Constants_JTOC_POINTER", JTOC_POINTER); 070 pln("Constants_FRAME_POINTER", FRAME_POINTER); 071 pln("Constants_THREAD_REGISTER", THREAD_REGISTER); 072 pln("Constants_FIRST_VOLATILE_GPR", FIRST_VOLATILE_GPR); 073 pln("Constants_DIVIDE_BY_ZERO_MASK", DIVIDE_BY_ZERO_MASK); 074 pln("Constants_DIVIDE_BY_ZERO_TRAP", DIVIDE_BY_ZERO_TRAP); 075 pln("Constants_MUST_IMPLEMENT_MASK", MUST_IMPLEMENT_MASK); 076 pln("Constants_MUST_IMPLEMENT_TRAP", MUST_IMPLEMENT_TRAP); 077 pln("Constants_STORE_CHECK_MASK", STORE_CHECK_MASK); 078 pln("Constants_STORE_CHECK_TRAP", STORE_CHECK_TRAP); 079 pln("Constants_ARRAY_INDEX_MASK", ARRAY_INDEX_MASK); 080 pln("Constants_ARRAY_INDEX_TRAP", ARRAY_INDEX_TRAP); 081 pln("Constants_ARRAY_INDEX_REG_MASK", ARRAY_INDEX_REG_MASK); 082 pln("Constants_ARRAY_INDEX_REG_SHIFT", ARRAY_INDEX_REG_SHIFT); 083 pln("Constants_CONSTANT_ARRAY_INDEX_MASK", CONSTANT_ARRAY_INDEX_MASK); 084 pln("Constants_CONSTANT_ARRAY_INDEX_TRAP", CONSTANT_ARRAY_INDEX_TRAP); 085 pln("Constants_CONSTANT_ARRAY_INDEX_INFO", CONSTANT_ARRAY_INDEX_INFO); 086 pln("Constants_WRITE_BUFFER_OVERFLOW_MASK", WRITE_BUFFER_OVERFLOW_MASK); 087 pln("Constants_WRITE_BUFFER_OVERFLOW_TRAP", WRITE_BUFFER_OVERFLOW_TRAP); 088 pln("Constants_STACK_OVERFLOW_MASK", STACK_OVERFLOW_MASK); 089 pln("Constants_STACK_OVERFLOW_HAVE_FRAME_TRAP", STACK_OVERFLOW_HAVE_FRAME_TRAP); 090 pln("Constants_STACK_OVERFLOW_TRAP", STACK_OVERFLOW_TRAP); 091 pln("Constants_STACK_OVERFLOW_TRAP_INFO_SET_HAVE_FRAME", STACK_OVERFLOW_TRAP_INFO_SET_HAVE_FRAME); 092 pln("Constants_CHECKCAST_MASK", CHECKCAST_MASK); 093 pln("Constants_CHECKCAST_TRAP", CHECKCAST_TRAP); 094 pln("Constants_REGENERATE_MASK", REGENERATE_MASK); 095 pln("Constants_REGENERATE_TRAP", REGENERATE_TRAP); 096 pln("Constants_NULLCHECK_MASK", NULLCHECK_MASK); 097 pln("Constants_NULLCHECK_TRAP", NULLCHECK_TRAP); 098 pln("Constants_JNI_STACK_TRAP_MASK", JNI_STACK_TRAP_MASK); 099 pln("Constants_JNI_STACK_TRAP", JNI_STACK_TRAP); 100 pln("Constants_STACKFRAME_RETURN_ADDRESS_OFFSET", STACKFRAME_RETURN_ADDRESS_OFFSET); 101 pln("Constants_STACKFRAME_ALIGNMENT", STACKFRAME_ALIGNMENT); 102 } 103 104 @Override 105 public void emitArchAssemblerDeclarations() { 106 // Nothing to do 107 } 108}