diff options
-rw-r--r-- | documentation/Data Models and Sizes | 18 | ||||
-rw-r--r-- | efi_memtest/Makefile | 7 | ||||
-rw-r--r-- | efi_memtest/memtest86+/bios/rsdp.h | 13 | ||||
-rw-r--r-- | efi_memtest/memtest86+/bios/stdin.h | 53 | ||||
-rw-r--r-- | efi_memtest/memtest86+/bios/stdint.h | 60 | ||||
-rw-r--r-- | efi_memtest/memtest86+/efi/rsdp.h | 14 | ||||
-rw-r--r-- | efi_memtest/memtest86+/efi/stdin.h (renamed from efi_memtest/memtest86+/stdin.h) | 6 | ||||
-rw-r--r-- | efi_memtest/memtest86+/efi/stdint.h (renamed from efi_memtest/memtest86+/stdint.h) | 4 | ||||
-rw-r--r-- | efi_memtest/memtest86+/smp.c | 4 | ||||
-rw-r--r-- | efi_memtest/memtest86+/smp.h | 13 |
10 files changed, 171 insertions, 21 deletions
diff --git a/documentation/Data Models and Sizes b/documentation/Data Models and Sizes new file mode 100644 index 0000000..305cb40 --- /dev/null +++ b/documentation/Data Models and Sizes @@ -0,0 +1,18 @@ +(https://www.ibm.com/support/knowledgecenter/SSLTBW_2.3.0/com.ibm.zos.v2r3.cbcpx01/datatypesize64.htm) + + ILP32 (32-bit environment) LP64 (64-bit environment) + size in bytes size in bytes + =========================== ================================ +char 1 1 +short 2 2 +int 4 4 +long 4 8 +long long 8 8 +float 4 4 +double 8 8 +long double 16 16 +pointer 4 8 +wchar_t 2 4 Other UNIX platforms usually have wchar_t 4 bytes for both + 32-bit and 64-bit mode +size_t 4 8 unsigned type +ptrdiff_t 4 8 signed type diff --git a/efi_memtest/Makefile b/efi_memtest/Makefile index e8489aa..c673435 100644 --- a/efi_memtest/Makefile +++ b/efi_memtest/Makefile @@ -26,7 +26,7 @@ PREPROCESSOR=-DUEFI -DUSING_LTO -Os \ INCLUDE_FILES=main cpuid test smp config screen_buffer lib init controller pci \ spd dmi reloc patn linuxbios error vmem memsize random -ADDITIONAL_HEADER=$(addprefix memtest86+/, defs.h linuxbios_tables.h stdin.h io.h \ +ADDITIONAL_HEADER=$(addprefix memtest86+/, defs.h linuxbios_tables.h efi/stdin.h io.h \ stdint.h stddef.h serial.h msr.h jedec_id.h elf.h) OBJS=AutoGen.obj main.o test.o smp.o config.o screen_buffer.o lib.o init.o controller.o \ @@ -63,7 +63,7 @@ $(MAIN_FILE).dll: $(MAIN_FILE).lib -DSTRING_ARRAY_NAME=${MAIN_FILE}Strings \ -I OUTPUT/ \ -I Library/ - objcopy --strip-unneeded -R .eh_frame -v OUTPUT/$MAIN_FILE.dll OUTPUT/$MAIN_FILE.dll + objcopy --strip-unneeded -R .eh_frame -v OUTPUT/$(MAIN_FILE).dll OUTPUT/$(MAIN_FILE).dll $(MAIN_FILE).lib: $(OBJS) gcc-ar crv OUTPUT/$(MAIN_FILE).lib $(OBJS) @@ -87,7 +87,8 @@ AutoGen.obj: memtest86+/efi/Include/AutoGen.c memtest86+/efi/Include/AutoGen.c %.o: memtest86+/%.c - $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -c -o $@ $< + $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -c -o $@ $< \ + -I"memtest86+/efi" clean: rm -f OUTPUT/* diff --git a/efi_memtest/memtest86+/bios/rsdp.h b/efi_memtest/memtest86+/bios/rsdp.h new file mode 100644 index 0000000..69403a7 --- /dev/null +++ b/efi_memtest/memtest86+/bios/rsdp.h @@ -0,0 +1,13 @@ +// BIOS VERSION / 32-bit + +#define RSDPSignature ('R' | ('S' << 8) | ('D' << 16) | (' ' << 24)) +typedef struct { + char signature[8]; // "RSD " + uint8_t checksum; + char oemid[6]; + uint8_t revision; + uint32_t rsdt; + uint32_t length; + uint32_t xrsdt[2]; + uint8_t xsum; +} rsdp_t;
\ No newline at end of file diff --git a/efi_memtest/memtest86+/bios/stdin.h b/efi_memtest/memtest86+/bios/stdin.h new file mode 100644 index 0000000..2fe2bba --- /dev/null +++ b/efi_memtest/memtest86+/bios/stdin.h @@ -0,0 +1,53 @@ +#ifndef I386_STDINT_H +#define I386_STDINT_H + +/* Exact integral types */ +typedef unsigned char uint8_t; +typedef signed char int8_t; + +typedef unsigned short uint16_t; +typedef signed short int16_t; + +typedef unsigned int uint32_t; +typedef signed int int32_t; + +typedef unsigned long long uint64_t; +typedef signed long long int64_t; + +/* Small types */ +typedef unsigned char uint_least8_t; +typedef signed char int_least8_t; + +typedef unsigned short uint_least16_t; +typedef signed short int_least16_t; + +typedef unsigned int uint_least32_t; +typedef signed int int_least32_t; + +typedef unsigned long long uint_least64_t; +typedef signed long long int_least64_t; + +/* Fast Types */ +typedef unsigned char uint_fast8_t; +typedef signed char int_fast8_t; + +typedef unsigned int uint_fast16_t; +typedef signed int int_fast16_t; + +typedef unsigned int uint_fast32_t; +typedef signed int int_fast32_t; + +typedef unsigned long long uint_fast64_t; +typedef signed long long int_fast64_t; + +/* Types for `void *' pointers. */ +typedef int intptr_t; +typedef unsigned int uintptr_t; + + +/* Largest integral types */ +typedef long long int intmax_t; +typedef unsigned long long uintmax_t; + + +#endif /* I386_STDINT_H */ diff --git a/efi_memtest/memtest86+/bios/stdint.h b/efi_memtest/memtest86+/bios/stdint.h new file mode 100644 index 0000000..3a51041 --- /dev/null +++ b/efi_memtest/memtest86+/bios/stdint.h @@ -0,0 +1,60 @@ +#ifndef I386_STDINT_H +#define I386_STDINT_H + +/* Exact integral types */ +typedef unsigned char uint8_t; +typedef signed char int8_t; + +typedef unsigned short uint16_t; +typedef signed short int16_t; + +typedef unsigned int uint32_t; +typedef signed int int32_t; + +typedef unsigned long long uint64_t; +typedef signed long long int64_t; + +/* Small types */ +typedef unsigned char uint_least8_t; +typedef signed char int_least8_t; + +typedef unsigned short uint_least16_t; +typedef signed short int_least16_t; + +typedef unsigned int uint_least32_t; +typedef signed int int_least32_t; + +typedef unsigned long long uint_least64_t; +typedef signed long long int_least64_t; + +/* Fast Types */ +typedef unsigned char uint_fast8_t; +typedef signed char int_fast8_t; + +typedef unsigned int uint_fast16_t; +typedef signed int int_fast16_t; + +typedef unsigned int uint_fast32_t; +typedef signed int int_fast32_t; + +typedef unsigned long long uint_fast64_t; +typedef signed long long int_fast64_t; + +/* Types for `void *' pointers. */ +typedef int intptr_t; +typedef unsigned int uintptr_t; + +/* Largest integral types */ +typedef long long int intmax_t; +typedef unsigned long long uintmax_t; + +typedef char bool; +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#endif /* I386_STDINT_H */ diff --git a/efi_memtest/memtest86+/efi/rsdp.h b/efi_memtest/memtest86+/efi/rsdp.h new file mode 100644 index 0000000..ec4aa8a --- /dev/null +++ b/efi_memtest/memtest86+/efi/rsdp.h @@ -0,0 +1,14 @@ +// EFI_VERSION / 64-bit + +#define RSDPSignature ('R' | ('S' << 8) | ('D' << 16) | (' ' << 24)) +typedef struct { + char signature[8]; // "RSD " + uint8_t checksum; + char oemid[6]; + uint8_t revision; + uint32_t rsdt; + uint32_t length; + uint64_t xrsdt[2]; + uint8_t xsum; + uint8_t reeserved[3]; +} __attribute__ ((packed)) rsdp_t;
\ No newline at end of file diff --git a/efi_memtest/memtest86+/stdin.h b/efi_memtest/memtest86+/efi/stdin.h index e3a08e1..4e04566 100644 --- a/efi_memtest/memtest86+/stdin.h +++ b/efi_memtest/memtest86+/efi/stdin.h @@ -41,12 +41,12 @@ typedef unsigned long long uint_fast64_t; typedef signed long long int_fast64_t; /* Types for `void *' pointers. */ -typedef int intptr_t; -typedef unsigned int uintptr_t; +typedef long intptr_t; +typedef unsigned long uintptr_t; /* Largest integral types */ typedef long long int intmax_t; typedef unsigned long long uintmax_t; -#endif /* I386_STDINT_H */
\ No newline at end of file +#endif /* I386_STDINT_H */ diff --git a/efi_memtest/memtest86+/stdint.h b/efi_memtest/memtest86+/efi/stdint.h index 1c136e0..4b90672 100644 --- a/efi_memtest/memtest86+/stdint.h +++ b/efi_memtest/memtest86+/efi/stdint.h @@ -41,8 +41,8 @@ typedef unsigned long long uint_fast64_t; typedef signed long long int_fast64_t; /* Types for `void *' pointers. */ -typedef int intptr_t; -typedef unsigned int uintptr_t; +typedef long intptr_t; +typedef unsigned long uintptr_t; /* Largest integral types */ typedef long long int intmax_t; diff --git a/efi_memtest/memtest86+/smp.c b/efi_memtest/memtest86+/smp.c index c101c36..8f620fc 100644 --- a/efi_memtest/memtest86+/smp.c +++ b/efi_memtest/memtest86+/smp.c @@ -506,7 +506,7 @@ void smp_find_cpus() rsdt_t *rt; uint8_t *tab_ptr, *tab_end; unsigned int *ptr; - unsigned int uiptr; + uintptr_t uiptr; if(vv->fail_safe & 3) { return; } @@ -591,7 +591,7 @@ void smp_find_cpus() } } else { - rt = (rsdt_t *)rp->rsdt; + rt = (rsdt_t *)(uintptr_t)rp->rsdt; if (rt == 0) { return; } diff --git a/efi_memtest/memtest86+/smp.h b/efi_memtest/memtest86+/smp.h index 5d07ce7..9ed23b0 100644 --- a/efi_memtest/memtest86+/smp.h +++ b/efi_memtest/memtest86+/smp.h @@ -9,6 +9,8 @@ #include "defs.h" #define MAX_CPUS 32 +#include "rsdp.h" + #define FPSignature ('_' | ('M' << 8) | ('P' << 16) | ('_' << 24)) typedef struct { @@ -107,17 +109,6 @@ typedef struct { uint8_t destapiclint; } mp_local_interrupt_entry_t; -#define RSDPSignature ('R' | ('S' << 8) | ('D' << 16) | (' ' << 24)) -typedef struct { - char signature[8]; // "RSD " - uint8_t checksum; - char oemid[6]; - uint8_t revision; - uint32_t rsdt; - uint32_t length; - uint32_t xrsdt[2]; - uint8_t xsum; -} rsdp_t; #define RSDTSignature ('R' | ('S' << 8) | ('D' << 16) | ('T' << 24)) #define XSDTSignature ('X' | ('S' << 8) | ('D' << 16) | ('T' << 24)) |