Fix bug with clobbers of cpuid function
diff --git a/src/Makefile b/src/Makefile
index 7c44049b..fdbb2ec2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,4 +1,5 @@
CC = ../toolchain/bin/i386-elf-gcc
+LD = ../toolchain/bin/i386-elf-gcc
CFLAGS = -Os -pipe -Wall -Wextra
@@ -31,7 +32,7 @@ OBJ := $(C_FILES:.c=.o)
all: qloader2.bin
qloader2.bin: $(OBJ)
- $(CC) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o stage2.bin
+ $(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o stage2.bin
cd bootsect && nasm bootsect.asm -fbin -o ../qloader2.bin
%.o: %.c
diff --git a/src/lib/blib.c b/src/lib/blib.c
index 86748f1f..35ea11a8 100644
--- a/src/lib/blib.c
+++ b/src/lib/blib.c
@@ -20,7 +20,7 @@ int cpuid(uint32_t leaf, uint32_t subleaf,
uint32_t cpuid_max;
ASM("cpuid\n\t", "=a" (cpuid_max)
: "a" (leaf & 0x80000000)
- : "rbx", "rcx", "rdx");
+ : "ebx", "ecx", "edx");
if (leaf > cpuid_max)
return 1;
ASM("cpuid\n\t", "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
