2 section .text class=CODE
4 ; NTS: If we code 'push ax' and 'popf' for the 16-bit tests in 32-bit protected mode we will screw up the stack pointer and crash
5 ; so we avoid duplicate code by defining 'native' pushf/popf functions and 'result' to ax or eax depending on CPU mode
20 %if TARGET_MSDOS == 16
22 %error You must specify MMODE variable (memory model) for 16-bit real mode code
26 %if TARGET_MSDOS == 16
28 %define retnative retf
29 %define cdecl_param_offset 6 ; RETF addr + PUSH BP
32 %define retnative retf
33 %define cdecl_param_offset 6 ; RETF addr + PUSH BP
36 %define cdecl_param_offset 4 ; RET addr + PUSH BP
41 %define cdecl_param_offset 8 ; RET addr + PUSH EBP
44 %if TARGET_MSDOS == 16
46 ; read RDTSC and return.
47 ; places 64-bit value in AX:BX:CX:DX according to Watcom register calling convention
62 %if TARGET_MSDOS == 16
63 ; WARNING: Do not execute this instruction when you are a Windows application.
64 ; The Windows VM doesn't take it well.
65 ; void __cdecl cpu_rdtsc_write(uint64_t val):
66 ; write RDTSC and return.
67 global cpu_rdtsc_write_
76 ; assemble EAX = AX:BX
80 ; assemble EDX = CX:DX