#include <types.h>
#include <errno.h>
#include <libc.h>
#include <bsp.h>
#include <core/sched.h>
#include <arch.h>
#include "thread.h"
#include "msr.h"
Go to the source code of this file.
Define Documentation
Function Documentation
Definition at line 203 of file space.c.
{
#ifdef POK_NEEDS_DEBUG
printf("dsi_int: part=%d, dar=%x dsisr=%x\n",
pok_current_partition, dar, dsisr);
#endif
if (dsisr & (1 << 30))
{
if (dar < spaces[pok_current_partition].size)
{
uint32_t vaddr = dar & POK_PAGE_MASK;
uint32_t v;
v = (spaces[pok_current_partition].phys_base + vaddr) & POK_PAGE_MASK;
v |= PPC_PTE_R | PPC_PTE_C | PPC_PTE_PP_RW;
pok_insert_pte (pok_current_partition, vaddr, v);
return;
}
}
#ifdef POK_NEEDS_DEBUG
printf("[DEBUG] Infinite loop in pok_arch_dsi_int\n");
#endif
while (1)
;
}
Definition at line 168 of file space.c.
{
#ifdef POK_NEEDS_DEBUG
printf("isi_int: part=%d, pc=%x msr=%x\n",
pok_current_partition, pc, msr);
if (msr & ((1 << 28) | (1 << 27)))
{
printf (" Bad access\n");
}
#endif
if (msr & (1 << 30))
{
if (pc < spaces[pok_current_partition].size)
{
uint32_t vaddr = pc & POK_PAGE_MASK;
uint32_t v;
v = (spaces[pok_current_partition].phys_base + vaddr) & POK_PAGE_MASK;
v |= PPC_PTE_R | PPC_PTE_C | PPC_PTE_PP_RW;
pok_insert_pte (pok_current_partition, vaddr, v);
return;
}
}
#ifdef POK_NEEDS_DEBUG
printf("[DEBUG] Infinite loop in pok_arch_isi_int\n");
#endif
while (1)
;
}
Definition at line 132 of file space.c.
{
uint32_t sdr1;
pt_base = 0;
pt_mask = 0x3ff;
sdr1 = pt_base | (pt_mask >> 10);
asm volatile ("mtsdr1 %0" : : "r"(sdr1));
}
Definition at line 42 of file space.c.
{
#ifdef POK_NEEDS_DEBUG
printf ("pok_create_space: %d: %x %x\n", partition_id, addr, size);
#endif
spaces[partition_id].phys_base = addr;
spaces[partition_id].size = size;
return (POK_ERRNO_OK);
}
Definition at line 64 of file space.c.
{
(void) addr;
return (0);
}
Create a new context in the given space
Definition at line 72 of file space.c.
{
context_t* ctx;
volatile_context_t* vctx;
char* stack_addr;
(void) partition_id;
stack_addr = pok_bsp_mem_alloc (KERNEL_STACK_SIZE);
vctx = (volatile_context_t *)
(stack_addr + KERNEL_STACK_SIZE - sizeof (volatile_context_t));
ctx = (context_t *)((char *)vctx - sizeof (context_t) + 8);
memset (ctx, 0, sizeof (*ctx));
memset (vctx, 0, sizeof (*vctx));
vctx->r3 = arg1;
vctx->r4 = arg2;
vctx->sp = stack_rel - 12;
vctx->srr0 = entry_rel;
vctx->srr1 = MSR_EE | MSR_IP | MSR_DR | MSR_IR | MSR_PR;
ctx->lr = (uint32_t) pok_arch_rfi;
ctx->sp = (uint32_t) &vctx->sp;
#ifdef POK_NEEDS_DEBUG
printf ("space_context_create %d: entry=%x stack=%x arg1=%x arg2=%x ksp=%x\n",
partition_id, entry_rel, stack_rel, arg1, arg2, &vctx->sp);
#endif
return (uint32_t)ctx;
}
Switch from one space to another
Definition at line 55 of file space.c.
{
(void) old_partition_id;
asm volatile ("mtsr %0,%1" : : "r"(0), "r"(PPC_SR_KP | new_partition_id));
return (POK_ERRNO_OK);
}
Variable Documentation