1
###############################################################################
3
# MN10300 Low-level cache purging routines for gdbstub
5
# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
6
# Written by David Howells (dhowells@redhat.com)
8
# This program is free software; you can redistribute it and/or
9
# modify it under the terms of the GNU General Public Licence
10
# as published by the Free Software Foundation; either version
11
# 2 of the Licence, or (at your option) any later version.
13
###############################################################################
14
#include <linux/sys.h>
15
#include <linux/linkage.h>
17
#include <asm/cache.h>
18
#include <asm/cpu-regs.h>
19
#include <asm/exceptions.h>
20
#include <asm/frame.inc>
21
#include <asm/serial-regs.h>
25
###############################################################################
27
# GDB stub cache purge
29
###############################################################################
30
.type gdbstub_purge_cache,@function
31
ENTRY(gdbstub_purge_cache)
32
#######################################################################
33
# read the addresses tagged in the cache's tag RAM and attempt to flush
34
# those addresses specifically
35
# - we rely on the hardware to filter out invalid tag entry addresses
36
mov DCACHE_TAG(0,0),a0 # dcache tag RAM access address
37
mov DCACHE_PURGE(0,0),a1 # dcache purge request address
38
mov L1_CACHE_NWAYS*L1_CACHE_NENTRIES,d1 # total number of entries
40
mn10300_dcache_flush_loop:
42
and L1_CACHE_TAG_ADDRESS|L1_CACHE_TAG_ENTRY,d0
43
or L1_CACHE_TAG_VALID,d0 # retain valid entries in the
45
mov d0,(a1) # conditional purge
47
mn10300_dcache_flush_skip:
51
bne mn10300_dcache_flush_loop
53
;; # unconditionally flush and invalidate the dcache
54
;; mov DCACHE_PURGE(0,0),a1 # dcache purge request address
55
;; mov L1_CACHE_NWAYS*L1_CACHE_NENTRIES,d1 # total number of
58
;; gdbstub_purge_cache__dcache_loop:
59
;; mov (a1),d0 # unconditional purge
61
;; add L1_CACHE_BYTES,a1
63
;; bne gdbstub_purge_cache__dcache_loop
65
#######################################################################
66
# now invalidate the icache
79
# and wait for it to calm down
89
# wait for the cache to finish
98
movhu (a0),d0 # read back to flush
99
# (SIGILLs all over without this)
105
.size gdbstub_purge_cache,.-gdbstub_purge_cache