This commit is contained in:
Adrien Bourmault 2019-05-09 12:00:30 +02:00
parent c0ded6f3a7
commit 6c504cff34
6 changed files with 21 additions and 19 deletions

View File

@ -172,7 +172,7 @@ $(KOBJDIR)/%.o: %.c $(INCLUDEDIR)/*/*.h $(KALEIDDIR)/*/*/*.h | $(KOBJDIR)
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
test: all
@qemu-system-x86_64 -soundhw pcspk -rtc base=localtime -m 4G -hda $(BUILDDIR)/bin/disk.img \
@qemu-system-x86_64 -cpu core2duo -soundhw pcspk -rtc base=localtime -m 4G -hda $(BUILDDIR)/bin/disk.img \
-d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
test32: all

View File

@ -31,9 +31,6 @@
// -------------------------------------------------------------------------- //
typedef struct Registers_t Registers_t;
// -------------------------------------------------------------------------- //
// CPU features masks
enum {
@ -98,13 +95,21 @@ enum {
// -------------------------------------------------------------------------- //
struct Registers_t
// Issue a single request to CPUID. Fits 'intel features', for instance
// note that even if only "eax" and "edx" are of interest, other registers
// will be modified by the operation, so we need to tell the compiler about it.
static inline void CpuCpuid(int code, uint *a, uint *d)
{
ulong ds;
ulong rdi, rsi, rbp, rsp, rbx, rdx, rcx, rax;
ulong intNo, errCode;
ulong rip, cs, eflags, useresp, ss;
} __attribute__((packed));
asm volatile("cpuid":"=a"(*a),"=d"(*d):"a"(code):"ecx","ebx");
}
// Issue a complete request, storing general registers output as a string
static inline int CpuCpuidString(int code, uint where[4])
{
asm volatile("cpuid":"=a"(*where),"=b"(*(where+1)),
"=c"(*(where+3)),"=d"(*(where+2)):"a"(code));
return (int)where[0];
}
// -------------------------------------------------------------------------- //

View File

@ -24,8 +24,3 @@
%include "kaleid/kernel/cpu/cpuf.inc"
CpuCpuid:
pushAll
mov rax, rsi
cpuid
popAll

View File

@ -24,8 +24,9 @@
#include <kernel/cpuid.h>
char *KeGetVendorString(void) {
return "Null";
char* CpuGetVendorString(void) {
uint where[5] = { 0 };
return (char *)&where[1];
}

View File

@ -62,7 +62,8 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
IoGetRtcTimeChar();
IoPrintRtcTime();
KernLog("%d\n",realKernelEnd);
extern void PrintVendorString(void);
PrintVendorString();
KeStartShell();

View File

@ -139,7 +139,7 @@ void *MmGetFirstAvailZone(void *start) {
// Because the kernel is the kernel
if ((ulong)start < (ulong)BtLoaderInfo.kernelEndAddr) {
return MmGetFirstAvailZone(BtLoaderInfo.kernelEndAddr);
return MmGetFirstAvailZone(BtLoaderInfo.kernelEndAddr+1);
}
// Search the zone where the start address is