Skip to content

Commit 435440d

Browse files
author
seppel
committedJul 13, 2011
faster effective_to_physical_address
1 parent 02efc6f commit 435440d

File tree

4 files changed

+35
-19
lines changed

4 files changed

+35
-19
lines changed
 

‎ChangeLog

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
PearPC ChangeLog
22
==================
33

4-
version 0.5pre (not yet released):
4+
version 0.6pre (not yet released):
5+
6+
version 0.5 (released 13. July 2011):
57
- slightly better code for lmw/stmw opcodes
68
- use "GNU as" instead of nasm
79
- use -mdynamic-no-pic on *darwin
8-
- fixed strict-aliasing problems
10+
- fixed some strict-aliasing problems
911
- JITC: AMD64 support
10-
- compiles with gcc 4.3
12+
- compiles with gcc 4.3, 4.4, 4.5
1113

1214
version 0.4 (released 20. December 2005):
1315
- CPU: stfiwx implemented

‎Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SUBDIRS = doc src scripts
55

66
dist2: distdir
77
-chmod -R a+r $(distdir)
8-
BZIP2=$(BZIP2_ENV) $(TAR) chojf $(distdir).tar.bz2 $(distdir)
8+
BZIP2=$(BZIP2_ENV) $(AMTAR) chojf $(distdir).tar.bz2 $(distdir)
99
-rm -rf $(distdir)
1010

1111
dist-all2: dist2

‎src/cpu/cpu_jitc_x86_64/jitc_mmu.S

+28-15
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,24 @@ ppc_pte_protection:
154154

155155
damageframebuffer:
156156
push %rax
157+
push %rbx
157158
push %rcx
159+
push %rdx
158160
push %rsi
159161
push %rdi
160162
push %r8
161163
mov %edi, %ebx
162164
sub %edi, IO_GCARD_FRAMEBUFFER_PA_START
163165
call EXTERN(damageFrameBufferExt)
166+
mov %edi, %ebx
167+
sub %edi, IO_GCARD_FRAMEBUFFER_PA_START-4095
168+
call EXTERN(damageFrameBufferExt)
164169
pop %r8
165170
pop %rdi
166171
pop %rsi
172+
pop %rdx
167173
pop %rcx
174+
pop %rbx
168175
pop %rax
169176
ret
170177

@@ -214,10 +221,11 @@ damageframebuffer:
214221
ret 8; \
215222
4: \
216223
cmp %edx, IO_GCARD_FRAMEBUFFER_PA_START; \
217-
jmp 5f; \
218-
/* jb 5f;*/ \
224+
jb 5f; \
219225
cmp %edx, IO_GCARD_FRAMEBUFFER_PA_END; \
220226
ja 5f; \
227+
mov %ebx, %edx; \
228+
call damageframebuffer; \
221229
sub %edx, IO_GCARD_FRAMEBUFFER_PA_START; \
222230
sub %eax, IO_GCARD_FRAMEBUFFER_PA_START; \
223231
add %rdx, [EXTERN(gFrameBuffer)]; \
@@ -236,6 +244,7 @@ damageframebuffer:
236244
## param2: 0 for read, 8 for write
237245
## param3: data / code
238246
## param4: pt offset
247+
## r9d effective address
239248
#define pg_table_lookup(n, rw, datacode, offset) \
240249
mov %rax, [EXTERN(gMemory)]; \
241250
mov %eax, [%rax + %rbx + offset]; \
@@ -282,8 +291,9 @@ damageframebuffer:
282291
.if n==0; \
283292
/* add %rsp, 8; /* hash1, no longer needed */ \
284293
pop %rdx; \
294+
.else; \
285295
.endif; \
286-
pop %rax; /* the effective address */ \
296+
mov %eax, %r9d; /* the effective address */ \
287297
jne protection_fault_##rw##_##datacode; \
288298
\
289299
/* update R and C bits */ \
@@ -322,8 +332,7 @@ damageframebuffer:
322332
.if datacode==data; \
323333
4: \
324334
cmp %ebx, IO_GCARD_FRAMEBUFFER_PA_START; \
325-
/* jb 5f;*/ \
326-
jmp 5f; \
335+
jb 5f; \
327336
cmp %ebx, IO_GCARD_FRAMEBUFFER_PA_END; \
328337
ja 5f; \
329338
call damageframebuffer; \
@@ -441,7 +450,7 @@ EXPORT(ppc_effective_to_physical_code):
441450

