static void port_out
(
uint16_t port,
uint8_t value
)
{
asm volatile ("outb %0, %1" : : "a" (value), "Nd" (port));
}
static uint8_t port_in
(
uint16_t port
)
{
uint8_t ans;
asm volatile ("inb %1, %0" : "=a" (ans) : "Nd" (port));
return ans;
}
is this stuff correct when the x86-CPU is in protected mode? :o :o :o
(32bit)
thanks, guys
I don't like x86(1) at all, but I am writing a special monitor for my Soekris net5501.
So it's something that boots in real-mode (pure assembly code) and then switches into protected-mode (pure assembly code but jumping into crt0, and then to C main).
MBR boot, CPU in 16-bit Mode
CHS loading sec2-10 ... done
console=/serial0,115200-8-n-1
Switching to 32-bit Mode ... done
Installing ISRs ... done
Enabling external interrupts ... done
Initializing dynamic memory ... done
suppa shell
> help
hallo - if you see the reply, it means it's starting to work
halt - halt the CPU
>
the above two in/out x86-port functions are needed to write the serial driver (drivers/serial.c)
(1) actually it's an AMD Geode LX @ 500Mhz
compatible with x86-i586 :-//