Skip to content

Commit

Permalink
hal/ia32: cast operands to correct sizes
Browse files Browse the repository at this point in the history
Newer binutils versions check closely if asm instructions get operands
of correct size.

JIRA: RTOS-912
  • Loading branch information
badochov committed Sep 23, 2024
1 parent 469212d commit a19bbc8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hal/ia32/ia32.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static inline u8 hal_inb(void *addr)
__asm__ volatile (
"inb %1, %0\n\t"
: "=a" (b)
: "d" (addr)
: "d" ((u16)(addr_t)addr)
: );
/* clang-format on */
return b;
Expand All @@ -42,7 +42,7 @@ static inline void hal_outb(void *addr, u8 b)
__asm__ volatile (
"outb %1, %0"
:
: "d" (addr), "a" (b)
: "d" ((u16)(addr_t)addr), "a" (b)
: );
/* clang-format on */

Expand All @@ -58,7 +58,7 @@ static inline u16 hal_inw(void *addr)
__asm__ volatile (
"inw %1, %0\n\t"
: "=a" (w)
: "d" (addr)
: "d" ((u16)(addr_t)addr)
: );
/* clang-format on */

Expand All @@ -72,7 +72,7 @@ static inline void hal_outw(void *addr, u16 w)
__asm__ volatile (
"outw %1, %0"
:
: "d" (addr), "a" (w)
: "d" ((u16)(addr_t)addr), "a" (w)
: );
/* clang-format on */

Expand Down

0 comments on commit a19bbc8

Please sign in to comment.