Skip to main content
Commonmark migration
Source Link

#x86 machine code, 12 bytes

x86 machine code, 12 bytes

8c c8 83 f8 23 b0 20 75 02 00 c0 c3

Ungolfed:

getKernelBitness:
    mov eax,cs
    cmp eax,0x23 ; 32 bit process on 64 bit kernel has this selector in CS
    mov al,32
    jne kernelIs32Bit
    add al,al    ; return value in eax
kernelIs32Bit:
    ret

This function works in Linux when used in ELF32, following i386 SysV ABI, as well as in Windows/Wine when used in PE32, following stdcall calling convention.

#x86 machine code, 12 bytes

8c c8 83 f8 23 b0 20 75 02 00 c0 c3

Ungolfed:

getKernelBitness:
    mov eax,cs
    cmp eax,0x23 ; 32 bit process on 64 bit kernel has this selector in CS
    mov al,32
    jne kernelIs32Bit
    add al,al    ; return value in eax
kernelIs32Bit:
    ret

This function works in Linux when used in ELF32, following i386 SysV ABI, as well as in Windows/Wine when used in PE32, following stdcall calling convention.

x86 machine code, 12 bytes

8c c8 83 f8 23 b0 20 75 02 00 c0 c3

Ungolfed:

getKernelBitness:
    mov eax,cs
    cmp eax,0x23 ; 32 bit process on 64 bit kernel has this selector in CS
    mov al,32
    jne kernelIs32Bit
    add al,al    ; return value in eax
kernelIs32Bit:
    ret

This function works in Linux when used in ELF32, following i386 SysV ABI, as well as in Windows/Wine when used in PE32, following stdcall calling convention.

edited body
Source Link
Ruslan
  • 1.3k
  • 10
  • 13

#x86 machine code, 12 bytes

8c c9c8 83 f9f8 23 b0 20 75 02 00 c0 c3

Ungolfed:

getKernelBitness:
    mov ecxeax,cs
    cmp ecxeax,0x23 ; 32 bit process on 64 bit kernel has this selector in CS
    mov al,32
    jne kernelIs32Bit
    add al,al    ; return value in eax
kernelIs32Bit:
    ret

This function works in Linux when used in ELF32, following i386 SysV ABI, as well as in Windows/Wine when used in PE32, following stdcall calling convention.

#x86 machine code, 12 bytes

8c c9 83 f9 23 b0 20 75 02 00 c0 c3

Ungolfed:

getKernelBitness:
    mov ecx,cs
    cmp ecx,0x23 ; 32 bit process on 64 bit kernel has this selector in CS
    mov al,32
    jne kernelIs32Bit
    add al,al    ; return value in eax
kernelIs32Bit:
    ret

This function works in Linux when used in ELF32, following i386 SysV ABI, as well as in Windows/Wine when used in PE32, following stdcall calling convention.

#x86 machine code, 12 bytes

8c c8 83 f8 23 b0 20 75 02 00 c0 c3

Ungolfed:

getKernelBitness:
    mov eax,cs
    cmp eax,0x23 ; 32 bit process on 64 bit kernel has this selector in CS
    mov al,32
    jne kernelIs32Bit
    add al,al    ; return value in eax
kernelIs32Bit:
    ret

This function works in Linux when used in ELF32, following i386 SysV ABI, as well as in Windows/Wine when used in PE32, following stdcall calling convention.

added 37 characters in body
Source Link
Ruslan
  • 1.3k
  • 10
  • 13

#x86 machine code, 12 bytes

8c c9 83 f9 23 b0 20 75 02 00 c0 c3

Ungolfed:

getKernelBitness:
    mov ecx,cs
    cmp ecx,0x23 ; 32 bit process on 64 bit kernel has this selector in CS
    mov al,32
    jne kernelIs32Bit
    add al,al    ; return value in eax
kernelIs32Bit:
    ret

This function works in Linux when used in ELF32, following i386 SysV ABI, oras well as in Windows/Wine when used in PE32, following stdcall calling convention.

#x86 machine code, 12 bytes

8c c9 83 f9 23 b0 20 75 02 00 c0 c3

Ungolfed:

getKernelBitness:
    mov ecx,cs
    cmp ecx,0x23 ; 32 bit process on 64 bit kernel has this selector in CS
    mov al,32
    jne kernelIs32Bit
    add al,al    ; return value in eax
kernelIs32Bit:
    ret

This function works in Linux when used in ELF32, following i386 SysV ABI, or PE32, following stdcall calling convention.

#x86 machine code, 12 bytes

8c c9 83 f9 23 b0 20 75 02 00 c0 c3

Ungolfed:

getKernelBitness:
    mov ecx,cs
    cmp ecx,0x23 ; 32 bit process on 64 bit kernel has this selector in CS
    mov al,32
    jne kernelIs32Bit
    add al,al    ; return value in eax
kernelIs32Bit:
    ret

This function works in Linux when used in ELF32, following i386 SysV ABI, as well as in Windows/Wine when used in PE32, following stdcall calling convention.

deleted 37 characters in body
Source Link
Ruslan
  • 1.3k
  • 10
  • 13
Loading
added 6 characters in body
Source Link
Ruslan
  • 1.3k
  • 10
  • 13
Loading
Source Link
Ruslan
  • 1.3k
  • 10
  • 13
Loading