@@ -154,17 +154,24 @@ ppc_pte_protection:
154
154
155
155
damageframebuffer:
156
156
push %rax
157
+ push %rbx
157
158
push %rcx
159
+ push %rdx
158
160
push %rsi
159
161
push %rdi
160
162
push %r8
161
163
mov %edi , %ebx
162
164
sub %edi , IO_GCARD_FRAMEBUFFER_PA_START
163
165
call EXTERN(damageFrameBufferExt)
166
+ mov %edi , %ebx
167
+ sub %edi , IO_GCARD_FRAMEBUFFER_PA_START-4095
168
+ call EXTERN(damageFrameBufferExt)
164
169
pop %r8
165
170
pop %rdi
166
171
pop %rsi
172
+ pop %rdx
167
173
pop %rcx
174
+ pop %rbx
168
175
pop %rax
169
176
ret
170
177
@@ -214,10 +221,11 @@ damageframebuffer:
214
221
ret 8 ; \
215
222
4: \
216
223
cmp %edx , IO_GCARD_FRAMEBUFFER_PA_START; \
217
- jmp 5f; \
218
- /* jb 5f;*/ \
224
+ jb 5f; \
219
225
cmp %edx , IO_GCARD_FRAMEBUFFER_PA_END; \
220
226
ja 5f; \
227
+ mov %ebx , %edx ; \
228
+ call damageframebuffer; \
221
229
sub %edx , IO_GCARD_FRAMEBUFFER_PA_START; \
222
230
sub %eax , IO_GCARD_FRAMEBUFFER_PA_START; \
223
231
add %rdx , [EXTERN(gFrameBuffer)]; \
@@ -236,6 +244,7 @@ damageframebuffer:
236
244
## param2: 0 for read, 8 for write
237
245
## param3: data / code
238
246
## param4: pt offset
247
+ ## r9d effective address
239
248
#define pg_table_lookup(n, rw, datacode, offset) \
240
249
mov %rax , [EXTERN(gMemory)]; \
241
250
mov %eax , [%rax + %rbx + offset]; \
@@ -282,8 +291,9 @@ damageframebuffer:
282
291
.if n==0 ; \
283
292
/* add %rsp, 8; /* hash1, no longer needed */ \
284
293
pop %rdx ; \
294
+ .else ; \
285
295
.endif ; \
286
- pop %rax ; /* the effective address */ \
296
+ mov %eax , %r9d ; /* the effective address */ \
287
297
jne protection_fault_##rw##_##datacode; \
288
298
\
289
299
/* update R and C bits */ \
@@ -322,8 +332,7 @@ damageframebuffer:
322
332
.if datacode==data; \
323
333
4: \
324
334
cmp %ebx , IO_GCARD_FRAMEBUFFER_PA_START; \
325
- /* jb 5f;*/ \
326
- jmp 5f; \
335
+ jb 5f; \
327
336
cmp %ebx , IO_GCARD_FRAMEBUFFER_PA_END; \
328
337
ja 5f; \
329
338
call damageframebuffer; \
@@ -441,7 +450,7 @@ EXPORT(ppc_effective_to_physical_code):
441
450
442
451
# %ebx = hash1
443
452
444
- push %rax
453
+ mov %r9d , %eax
445
454
push %rbx # das brauch ich
446
455
447
456
and %ebx , [curCPU(pagetable_hashmask)]
@@ -477,7 +486,7 @@ EXPORT(ppc_effective_to_physical_code):
477
486
478
487
# page lookup failed --> throw exception
479
488
480
- pop %rax
489
+ mov %eax , %r9d
481
490
pop %rdx # return address is no longer needed
482
491
pop %rcx # bytes to roll back
483
492
add %rsp , %rcx
@@ -555,7 +564,7 @@ ppc_effective_to_physical_data_read:
555
564
556
565
# %ebx = hash1
557
566
558
- push %rax
567
+ mov %r9d , %eax
559
568
push %rbx # das brauch ich
560
569
561
570
and %ebx , [curCPU(pagetable_hashmask)]
@@ -591,7 +600,7 @@ ppc_effective_to_physical_data_read:
591
600
592
601
# page lookup failed --> throw exception
593
602
594
- pop %rax
603
+ mov %eax , %r9d
595
604
pop %rdx # return address is no longer needed
596
605
pop %rcx # bytes to roll back
597
606
add %rsp , %rcx
@@ -662,7 +671,7 @@ ppc_effective_to_physical_data_write:
662
671
663
672
# %ebx = hash1
664
673
665
- push %rax
674
+ mov %r9d , %eax
666
675
push %rbx # das brauch ich
667
676
668
677
and %ebx , [curCPU(pagetable_hashmask)]
@@ -699,7 +708,7 @@ ppc_effective_to_physical_data_write:
699
708
700
709
# page lookup failed --> throw exception
701
710
702
- pop %rax
711
+ mov %eax , %r9d
703
712
pop %rdx # return address is no longer needed
704
713
pop %rbx # bytes to roll back
705
714
add %rsp , %rbx
@@ -723,7 +732,8 @@ EXPORT(ppc_write_effective_byte_asm):
723
732
push %rdx
724
733
push 16 # roll back 16 bytes in case of exception
725
734
call ppc_effective_to_physical_data_write
726
- pop %rdx
735
+ mov %edx , [%rsp ]
736
+ lea %rsp , [%rsp +8]
727
737
jc 1f
728
738
mov [%rax ], %dl
729
739
ret
@@ -753,7 +763,8 @@ EXPORT(ppc_write_effective_half_asm):
753
763
push %rdx
754
764
push 16 # roll back 16 bytes in case of exception
755
765
call ppc_effective_to_physical_data_write
756
- pop %rdx
766
+ mov %edx , [%rsp ]
767
+ lea %rsp , [%rsp +8]
757
768
jc 2f
758
769
mov [%rax ], %dh
759
770
mov [%rax +1], %dl
@@ -818,7 +829,8 @@ EXPORT(ppc_write_effective_word_asm):
818
829
push %rdx
819
830
push 16 # roll back 16 bytes in case of exception
820
831
call ppc_effective_to_physical_data_write
821
- pop %rdx
832
+ mov %edx , [%rsp ]
833
+ lea %rsp , [%rsp +8]
822
834
jc 2f
823
835
mov [%rax ], %edx
824
836
ret
@@ -925,7 +937,8 @@ EXPORT(ppc_write_effective_dword_asm):
925
937
push %rdx
926
938
push 16 # roll back 16 bytes in case of exception
927
939
call ppc_effective_to_physical_data_write
928
- pop %rdx
940
+ mov %rdx , [%rsp ]
941
+ lea %rsp , [%rsp +8]
929
942
jc 2f
930
943
mov [%rax ], %rdx
931
944
ret
0 commit comments