1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

Kernel: Remove i686 support

This commit is contained in:
Liav A 2022-10-04 03:05:54 +03:00 committed by Andreas Kling
parent 32270dcd20
commit 5ff318cf3a
75 changed files with 142 additions and 895 deletions

View file

@ -306,11 +306,7 @@ ErrorOr<Vector<Region*, 2>> AddressSpace::try_split_region_around_range(Region c
void AddressSpace::dump_regions()
{
dbgln("Process regions:");
#if ARCH(I386)
char const* addr_padding = "";
#else
char const* addr_padding = " ";
#endif
dbgln("BEGIN{} END{} SIZE{} ACCESS NAME",
addr_padding, addr_padding, addr_padding);

View file

@ -249,7 +249,7 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map()
// Register used memory regions that we know of.
m_global_data.with([&](auto& global_data) {
global_data.used_memory_ranges.ensure_capacity(4);
#if ARCH(I386) || ARCH(X86_64)
#if ARCH(X86_64)
global_data.used_memory_ranges.append(UsedMemoryRange { UsedMemoryRangeType::LowMemory, PhysicalAddress(0x00000000), PhysicalAddress(1 * MiB) });
#endif
global_data.used_memory_ranges.append(UsedMemoryRange { UsedMemoryRangeType::Kernel, PhysicalAddress(virtual_to_low_physical((FlatPtr)start_of_kernel_image)), PhysicalAddress(page_round_up(virtual_to_low_physical((FlatPtr)end_of_kernel_image)).release_value_but_fixme_should_propagate_errors()) });
@ -1152,11 +1152,7 @@ void MemoryManager::unregister_kernel_region(Region& region)
void MemoryManager::dump_kernel_regions()
{
dbgln("Kernel regions:");
#if ARCH(I386)
char const* addr_padding = "";
#else
char const* addr_padding = " ";
#endif
dbgln("BEGIN{} END{} SIZE{} ACCESS NAME",
addr_padding, addr_padding, addr_padding);
m_global_data.with([&](auto& global_data) {

View file

@ -57,11 +57,7 @@ ErrorOr<NonnullLockRefPtr<PageDirectory>> PageDirectory::try_create_for_userspac
auto& table = *(PageDirectoryPointerTable*)MM.quickmap_page(*directory->m_directory_table);
for (size_t i = 0; i < sizeof(m_directory_pages) / sizeof(m_directory_pages[0]); i++) {
if (directory->m_directory_pages[i]) {
#if ARCH(I386)
table.raw[i] = (FlatPtr)directory->m_directory_pages[i]->paddr().as_ptr() | 1;
#else
table.raw[i] = (FlatPtr)directory->m_directory_pages[i]->paddr().as_ptr() | 7;
#endif
}
}

View file

@ -121,26 +121,6 @@ ErrorOr<VirtualRange> RegionTree::allocate_range_randomized(size_t size, size_t
if (!m_total_range.contains(random_address, size))
continue;
#if ARCH(I386)
// Attempt to limit the amount of wasted address space on platforms with small address sizes (read: i686).
// This works by only allowing arbitrary random allocations until a certain threshold, to create more possibilities for placing mappings.
// After the threshold has been reached, new allocations can only be placed randomly within a certain range from the adjacent allocations.
VirtualAddress random_address_end { random_address.get() + size };
constexpr size_t max_allocations_until_limited = 200;
constexpr size_t max_space_between_allocations = 1 * MiB;
if (m_regions.size() >= max_allocations_until_limited) {
auto* lower_allocation = m_regions.find_largest_not_above(random_address.get());
auto* upper_allocation = m_regions.find_smallest_not_below(random_address_end.get());
bool lower_in_range = (!lower_allocation || random_address - lower_allocation->range().end() <= VirtualAddress(max_space_between_allocations));
bool upper_in_range = (!upper_allocation || upper_allocation->range().base() - random_address_end <= VirtualAddress(max_space_between_allocations));
if (!upper_in_range && !lower_in_range)
continue;
}
#endif
auto range_or_error = allocate_range_specific(random_address, size);
if (!range_or_error.is_error())
return range_or_error.release_value();

View file

@ -13,7 +13,7 @@ namespace Kernel {
ScopedAddressSpaceSwitcher::ScopedAddressSpaceSwitcher(Process& process)
{
VERIFY(Thread::current() != nullptr);
#if ARCH(I386) || ARCH(X86_64)
#if ARCH(X86_64)
m_previous_cr3 = read_cr3();
#elif ARCH(AARC64)
TODO_AARCH64();
@ -24,7 +24,7 @@ ScopedAddressSpaceSwitcher::ScopedAddressSpaceSwitcher(Process& process)
ScopedAddressSpaceSwitcher::~ScopedAddressSpaceSwitcher()
{
InterruptDisabler disabler;
#if ARCH(I386) || ARCH(X86_64)
#if ARCH(X86_64)
Thread::current()->regs().cr3 = m_previous_cr3;
write_cr3(m_previous_cr3);
#elif ARCH(AARC64)