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