/[pcsx2_0.9.7]/trunk/pcsx2/IPU/acoroutine.S
ViewVC logotype

Contents of /trunk/pcsx2/IPU/acoroutine.S

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 5 months ago) by william
File size: 1622 byte(s)
committing r3113 initial commit again...
1 .intel_syntax noprefix
2
3 .extern g_pCurrentRoutine
4
5 .globl so_call
6 so_call:
7 mov eax, dword ptr [esp+4]
8 test dword ptr [eax+24], 1
9 jnz RestoreRegs
10 mov [eax+8], ebx
11 mov [eax+12], esi
12 mov [eax+16], edi
13 mov [eax+20], ebp
14 mov dword ptr [eax+24], 1
15 jmp CallFn
16 RestoreRegs:
17 // have to load and save at the same time
18 mov ecx, [eax+8]
19 mov edx, [eax+12]
20 mov [eax+8], ebx
21 mov [eax+12], esi
22 mov ebx, ecx
23 mov esi, edx
24 mov ecx, [eax+16]
25 mov edx, [eax+20]
26 mov [eax+16], edi
27 mov [eax+20], ebp
28 mov edi, ecx
29 mov ebp, edx
30
31 CallFn:
32 mov [g_pCurrentRoutine], eax
33 mov ecx, esp
34 mov esp, [eax+4]
35 mov [eax+4], ecx
36
37 jmp dword ptr [eax]
38
39 .globl so_resume
40 so_resume:
41 mov eax, [g_pCurrentRoutine]
42 mov ecx, [eax+8]
43 mov edx, [eax+12]
44 mov [eax+8], ebx
45 mov [eax+12], esi
46 mov ebx, ecx
47 mov esi, edx
48 mov ecx, [eax+16]
49 mov edx, [eax+20]
50 mov [eax+16], edi
51 mov [eax+20], ebp
52 mov edi, ecx
53 mov ebp, edx
54
55 // put the return address in pcalladdr
56 mov ecx, [esp]
57 mov [eax], ecx
58 add esp, 4 // remove the return address
59
60 // swap stack pointers
61 mov ecx, [eax+4]
62 mov [eax+4], esp
63 mov esp, ecx
64 ret
65
66 .globl so_exit
67 so_exit:
68 mov eax, [g_pCurrentRoutine]
69 mov esp, [eax+4]
70 mov ebx, [eax+8]
71 mov esi, [eax+12]
72 mov edi, [eax+16]
73 mov ebp, [eax+20]
74 ret
75

  ViewVC Help
Powered by ViewVC 1.1.22