mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Update files
This commit is contained in:
parent
1a6665fd67
commit
fa921fe626
@ -37,7 +37,15 @@ namespace InterruptDescriptorTable
|
|||||||
|
|
||||||
extern "C" __attribute__((naked, used, no_stack_protector)) void ExceptionHandlerStub()
|
extern "C" __attribute__((naked, used, no_stack_protector)) void ExceptionHandlerStub()
|
||||||
{
|
{
|
||||||
asm("cld\n" // clear direction flag
|
asm(
|
||||||
|
// "cmp $0x1000, %rsp\n" // Just in case the stack is corrupted
|
||||||
|
// "jng .skip_swap_check_1\n" /* if is not greater than */
|
||||||
|
// "cmpw $0x8, 0x8(%rsp)\n"
|
||||||
|
// "je .skip_swap_check_1\n"
|
||||||
|
// "swapgs\n"
|
||||||
|
// ".skip_swap_check_1:\n"
|
||||||
|
|
||||||
|
"cld\n" // clear direction flag
|
||||||
|
|
||||||
// push all registers
|
// push all registers
|
||||||
"pushq %rax\n"
|
"pushq %rax\n"
|
||||||
@ -77,12 +85,31 @@ namespace InterruptDescriptorTable
|
|||||||
"popq %rax\n"
|
"popq %rax\n"
|
||||||
|
|
||||||
"addq $16, %rsp\n"
|
"addq $16, %rsp\n"
|
||||||
|
|
||||||
|
// "cmp $0x1000, %rsp\n"
|
||||||
|
// "jng .skip_swap_check_2\n"
|
||||||
|
// "cmpw $0x8, 0x8(%rsp)\n"
|
||||||
|
// "je .skip_swap_check_2\n"
|
||||||
|
// "swapgs\n"
|
||||||
|
// ".skip_swap_check_2:\n"
|
||||||
|
|
||||||
"iretq"); // pop CS RIP RFLAGS SS ESP
|
"iretq"); // pop CS RIP RFLAGS SS ESP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void WarnSwapgs() { warn("swapgs"); }
|
||||||
|
|
||||||
extern "C" __attribute__((naked, used, no_stack_protector)) void InterruptHandlerStub()
|
extern "C" __attribute__((naked, used, no_stack_protector)) void InterruptHandlerStub()
|
||||||
{
|
{
|
||||||
asm("cld\n"
|
asm(
|
||||||
|
// "cmp $0x1000, %rsp\n"
|
||||||
|
// "jng .skip_swap_check__1\n"
|
||||||
|
// "cmpw $0x8, 0x8(%rsp)\n"
|
||||||
|
// "je .skip_swap_check__1\n"
|
||||||
|
// "swapgs\n"
|
||||||
|
// "call WarnSwapgs\n"
|
||||||
|
// ".skip_swap_check__1:\n"
|
||||||
|
|
||||||
|
"cld\n"
|
||||||
"pushq %rax\n"
|
"pushq %rax\n"
|
||||||
"pushq %rbx\n"
|
"pushq %rbx\n"
|
||||||
"pushq %rcx\n"
|
"pushq %rcx\n"
|
||||||
@ -119,6 +146,15 @@ namespace InterruptDescriptorTable
|
|||||||
"popq %rax\n"
|
"popq %rax\n"
|
||||||
|
|
||||||
"addq $16, %rsp\n"
|
"addq $16, %rsp\n"
|
||||||
|
|
||||||
|
// "cmp $0x1000, %rsp\n"
|
||||||
|
// "jng .skip_swap_check__2\n"
|
||||||
|
// "cmpw $0x8, 0x8(%rsp)\n"
|
||||||
|
// "je .skip_swap_check__2\n"
|
||||||
|
// "call WarnSwapgs\n"
|
||||||
|
// "swapgs\n"
|
||||||
|
// ".skip_swap_check__2:\n"
|
||||||
|
|
||||||
"iretq");
|
"iretq");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
Makefile
10
Makefile
@ -111,7 +111,15 @@ prepare:
|
|||||||
gzip -d Files/ter-powerline-v12n.psf.gz
|
gzip -d Files/ter-powerline-v12n.psf.gz
|
||||||
|
|
||||||
build: $(KERNEL_FILENAME)
|
build: $(KERNEL_FILENAME)
|
||||||
|
|
||||||
|
dump:
|
||||||
|
ifeq (,$(wildcard $(KERNEL_FILENAME)))
|
||||||
|
$(error $(KERNEL_FILENAME) does not exist)
|
||||||
|
endif
|
||||||
|
$(info Dumping $(KERNEL_FILENAME) in AT T syntax...)
|
||||||
$(OBJDUMP) -D -d $(KERNEL_FILENAME) > kernel_dump.map
|
$(OBJDUMP) -D -d $(KERNEL_FILENAME) > kernel_dump.map
|
||||||
|
$(info Dumping $(KERNEL_FILENAME) in Intel syntax...)
|
||||||
|
$(OBJDUMP) -M intel -D -d $(KERNEL_FILENAME) > kernel_dump_intel.map
|
||||||
|
|
||||||
$(KERNEL_FILENAME): $(OBJ)
|
$(KERNEL_FILENAME): $(OBJ)
|
||||||
$(CC) $(LDFLAGS) $(OBJ) -o $@
|
$(CC) $(LDFLAGS) $(OBJ) -o $@
|
||||||
@ -160,4 +168,4 @@ endif
|
|||||||
$(NM) $@
|
$(NM) $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.bin *.o *.elf *.sym kernel.map kernel_dump.map initrd.tar.gz $(OBJ) $(KERNEL_FILENAME)
|
rm -f *.bin *.o *.elf *.sym kernel.map kernel_dump.map kernel_dump_intel.map initrd.tar.gz $(OBJ) $(KERNEL_FILENAME)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user