summaryrefslogtreecommitdiffstats
path: root/bsps/powerpc/virtex4/start/mmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'bsps/powerpc/virtex4/start/mmu.c')
-rw-r--r--bsps/powerpc/virtex4/start/mmu.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/bsps/powerpc/virtex4/start/mmu.c b/bsps/powerpc/virtex4/start/mmu.c
index e96619796b..8013f9cbc8 100644
--- a/bsps/powerpc/virtex4/start/mmu.c
+++ b/bsps/powerpc/virtex4/start/mmu.c
@@ -66,6 +66,7 @@
#include <rtems.h>
#include <rtems/bspIo.h>
#include <rtems/powerpc/powerpc.h>
+#include <rtems/score/sysstate.h>
#include <inttypes.h>
#include <stdio.h>
@@ -92,7 +93,7 @@ myprintf(FILE *f, char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- if (!f || !_impure_ptr->__sdidinit) {
+ if (!f || !_System_state_Is_up(_System_state_Get())) {
/* Might be called at an early stage when stdio is not yet initialized. */
vprintk(fmt,ap);
} else {
@@ -132,13 +133,16 @@ static void
fetch(bsp_tlb_idx_t key, bsp_tlb_entry_t* tlb)
{
register uint32_t tmp;
- __asm__ volatile ("mfpid %[tmp] \n\t"
+ __asm__ volatile (".machine \"push\" \n\t"
+ ".machine \"any\" \n\t"
+ "mfpid %[tmp] \n\t"
"stw %[tmp],0(%[tlb]) \n\t"
"tlbrehi %[tmp],%[key] \n\t"
"stw %[tmp],4(%[tlb]) \n\t"
"tlbrelo %[tmp],%[key] \n\t"
"stw %[tmp],8(%[tlb]) \n\t"
"sync \n\t"
+ ".machine \"pop\" \n\t"
: [tmp]"=&r"(tmp)
: [key]"r"(key),
[tlb]"b"(tlb)
@@ -150,12 +154,15 @@ static void
store(bsp_tlb_idx_t key, bsp_tlb_entry_t* tlb)
{
register uint32_t tmp;
- __asm__ volatile ("lwz %[tmp],0(%[tlb]) \n\t"
+ __asm__ volatile (".machine \"push\" \n\t"
+ ".machine \"any\" \n\t"
+ "lwz %[tmp],0(%[tlb]) \n\t"
"mtpid %[tmp] \n\t"
"lwz %[tmp],4(%[tlb]) \n\t"
"tlbwehi %[tmp],%[key] \n\t"
"lwz %[tmp],8(%[tlb]) \n\t"
"tlbwelo %[tmp],%[key] \n\t"
+ ".machine \"pop\" \n\t"
: [tmp]"=&r"(tmp)
: [tlb]"b"(tlb),
[key]"r"(key)
@@ -289,9 +296,12 @@ bsp_mmu_find_first_free()
for (idx=0; idx<NTLBS; idx++) {
register uint32_t tmp;
- __asm__ volatile ("tlbrehi %[tmp],%[idx] \n\t"
+ __asm__ volatile (".machine \"push\" \n\t"
+ ".machine \"any\" \n\t"
+ "tlbrehi %[tmp],%[idx] \n\t"
"stw %[tmp],4(%[tlb]) \n\t" /* entry.hi */
"sync \n\t"
+ ".machine \"pop\" \n\t"
: [tmp]"=&r"(tmp)
: [idx]"r"(idx),
[tlb]"b"(&entry)
@@ -488,11 +498,14 @@ bsp_mmu_find(uint32_t ea, uint32_t tid)
rtems_interrupt_disable(lvl);
- __asm__ volatile ("mfpid %[pid] \n\t" /* Save PID */
+ __asm__ volatile (".machine \"push\"\n\t"
+ ".machine \"any\"\n\t"
+ "mfpid %[pid] \n\t" /* Save PID */
"mtpid %[tid] \n\t"
"tlbsx. %[idx],0,%[ea] \n\t" /* Failure changes the index reg randomly. */
"mfcr %[failure] \n\t"
"mtpid %[pid] \n\t" /* Restore PID */
+ ".machine \"pop\"\n\t"
: [pid]"=r"(pid),
[idx]"=&r"(idx),
[failure]"=&r"(failure)