121482Smpp/*- 2208291Suqs * Copyright (c) 2004 Marcel Moolenaar 321482Smpp * All rights reserved. 421482Smpp * 521482Smpp * Redistribution and use in source and binary forms, with or without 621482Smpp * modification, are permitted provided that the following conditions 721482Smpp * are met: 821482Smpp * 921482Smpp * 1. Redistributions of source code must retain the above copyright 1021482Smpp * notice, this list of conditions and the following disclaimer. 1121482Smpp * 2. Redistributions in binary form must reproduce the above copyright 1221482Smpp * notice, this list of conditions and the following disclaimer in the 1321482Smpp * documentation and/or other materials provided with the distribution. 1421482Smpp * 1521482Smpp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1621482Smpp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1721482Smpp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1821482Smpp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1921482Smpp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2021482Smpp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2121482Smpp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2221482Smpp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2321482Smpp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2421482Smpp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2521482Smpp * 2621482Smpp * $FreeBSD: releng/10.2/sys/ia64/include/kdb.h 268199 2014-07-02 23:37:14Z marcel $ 2721482Smpp */ 2850479Speter 2948791Snik#ifndef _MACHINE_KDB_H_ 30177196Sjkim#define _MACHINE_KDB_H_ 3121482Smpp 3221482Smpp#include <machine/cpufunc.h> 3321482Smpp#include <machine/frame.h> 3421482Smpp#include <machine/ia64_cpu.h> 3521482Smpp 3621482Smpp#define KDB_STOPPEDPCB(pc) (&(pc)->pc_md.pcb) 3721482Smpp 3829612Sjmgvoid kdb_cpu_trap(int, int); 39147377Sru 40115221Srustatic __inline void 41115221Srukdb_cpu_clear_singlestep(void) 42115221Sru{ 43115221Sru kdb_frame->tf_special.psr &= ~IA64_PSR_SS; 44115221Sru} 45115221Sru 46115221Srustatic __inline void 47115221Srukdb_cpu_set_singlestep(void) 48115221Sru{ 49115221Sru kdb_frame->tf_special.psr |= IA64_PSR_SS; 50113299Smdodd} 51113299Smdodd 52113299Smdoddstatic __inline void 53147377Srukdb_cpu_sync_icache(unsigned char *addr, size_t size) 54113299Smdodd{ 55113299Smdodd vm_offset_t cacheline; 56113299Smdodd 57113299Smdodd cacheline = (uintptr_t)addr & ~31; 58147377Sru size += (uintptr_t)addr - cacheline; 5971898Sru size = (size + 31) & ~31; 60115221Sru while (size > 0) { 6171898Sru __asm __volatile("fc %0;; sync.i;; srlz.i;;" :: "r"(cacheline)); 62115221Sru cacheline += 32; 63115221Sru size -= 32; 6471898Sru } 65115221Sru} 6621482Smpp 6721482Smpp#endif /* _MACHINE_KDB_H_ */ 6821482Smpp