1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 05:57:35 +00:00

Use uintptr_t instead of u32 when storing pointers as integers

uintptr_t is 32-bit or 64-bit depending on the target platform.
This will help us write pointer size agnostic code so that when the day
comes that we want to do a 64-bit port, we'll be in better shape.
This commit is contained in:
Andreas Kling 2020-01-20 13:06:14 +01:00
parent e07b34b9b8
commit a246e9cd7e
14 changed files with 110 additions and 110 deletions

View file

@ -253,14 +253,14 @@ bool E1000NetworkAdapter::link_up()
void E1000NetworkAdapter::initialize_rx_descriptors()
{
auto ptr = (u32)kmalloc_eternal(sizeof(e1000_rx_desc) * number_of_rx_descriptors + 16);
auto ptr = (uintptr_t)kmalloc_eternal(sizeof(e1000_rx_desc) * number_of_rx_descriptors + 16);
// Make sure it's 16-byte aligned.
if (ptr % 16)
ptr = (ptr + 16) - (ptr % 16);
m_rx_descriptors = (e1000_rx_desc*)ptr;
for (int i = 0; i < number_of_rx_descriptors; ++i) {
auto& descriptor = m_rx_descriptors[i];
auto addr = (u32)kmalloc_eternal(8192 + 16);
auto addr = (uintptr_t)kmalloc_eternal(8192 + 16);
if (addr % 16)
addr = (addr + 16) - (addr % 16);
descriptor.addr = addr - 0xc0000000;
@ -278,14 +278,14 @@ void E1000NetworkAdapter::initialize_rx_descriptors()
void E1000NetworkAdapter::initialize_tx_descriptors()
{
auto ptr = (u32)kmalloc_eternal(sizeof(e1000_tx_desc) * number_of_tx_descriptors + 16);
auto ptr = (uintptr_t)kmalloc_eternal(sizeof(e1000_tx_desc) * number_of_tx_descriptors + 16);
// Make sure it's 16-byte aligned.
if (ptr % 16)
ptr = (ptr + 16) - (ptr % 16);
m_tx_descriptors = (e1000_tx_desc*)ptr;
for (int i = 0; i < number_of_tx_descriptors; ++i) {
auto& descriptor = m_tx_descriptors[i];
auto addr = (u32)kmalloc_eternal(8192 + 16);
auto addr = (uintptr_t)kmalloc_eternal(8192 + 16);
if (addr % 16)
addr = (addr + 16) - (addr % 16);
descriptor.addr = addr - 0xc0000000;