442451
# %ebx = hash1
443452

444-
push %rax
453+
mov %r9d, %eax
445454
push %rbx # das brauch ich
446455

447456
and %ebx, [curCPU(pagetable_hashmask)]
@@ -477,7 +486,7 @@ EXPORT(ppc_effective_to_physical_code):
477486

478487
# page lookup failed --> throw exception
479488

480-
pop %rax
489+
mov %eax, %r9d
481490
pop %rdx # return address is no longer needed
482491
pop %rcx # bytes to roll back
483492
add %rsp, %rcx
@@ -555,7 +564,7 @@ ppc_effective_to_physical_data_read:
555564

556565
# %ebx = hash1
557566

558-
push %rax
567+
mov %r9d, %eax
559568
push %rbx # das brauch ich
560569

561570
and %ebx, [curCPU(pagetable_hashmask)]
@@ -591,7 +600,7 @@ ppc_effective_to_physical_data_read:
591600

592601
# page lookup failed --> throw exception
593602

594-
pop %rax
603+
mov %eax, %r9d
595604
pop %rdx # return address is no longer needed
596605
pop %rcx # bytes to roll back
597606
add %rsp, %rcx
@@ -662,7 +671,7 @@ ppc_effective_to_physical_data_write:
662671

663672
# %ebx = hash1
664673

665-
push %rax
674+
mov %r9d, %eax
666675
push %rbx # das brauch ich
667676

668677
and %ebx, [curCPU(pagetable_hashmask)]
@@ -699,7 +708,7 @@ ppc_effective_to_physical_data_write:
699708

700709
# page lookup failed --> throw exception
701710

702-
pop %rax
711+
mov %eax, %r9d
703712
pop %rdx # return address is no longer needed
704713
pop %rbx # bytes to roll back
705714
add %rsp, %rbx
@@ -723,7 +732,8 @@ EXPORT(ppc_write_effective_byte_asm):
723732
push %rdx
724733
push 16 # roll back 16 bytes in case of exception
725734
call ppc_effective_to_physical_data_write
726-
pop %rdx
735+
mov %edx, [%rsp]
736+
lea %rsp, [%rsp+8]
727737
jc 1f
728738
mov [%rax], %dl
729739
ret
@@ -753,7 +763,8 @@ EXPORT(ppc_write_effective_half_asm):
753763
push %rdx
754764
push 16 # roll back 16 bytes in case of exception
755765
call ppc_effective_to_physical_data_write
756-
pop %rdx
766+
mov %edx, [%rsp]
767+
lea %rsp, [%rsp+8]
757768
jc 2f
758769
mov [%rax], %dh
759770
mov [%rax+1], %dl
@@ -818,7 +829,8 @@ EXPORT(ppc_write_effective_word_asm):
818829
push %rdx
819830
push 16 # roll back 16 bytes in case of exception
820831
call ppc_effective_to_physical_data_write
821-
pop %rdx
832+
mov %edx, [%rsp]
833+
lea %rsp, [%rsp+8]
822834
jc 2f
823835
mov [%rax], %edx
824836
ret
@@ -925,7 +937,8 @@ EXPORT(ppc_write_effective_dword_asm):
925937
push %rdx
926938
push 16 # roll back 16 bytes in case of exception
927939
call ppc_effective_to_physical_data_write
928-
pop %rdx
940+
mov %rdx, [%rsp]
941+
lea %rsp, [%rsp+8]
929942
jc 2f
930943
mov [%rax], %rdx
931944
ret

‎src/cpu/cpu_jitc_x86_64/ppc_mmu.cc

+1
Original file line numberDiff line numberDiff line change
@@ -3066,6 +3066,7 @@ JITCFlow ppc_opc_gen_stfd(JITC &jitc)
30663066

30673067
jitc.asmResolveFixup(fixup2, jitc.asmHERE());
30683068
#else
3069+
jitc.asmALU32(X86_MOV, RSI, jitc.pc);
30693070
jitc.asmCALL((NativeAddress)ppc_write_effective_dword_asm);
30703071
#endif
30713072
return flowEndBlock;

0 commit comments

Comments
 (0)
Please sign in to comment.