Kernel question:
Kernel question:
Is this source code for my kernel right?
Please Help me.
[attachment deleted by admin]
Please Help me.
[attachment deleted by admin]
Re:Kernel question:
it looks like misc functions are there.
does anyone know when someone says they want to make their OS portable...what does that mean?
does anyone know when someone says they want to make their OS portable...what does that mean?
Re:Kernel question:
I think they mean letting their os run on more than 1 architecture.
for example netbsd supports a lot of different architectures.
(see the list at the right on www.netbsd.org)
for example netbsd supports a lot of different architectures.
(see the list at the right on www.netbsd.org)
Re:Kernel question:
I think they mean they want their OS to be buzzword-compliant.
For example, windows NT is 'portable'.
(Well, NT -used- to have Alpha and MIPS versions...)
For example, windows NT is 'portable'.
(Well, NT -used- to have Alpha and MIPS versions...)
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel question:
one thing that trouble me with your source is that you have so much PCI scanning and memory probe code, while everything main does is issuing two calls to printf (which isn't declared here ...)nuno_silva_pt wrote: Is this source code for my kernel right?
Please Help me.
Re:Kernel question:
Windows NT is portable. It's just not being ported right now. (Windows NT 3.51 targetted x86, Alpha, PowerPC and MIPS. NT dropped to x86 only after Windows 2000 RC1. Windows CE, on the other hand, is everywhere.)
Re:Kernel question:
I forgot what are the #include files.
Will u ppl tell me, pls, if it isn't asking too much?
Will u ppl tell me, pls, if it isn't asking too much?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel question:
hmm, you should be more clear on what you'd like to know, if you want to be helped. Did you ever try to compile your sources ??Is this source code for my kernel right?
obviously, you need something like #include "types.h" that will declare your ULONG, UCHAR, etc. uppercase identifiers are usually macros, which means the language per se do not know them: they must be #define'd somewhere ...nuno_silva_Main.c:3: error: parse error before "ULONG"
Code: Select all
#define ULONG unsigned long
#define UCHAR unsigned char
#define USHORT unsigned short
#define NULL ((void*)0)
this should be __attribute__ rather than attribute.nuno_silva_Main.c:7: error: parse error before "attribute"
C identifiers are case-sensitive ... where you have "x", you may not have "X" instead. And this is true for keywords aswell: "IF" is not "if".nuno_silva_Main.c:32: error: `X' undeclared (first use in this function)
nuno_silva_Main.c:32: error: `P' undeclared (first use in this function)
This is *not* basic, okay ?
moreover, unlike in basic, printf is not a built-in function of the language (as PRINT is), but rather a library function available in the standard library. However, your kernel usually do not have an implementation of the stdlib to help him, because the STDLIB is OS-dependent ... Therefore, if you want to create an OS, you may not rely on functions like printf, fopen, log(), sin(), etc. to be available. The only functions that will be available are those you'll put in the kernel's environment yourself.
Re:Kernel question:
OK, no problem... but I should warn you that, if you're having trouble with something as fundemental as this, you really should learn more about C programming before jumping into OS design. Just a word of advice.nuno_silva_pt wrote: I forgot what are the #include files.
Will u ppl tell me, pls, if it isn't asking too much?
Anyway: include files, or header files, are files which are automatcally inserted into the text of a source file by the [tt]#include[/tt] preprocessor directive. They are primarily used to allow separate source files to share common type definitions, [tt]extern[/tt] variable declarations, and function prototypes. For example, in the classic "Hello, World!" program,
Code: Select all
#include <stdio.h>
int main()
{
printf("Hello, World!");
}
Code: Select all
int printf (const char*, ...);
This function prototype tells the compiler that there is a function by this name and accepting these arguments, so that it can set up the necessary structures in the object code for the linker to add the function from the library later. Such function prototypes are used to make sure that the function calls in the programs match the actual functions in the libraries.
For some more detailed explanations of [tt]#include[/tt], and the preprocessor in general, see
reply #9 in this thread
Reply #3 in this thread
Reply #13 in this thread
Re:Kernel question:
I have a new kernel, from a tutorial, but when i compile it, gcc says: gcc - undefined reference to __gxx_personality_v0
Please help me...
Please help me...
Re:Kernel question:
It also gives me an information saying something about str, that is the first use of this function...
Here is the source:
[attachment deleted by admin]
Here is the source:
[attachment deleted by admin]
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel question:
Dear Nuno... please, read carefully:nuno_silva_pt wrote: I have a new kernel, from a tutorial, but when i compile it, gcc says: gcc - undefined reference to __gxx_personality_v0
Please help me...
- you MAY NOT use something like #include <stdio.h> in a kernel, because your kernel has nothing like a standard lib.
- you MUST use the --ffreestanding flag when compiling your kernel (which you probably did).
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel question:
nuno_silva_pt wrote: It also gives me an information saying something about str, that is the first use of this function...
Here is the source:
Code: Select all
nuno-kernel2.c: In function `clear_screen':
nuno-kernel2.c:30: error: `str' undeclared (first use in this function)
nuno-kernel2.c:30: error: (Each undeclared identifier is reported only once
nuno-kernel2.c:30: error: for each function it appears in.)
As a particular case, "str" which was declared in "main" does not exist in "clearscreen" even if "clearscreen" is called by main.
looks like you cut'n'pasted the "while" loop a bit too fast. just remove "str++" and it will compile fine.
you also seem to have problems with pointers:
Code: Select all
*text_video++;
Code: Select all
text_video++;
Code: Select all
*text_video = attrib;
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel question:
Code: Select all
gcc nuno-kernel2.c -ffreestanding -nostdlib