Path: blob/master/src/hotspot/cpu/ppc/icache_ppc.cpp
40930 views
/*1* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2012, 2018 SAP SE. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#include "precompiled.hpp"26#include "runtime/icache.hpp"2728// Use inline assembler to implement icache flush.29int ICache::ppc64_flush_icache(address start, int lines, int magic) {30address end = start + (unsigned int)lines*ICache::line_size;31assert(start <= end, "flush_icache parms");3233// Store modified cache lines from data cache.34for (address a = start; a < end; a += ICache::line_size) {35__asm__ __volatile__(36"dcbst 0, %0 \n"37:38: "r" (a)39: "memory");40}4142// sync instruction43__asm__ __volatile__(44"sync \n"45:46:47: "memory");4849// Invalidate respective cache lines in instruction cache.50for (address a = start; a < end; a += ICache::line_size) {51__asm__ __volatile__(52"icbi 0, %0 \n"53:54: "r" (a)55: "memory");56}5758// Discard fetched instructions.59__asm__ __volatile__(60"isync \n"61:62:63: "memory");6465return magic;66}6768void ICacheStubGenerator::generate_icache_flush(ICache::flush_icache_stub_t* flush_icache_stub) {6970*flush_icache_stub = (ICache::flush_icache_stub_t)ICache::ppc64_flush_icache;7172// First call to flush itself.73// Pointless since we call C, but it is expected to get74// executed during VM_Version::determine_features().75ICache::invalidate_range((address)(*flush_icache_stub), 0);76}777879