1 | ;; @file
|
---|
2 | ;
|
---|
3 | ; tstProg-1a assembly.
|
---|
4 |
|
---|
5 | ; Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
6 | ;
|
---|
7 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
8 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
9 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
10 | ; General Public License as published by the Free Software Foundation,
|
---|
11 | ; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
12 | ; distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
13 | ; be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
14 | ;
|
---|
15 | ; If you received this file as part of a commercial VirtualBox
|
---|
16 | ; distribution, then only the terms of your commercial VirtualBox
|
---|
17 | ; license agreement apply instead of the previous paragraph.
|
---|
18 |
|
---|
19 |
|
---|
20 | %include "VBox/nasm.mac"
|
---|
21 |
|
---|
22 | BEGINCODE
|
---|
23 | extern NAME(TSTCompareCtx)
|
---|
24 | extern NAME(TSTSaveCtx)
|
---|
25 |
|
---|
26 |
|
---|
27 | BEGINPROC tstProg1ForeverAsm
|
---|
28 | mov edx, [esp + 4] ; pCtx1
|
---|
29 | mov ecx, [esp + 8] ; pCtx2
|
---|
30 | push 0 ; counter
|
---|
31 |
|
---|
32 | ; a little marker for debugging.
|
---|
33 | mov eax, ds
|
---|
34 | mov gs, eax
|
---|
35 | mov fs, eax
|
---|
36 |
|
---|
37 | ;
|
---|
38 | ; Get initial context.
|
---|
39 | ; The state must be 100% correct here, which means
|
---|
40 | ; we assume both ctx structs are initially equal and do compare them
|
---|
41 | ; like we would in the loop.
|
---|
42 | ;
|
---|
43 | push ecx
|
---|
44 | push edx
|
---|
45 | call NAME(TSTCompareCtx)
|
---|
46 | lea esp, [esp + 8]
|
---|
47 | or eax, eax
|
---|
48 | jz ok
|
---|
49 | int03
|
---|
50 | ok:
|
---|
51 | ; now we actually get the first state.
|
---|
52 | push edx
|
---|
53 | call NAME(TSTSaveCtx)
|
---|
54 | lea esp, [esp + 4]
|
---|
55 |
|
---|
56 | ;
|
---|
57 | ; Forever.
|
---|
58 | ;
|
---|
59 | daloop:
|
---|
60 | xchg ebx, [esp]
|
---|
61 | lea ebx, [ebx + 1]
|
---|
62 | xchg ebx, [esp]
|
---|
63 | ; Save context.
|
---|
64 | push ecx
|
---|
65 | call NAME(TSTSaveCtx)
|
---|
66 | lea esp, [esp + 4]
|
---|
67 |
|
---|
68 | ; Compare with original context.
|
---|
69 | push ecx
|
---|
70 | push edx
|
---|
71 | call NAME(TSTCompareCtx)
|
---|
72 | lea esp, [esp + 8]
|
---|
73 | or eax, eax
|
---|
74 | jz daloop
|
---|
75 |
|
---|
76 | ; not equal!
|
---|
77 | pop edx
|
---|
78 | shl edx, 16
|
---|
79 | or eax, edx
|
---|
80 | pop ebx
|
---|
81 | ret
|
---|
82 | ENDPROC tstProg1ForeverAsm
|
---|
83 |
|
---|
84 |
|
---|
85 |
|
---|