1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:17:44 +00:00

Kernel/Net: Allocate regions before invoking Intel driver constructors

Instead of allocating after the construction point ensure that all Intel
drivers are allocating necessary buffer regions and then pass them to
the constructors.
This could let us fail early in case of OOM, so we don't touch a network
adapter before we ensure we have all the appropriate mappings in place.
This commit is contained in:
Liav A 2022-12-17 21:43:11 +02:00 committed by Jelle Raaijmakers
parent 301f9de915
commit 102186b0f5
4 changed files with 62 additions and 19 deletions

View file

@ -30,7 +30,10 @@ public:
virtual StringView purpose() const override { return class_name(); }
private:
E1000ENetworkAdapter(PCI::Address, u8 irq, NonnullOwnPtr<IOWindow> registers_io_window, NonnullOwnPtr<KString>);
E1000ENetworkAdapter(PCI::Address, u8 irq,
NonnullOwnPtr<IOWindow> registers_io_window, NonnullOwnPtr<Memory::Region> rx_buffer_region,
NonnullOwnPtr<Memory::Region> tx_buffer_region, NonnullOwnPtr<Memory::Region> rx_descriptors_region,
NonnullOwnPtr<Memory::Region> tx_descriptors_region, NonnullOwnPtr<KString>);
virtual StringView class_name() const override { return "E1000ENetworkAdapter"sv; }