28 #define KERNEL_STACK_SIZE 8192
30 #define PPC_SR_KP (1 << 29)
31 #define PPC_SR_Ks (1 << 30)
32 #define PPC_SR_T (1 << 31)
46 #ifdef POK_NEEDS_DEBUG
47 printf (
"pok_create_space: %d: %x %x\n", partition_id, addr, size);
58 (void) old_partition_id;
60 asm volatile (
"mtsr %0,%1" : :
"r"(0),
"r"(
PPC_SR_KP | new_partition_id));
89 memset (ctx, 0,
sizeof (*ctx));
90 memset (vctx, 0,
sizeof (*vctx));
94 vctx->
sp = stack_rel - 12;
95 vctx->
srr0 = entry_rel;
101 #ifdef POK_NEEDS_DEBUG
102 printf (
"space_context_create %d: entry=%x stack=%x arg1=%x arg2=%x ksp=%x\n",
103 partition_id, entry_rel, stack_rel, arg1, arg2, &vctx->
sp);
118 #define PPC_PTE_V (1 << 31)
119 #define POK_PAGE_SIZE (1 << 12)
120 #define POK_PAGE_MASK (~(POK_PAGE_SIZE - 1))
121 #define PPC_PTE_H (1 << 6)
122 #define PPC_PTE_R (1 << 8)
123 #define PPC_PTE_C (1 << 7)
124 #define PPC_PTE_W (1 << 6)
125 #define PPC_PTE_I (1 << 5)
126 #define PPC_PTE_M (1 << 4)
127 #define PPC_PTE_G (1 << 3)
128 #define PPC_PTE_PP_NO 0
129 #define PPC_PTE_PP_RO 1
130 #define PPC_PTE_PP_RW 2
139 sdr1 = pt_base | (pt_mask >> 10);
140 asm volatile (
"mtsdr1 %0" : :
"r"(sdr1));
145 uint32_t hash = (vsid & 0x7ffff) ^ ((vaddr >> 12) & 0xffff);
149 pteg = (
ppc_pte_t *)(pt_base + ((hash & pt_mask) << 6));
150 for (i = 0; i < 8; i++)
154 pteg[i].
vsid_api = PPC_PTE_V | (vsid << 7) | ((vaddr >> 22) & 0x3f);
160 #ifdef POK_NEEDS_DEBUG
161 printf (
"pok_insert_pte: no free entry\n");
171 #ifdef POK_NEEDS_DEBUG
172 printf(
"isi_int: part=%d, pc=%x msr=%x\n",
173 pok_current_partition, pc, msr);
175 if (msr & ((1 << 28) | (1 << 27)))
177 printf (
" Bad access\n");
190 pok_insert_pte (pok_current_partition, vaddr, v);
195 #ifdef POK_NEEDS_DEBUG
196 printf(
"[DEBUG] Infinite loop in pok_arch_isi_int\n");
205 #ifdef POK_NEEDS_DEBUG
206 printf(
"dsi_int: part=%d, dar=%x dsisr=%x\n",
207 pok_current_partition, dar, dsisr);
210 if (dsisr & (1 << 30))
219 pok_insert_pte (pok_current_partition, vaddr, v);
223 #ifdef POK_NEEDS_DEBUG
224 printf(
"[DEBUG] Infinite loop in pok_arch_dsi_int\n");