Gunnar Beutner
e56a0d6af7
Kernel: Fix memset() on x86_64
...
Previously memset() only set half of the bytes to the requested value.
2021-06-28 15:55:00 +02:00
Gunnar Beutner
32840dfa17
Kernel: Implement more x86_64 context switching functionality
2021-06-28 15:55:00 +02:00
Gunnar Beutner
9ed051fe25
Kernel: Implement initializing threads on x86_64
2021-06-27 15:46:42 +02:00
Gunnar Beutner
f285241cb8
Kernel: Rename Thread::tss to Thread::regs and add x86_64 support
...
We're using software context switches so calling this struct tss is
somewhat misleading.
2021-06-27 15:46:42 +02:00
Gunnar Beutner
eba33f82b8
Kernel: Reorder code a bit to clarify which #if block it belongs to
2021-06-27 15:46:42 +02:00
Gunnar Beutner
df530941cc
Kernel: Implement safe_* memory access functions for x86_64
2021-06-27 15:46:42 +02:00
Gunnar Beutner
9d9f20391d
Kernel: Use macros for GDT indices instead of hardcoding the values
2021-06-27 15:46:42 +02:00
Gunnar Beutner
065c6c307d
Kernel: Add support for interrupts on x86_64
2021-06-27 15:46:42 +02:00
Gunnar Beutner
233ef26e4d
Kernel+Userland: Add x86_64 registers to RegisterState/PtraceRegisters
2021-06-27 15:46:42 +02:00
Gunnar Beutner
324f72d02b
Kernel: Fix incorrect flags for the GDT entries
...
The Sz (protected mode) bit should not be set for 64-bit GDT entries.
2021-06-27 15:46:42 +02:00
Gunnar Beutner
389bf82889
Kernel: Add CPUID flag for long mode
...
This isn't particularly useful because by the time we've entered
init() the CPU had better support x86_64 anyway. However this shows the
CPU flag in System Monitor - even in 32-bit mode.
2021-06-26 11:08:52 +02:00
Gunnar Beutner
e52051903b
Kernel: Fix off-by-one error in Processor::write_raw_gdt_entry
2021-06-26 11:08:52 +02:00
Gunnar Beutner
f630299d49
Kernel: Add support for setting up a x86_64 GDT once in C++ land
2021-06-26 11:08:52 +02:00
Gunnar Beutner
29d9666e02
Kernel: Fix GDT limits
...
The GDT limits are inclusive, so for correctness we should subtract
one from the structs' size.
2021-06-26 11:08:52 +02:00
Gunnar Beutner
13e4093da4
Kernel: Move Multiboot header into a separate file
2021-06-25 15:19:09 +02:00
Daniel Bertalan
74535628a8
Kernel: Use proper Atomic<T>
types in CPU
...
This is needed because Clang's intrinsic atomic functions behave weirdly
if only one of their pointer arguments is volatile.
2021-06-24 17:35:49 +04:30
Gunnar Beutner
38fca26f54
Kernel: Add stubs for missing x86_64 functionality
...
This adds just enough stubs to make the kernel compile on x86_64. Obviously
it won't do anything useful - in fact it won't even attempt to boot because
Multiboot doesn't support ELF64 binaries - but it gets those compiler errors
out of the way so more progress can be made getting all the missing
functionality in place.
2021-06-24 09:27:13 +02:00
Hendiadyoin1
62f9377656
Kernel: Move special sections into Sections.h
...
This also removes a lot of CPU.h includes infavor for Sections.h
2021-06-24 00:38:23 +02:00
Hendiadyoin1
7ca3d413f7
Kernel: Pull apart CPU.h
...
This does not add any functional changes
2021-06-24 00:38:23 +02:00