1; **
2; * @namespace   biewlib
3; * @file        biewlib/sysdep/ia32/qnx/cpu_info.asm
4; * @brief       This file contains function for retrieving CPU information for
5; *              32-bit Intel x86 compatible platform
6; * @version     -
7; * @remark      this source file is part of Binary vIEW project (BIEW).
8; *              The Binary vIEW (BIEW) is copyright (C) 1995 Nickols_K.
9; *              All rights reserved. This software is redistributable under the
10; *              licence given in the file "Licence.en" ("Licence.ru" in russian
11; *              translation) distributed in the BIEW archive.
12; * @note        Requires POSIX compatible development system
13; * @author      Andrew Golovnia
14; * @since       2001
15; * @note        Development, fixes and improvements
16; * @note        Code for QNX 4.xx + Watcom C 10.6 (depricated)
17;**
18
19.386p
20.387
21.model flat
22
23	public __OPS_nop_
24	public __OPS_std_
25	public __FOPS_nowait_
26	public __MOPS_std_
27	public __SSEOPS_std_
28
29.code
30
31;unsigned long __OPS_nop(volatile unsigned*)
32__OPS_nop_ proc near
33	push	edx
34	push	ecx
35	mov 	edx,eax
36	xor 	eax,eax
37on1:
38	cmp 	dword ptr [edx],0
39	jz  	on1
40on2:
41	cmp 	dword ptr [edx],0
42	jz		on3
43	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
44	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
45	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
46	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
47	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
48	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
49	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
50	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
51	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
52	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
53	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
54	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
55	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
56	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
57	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
58	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
59	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
60	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
61	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
62	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
63	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
64	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
65	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
66	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
67	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
68	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
69	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
70	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
71	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
72	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
73	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
74	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
75	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
76	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
77	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
78	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
79	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
80	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
81	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
82	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
83	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
84	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
85	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
86	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
87	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
88	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
89	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
90	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
91	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
92	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
93	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
94	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
95	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
96	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
97	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
98	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
99	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
100	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
101	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
102	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
103	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
104	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
105	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
106	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
107	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
108	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
109	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
110	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
111	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
112	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
113	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
114	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
115	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
116	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
117	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
118	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
119	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
120	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
121	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
122	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
123	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
124	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
125	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
126	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
127	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
128	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
129	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
130	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
131	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
132	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
133	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
134	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
135	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
136	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
137	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
138	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
139	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
140	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
141	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
142	db		90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
143	inc 	eax
144	jmp 	on2
145on3:
146	pop 	edx
147	pop 	ecx
148	ret
149__OPS_nop_ endp
150
151;unsigned long __OPS_std(volatile unsigned*,char*)
152__OPS_std_ proc near
153	push	ebx
154	push	ecx
155	push	esi
156	push	edi
157	mov 	esi,eax
158	mov 	edi,edx
159	xor 	eax,eax
160os1:
161	cmp 	dword ptr [esi],0
162	jz		os1
163os2:
164	cmp 	dword ptr [esi],0
165	jnz 	os3
166	jmp 	os4
167os3:
168	push	eax
169	mov 	eax,14h
170	mov 	ecx,7
171	mul 	ecx
172	imul	ecx
173	div 	ecx
174	idiv	ecx
175	add 	eax,ecx
176	adc 	eax,1
177	sub 	eax,ecx
178	sbb 	eax,1
179	push	esi
180	push	edi
181	mov 	esi,edi
182	movsd
183	call	os5
184	cmpsd
185	pop 	edi
186	pop 	esi
187	push	eax
188	push	edx
189	pop 	edx
190	pop 	eax
191	mov 	eax,14h
192	mov 	ecx,7
193	mul 	ecx
194	imul	ecx
195	div 	ecx
196	idiv	ecx
197	add 	eax,ecx
198	adc 	eax,1
199	sub 	eax,ecx
200	sbb 	eax,1
201	push	esi
202	push	edi
203	mov 	esi,edi
204	movsd
205	call	os5
206	cmpsd
207	pop 	edi
208	pop 	esi
209	push	eax
210	push	edx
211	pop 	edx
212	pop 	eax
213	mov 	eax,14h
214	mov 	ecx,7
215	mul 	ecx
216	imul	ecx
217	div 	ecx
218	idiv	ecx
219	add 	eax,ecx
220	adc 	eax,1
221	sub 	eax,ecx
222	sbb 	eax,1
223	push	esi
224	push	edi
225	mov 	esi,edi
226	movsd
227	call	os5
228	cmpsd
229	pop 	edi
230	pop 	esi
231	push	eax
232	push	edx
233	pop 	edx
234	pop 	eax
235	mov 	eax,14h
236	mov 	ecx,7
237	mul 	ecx
238	imul	ecx
239	div 	ecx
240	idiv	ecx
241	adc 	eax,1
242	sub 	eax,ecx
243	sbb 	eax,1
244	push	edx
245	pop 	edx
246	pop 	eax
247	inc 	eax
248	jmp 	os2
249os5:
250	ret
251os4:
252	pop 	edi
253	pop 	esi
254	pop 	ecx
255	pop 	ebx
256	ret
257__OPS_std_ endp
258
259;unsigned long __FOPS_nowait(volatile unsigned*,char*)
260__FOPS_nowait_ proc near
261	push	ebx
262	push	ecx
263	push	esi
264	push	edi
265	mov 	esi,eax
266	mov 	edi,edx
267	xor 	eax,eax
268fn1:
269	cmp 	dword ptr [esi],0
270	jz		fn1
271fn2:
272	cmp 	dword ptr [esi],0
273	jz		fn3
274	finit
275	fld 	tbyte ptr [edi+8]
276	fstp	tbyte ptr [edi+8]
277	fstp	st(1)
278	fldz
279	fld1
280	fcompp
281	fstsw	[edi+4]
282	fstcw	[edi]
283	fldcw	[edi]
284	fldpi
285	fstp	st(1)
286	fst 	st(2)
287	fst 	st(3)
288	f2xm1
289	fabs
290	fchs
291	fprem
292	fptan
293	fsqrt
294	frndint
295	faddp	st(1),st
296	fstp	st(1)
297	fmulp	st(1),st
298	fstp	st(1)
299	fld1
300	fstp	st(1)
301	fpatan
302	fstp	st(1)
303	fscale
304	fstp	st(1)
305	fdivp	st(1),st
306	fstp	st(1)
307	fsubrp	st(1),st
308	fstp	st(1)
309	fyl2x
310	fstp	st(1)
311	fyl2xp1
312	fstp	st(1)
313	fbld	tbyte ptr [edi+8]
314	fbstp	tbyte ptr [edi+8]
315	fild	word ptr [edi]
316	fistp	word ptr [edi]
317	fld 	tbyte ptr [edi+4]
318	fstp	tbyte ptr [edi+4]
319	fstp	st(1)
320	fldz
321	fld1
322	fcompp
323	fstsw	[edi+4]
324	fstcw	[edi]
325	fldcw	[edi]
326	fldpi
327	fstp	st(1)
328	fst 	st(2)
329	fst 	st(3)
330	f2xm1
331	fabs
332	fchs
333	fprem
334	fptan
335	fsqrt
336	frndint
337	faddp	st(1),st
338	fstp	st(1)
339	fmulp	st(1),st
340	fstp	st(1)
341	fld1
342	fstp	st(1)
343	fpatan
344	fstp	st(1)
345	fscale
346	fstp	st(1)
347	fdivp	st(1),st
348	fstp	st(1)
349	fsubrp	st(1),st
350	fstp	st(1)
351	fyl2x
352	fstp	st(1)
353	fyl2xp1
354	fstp	st(1)
355	fild	word ptr [edi]
356	fistp	word ptr [edi]
357	inc 	eax
358	jmp 	fn2
359fn3:
360	pop		edi
361	pop 	esi
362	pop 	ecx
363	pop 	ebx
364	ret
365__FOPS_nowait_ endp
366
367;unsigned long __MOPS_std(volatile unsigned*,char*)
368__MOPS_std_ proc near
369	push	ebx
370	push	ecx
371	push	esi
372	push	edi
373	mov 	esi,eax
374	mov 	edi,edx
375	xor 	eax,eax
376ms1:
377	cmp 	dword ptr [esi],0
378	jz		ms1
379ms2:
380	cmp 	dword ptr [esi],0
381	jz		ms3
382	db		00Fh,077h
383	db		00Fh,06Eh,0C0h
384	db		00Fh,06Bh,0C5h
385	db		00Fh,063h,0C4h
386	db		00Fh,067h,0C7h
387	db		00Fh,0FCh,0DAh
388	db		00Fh,0FEh,0E9h
389	db		00Fh,0E8h,0E6h
390	db		00Fh,0D8h,0DCh
391	db		00Fh,0DBh,0CBh
392	db		00Fh,076h,0C0h
393	db		00Fh,064h,0D2h
394	db		00Fh,0F5h,0FFh
395	db		00Fh,0D5h,0F6h
396	db		00Fh,0EBh,0D4h
397	db		00Fh,0F3h,0C6h
398	db		00Fh,0E2h,0CBh
399	db		00Fh,0F8h,0C9h
400	db		00Fh,0E9h,0D7h
401	db		00Fh,0D9h,0D9h
402	db		00Fh,06Ah,0C4h
403	db		00Fh,061h,0D0h
404	db		00Fh,0EFh,0E2h
405	db		00Fh,06Bh,0C5h
406	db		00Fh,063h,0C4h
407	db		00Fh,067h,0C7h
408	db		00Fh,0FCh,0DAh
409	db		00Fh,0FEh,0E9h
410	db		00Fh,0E8h,0E6h
411	db		00Fh,0D8h,0DCh
412	db		00Fh,0DBh,0CBh
413	db		00Fh,076h,0C0h
414	db		00Fh,064h,0D2h
415	db		00Fh,0F5h,0FFh
416	db		00Fh,0D5h,0F6h
417	db		00Fh,0EBh,0D4h
418	db		00Fh,0F3h,0C6h
419	db		00Fh,0E2h,0CBh
420	db		00Fh,0F8h,0C9h
421	db		00Fh,0E9h,0D7h
422	db		00Fh,0D9h,0D9h
423	db		00Fh,06Ah,0C4h
424	db		00Fh,061h,0D0h
425	db		00Fh,0EFh,0E2h
426	db		00Fh,077h
427	db		00Fh,06Eh,0C0h
428	db		00Fh,06Bh,0C5h
429	db		00Fh,063h,0C4h
430	db		00Fh,067h,0C7h
431	db		00Fh,0FCh,0DAh
432	db		00Fh,0FEh,0E9h
433	db		00Fh,0E8h,0E6h
434	db		00Fh,0D8h,0DCh
435	db		00Fh,0DBh,0CBh
436	db		00Fh,076h,0C0h
437	db		00Fh,064h,0D2h
438	db		00Fh,0F5h,0FFh
439	db		00Fh,0D5h,0F6h
440	db		00Fh,0EBh,0D4h
441	db		00Fh,0F3h,0C6h
442	db		00Fh,0E2h,0CBh
443	db		00Fh,0F8h,0C9h
444	db		00Fh,0E9h,0D7h
445	db		00Fh,0D9h,0D9h
446	db		00Fh,06Ah,0C4h
447	db		00Fh,061h,0D0h
448	db		00Fh,0EFh,0E2h
449	db		00Fh,06Bh,0C5h
450	db		00Fh,063h,0C4h
451	db		00Fh,067h,0C7h
452	db		00Fh,0FCh,0DAh
453	db		00Fh,0FEh,0E9h
454	db		00Fh,0E8h,0E6h
455	db		00Fh,0D8h,0DCh
456	db		00Fh,0DBh,0CBh
457	db		00Fh,076h,0C0h
458	db		00Fh,064h,0D2h
459	db		00Fh,0F5h,0FFh
460	db		00Fh,0D5h,0F6h
461	db		00Fh,0EBh,0D4h
462	db		00Fh,0F3h,0C6h
463	db		00Fh,0E2h,0CBh
464	db		00Fh,0F8h,0C9h
465	db		00Fh,0E9h,0D7h
466	db		00Fh,0D9h,0D9h
467	db		00Fh,06Ah,0C4h
468	db		00Fh,061h,0D0h
469	db		00Fh,0EFh,0E2h
470	inc 	eax
471	jmp 	ms2
472ms3:
473	pop		edi
474	pop 	esi
475	pop 	ecx
476	pop 	ebx
477	ret
478__MOPS_std_ endp
479
480;unsigned long __SSEOPS_std(volatile unsigned*,char*)
481__SSEOPS_std_ proc near
482	push	ebx
483	push	ecx
484	push	esi
485	push	edi
486	mov 	esi,edx
487	mov 	edi,ebx
488	xor 	eax,eax
489ss1:
490	cmp 	dword ptr [esi],0
491	jz		ss1
492ss2:
493	cmp 	dword ptr [esi],0
494	jz		ss3
495	db		00Fh,077h
496	db		00Fh,028h,007h
497	db		00Fh,016h,00Fh
498	db		00Fh,012h,017h
499	db		00Fh,010h,01Fh
500	db		00Fh,058h,0C1h
501	db		0F3h,00Fh,058h,0C1h
502	db		00Fh,02Dh,0C1h
503	db		00Fh,02Ch,0CAh
504	db		00Fh,05Fh,0C1h
505	db		0F3h,00Fh,05Fh,0C1h
506	db		00Fh,05Dh,0C1h
507	db		0F3h,00Fh,05Dh,0C1h
508	db		00Fh,059h,0C1h
509	db		0F3h,00Fh,059h,0C1h
510	db		00Fh,054h,0C1h
511	db		00Fh,056h,0C1h
512	db		00Fh,057h,0C9h
513	db		00Fh,05Eh,0C1h
514	db		0F3h,00Fh,05Eh,0C1h
515	db		00Fh,053h,0C1h
516	db		0F3h,00Fh,053h,0C1h
517	db		00Fh,052h,0C1h
518	db		0F3h,00Fh,052h,0C1h
519	db		00Fh,051h,0C1h
520	db		0F3h,00Fh,051h,0C1h
521	db		00Fh,05Ch,0C1h
522	db		0F3h,00Fh,05Ch,0C1h
523	db		00Fh,02Eh,0C1h
524	db		00Fh,015h,0C1h
525	db		00Fh,014h,0C1h
526	db		00Fh,077h
527	db		00Fh,028h,007h
528	db		00Fh,016h,00Fh
529	db		00Fh,012h,017h
530	db		00Fh,010h,01Fh
531	db		00Fh,058h,0C1h
532	db		0F3h,00Fh,058h,0C1h
533	db		00Fh,02Dh,0C1h
534	db		00Fh,02Ch,0CAh
535	db		00Fh,05Fh,0C1h
536	db		0F3h,00Fh,05Fh,0C1h
537	db		00Fh,05Dh,0C1h
538	db		0F3h,00Fh,05Dh,0C1h
539	db		00Fh,059h,0C1h
540	db		0F3h,00Fh,059h,0C1h
541	db		00Fh,054h,0C1h
542	db		00Fh,056h,0C1h
543	db		00Fh,057h,0C9h
544	db		00Fh,05Eh,0C1h
545	db		0F3h,00Fh,05Eh,0C1h
546	db		00Fh,053h,0C1h
547	db		0F3h,00Fh,053h,0C1h
548	db		00Fh,052h,0C1h
549	db		0F3h,00Fh,052h,0C1h
550	db		00Fh,051h,0C1h
551	db		0F3h,00Fh,051h,0C1h
552	db		00Fh,05Ch,0C1h
553	db		0F3h,00Fh,05Ch,0C1h
554	db		00Fh,02Eh,0C1h
555	db		00Fh,015h,0C1h
556	db		00Fh,014h,0C1h
557	inc 	eax
558	jmp 	ss2
559ss3:
560	pop		edi
561	pop 	esi
562	pop 	ecx
563	pop 	ebx
564	ret
565__SSEOPS_std_ endp
566
567	end