Merging cpu&memory
This commit is contained in:
commit
6384d6e533
21
Makefile
21
Makefile
|
@ -47,6 +47,7 @@ OBJDIR=build/obj
|
|||
KOBJDIR=build/obj/kaleid
|
||||
LOBJDIR=build/obj/boot
|
||||
BINDIR=build/bin
|
||||
BUILDDIR=build
|
||||
|
||||
#Color codes
|
||||
CL='\033[0;32m'
|
||||
|
@ -192,23 +193,23 @@ $(KOBJDIR)/kernel/sched.o: $(KERNELDIR)/kernel/proc/sched.c $(KERNELDIR)/include
|
|||
|
||||
.PHONY: test
|
||||
test: all
|
||||
@qemu-system-x86_64 -m 5G -mem-prealloc -hda build/bin/disk.img \
|
||||
-d cpu_reset,guest_errors,pcall,int 2> qemu.log &
|
||||
@qemu-system-x86_64 -m 5G -hda $(BUILDDIR)/bin/disk.img \
|
||||
-d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
||||
.PHONY: test32
|
||||
test32: all
|
||||
@qemu-system-i386 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int 2> qemu.log &
|
||||
@qemu-system-i386 -hda $(BUILDDIR)/bin/disk.img -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
||||
|
||||
.PHONY: debug
|
||||
debug: all
|
||||
@qemu-system-x86_64 -m 64M -hda build/bin/disk.img -no-reboot \
|
||||
-no-shutdown -mem-path memdump.bin -mem-prealloc -d cpu_reset,guest_errors,pcall,int 2> qemu.log &
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > kaleid64_disasm.asm
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > kaleid32_disasm.asm
|
||||
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \
|
||||
-no-shutdown -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > $(BUILDDIR)/kaleid64_disasm.asm
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > $(BUILDDIR)/kaleid32_disasm.asm
|
||||
|
||||
.PHONY: gdb
|
||||
gdb: all
|
||||
@qemu-system-x86_64 -m 64M -hda build/bin/disk.img -no-reboot \
|
||||
-no-shutdown -mem-path memdump.bin -d cpu_reset,guest_errors,pcall,int -s 2> qemu.log &
|
||||
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \
|
||||
-no-shutdown -d cpu_reset,guest_errors,pcall,int -s 2> $(BUILDDIR)/qemu.log &
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > kaleid64_disasm.asm
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > kaleid32_disasm.asm
|
||||
@gdb \
|
||||
|
@ -241,7 +242,7 @@ $(BINDIR)/kaleid: $(LOBJDIR)/kaleid.x86_64
|
|||
|
||||
$(LOBJDIR)/kaleid.x86_64: $(kal_kern_obj) $(kal_com_obj) $(LOBJDIR)/loader.o
|
||||
@echo ${CL2}[$@] ${NC}Linking kernel objects...${CL3}
|
||||
@$(LD) $(LDFLAGS) -T build/kernel.ld \
|
||||
@$(LD) $(LDFLAGS) -T $(BUILDDIR)/kernel.ld \
|
||||
$(LOBJDIR)/loader.o \
|
||||
$(KOBJDIR)/*.o \
|
||||
$(KOBJDIR)/kernel/*.o \
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
│ │ ├── strtol.o
|
||||
│ │ ├── ultoa.o
|
||||
│ │ └── utoa.o
|
||||
│ ├── grub.log
|
||||
│ └── kernel.ld
|
||||
├── kaleid
|
||||
│ ├── crtlib
|
||||
|
@ -162,13 +163,8 @@
|
|||
├── AUTHORS
|
||||
├── ChangeLog
|
||||
├── COPYING
|
||||
├── grub.log
|
||||
├── kaleid32_disasm.asm
|
||||
├── kaleid64_disasm.asm
|
||||
├── Makefile
|
||||
├── memdump.bin
|
||||
├── ProjectTree
|
||||
├── qemu.log
|
||||
└── Readme.md
|
||||
|
||||
28 directories, 118 files
|
||||
28 directories, 114 files
|
||||
|
|
|
@ -47,7 +47,7 @@ sudo mount /dev/loop1 $2 > /dev/null
|
|||
echo ${CL2}[grub-install.sh]${NC} Installing grub... \(grub-install\)${CL3}
|
||||
## Install grub
|
||||
sudo grub-install -V
|
||||
sudo grub-install --target=i386-pc --debug --root-directory=$2 --boot-directory=$2/boot --no-floppy --modules="part_msdos biosdisk fat multiboot configfile" /dev/loop0 2> grub.log
|
||||
sudo grub-install --target=i386-pc --debug --root-directory=$2 --boot-directory=$2/boot --no-floppy --modules="part_msdos biosdisk fat multiboot configfile" /dev/loop0 2> build/grub.log
|
||||
|
||||
echo ${CL2}[grub-install.sh]${NC} Copying grub.cfg
|
||||
sudo cp $3 $2/boot/grub/grub.cfg > /dev/null
|
||||
|
|
|
@ -187,6 +187,9 @@ extern volatile Processor_t cpuTable[NCPUS];
|
|||
static inline void _##pref##Set##name(type __val) \
|
||||
{ KeGetCurCPU().field = __val; }
|
||||
|
||||
#define BARRIER() do{\
|
||||
asm volatile("": : :"memory");__sync_synchronize();}while(0)
|
||||
|
||||
//------------------------------------------//
|
||||
|
||||
// Needed by basically everyone
|
||||
|
|
|
@ -83,6 +83,11 @@ struct GdtPtr_t
|
|||
//
|
||||
void MmInitMemoryMap(void);
|
||||
|
||||
//
|
||||
// Initializes the memory map structure
|
||||
//
|
||||
void MmPrintMemoryMap(void);
|
||||
|
||||
//
|
||||
// Returns the size of the first available memory zone
|
||||
// from the start address pointer
|
||||
|
|
|
@ -113,9 +113,6 @@ void BtInitBootInfo(multiboot_info_t *mbi)
|
|||
extern void pstest(void);
|
||||
extern error_t IoInitVGABuffer(void);
|
||||
|
||||
#define BARRIER() do{\
|
||||
asm volatile("": : :"memory");__sync_synchronize();}while(0)
|
||||
|
||||
//
|
||||
// Entry point of the Kaleid kernel
|
||||
//
|
||||
|
@ -133,7 +130,7 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic)
|
|||
IoInitVGABuffer();
|
||||
|
||||
// Hello world
|
||||
KernLog("%c%c%c OS/K\n\n", 219, 219, 219);
|
||||
KernLog("%c%c%c OS/K\n \n", 219, 219, 219);
|
||||
|
||||
KalAlwaysAssert(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC);
|
||||
|
||||
|
|
|
@ -172,3 +172,30 @@ void *MmGetFirstAvailZone(void *start) {
|
|||
|
||||
return current;
|
||||
}
|
||||
|
||||
void MmPrintMemoryMap(void) {
|
||||
char *avStr = "";
|
||||
|
||||
for (int i=0; i < memoryMap.length; i++) {
|
||||
|
||||
switch (memoryMap.entry[i].type) {
|
||||
case AVAILABLE_ZONE: avStr="Available";
|
||||
break;
|
||||
case RESERVED_ZONE: avStr="Reserved";
|
||||
break;
|
||||
case ACPI_ZONE: avStr="ACPI";
|
||||
break;
|
||||
case NVS_ZONE: avStr="NVS";
|
||||
break;
|
||||
case BADRAM_ZONE: avStr="Bad Ram";
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
||||
KernLog("Mem zone : %p\t%s\twith length: %d Kio\n",
|
||||
memoryMap.entry[i].addr,
|
||||
avStr,
|
||||
memoryMap.entry[i].length / KB
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue