1//
2// mpu_asm.S - Assembler routine(s) for the MPU
3//
4// $Id$
5
6// Copyright (c) 2015 Tensilica Inc.
7//
8// Permission is hereby granted, free of charge, to any person obtaining
9// a copy of this software and associated documentation files (the
10// "Software"), to deal in the Software without restriction, including
11// without limitation the rights to use, copy, modify, merge, publish,
12// distribute, sublicense, and/or sell copies of the Software, and to
13// permit persons to whom the Software is furnished to do so, subject to
14// the following conditions:
15//
16// The above copyright notice and this permission notice shall be included
17// in all copies or substantial portions of the Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27#include <xtensa/coreasm.h>
28#include <xtensa/mpuasm.h>
29
30#if defined(__SPLIT__write_map_raw) ||\
31    defined(__SPLIT__write_map_raw_nw)
32
33/*
34  void  xthal_write_map_raw( const struct xthal_MPU_entry* map, unsigned n);
35
36  Updates the MPU with the MPU entries provided:
37	map	pointer to array of MPU entries
38	n	number of entries in array (0 <= n <= XCHAL_MPU_ENTRIES)
39
40  The entries provided must have monotonically increasing addresses.
41  This function otherwise orders its updates to ensure the MPU always has
42  all its entries in monotonically increasing sequence.
43
44  on entry
45  	a2 		=>	vector of MPU entries to write
46  	a3		=>	number of entries to write
47  	a4-a7	=>	destroyed
48*/
49
50DECLFUNC (xthal_write_map_raw)
51	abi_entry
52	mpu_write_map a2, a3, a4, a5, a6, a7
53	abi_return
54	endfunc
55
56#endif
57
58/*
59	void xthal_read_map_raw(struct xthal_MPU_entry* map);
60
61	Reads the current map from the MPU and puts it the vector
62	pointed to by map.
63
64	a2		=> 	vector of MPU entries where the current MPU state is copied
65	a3-a4	=>	destroyed
66*/
67
68#if defined(__SPLIT__read_map_raw) ||\
69    defined(__SPLIT__read_map_raw_nw)
70
71DECLFUNC (xthal_read_map_raw)
72	abi_entry
73	mpu_read_map a2, a3, a4
74	abi_return
75	endfunc
76
77#endif
78
79