mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:08:10 +00:00
Kernel/USB: Use allocate_kernel_region in Transfer buffer allocations
Previously it would create a contiguous AVMO manually and pass it to MM. This uses supervisor pages that quickly run out as they never get returned and crash the system. Instead, use allocate_kernel_region as we're only allocating a page so it will be contiguous and will be returned when destroyed. A potentially better solution would be to use a pool of transfers to avoid all the allocations. This just prevents the system from crashing within ~5 seconds from the continuous hub polling.
This commit is contained in:
parent
1ca5b6caa9
commit
14da080dcf
2 changed files with 19 additions and 19 deletions
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
public:
|
||||
Transfer() = delete;
|
||||
Transfer(Pipe& pipe, u16 len, Memory::AnonymousVMObject&);
|
||||
Transfer(Pipe& pipe, u16 len, NonnullOwnPtr<Memory::Region>);
|
||||
~Transfer();
|
||||
|
||||
void set_setup_packet(const USBRequestData& request);
|
||||
|
@ -41,11 +41,11 @@ public:
|
|||
bool error_occurred() const { return m_error_occurred; }
|
||||
|
||||
private:
|
||||
Pipe& m_pipe; // Pipe that initiated this transfer
|
||||
USBRequestData m_request; // USB request
|
||||
OwnPtr<Memory::Region> m_data_buffer; // DMA Data buffer for transaction
|
||||
u16 m_transfer_data_size { 0 }; // Size of the transfer's data stage
|
||||
bool m_complete { false }; // Has this transfer been completed?
|
||||
bool m_error_occurred { false }; // Did an error occur during this transfer?
|
||||
Pipe& m_pipe; // Pipe that initiated this transfer
|
||||
USBRequestData m_request; // USB request
|
||||
NonnullOwnPtr<Memory::Region> m_data_buffer; // DMA Data buffer for transaction
|
||||
u16 m_transfer_data_size { 0 }; // Size of the transfer's data stage
|
||||
bool m_complete { false }; // Has this transfer been completed?
|
||||
bool m_error_occurred { false }; // Did an error occur during this transfer?
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue