/* * Mesa 3-D graphics library * Version: 4.0.3 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Sparc assembly code by David S. Miller */ #include "context.h" #include "math/m_vertices.h" #include "math/m_xform.h" #include "tnl/t_context.h" #include "sparc.h" #ifdef DEBUG #include "math/m_debug.h" #endif #ifndef IN_GLX /* Lots of code removed for readability */ #endif /* Don't do if IN_GLX */ extern unsigned int _mesa_sparc_glapi_begin; extern unsigned int _mesa_sparc_glapi_end; extern void __glapi_sparc_icache_flush(unsigned int *); void _glx_mesa_init_sparc_glapi_relocs(void) { #ifdef USE_SPARC_ASM #define M1 ( (1 << 10) - 1) #define M2 (~M1) unsigned int *insn_ptr, *end_ptr; unsigned long disp_addr; insn_ptr = &_mesa_sparc_glapi_begin; end_ptr = &_mesa_sparc_glapi_end; disp_addr = (unsigned long) &_glapi_Dispatch; while (insn_ptr < end_ptr) { #if 0 /* This code patches for 64-bit addresses. This had better not happen for Sparc/Linux, no matter what architecture we are building for. So, don't do this. */ insn_ptr[0] |= (disp_addr >> (32 + 10)); insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10); __glapi_sparc_icache_flush(&insn_ptr[0]); insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1)); insn_ptr[3] |= (disp_addr & ((1 << 10) - 1)); __glapi_sparc_icache_flush(&insn_ptr[2]); insn_ptr += 11; #else /* I think this might get called more than once. So, don't just -or- in the table address, but instead mask out any possible previous table residue. */ /* insn_ptr[0] |= (disp_addr >> 10); */ insn_ptr[0] = ( (insn_ptr[0]) & M2 ) | (disp_addr >> 10); /* insn_ptr[1] |= (disp_addr & ((1 << 10) - 1)); */ insn_ptr[1] = ( (insn_ptr[1]) & M2 ) | (disp_addr & M1); __glapi_sparc_icache_flush(&insn_ptr[0]); insn_ptr += 5; #endif #endif /* sparc ASM in use */ } }