source: trunk/libs/newlib/src/libgloss/or1k/mmu-asm.S @ 509

Last change on this file since 509 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.2 KB
Line 
1/* mmu-asm.S -- MMU handling for OpenRISC 1000.
2 *
3 * Copyright (c) 2011, 2014 Authors
4 *
5 * Contributor Julius Baxter <juliusbaxter@gmail.com>
6 * Contributor Stefan Wallentowitz <stefan.wallentowitz@tum.de>
7 *
8 * The authors hereby grant permission to use, copy, modify, distribute,
9 * and license this software and its documentation for any purpose, provided
10 * that existing copyright notices are retained in all copies and that this
11 * notice is included verbatim in any distributions. No written agreement,
12 * license, or royalty fee is required for any of the authorized uses.
13 * Modifications to this software may be copyrighted by their authors
14 * and need not follow the licensing terms described here, provided that
15 * the new terms are clearly indicated on the first page of each file where
16 * they apply.
17 */
18
19/* -------------------------------------------------------------------------- */
20/*!Function to control MMU
21                                                                              */
22/* -------------------------------------------------------------------------- */
23
24#include "include/or1k-asm.h"
25#include "include/or1k-sprs.h"
26
27/* MMU control functions always switch MMU control with a l.rfe to return
28   from function */
29        .section .text
30
31        .global or1k_dmmu_enable
32or1k_dmmu_enable:
33        l.mfspr r3,r0,OR1K_SPR_SYS_SR_ADDR
34        l.ori   r3,r3,OR1K_SPR_SYS_SR_DME_MASK
35        l.mtspr r0,r3,OR1K_SPR_SYS_ESR_BASE
36        l.mtspr r0,r9,OR1K_SPR_SYS_EPCR_BASE
37        OR1K_DELAYED_NOP(OR1K_INST(l.rfe))
38
39
40        .global or1k_dmmu_disable
41or1k_dmmu_disable:
42        l.ori   r3,r0,OR1K_SPR_SYS_SR_DME_MASK
43        l.xori  r4,r3,0xffff
44        l.mfspr r3,r0,OR1K_SPR_SYS_SR_ADDR
45        l.and   r3,r4,r3
46        l.mtspr r0,r3,OR1K_SPR_SYS_ESR_BASE
47        l.mtspr r0,r9,OR1K_SPR_SYS_EPCR_BASE
48        OR1K_DELAYED_NOP(OR1K_INST(l.rfe))
49
50
51        .global or1k_immu_enable
52or1k_immu_enable:
53        l.mfspr r3,r0,OR1K_SPR_SYS_SR_ADDR
54        l.ori   r3,r3,OR1K_SPR_SYS_SR_IME_MASK
55        l.mtspr r0,r3,OR1K_SPR_SYS_ESR_BASE
56        l.mtspr r0,r9,OR1K_SPR_SYS_EPCR_BASE
57        OR1K_DELAYED_NOP(OR1K_INST(l.rfe))
58
59        .global or1k_immu_disable
60or1k_immu_disable:
61        l.ori   r3,r0,OR1K_SPR_SYS_SR_IME_MASK
62        l.xori  r4,r3,0xffff
63        l.mfspr r3,r0,OR1K_SPR_SYS_SR_ADDR
64        l.and   r3,r4,r3
65        l.mtspr r0,r3,OR1K_SPR_SYS_ESR_BASE
66        l.mtspr r0,r9,OR1K_SPR_SYS_EPCR_BASE
67        OR1K_DELAYED_NOP(OR1K_INST(l.rfe))
Note: See TracBrowser for help on using the repository browser.