kernel functions?
Posted: Tue Oct 26, 2004 1:16 am
well, I have been thinking.. while I have been reading different posts the standard functions provided in the c-library like printf would be something like this
void printf(const char *, ... )
{
// fix the va_list stuff
...
// then write to the video memory
char *vidmem = 0xb8000;
...
}
altough this writes directly to the memory which I don't understand? that would imply that the userspace-application will have direct memory access!?
and another thing, lets say I go through the kernel doing like this:
void printf(const char *str, ... )
{
// do the va_list stuff
...
// write finished string using a kernel print function
k_printstr( str_buff );
}
but how do I get the user-app to use the kernels print string function? if I link the c-lib directly to the source file of the k_printstr(...); function it won't work as it suppose to becouse if I do like that the k_printstr would be linked to the user-app at compile time and that would make the k_printstr function run in user space which would stop the app from writing to memory.
so then the kernel functions must be aviable through a dynamicly linking, which would allow the c-lib to dynamicly resolve the kernel-k_printstr function.
or is this faaaar from what it "should" be ? ::)
void printf(const char *, ... )
{
// fix the va_list stuff
...
// then write to the video memory
char *vidmem = 0xb8000;
...
}
altough this writes directly to the memory which I don't understand? that would imply that the userspace-application will have direct memory access!?
and another thing, lets say I go through the kernel doing like this:
void printf(const char *str, ... )
{
// do the va_list stuff
...
// write finished string using a kernel print function
k_printstr( str_buff );
}
but how do I get the user-app to use the kernels print string function? if I link the c-lib directly to the source file of the k_printstr(...); function it won't work as it suppose to becouse if I do like that the k_printstr would be linked to the user-app at compile time and that would make the k_printstr function run in user space which would stop the app from writing to memory.
so then the kernel functions must be aviable through a dynamicly linking, which would allow the c-lib to dynamicly resolve the kernel-k_printstr function.
or is this faaaar from what it "should" be ? ::)