Sun, 10 Aug 2025 17:56:23 +0200
1 files changed,
21 insertions(+),
1 deletions(-)
jump to
M
common/assembly.h
→
common/assembly.h
@@ -27,6 +27,26 @@ return msg;
} /*! + * Sends a 32-bit dword to the specified port. + * \param msg The dword to be sent. + * \param port The destination port. + */ +__attribute((always_inline)) inline void outl(uint32_t msg, uint16_t port) { + __asm__ volatile ("outl %0, %1" : : "a" (msg), "Nd" (port)); +} + +/*! + * Retrieves a 32-bit dword from the specified port. + * \param port The source port. + * \return The recieved dword. + */ +__attribute((always_inline)) inline uint32_t inl(uint16_t port) { + uint32_t msg; + __asm__ volatile ("inl %1, %0" : "=a" (msg) : "Nd" (port)); + return msg; +} + +/*! * nop */ __attribute__((always_inline)) inline void nop(void) {@@ -133,4 +153,4 @@ * Causes an interrupt
*/ #define INT(n) __asm__ volatile ("int $" #n) -#endif+#endif