3 ms·
COM files on Windows are always 16-bit. His CON files appear to be the native bit width of the kernel. This means unlike on Windiwsm his COM files cannot execut
by ryao 2y ago
COM files on Windows are always 16-bit. His CON files appear to be the native bit width of the kernel. This means unlike on Windiwsm his COM files cannot execute on both 32-bit and 64-bit versions of the kernel. That one imperfection aside, this is a fantastic achievement.
- rep_lodsb 2y agoThe zero-byte program should work on either :) It's also possible to detect which mode the CPU is in: bits 16 mov ax,start16 ;may load EAX instead, jmp ax ;skipping this 2-byte instruction bits 32 dec eax ;REX prefix in long mode, mov eax,start32 ;may load RAX, jmp eax ;skipping these 4 bytes nop nop bits 64 jmp start64 You can even be compatible with CP/M-80 by putting this at the start: add bx,start8 ;8080: ADD C, JMP start8 nop ;immediate may be 16 or 32 bits nop
- breadbox 2y agoA valid point! Clearly the correct solution would be for the kernel module to check if the filename contains the substring "32", and if so it should load it as a 32-bit binary.
- ycombinatrix 2y agoHave you considered building your program into the binfmt module and only running 0 byte executables?