fputc, putc, fputs, puts, fgetc, getc and fflush now run as runtime
services on the shared fopen stream state. fflush writes host-backed
streams to their mount before fclose. The import metadata classified
these as native libc calls although they take guest FILE cookies.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
strcpy_s, strcat_s, strncpy_s, strncat_s and their wcs forms follow the
documented EINVAL, ERANGE and _TRUNCATE rules. The import metadata had
mapped six of them to unchecked libc functions that ignore the buffer
size; they are now runtime services, and the pipeline test asserts so.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
The guest time zone is UTC with no daylight transition. Processor
topology reports one core per profile processor and one package; no
simulated cache entries are reported.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
Each PF_* feature is present only when guest CPUID reports every bit it
depends on, so startup code cannot pick instruction sets the translator
does not advertise. Features without a CPUID test report FALSE.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
_msize, _recalloc, _aligned_malloc, _aligned_realloc, _aligned_msize
and _aligned_free on the CRT heap. Aligned blocks are tracked so double
and mismatched frees stop the guest.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
__std_exception_copy duplicates an owned message on the CRT heap and
shares a borrowed one; __std_exception_destroy frees an owned message
and clears the record.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
xenora imports coverage lists every standard runtime service by module
and status and where the import metadata disagrees with the registry.
It found six kernel32 services the metadata still classified as stubs.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
__std_type_info_compare, __std_type_info_hash, __std_type_info_name and
__std_type_info_destroy_list compare and hash by decorated name and
undecorate plain class, struct, union and enum names. Decorations they
do not model stop the guest instead of returning a wrong name.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
XInputGetState, XInputSetState, XInputGetCapabilities and XInputEnable
on xinput1_4.dll, reachable from xinput1_3.dll and xinput9_1_0.dll.
Readings come from a host-connected ControllerSource; without one,
every slot reports ERROR_DEVICE_NOT_CONNECTED.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
FIONREAD reports unread stream bytes or the size of the next datagram.
FIONBIO accepts non-blocking mode; blocking mode returns WSAEOPNOTSUPP
because loopback sockets never block.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
Stream sockets listen, accept and connect between guest sockets on
127.0.0.1 inside the runtime; no host socket is opened. Each socket
buffers up to 64 KiB, send takes what fits, recv returns 0 at end of
file after shutdown(SD_SEND) or closesocket, and sending to a closed
peer reports WSAECONNRESET. WSAPoll reports listen-queue readiness,
write space and POLLHUP. TCP and UDP ports are separate namespaces.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
Both engines refused SHLD and SHRD (0F A4/A5, 0F AC/AD) as illegal
instructions. They are now declared in the x86 registry and run on the
shared semantics for 16-, 32- and 64-bit register and memory
destinations, with the count in an 8-bit immediate or in CL.
- instructions.toml, x86_table.rs (generated), generate_x86.py,
x86_decode.rs: the two operations and two operand encodings,
rm_reg_imm and rm_reg_cl (ModRM destination, reg source, count).
- x86_exec.rs: the destination is shifted with the vacated bits filled
from the source register. The count is masked to five bits (six for
64-bit operands), a masked count of zero changes nothing, CF takes the
last bit shifted out, ZF/SF/PF follow the result and OF is set only
for a count of one. A 16-bit count above 16 is undefined in the SDM;
the flags are kept and no test relies on the result.
- cpu_known_answers.rs: eight SDM-derived cases move from refused to
verified.
- tests/x86: 72 assembled SHLD and SHRD instructions, with a
bit-at-a-time reference in x86_integer.rs. A destination the
reference marks undefined now skips the memory operand check too.
- docs/cpu/instruction-registry.md, CHANGELOG.md.
Nothing is lowered to ARM64.
Signed-off-by: maridogolpeador <354308468+maridogolpeador@users.noreply.github.com>
MoveFileExW accepts MOVEFILE_REPLACE_EXISTING, MOVEFILE_WRITE_THROUGH
and MOVEFILE_COPY_ALLOWED. A closed file may atomically replace another
closed file on a host mount or the synthetic C: drive; directories are
never replaced, and open files can neither move nor be replaced. Write
through flushes both host directories. Moves between drives report
ERROR_NOT_SAME_DEVICE, or ERROR_NOT_SUPPORTED when a copy is allowed.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
MoveFileW now renames closed files and directories inside one writable
host mount using an exclusive host rename (renameatx_np RENAME_EXCL on
macOS, renameat2 RENAME_NOREPLACE on Linux), so an existing name is
never replaced. A change of case alone renames in place. Open files,
read-only mounts, the mount root and moves between drives fail with
explicit Win32 errors.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>
HostMount::with_quota limits the net bytes and the number of files and
directories guest operations add to a writable mount. Win32 writes,
extending SetEndOfFile, CreateFileW, CreateDirectoryW, GetTempFileNameW
and CRT fopen/fclose are charged; deletion and shrinking give the
amount back, never below zero. Exceeding a limit fails with
ERROR_DISK_FULL (CRT ENOSPC) and leaves the host unchanged.
Signed-off-by: Adeeb Rahman <therealabeeb@icloud.com>