Skip to content

[UDFS] Remove X86 optimizations#316

Draft
Copilot wants to merge 6 commits into
udf-devfrom
copilot/remove-x86-optimizations
Draft

[UDFS] Remove X86 optimizations#316
Copilot wants to merge 6 commits into
udf-devfrom
copilot/remove-x86-optimizations

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 28, 2026

The UDFS driver contained several #ifdef _X86_ code paths using MSVC inline assembly (__asm) as architecture-specific "optimizations", making the code non-portable and incompatible with non-MSVC compilers (e.g. Clang/GCC).

Changes

  • udf_info/udf_info.cpp — Drop 256-entry int8 lookup table for valid_char_arr guarded by #ifdef _X86_; use the existing generic string form unconditionally
  • udf_dbg.h — Replace __asm int 3 in UDFBreakPoint() with DbgBreakPoint(); collapse dual UDFTouch() implementations into a single portable one using volatile UCHAR to prevent the memory read from being elided
  • Include/mem_tools.cpp — Same volatile UCHAR fix for DbgTouch(), removing x86 inline asm variant
  • Include/string_lib.cpp — Remove x86 asm string-length loops in RtlAppendUnicodeToString() and MyInitUnicodeString(); keep the generic while(Str2[i]) loop
  • Include/mem_tools.h — Replace __asm int 3 debug breakpoints with portable __debugbreak() in MyFreePool__() and MyReallocPool__()

Before (example):

#if defined(_X86_) && defined(_MSC_VER)
__inline VOID UDFTouch(IN PVOID addr) {
    __asm { mov eax,addr; mov al,[byte ptr eax] }
}
#else
__inline VOID UDFTouch(IN PVOID addr) {
    UCHAR a = ((PUCHAR)addr)[0]; a = a;
}
#endif

After:

__inline VOID UDFTouch(IN PVOID addr) {
    volatile UCHAR a = ((PUCHAR)addr)[0];
    (void)a;
}

Copilot AI linked an issue Apr 28, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 28, 2026 15:54
Copilot AI changed the title [WIP] Remove x86 optimizations [UDFS] Remove X86 optimizations Apr 28, 2026
Copilot AI requested a review from Zero3K20 April 28, 2026 15:56
Copilot AI added a commit that referenced this pull request May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UDFS] Remove X86 optimizations

3 participants