Commit 0f3955e2d28d71bc18935913e0bc2c5d134b1568
1 parent
4bf5801d
target-ppc: convert software TLB instructions to TCG
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5819 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
5 changed files
with
36 additions
and
42 deletions
target-ppc/helper.h
| @@ -139,4 +139,11 @@ DEF_HELPER_2(efdcmplt, i32, i64, i64) | @@ -139,4 +139,11 @@ DEF_HELPER_2(efdcmplt, i32, i64, i64) | ||
| 139 | DEF_HELPER_2(efdcmpgt, i32, i64, i64) | 139 | DEF_HELPER_2(efdcmpgt, i32, i64, i64) |
| 140 | DEF_HELPER_2(efdcmpeq, i32, i64, i64) | 140 | DEF_HELPER_2(efdcmpeq, i32, i64, i64) |
| 141 | 141 | ||
| 142 | +#if !defined(CONFIG_USER_ONLY) | ||
| 143 | +DEF_HELPER_1(load_6xx_tlbd, void, tl) | ||
| 144 | +DEF_HELPER_1(load_6xx_tlbi, void, tl) | ||
| 145 | +DEF_HELPER_1(load_74xx_tlbd, void, tl) | ||
| 146 | +DEF_HELPER_1(load_74xx_tlbi, void, tl) | ||
| 147 | +#endif | ||
| 148 | + | ||
| 142 | #include "def-helper.h" | 149 | #include "def-helper.h" |
target-ppc/op.c
| @@ -378,34 +378,6 @@ void OPPROTO op_slbie_64 (void) | @@ -378,34 +378,6 @@ void OPPROTO op_slbie_64 (void) | ||
| 378 | #endif | 378 | #endif |
| 379 | #endif | 379 | #endif |
| 380 | 380 | ||
| 381 | -#if !defined(CONFIG_USER_ONLY) | ||
| 382 | -/* PowerPC 602/603/755 software TLB load instructions */ | ||
| 383 | -void OPPROTO op_6xx_tlbld (void) | ||
| 384 | -{ | ||
| 385 | - do_load_6xx_tlb(0); | ||
| 386 | - RETURN(); | ||
| 387 | -} | ||
| 388 | - | ||
| 389 | -void OPPROTO op_6xx_tlbli (void) | ||
| 390 | -{ | ||
| 391 | - do_load_6xx_tlb(1); | ||
| 392 | - RETURN(); | ||
| 393 | -} | ||
| 394 | - | ||
| 395 | -/* PowerPC 74xx software TLB load instructions */ | ||
| 396 | -void OPPROTO op_74xx_tlbld (void) | ||
| 397 | -{ | ||
| 398 | - do_load_74xx_tlb(0); | ||
| 399 | - RETURN(); | ||
| 400 | -} | ||
| 401 | - | ||
| 402 | -void OPPROTO op_74xx_tlbli (void) | ||
| 403 | -{ | ||
| 404 | - do_load_74xx_tlb(1); | ||
| 405 | - RETURN(); | ||
| 406 | -} | ||
| 407 | -#endif | ||
| 408 | - | ||
| 409 | /* 601 specific */ | 381 | /* 601 specific */ |
| 410 | void OPPROTO op_load_601_rtcl (void) | 382 | void OPPROTO op_load_601_rtcl (void) |
| 411 | { | 383 | { |
target-ppc/op_helper.c
| @@ -2460,7 +2460,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | @@ -2460,7 +2460,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) | ||
| 2460 | 2460 | ||
| 2461 | /* Software driven TLBs management */ | 2461 | /* Software driven TLBs management */ |
| 2462 | /* PowerPC 602/603 software TLB load instructions helpers */ | 2462 | /* PowerPC 602/603 software TLB load instructions helpers */ |
| 2463 | -void do_load_6xx_tlb (int is_code) | 2463 | +static void helper_load_6xx_tlb (target_ulong new_EPN, int is_code) |
| 2464 | { | 2464 | { |
| 2465 | target_ulong RPN, CMP, EPN; | 2465 | target_ulong RPN, CMP, EPN; |
| 2466 | int way; | 2466 | int way; |
| @@ -2482,11 +2482,22 @@ void do_load_6xx_tlb (int is_code) | @@ -2482,11 +2482,22 @@ void do_load_6xx_tlb (int is_code) | ||
| 2482 | } | 2482 | } |
| 2483 | #endif | 2483 | #endif |
| 2484 | /* Store this TLB */ | 2484 | /* Store this TLB */ |
| 2485 | - ppc6xx_tlb_store(env, (uint32_t)(T0 & TARGET_PAGE_MASK), | 2485 | + ppc6xx_tlb_store(env, (uint32_t)(new_EPN & TARGET_PAGE_MASK), |
| 2486 | way, is_code, CMP, RPN); | 2486 | way, is_code, CMP, RPN); |
| 2487 | } | 2487 | } |
| 2488 | 2488 | ||
| 2489 | -void do_load_74xx_tlb (int is_code) | 2489 | +void helper_load_6xx_tlbd (target_ulong EPN) |
| 2490 | +{ | ||
| 2491 | + helper_load_6xx_tlb(EPN, 0); | ||
| 2492 | +} | ||
| 2493 | + | ||
| 2494 | +void helper_load_6xx_tlbi (target_ulong EPN) | ||
| 2495 | +{ | ||
| 2496 | + helper_load_6xx_tlb(EPN, 1); | ||
| 2497 | +} | ||
| 2498 | + | ||
| 2499 | +/* PowerPC 74xx software TLB load instructions helpers */ | ||
| 2500 | +static void helper_load_74xx_tlb (target_ulong new_EPN, int is_code) | ||
| 2490 | { | 2501 | { |
| 2491 | target_ulong RPN, CMP, EPN; | 2502 | target_ulong RPN, CMP, EPN; |
| 2492 | int way; | 2503 | int way; |
| @@ -2503,10 +2514,20 @@ void do_load_74xx_tlb (int is_code) | @@ -2503,10 +2514,20 @@ void do_load_74xx_tlb (int is_code) | ||
| 2503 | } | 2514 | } |
| 2504 | #endif | 2515 | #endif |
| 2505 | /* Store this TLB */ | 2516 | /* Store this TLB */ |
| 2506 | - ppc6xx_tlb_store(env, (uint32_t)(T0 & TARGET_PAGE_MASK), | 2517 | + ppc6xx_tlb_store(env, (uint32_t)(new_EPN & TARGET_PAGE_MASK), |
| 2507 | way, is_code, CMP, RPN); | 2518 | way, is_code, CMP, RPN); |
| 2508 | } | 2519 | } |
| 2509 | 2520 | ||
| 2521 | +void helper_load_74xx_tlbd (target_ulong EPN) | ||
| 2522 | +{ | ||
| 2523 | + helper_load_74xx_tlb(EPN, 0); | ||
| 2524 | +} | ||
| 2525 | + | ||
| 2526 | +void helper_load_74xx_tlbi (target_ulong EPN) | ||
| 2527 | +{ | ||
| 2528 | + helper_load_74xx_tlb(EPN, 1); | ||
| 2529 | +} | ||
| 2530 | + | ||
| 2510 | static always_inline target_ulong booke_tlb_to_page_size (int size) | 2531 | static always_inline target_ulong booke_tlb_to_page_size (int size) |
| 2511 | { | 2532 | { |
| 2512 | return 1024 << (2 * size); | 2533 | return 1024 << (2 * size); |
target-ppc/op_helper.h
| @@ -67,8 +67,6 @@ void do_rfi (void); | @@ -67,8 +67,6 @@ void do_rfi (void); | ||
| 67 | void do_rfid (void); | 67 | void do_rfid (void); |
| 68 | void do_hrfid (void); | 68 | void do_hrfid (void); |
| 69 | #endif | 69 | #endif |
| 70 | -void do_load_6xx_tlb (int is_code); | ||
| 71 | -void do_load_74xx_tlb (int is_code); | ||
| 72 | #endif | 70 | #endif |
| 73 | 71 | ||
| 74 | /* POWER / PowerPC 601 specific helpers */ | 72 | /* POWER / PowerPC 601 specific helpers */ |
target-ppc/translate.c
| @@ -4965,8 +4965,7 @@ GEN_HANDLER2(tlbld_6xx, "tlbld", 0x1F, 0x12, 0x1E, 0x03FF0001, PPC_6xx_TLB) | @@ -4965,8 +4965,7 @@ GEN_HANDLER2(tlbld_6xx, "tlbld", 0x1F, 0x12, 0x1E, 0x03FF0001, PPC_6xx_TLB) | ||
| 4965 | GEN_EXCP_PRIVOPC(ctx); | 4965 | GEN_EXCP_PRIVOPC(ctx); |
| 4966 | return; | 4966 | return; |
| 4967 | } | 4967 | } |
| 4968 | - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]); | ||
| 4969 | - gen_op_6xx_tlbld(); | 4968 | + gen_helper_load_6xx_tlbd(cpu_gpr[rB(ctx->opcode)]); |
| 4970 | #endif | 4969 | #endif |
| 4971 | } | 4970 | } |
| 4972 | 4971 | ||
| @@ -4980,8 +4979,7 @@ GEN_HANDLER2(tlbli_6xx, "tlbli", 0x1F, 0x12, 0x1F, 0x03FF0001, PPC_6xx_TLB) | @@ -4980,8 +4979,7 @@ GEN_HANDLER2(tlbli_6xx, "tlbli", 0x1F, 0x12, 0x1F, 0x03FF0001, PPC_6xx_TLB) | ||
| 4980 | GEN_EXCP_PRIVOPC(ctx); | 4979 | GEN_EXCP_PRIVOPC(ctx); |
| 4981 | return; | 4980 | return; |
| 4982 | } | 4981 | } |
| 4983 | - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]); | ||
| 4984 | - gen_op_6xx_tlbli(); | 4982 | + gen_helper_load_6xx_tlbi(cpu_gpr[rB(ctx->opcode)]); |
| 4985 | #endif | 4983 | #endif |
| 4986 | } | 4984 | } |
| 4987 | 4985 | ||
| @@ -4996,8 +4994,7 @@ GEN_HANDLER2(tlbld_74xx, "tlbld", 0x1F, 0x12, 0x1E, 0x03FF0001, PPC_74xx_TLB) | @@ -4996,8 +4994,7 @@ GEN_HANDLER2(tlbld_74xx, "tlbld", 0x1F, 0x12, 0x1E, 0x03FF0001, PPC_74xx_TLB) | ||
| 4996 | GEN_EXCP_PRIVOPC(ctx); | 4994 | GEN_EXCP_PRIVOPC(ctx); |
| 4997 | return; | 4995 | return; |
| 4998 | } | 4996 | } |
| 4999 | - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]); | ||
| 5000 | - gen_op_74xx_tlbld(); | 4997 | + gen_helper_load_74xx_tlbd(cpu_gpr[rB(ctx->opcode)]); |
| 5001 | #endif | 4998 | #endif |
| 5002 | } | 4999 | } |
| 5003 | 5000 | ||
| @@ -5011,8 +5008,7 @@ GEN_HANDLER2(tlbli_74xx, "tlbli", 0x1F, 0x12, 0x1F, 0x03FF0001, PPC_74xx_TLB) | @@ -5011,8 +5008,7 @@ GEN_HANDLER2(tlbli_74xx, "tlbli", 0x1F, 0x12, 0x1F, 0x03FF0001, PPC_74xx_TLB) | ||
| 5011 | GEN_EXCP_PRIVOPC(ctx); | 5008 | GEN_EXCP_PRIVOPC(ctx); |
| 5012 | return; | 5009 | return; |
| 5013 | } | 5010 | } |
| 5014 | - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]); | ||
| 5015 | - gen_op_74xx_tlbli(); | 5011 | + gen_helper_load_74xx_tlbi(cpu_gpr[rB(ctx->opcode)]); |
| 5016 | #endif | 5012 | #endif |
| 5017 | } | 5013 | } |
| 5018 | 5014 |