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
|
KOBJDIR=build/obj/kaleid
|
||||||
LOBJDIR=build/obj/boot
|
LOBJDIR=build/obj/boot
|
||||||
BINDIR=build/bin
|
BINDIR=build/bin
|
||||||
|
BUILDDIR=build
|
||||||
|
|
||||||
#Color codes
|
#Color codes
|
||||||
CL='\033[0;32m'
|
CL='\033[0;32m'
|
||||||
|
@ -192,23 +193,23 @@ $(KOBJDIR)/kernel/sched.o: $(KERNELDIR)/kernel/proc/sched.c $(KERNELDIR)/include
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: all
|
test: all
|
||||||
@qemu-system-x86_64 -m 5G -mem-prealloc -hda build/bin/disk.img \
|
@qemu-system-x86_64 -m 5G -hda $(BUILDDIR)/bin/disk.img \
|
||||||
-d cpu_reset,guest_errors,pcall,int 2> qemu.log &
|
-d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
||||||
.PHONY: test32
|
.PHONY: test32
|
||||||
test32: all
|
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
|
.PHONY: debug
|
||||||
debug: all
|
debug: all
|
||||||
@qemu-system-x86_64 -m 64M -hda build/bin/disk.img -no-reboot \
|
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \
|
||||||
-no-shutdown -mem-path memdump.bin -mem-prealloc -d cpu_reset,guest_errors,pcall,int 2> qemu.log &
|
-no-shutdown -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
||||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > kaleid64_disasm.asm
|
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > $(BUILDDIR)/kaleid64_disasm.asm
|
||||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > kaleid32_disasm.asm
|
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > $(BUILDDIR)/kaleid32_disasm.asm
|
||||||
|
|
||||||
.PHONY: gdb
|
.PHONY: gdb
|
||||||
gdb: all
|
gdb: all
|
||||||
@qemu-system-x86_64 -m 64M -hda build/bin/disk.img -no-reboot \
|
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \
|
||||||
-no-shutdown -mem-path memdump.bin -d cpu_reset,guest_errors,pcall,int -s 2> qemu.log &
|
-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 64 > kaleid64_disasm.asm
|
||||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > kaleid32_disasm.asm
|
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > kaleid32_disasm.asm
|
||||||
@gdb \
|
@gdb \
|
||||||
|
@ -241,7 +242,7 @@ $(BINDIR)/kaleid: $(LOBJDIR)/kaleid.x86_64
|
||||||
|
|
||||||
$(LOBJDIR)/kaleid.x86_64: $(kal_kern_obj) $(kal_com_obj) $(LOBJDIR)/loader.o
|
$(LOBJDIR)/kaleid.x86_64: $(kal_kern_obj) $(kal_com_obj) $(LOBJDIR)/loader.o
|
||||||
@echo ${CL2}[$@] ${NC}Linking kernel objects...${CL3}
|
@echo ${CL2}[$@] ${NC}Linking kernel objects...${CL3}
|
||||||
@$(LD) $(LDFLAGS) -T build/kernel.ld \
|
@$(LD) $(LDFLAGS) -T $(BUILDDIR)/kernel.ld \
|
||||||
$(LOBJDIR)/loader.o \
|
$(LOBJDIR)/loader.o \
|
||||||
$(KOBJDIR)/*.o \
|
$(KOBJDIR)/*.o \
|
||||||
$(KOBJDIR)/kernel/*.o \
|
$(KOBJDIR)/kernel/*.o \
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
│ │ ├── strtol.o
|
│ │ ├── strtol.o
|
||||||
│ │ ├── ultoa.o
|
│ │ ├── ultoa.o
|
||||||
│ │ └── utoa.o
|
│ │ └── utoa.o
|
||||||
|
│ ├── grub.log
|
||||||
│ └── kernel.ld
|
│ └── kernel.ld
|
||||||
├── kaleid
|
├── kaleid
|
||||||
│ ├── crtlib
|
│ ├── crtlib
|
||||||
|
@ -162,13 +163,8 @@
|
||||||
├── AUTHORS
|
├── AUTHORS
|
||||||
├── ChangeLog
|
├── ChangeLog
|
||||||
├── COPYING
|
├── COPYING
|
||||||
├── grub.log
|
|
||||||
├── kaleid32_disasm.asm
|
|
||||||
├── kaleid64_disasm.asm
|
|
||||||
├── Makefile
|
├── Makefile
|
||||||
├── memdump.bin
|
|
||||||
├── ProjectTree
|
├── ProjectTree
|
||||||
├── qemu.log
|
|
||||||
└── Readme.md
|
└── 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}
|
echo ${CL2}[grub-install.sh]${NC} Installing grub... \(grub-install\)${CL3}
|
||||||
## Install grub
|
## Install grub
|
||||||
sudo grub-install -V
|
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
|
echo ${CL2}[grub-install.sh]${NC} Copying grub.cfg
|
||||||
sudo cp $3 $2/boot/grub/grub.cfg > /dev/null
|
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) \
|
static inline void _##pref##Set##name(type __val) \
|
||||||
{ KeGetCurCPU().field = __val; }
|
{ KeGetCurCPU().field = __val; }
|
||||||
|
|
||||||
|
#define BARRIER() do{\
|
||||||
|
asm volatile("": : :"memory");__sync_synchronize();}while(0)
|
||||||
|
|
||||||
//------------------------------------------//
|
//------------------------------------------//
|
||||||
|
|
||||||
// Needed by basically everyone
|
// Needed by basically everyone
|
||||||
|
|
|
@ -83,6 +83,11 @@ struct GdtPtr_t
|
||||||
//
|
//
|
||||||
void MmInitMemoryMap(void);
|
void MmInitMemoryMap(void);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initializes the memory map structure
|
||||||
|
//
|
||||||
|
void MmPrintMemoryMap(void);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Returns the size of the first available memory zone
|
// Returns the size of the first available memory zone
|
||||||
// from the start address pointer
|
// from the start address pointer
|
||||||
|
|
|
@ -113,9 +113,6 @@ void BtInitBootInfo(multiboot_info_t *mbi)
|
||||||
extern void pstest(void);
|
extern void pstest(void);
|
||||||
extern error_t IoInitVGABuffer(void);
|
extern error_t IoInitVGABuffer(void);
|
||||||
|
|
||||||
#define BARRIER() do{\
|
|
||||||
asm volatile("": : :"memory");__sync_synchronize();}while(0)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Entry point of the Kaleid kernel
|
// Entry point of the Kaleid kernel
|
||||||
//
|
//
|
||||||
|
|
|
@ -172,3 +172,30 @@ void *MmGetFirstAvailZone(void *start) {
|
||||||
|
|
||||||
return current;
|
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