Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
#include <stdio.h>
#include <stdint.h>
#include <inline.h>
static inline void outb (uint16_t port, uint8_t val)
{
asm volatile ("outb% 0,% 1":: "a" (val), "Nd" (port));
/ * There's an outb% al, $ imm8 encoding, for compile-time constant port numbers that fit in 8b. (N constraint).
* Wider immediate constants would be truncated at assemble-time (e.g. "i" constraint).
* The outb% al,% dx encoding is the only option for all other cases.
*% 1 expands to% dx because port is a uint16_t. % w1 could be used if we had the port number a wider C type * /
}
If I try to use outb in the kernel, I get a undefined reference to 'outb' even if I add the outb.o file in the Makefile to the FREEOBJS list. Does anyone have any solution?
Not related to your problem, but why do you include "stdio.h" in your header file, let alone in the code file?
The suspicion - particularly because of the initial error - is that you are cut and pasting code from elsewhere without really understanding what it does.