mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
Kernel: Add a VERIFY() to make sure our DMA address is valid
This checks whether the address we're trying to use for DMA is low enough so as not to overflow the I/O register.
This commit is contained in:
parent
017c5fc7d9
commit
9b14a8605a
Notes:
sideshowbarker
2024-07-18 12:07:09 +09:00
Author: https://github.com/gunnarbeutner
Commit: 9b14a8605a
Pull-request: https://github.com/SerenityOS/serenity/pull/8109
Issue: https://github.com/SerenityOS/serenity/issues/8092
1 changed files with 3 additions and 0 deletions
|
@ -200,6 +200,9 @@ void SB16::dma_start(uint32_t length)
|
|||
|
||||
// Write the buffer
|
||||
IO::out8(0x8b, addr >> 16);
|
||||
auto page_number = addr >> 16;
|
||||
VERIFY(page_number <= NumericLimits<u8>::max());
|
||||
IO::out8(0x8b, page_number);
|
||||
|
||||
// Enable the DMA channel
|
||||
IO::out8(0xd4, (channel % 4));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue