1; Copyright (c) 2009 The Chromium Authors. All rights reserved.
2; Use of this source code is governed by a BSD-style license that can be
3; found in the LICENSE file.
4
5; This file is just a convenient place for experimenting with x86 encodings.
6
7BITS 32
8
9; sldt to detect which processor we are running on.
10sldt eax
11sidt [esp]
12sidt [esp+2]
13
14lea eax, [fs:0]
15
16mov eax, [fs:0x18]
17
18mov ebx, 0x1234567
19mov eax, 0x1234567
20
21rdtsc
22
23push eax
24pop eax
25
26mov eax, [ecx]
27mov eax, [esp+4]
28mov ebx, [esp+4]
29
30lock xadd [eax], eax
31lock xadd [ecx], ecx
32lock xadd [ecx], eax
33
34jmp eax
35jmp edx
36
37lodsd
38
39rep stosb
40
41rep movsb
42
43mov eax, ebx
44mov edx, edx
45
46mov eax, eax
47
48stosd
49
50add eax, eax
51add edi, ecx
52
53and eax, 0x0000ffff
54and ecx, 0x0000ffff
55and edx, 0x0000ffff
56
57add edi, 0x12345
58add eax, 0x12345
59add ecx, 0x12345
60
61push 0x12
62push BYTE 0x12
63
64mov eax, [ebp+8]
65
66mov eax, 0x1234
67mov [fs:0], eax
68
69call 0x1234
70
71call eax
72call ecx
73
74add ebx, BYTE 3
75or ecx, 0xffff
76or eax, 0xffff
77
78mov eax, [esp+24]
79
80movsd
81movsb
82
83jmp blah
84blah:
85jmp blah
86
87cmp eax, 0x1234567
88cmp ecx, 0x1234567
89je NEAR blah2
90jo NEAR blah2
91blah2:
92
93add esp, 12
94add esp, BYTE 12
95sub esp, BYTE 12
96
97cmp eax, 12
98cmp ecx, BYTE 12
99
100cmp WORD [esp+6], 0x6666
101
102push DWORD [edi-4]
103push DWORD [edi-8]
104push DWORD [edi-12]
105push DWORD [edi-16]
106push DWORD [edi-20]
107
108x:
109loop x
110
111mov edx, [fs:0x4]
112
113cmp ecx, ecx
114cmp ecx, ebx
115cmp ebx, ebx
116
117mov eax,[dword fs:0x24]
118mov eax,[fs:0x24]
119
120mov ecx,[dword fs:0x24]
121mov ecx,[fs:0x24]
122
123mov eax, [ebx+12]
124mov ebx, [ebx+12]
125
126cmovo eax, eax
127
128mov eax, eax
129
130xchg eax, ebx
131xchg ebx, ecx
132xchg ebx, [esp+4]
133