diff options
Diffstat (limited to 'dev/kernel')
| -rw-r--r-- | dev/kernel/DmaKit/DmaPool.h | 11 | ||||
| -rw-r--r-- | dev/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cc | 7 |
2 files changed, 13 insertions, 5 deletions
diff --git a/dev/kernel/DmaKit/DmaPool.h b/dev/kernel/DmaKit/DmaPool.h index ada8299e..db12eb25 100644 --- a/dev/kernel/DmaKit/DmaPool.h +++ b/dev/kernel/DmaKit/DmaPool.h @@ -23,7 +23,12 @@ #define kNeDMAPoolSize (0x1000000) #endif +#ifdef __GNUC__ #define kNeDMABestAlign __BIGGEST_ALIGNMENT__ +#else +#define kNeDMABestAlign (8) +#endif + namespace Kernel { /// @brief DMA pool base pointer, here we're sure that AHCI or whatever tricky standard sees it. @@ -37,7 +42,7 @@ inline const UInt8* kDmaPoolEnd = (UInt8*) (kNeDMAPoolStart + kNeDMAPoolSize); /***********************************************************************************/ inline VoidPtr rtl_dma_alloc(SizeT size, SizeT align) { if (!size) { - return nullptr; + ++size; } /// Check alignement according to architecture. @@ -69,7 +74,7 @@ inline VoidPtr rtl_dma_alloc(SizeT size, SizeT align) { inline Void rtl_dma_free(SizeT size) { if (!size) return; - auto ptr = (UInt8*) (kDmaPoolPtr - size); + auto ptr = (kDmaPoolPtr - size); if (!ptr || ptr < (UInt8*) kNeDMAPoolStart) { err_global_get() = kErrorDmaExhausted; @@ -98,4 +103,4 @@ inline Void rtl_dma_flush(VoidPtr ptr, SizeT size_buffer) { HAL::mm_memory_fence((VoidPtr) ((UInt8*) ptr + buf_idx)); } } -} // namespace Kernel
\ No newline at end of file +} // namespace Kernel diff --git a/dev/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cc b/dev/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cc index bf0731c6..be27915a 100644 --- a/dev/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cc +++ b/dev/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cc @@ -66,11 +66,14 @@ EXTERN_C BOOL rtl_init_nic_rtl8139(UInt16 io_base) noexcept { /***********************************************************************************/ /// @brief RTL8139 I/O interrupt handler. +/// @param rsp stack pointer. /// @note This function is called when the device interrupts to retrieve network data. /***********************************************************************************/ EXTERN_C Void rtl_rtl8139_interrupt_handler(UIntPtr rsp) { - if (kRTLIOBase == 0xFFFF) return; + if (kRTLIOBase == 0xFFFF || kRTLIOBase == 0) return; + + NE_UNUSED(rsp); UInt16 status = rt_in16(kRTLIOBase + 0x3E); rt_out16(kRTLIOBase + 0x3E, status); @@ -123,4 +126,4 @@ EXTERN_C BOOL rtl_rtl8139_set_upper_layer(UInt8* layer) { kRXUpperLayer = layer; return YES; -}
\ No newline at end of file +} |
