sig_x86.inc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. {$IFDEF FPC}
  2. {$PACKRECORDS C}
  3. {$ENDIF}
  4. {
  5. * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  6. *
  7. * @APPLE_LICENSE_HEADER_START@
  8. *
  9. * The contents of this file constitute Original Code as defined in and
  10. * are subject to the Apple Public Source License Version 1.1 (the
  11. * "License"). You may not use this file except in compliance with the
  12. * License. Please obtain a copy of the License at
  13. * http://www.apple.com/publicsource and read it before using this file.
  14. *
  15. * This Original Code and all software distributed under the License are
  16. * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  17. * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  18. * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
  20. * License for the specific language governing rights and limitations
  21. * under the License.
  22. *
  23. * @APPLE_LICENSE_HEADER_END@
  24. }
  25. {
  26. * @OSF_COPYRIGHT@
  27. }
  28. {
  29. * Mach Operating System
  30. * Copyright (c) 1991,1990,1989 Carnegie Mellon University
  31. * All Rights Reserved.
  32. *
  33. * Permission to use, copy, modify and distribute this software and its
  34. * documentation is hereby granted, provided that both the copyright
  35. * notice and this permission notice appear in all copies of the
  36. * software, derivative works or modified versions, and any portions
  37. * thereof, and that both notices appear in supporting documentation.
  38. *
  39. * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  40. * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  41. * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  42. *
  43. * Carnegie Mellon requests users of this software to return to
  44. *
  45. * Software Distribution Coordinator or [email protected]
  46. * School of Computer Science
  47. * Carnegie Mellon University
  48. * Pittsburgh PA 15213-3890
  49. *
  50. * any improvements or extensions that they make and grant Carnegie Mellon
  51. * the rights to redistribute these changes.
  52. }
  53. {
  54. }
  55. {
  56. * File: thread_status.h
  57. * Author: Avadis Tevanian, Jr.
  58. * Date: 1985
  59. *
  60. * This file contains the structure definitions for the thread
  61. * state as applied to I386 processors.
  62. }
  63. {
  64. * i386_thread_state this is the structure that is exported
  65. * to user threads for use in status/mutate
  66. * calls. This structure should never
  67. * change.
  68. *
  69. * i386_float_state exported to use threads for access to
  70. * floating point registers. Try not to
  71. * change this one, either.
  72. *
  73. }
  74. { THREAD_STATE_FLAVOR_LIST 0 }
  75. {
  76. const
  77. i386_THREAD_STATE = 1;
  78. i386_FLOAT_STATE = 2;
  79. i386_EXCEPTION_STATE = 3;
  80. THREAD_STATE_NONE = 4;
  81. }
  82. {
  83. * Main thread state consists of
  84. * general registers, segment registers,
  85. * eip and eflags.
  86. }
  87. type
  88. i386_thread_state = record
  89. eax : cuint;
  90. ebx : cuint;
  91. ecx : cuint;
  92. edx : cuint;
  93. edi : cuint;
  94. esi : cuint;
  95. ebp : cuint;
  96. esp : cuint;
  97. ss : cuint;
  98. eflags : cuint;
  99. eip : cuint;
  100. cs : cuint;
  101. ds : cuint;
  102. es : cuint;
  103. fs : cuint;
  104. gs : cuint;
  105. end;
  106. i386_thread_state_t = i386_thread_state;
  107. type
  108. x86_64_thread_state = record
  109. rax : cuint64;
  110. rbx : cuint64;
  111. rcx : cuint64;
  112. rdx : cuint64;
  113. rdi : cuint64;
  114. rsi : cuint64;
  115. rbp : cuint64;
  116. rsp : cuint64;
  117. r8 : cuint64;
  118. r9 : cuint64;
  119. r10 : cuint64;
  120. r11 : cuint64;
  121. r12 : cuint64;
  122. r13 : cuint64;
  123. r14 : cuint64;
  124. r15 : cuint64;
  125. rip : cuint64;
  126. rflags : cuint64;
  127. cs : cuint64;
  128. fs : cuint64;
  129. gs : cuint64;
  130. end;
  131. x86_64_thread_state_t = x86_64_thread_state;
  132. {
  133. * Default segment register values.
  134. }
  135. const
  136. USER_CODE_SELECTOR = $0017;
  137. USER_DATA_SELECTOR = $001f;
  138. KERN_CODE_SELECTOR = $0008;
  139. KERN_DATA_SELECTOR = $0010;
  140. FP_PREC_24B = 0;
  141. FP_PREC_53B = 2;
  142. FP_PREC_64B = 3;
  143. FP_RND_NEAR = 0;
  144. FP_RND_DOWN = 1;
  145. FP_RND_UP = 2;
  146. FP_CHOP = 3;
  147. type
  148. fp_control = record
  149. flag0 : cushort;
  150. end;
  151. fp_control_t = fp_control;
  152. const
  153. bm_fp_control_invalid = $1;
  154. bp_fp_control_invalid = 0;
  155. bm_fp_control_denorm = $2;
  156. bp_fp_control_denorm = 1;
  157. bm_fp_control_zdiv = $4;
  158. bp_fp_control_zdiv = 2;
  159. bm_fp_control_ovrfl = $8;
  160. bp_fp_control_ovrfl = 3;
  161. bm_fp_control_undfl = $10;
  162. bp_fp_control_undfl = 4;
  163. bm_fp_control_precis = $20;
  164. bp_fp_control_precis = 5;
  165. bm_fp_control_x = $C0;
  166. bp_fp_control_x = 6;
  167. bm_fp_control_pc = $300;
  168. bp_fp_control_pc = 8;
  169. bm_fp_control_rc = $C00;
  170. bp_fp_control_rc = 10;
  171. bm_fp_control_inf = $1000;
  172. bp_fp_control_inf = 12;
  173. bm_fp_control_y = $E000;
  174. bp_fp_control_y = 13;
  175. (*
  176. function invalid(var a : fp_control) : word;
  177. procedure set_invalid(var a : fp_control; __invalid : word);
  178. function denorm(var a : fp_control) : word;
  179. procedure set_denorm(var a : fp_control; __denorm : word);
  180. function zdiv(var a : fp_control) : word;
  181. procedure set_zdiv(var a : fp_control; __zdiv : word);
  182. function ovrfl(var a : fp_control) : word;
  183. procedure set_ovrfl(var a : fp_control; __ovrfl : word);
  184. function undfl(var a : fp_control) : word;
  185. procedure set_undfl(var a : fp_control; __undfl : word);
  186. function precis(var a : fp_control) : word;
  187. procedure set_precis(var a : fp_control; __precis : word);
  188. function pc(var a : fp_control) : word;
  189. procedure set_pc(var a : fp_control; __pc : word);
  190. function rc(var a : fp_control) : word;
  191. procedure set_rc(var a : fp_control; __rc : word);
  192. function inf(var a : fp_control) : word;
  193. procedure set_inf(var a : fp_control; __inf : word);
  194. *)
  195. {
  196. * Status word.
  197. }
  198. type
  199. fp_status = record
  200. flag0 : cushort;
  201. end;
  202. fp_status_t = fp_status;
  203. const
  204. bm_fp_status_invalid = $1;
  205. bp_fp_status_invalid = 0;
  206. bm_fp_status_denorm = $2;
  207. bp_fp_status_denorm = 1;
  208. bm_fp_status_zdiv = $4;
  209. bp_fp_status_zdiv = 2;
  210. bm_fp_status_ovrfl = $8;
  211. bp_fp_status_ovrfl = 3;
  212. bm_fp_status_undfl = $10;
  213. bp_fp_status_undfl = 4;
  214. bm_fp_status_precis = $20;
  215. bp_fp_status_precis = 5;
  216. bm_fp_status_stkflt = $40;
  217. bp_fp_status_stkflt = 6;
  218. bm_fp_status_errsumm = $80;
  219. bp_fp_status_errsumm = 7;
  220. bm_fp_status_c0 = $100;
  221. bp_fp_status_c0 = 8;
  222. bm_fp_status_c1 = $200;
  223. bp_fp_status_c1 = 9;
  224. bm_fp_status_c2 = $400;
  225. bp_fp_status_c2 = 10;
  226. bm_fp_status_tos = $3800;
  227. bp_fp_status_tos = 11;
  228. bm_fp_status_c3 = $4000;
  229. bp_fp_status_c3 = 14;
  230. bm_fp_status_busy = $8000;
  231. bp_fp_status_busy = 15;
  232. {
  233. function invalid(var a : fp_status) : word;
  234. procedure set_invalid(var a : fp_status; __invalid : word);
  235. function denorm(var a : fp_status) : word;
  236. procedure set_denorm(var a : fp_status; __denorm : word);
  237. function zdiv(var a : fp_status) : word;
  238. procedure set_zdiv(var a : fp_status; __zdiv : word);
  239. function ovrfl(var a : fp_status) : word;
  240. procedure set_ovrfl(var a : fp_status; __ovrfl : word);
  241. function undfl(var a : fp_status) : word;
  242. procedure set_undfl(var a : fp_status; __undfl : word);
  243. function precis(var a : fp_status) : word;
  244. procedure set_precis(var a : fp_status; __precis : word);
  245. function stkflt(var a : fp_status) : word;
  246. procedure set_stkflt(var a : fp_status; __stkflt : word);
  247. function errsumm(var a : fp_status) : word;
  248. procedure set_errsumm(var a : fp_status; __errsumm : word);
  249. function c0(var a : fp_status) : word;
  250. procedure set_c0(var a : fp_status; __c0 : word);
  251. function c1(var a : fp_status) : word;
  252. procedure set_c1(var a : fp_status; __c1 : word);
  253. function c2(var a : fp_status) : word;
  254. procedure set_c2(var a : fp_status; __c2 : word);
  255. function tos(var a : fp_status) : word;
  256. procedure set_tos(var a : fp_status; __tos : word);
  257. function c3(var a : fp_status) : word;
  258. procedure set_c3(var a : fp_status; __c3 : word);
  259. function busy(var a : fp_status) : word;
  260. procedure set_busy(var a : fp_status; __busy : word);
  261. }
  262. { defn of 80bit x87 FPU or MMX register }
  263. type
  264. mmst_reg = record
  265. mmst_reg : array[0..9] of byte;
  266. mmst_rsrv : array[0..5] of byte;
  267. end;
  268. { defn of 128 bit XMM regs }
  269. xmm_reg = record
  270. xmm_reg : array[0..15] of byte;
  271. end;
  272. {
  273. * Floating point state.
  274. }
  275. { number of chars worth of data from fpu_fcw }
  276. const
  277. FP_STATE_BYTES = 512;
  278. { For legacy reasons we need to leave the hw_state as char bytes }
  279. { x87 FPU control word }
  280. { x87 FPU status word }
  281. { x87 FPU tag word }
  282. { reserved } { x87 FPU Opcode }
  283. { x87 FPU Instruction Pointer offset }
  284. { x87 FPU Instruction Pointer Selector }
  285. { reserved }
  286. { x87 FPU Instruction Operand(Data) Pointer offset }
  287. { x87 FPU Instruction Operand(Data) Pointer Selector }
  288. { reserved }
  289. { MXCSR Register state }
  290. { MXCSR mask }
  291. { ST0/MM0 }
  292. { ST1/MM1 }
  293. { ST2/MM2 }
  294. { ST3/MM3 }
  295. { ST4/MM4 }
  296. { ST5/MM5 }
  297. { ST6/MM6 }
  298. { ST7/MM7 }
  299. { XMM 0 }
  300. { XMM 1 }
  301. { XMM 2 }
  302. { XMM 3 }
  303. { XMM 4 }
  304. { XMM 5 }
  305. { XMM 6 }
  306. { XMM 7 }
  307. { reserved }
  308. type
  309. i386_float_state = record
  310. fpu_reserved : array[0..1] of cint;
  311. fpu_fcw : fp_control_t;
  312. fpu_fsw : fp_status_t;
  313. fpu_ftw : cuint8;
  314. fpu_rsrv1 : cuint8;
  315. fpu_fop : cuint16;
  316. fpu_ip : cuint32;
  317. fpu_cs : cuint16;
  318. fpu_rsrv2 : cuint16;
  319. fpu_dp : cuint32;
  320. fpu_ds : cuint16;
  321. fpu_rsrv3 : cuint16;
  322. fpu_mxcsr : cuint32;
  323. fpu_mxcsrmask : cuint32;
  324. fpu_stmm0 : mmst_reg;
  325. fpu_stmm1 : mmst_reg;
  326. fpu_stmm2 : mmst_reg;
  327. fpu_stmm3 : mmst_reg;
  328. fpu_stmm4 : mmst_reg;
  329. fpu_stmm5 : mmst_reg;
  330. fpu_stmm6 : mmst_reg;
  331. fpu_stmm7 : mmst_reg;
  332. fpu_xmm0 : xmm_reg;
  333. fpu_xmm1 : xmm_reg;
  334. fpu_xmm2 : xmm_reg;
  335. fpu_xmm3 : xmm_reg;
  336. fpu_xmm4 : xmm_reg;
  337. fpu_xmm5 : xmm_reg;
  338. fpu_xmm6 : xmm_reg;
  339. fpu_xmm7 : xmm_reg;
  340. fpu_rsrv4 : array[0..(14*16)-1] of byte;
  341. fpu_reserved1 : cint;
  342. end;
  343. i386_float_state_t = i386_float_state;
  344. {
  345. * Extra state that may be
  346. * useful to exception handlers.
  347. }
  348. i386_exception_state = record
  349. trapno : cuint;
  350. err : cuint;
  351. faultvaddr : cuint;
  352. end;
  353. i386_exception_state_t = i386_exception_state;
  354. type
  355. x86_64_float_state = record
  356. fpu_reserved : array[0..1] of cint;
  357. fpu_fcw : fp_control_t;
  358. fpu_fsw : fp_status_t;
  359. fpu_ftw : cuint8;
  360. fpu_rsrv1 : cuint8;
  361. fpu_fop : cuint16;
  362. fpu_ip : cuint32;
  363. fpu_cs : cuint16;
  364. fpu_rsrv2 : cuint16;
  365. fpu_dp : cuint32;
  366. fpu_ds : cuint16;
  367. fpu_rsrv3 : cuint16;
  368. fpu_mxcsr : cuint32;
  369. fpu_mxcsrmask : cuint32;
  370. fpu_stmm0 : mmst_reg;
  371. fpu_stmm1 : mmst_reg;
  372. fpu_stmm2 : mmst_reg;
  373. fpu_stmm3 : mmst_reg;
  374. fpu_stmm4 : mmst_reg;
  375. fpu_stmm5 : mmst_reg;
  376. fpu_stmm6 : mmst_reg;
  377. fpu_stmm7 : mmst_reg;
  378. fpu_xmm0 : xmm_reg;
  379. fpu_xmm1 : xmm_reg;
  380. fpu_xmm2 : xmm_reg;
  381. fpu_xmm3 : xmm_reg;
  382. fpu_xmm4 : xmm_reg;
  383. fpu_xmm5 : xmm_reg;
  384. fpu_xmm6 : xmm_reg;
  385. fpu_xmm7 : xmm_reg;
  386. fpu_xmm8 : xmm_reg;
  387. fpu_xmm9 : xmm_reg;
  388. fpu_xmm10 : xmm_reg;
  389. fpu_xmm11 : xmm_reg;
  390. fpu_xmm12 : xmm_reg;
  391. fpu_xmm13 : xmm_reg;
  392. fpu_xmm14 : xmm_reg;
  393. fpu_xmm15 : xmm_reg;
  394. fpu_rsrv4 : array[0..(6*16)-1] of byte;
  395. fpu_reserved1 : cint;
  396. end;
  397. x86_64_float_state_t = x86_64_float_state;
  398. {
  399. * Extra state that may be
  400. * useful to exception handlers.
  401. }
  402. x86_64_exception_state = record
  403. trapno : cuint;
  404. err : cuint;
  405. faultvaddr : cuint64;
  406. end;
  407. x86_64_exception_state_t = x86_64_exception_state;
  408. (*
  409. function invalid(var a : fp_control) : word;
  410. begin
  411. invalid:=(a.flag0 and bm_fp_control_invalid) shr bp_fp_control_invalid;
  412. end;
  413. procedure set_invalid(var a : fp_control; __invalid : word);
  414. begin
  415. a.flag0:=a.flag0 or ((__invalid shl bp_fp_control_invalid) and bm_fp_control_invalid);
  416. end;
  417. function denorm(var a : fp_control) : word;
  418. begin
  419. denorm:=(a.flag0 and bm_fp_control_denorm) shr bp_fp_control_denorm;
  420. end;
  421. procedure set_denorm(var a : fp_control; __denorm : word);
  422. begin
  423. a.flag0:=a.flag0 or ((__denorm shl bp_fp_control_denorm) and bm_fp_control_denorm);
  424. end;
  425. function zdiv(var a : fp_control) : word;
  426. begin
  427. zdiv:=(a.flag0 and bm_fp_control_zdiv) shr bp_fp_control_zdiv;
  428. end;
  429. procedure set_zdiv(var a : fp_control; __zdiv : word);
  430. begin
  431. a.flag0:=a.flag0 or ((__zdiv shl bp_fp_control_zdiv) and bm_fp_control_zdiv);
  432. end;
  433. function ovrfl(var a : fp_control) : word;
  434. begin
  435. ovrfl:=(a.flag0 and bm_fp_control_ovrfl) shr bp_fp_control_ovrfl;
  436. end;
  437. procedure set_ovrfl(var a : fp_control; __ovrfl : word);
  438. begin
  439. a.flag0:=a.flag0 or ((__ovrfl shl bp_fp_control_ovrfl) and bm_fp_control_ovrfl);
  440. end;
  441. function undfl(var a : fp_control) : word;
  442. begin
  443. undfl:=(a.flag0 and bm_fp_control_undfl) shr bp_fp_control_undfl;
  444. end;
  445. procedure set_undfl(var a : fp_control; __undfl : word);
  446. begin
  447. a.flag0:=a.flag0 or ((__undfl shl bp_fp_control_undfl) and bm_fp_control_undfl);
  448. end;
  449. function precis(var a : fp_control) : word;
  450. begin
  451. precis:=(a.flag0 and bm_fp_control_precis) shr bp_fp_control_precis;
  452. end;
  453. procedure set_precis(var a : fp_control; __precis : word);
  454. begin
  455. a.flag0:=a.flag0 or ((__precis shl bp_fp_control_precis) and bm_fp_control_precis);
  456. end;
  457. function x(var a : fp_control) : word;
  458. begin
  459. x:=(a.flag0 and bm_fp_control_x) shr bp_fp_control_x;
  460. end;
  461. procedure set_x(var a : fp_control; __x : word);
  462. begin
  463. a.flag0:=a.flag0 or ((__x shl bp_fp_control_x) and bm_fp_control_x);
  464. end;
  465. function pc(var a : fp_control) : word;
  466. begin
  467. pc:=(a.flag0 and bm_fp_control_pc) shr bp_fp_control_pc;
  468. end;
  469. procedure set_pc(var a : fp_control; __pc : word);
  470. begin
  471. a.flag0:=a.flag0 or ((__pc shl bp_fp_control_pc) and bm_fp_control_pc);
  472. end;
  473. function rc(var a : fp_control) : word;
  474. begin
  475. rc:=(a.flag0 and bm_fp_control_rc) shr bp_fp_control_rc;
  476. end;
  477. procedure set_rc(var a : fp_control; __rc : word);
  478. begin
  479. a.flag0:=a.flag0 or ((__rc shl bp_fp_control_rc) and bm_fp_control_rc);
  480. end;
  481. function inf(var a : fp_control) : word;
  482. begin
  483. inf:=(a.flag0 and bm_fp_control_inf) shr bp_fp_control_inf;
  484. end;
  485. procedure set_inf(var a : fp_control; __inf : word);
  486. begin
  487. a.flag0:=a.flag0 or ((__inf shl bp_fp_control_inf) and bm_fp_control_inf);
  488. end;
  489. function y(var a : fp_control) : word;
  490. begin
  491. y:=(a.flag0 and bm_fp_control_y) shr bp_fp_control_y;
  492. end;
  493. procedure set_y(var a : fp_control; __y : word);
  494. begin
  495. a.flag0:=a.flag0 or ((__y shl bp_fp_control_y) and bm_fp_control_y);
  496. end;
  497. function invalid(var a : fp_status) : word;
  498. begin
  499. invalid:=(a.flag0 and bm_fp_status_invalid) shr bp_fp_status_invalid;
  500. end;
  501. procedure set_invalid(var a : fp_status; __invalid : word);
  502. begin
  503. a.flag0:=a.flag0 or ((__invalid shl bp_fp_status_invalid) and bm_fp_status_invalid);
  504. end;
  505. function denorm(var a : fp_status) : word;
  506. begin
  507. denorm:=(a.flag0 and bm_fp_status_denorm) shr bp_fp_status_denorm;
  508. end;
  509. procedure set_denorm(var a : fp_status; __denorm : word);
  510. begin
  511. a.flag0:=a.flag0 or ((__denorm shl bp_fp_status_denorm) and bm_fp_status_denorm);
  512. end;
  513. function zdiv(var a : fp_status) : word;
  514. begin
  515. zdiv:=(a.flag0 and bm_fp_status_zdiv) shr bp_fp_status_zdiv;
  516. end;
  517. procedure set_zdiv(var a : fp_status; __zdiv : word);
  518. begin
  519. a.flag0:=a.flag0 or ((__zdiv shl bp_fp_status_zdiv) and bm_fp_status_zdiv);
  520. end;
  521. function ovrfl(var a : fp_status) : word;
  522. begin
  523. ovrfl:=(a.flag0 and bm_fp_status_ovrfl) shr bp_fp_status_ovrfl;
  524. end;
  525. procedure set_ovrfl(var a : fp_status; __ovrfl : word);
  526. begin
  527. a.flag0:=a.flag0 or ((__ovrfl shl bp_fp_status_ovrfl) and bm_fp_status_ovrfl);
  528. end;
  529. function undfl(var a : fp_status) : word;
  530. begin
  531. undfl:=(a.flag0 and bm_fp_status_undfl) shr bp_fp_status_undfl;
  532. end;
  533. procedure set_undfl(var a : fp_status; __undfl : word);
  534. begin
  535. a.flag0:=a.flag0 or ((__undfl shl bp_fp_status_undfl) and bm_fp_status_undfl);
  536. end;
  537. function precis(var a : fp_status) : word;
  538. begin
  539. precis:=(a.flag0 and bm_fp_status_precis) shr bp_fp_status_precis;
  540. end;
  541. procedure set_precis(var a : fp_status; __precis : word);
  542. begin
  543. a.flag0:=a.flag0 or ((__precis shl bp_fp_status_precis) and bm_fp_status_precis);
  544. end;
  545. function stkflt(var a : fp_status) : word;
  546. begin
  547. stkflt:=(a.flag0 and bm_fp_status_stkflt) shr bp_fp_status_stkflt;
  548. end;
  549. procedure set_stkflt(var a : fp_status; __stkflt : word);
  550. begin
  551. a.flag0:=a.flag0 or ((__stkflt shl bp_fp_status_stkflt) and bm_fp_status_stkflt);
  552. end;
  553. function errsumm(var a : fp_status) : word;
  554. begin
  555. errsumm:=(a.flag0 and bm_fp_status_errsumm) shr bp_fp_status_errsumm;
  556. end;
  557. procedure set_errsumm(var a : fp_status; __errsumm : word);
  558. begin
  559. a.flag0:=a.flag0 or ((__errsumm shl bp_fp_status_errsumm) and bm_fp_status_errsumm);
  560. end;
  561. function c0(var a : fp_status) : word;
  562. begin
  563. c0:=(a.flag0 and bm_fp_status_c0) shr bp_fp_status_c0;
  564. end;
  565. procedure set_c0(var a : fp_status; __c0 : word);
  566. begin
  567. a.flag0:=a.flag0 or ((__c0 shl bp_fp_status_c0) and bm_fp_status_c0);
  568. end;
  569. function c1(var a : fp_status) : word;
  570. begin
  571. c1:=(a.flag0 and bm_fp_status_c1) shr bp_fp_status_c1;
  572. end;
  573. procedure set_c1(var a : fp_status; __c1 : word);
  574. begin
  575. a.flag0:=a.flag0 or ((__c1 shl bp_fp_status_c1) and bm_fp_status_c1);
  576. end;
  577. function c2(var a : fp_status) : word;
  578. begin
  579. c2:=(a.flag0 and bm_fp_status_c2) shr bp_fp_status_c2;
  580. end;
  581. procedure set_c2(var a : fp_status; __c2 : word);
  582. begin
  583. a.flag0:=a.flag0 or ((__c2 shl bp_fp_status_c2) and bm_fp_status_c2);
  584. end;
  585. function tos(var a : fp_status) : word;
  586. begin
  587. tos:=(a.flag0 and bm_fp_status_tos) shr bp_fp_status_tos;
  588. end;
  589. procedure set_tos(var a : fp_status; __tos : word);
  590. begin
  591. a.flag0:=a.flag0 or ((__tos shl bp_fp_status_tos) and bm_fp_status_tos);
  592. end;
  593. function c3(var a : fp_status) : word;
  594. begin
  595. c3:=(a.flag0 and bm_fp_status_c3) shr bp_fp_status_c3;
  596. end;
  597. procedure set_c3(var a : fp_status; __c3 : word);
  598. begin
  599. a.flag0:=a.flag0 or ((__c3 shl bp_fp_status_c3) and bm_fp_status_c3);
  600. end;
  601. function busy(var a : fp_status) : word;
  602. begin
  603. busy:=(a.flag0 and bm_fp_status_busy) shr bp_fp_status_busy;
  604. end;
  605. procedure set_busy(var a : fp_status; __busy : word);
  606. begin
  607. a.flag0:=a.flag0 or ((__busy shl bp_fp_status_busy) and bm_fp_status_busy);
  608. end;
  609. *)
  610. {$ifdef cpu64}
  611. mcontext_t = record
  612. es: x86_64_exception_state_t;
  613. ts: x86_64_thread_state_t;
  614. fs: x86_64_float_state_t;
  615. end;
  616. {$else cpu64}
  617. mcontext_t = record
  618. es: i386_exception_state_t;
  619. ts: i386_thread_state_t;
  620. fs: i386_float_state_t;
  621. end;
  622. {$endif cpu64}