Page 1 of 1
Problems encountered in memory detection by operating system
Posted: Fri Nov 30, 2018 2:47 am
by benji
Hi, everyone. I am a complete beginner in Operating System. I find a problem which is I found an error occurred while I refreshed memory. I found 0x502243 is not available. When I try to change the value of the address, my os will crash!!! but 0x502242 & 0x502244 is available. And I found every several KBs, there will be some memory that cannot be used. I am so confused. My virtual box is qemu. The platform is X86. the is my OS source code:https://github.com/FTOlaf/DolphinOS. I use refresh() to refresh memory. The function in memory.c.
Re: Problems encountered in memory detection by operating sy
Posted: Fri Nov 30, 2018 9:18 am
by MichaelPetch
I don't see the code in your file that is allegedly crashing.There is a bunch of stuff commented out but that's about it.You seem to have a lot of peculiar things in your makefile. I question your use of -shared . The way you are building things would probably not work well with that option. In types.h you use #define and terminate it with a semicolon. That is a problem. You seem to use typedefs for something and not others. In idt.c you have the function
Code: Select all
void set_idt_gatedesc(IDT_Gate_Descriptor *gd, uint32_t offset, uint32_t selector, uint32_t ar, uint8_t privilege)
but then call it with fewer parameters like:
Code: Select all
set_idt_gatedesc(idt + i, 0, 0, 0);
.
Your makefile has explicit rules for object files in the wrong directory so it defaults to the builtin make rules for compiling/assembling those files to objects.
You really should be compiling with -ffreestanding .
I think if your compiler is throwing warnings you should not ignore them.
Re: Problems encountered in memory detection by operating sy
Posted: Sun Dec 02, 2018 11:14 pm
by benji
MichaelPetch wrote:I don't see the code in your file that is allegedly crashing.There is a bunch of stuff commented out but that's about it.You seem to have a lot of peculiar things in your makefile. I question your use of -shared . The way you are building things would probably not work well with that option. In types.h you use #define and terminate it with a semicolon. That is a problem. You seem to use typedefs for something and not others. In idt.c you have the function
Code: Select all
void set_idt_gatedesc(IDT_Gate_Descriptor *gd, uint32_t offset, uint32_t selector, uint32_t ar, uint8_t privilege)
but then call it with fewer parameters like:
Code: Select all
set_idt_gatedesc(idt + i, 0, 0, 0);
.
Your makefile has explicit rules for object files in the wrong directory so it defaults to the builtin make rules for compiling/assembling those files to objects.
You really should be compiling with -ffreestanding .
I think if your compiler is throwing warnings you should not ignore them.
Thank you very much, I had found this problem which is the paging isn't installed correctly. You give me a very good suggestion which is considered the warning of the compiler. But, it is difficult to correct all warnings.
Re: Problems encountered in memory detection by operating sy
Posted: Tue Dec 04, 2018 8:02 am
by mallard
benji wrote:But, it is difficult to correct all warnings.
It really isn't and it'll save you a
lot of headaches in the long run. I compile pretty much all my programming projects (including my OS) with all warnings enabled and "warnings are errors" ("-Wall -Wextra -Werror" for GCC). If you're competent enough in the language to build a working OS, you're competent enough to write code that compiles without warnings.
Re: Problems encountered in memory detection by operating sy
Posted: Tue Dec 04, 2018 10:53 pm
by benji
mallard wrote:benji wrote:But, it is difficult to correct all warnings.
It really isn't and it'll save you a
lot of headaches in the long run. I compile pretty much all my programming projects (including my OS) with all warnings enabled and "warnings are errors" ("-Wall -Wextra -Werror" for GCC). If you're competent enough in the language to build a working OS, you're competent enough to write code that compiles without warnings.
Yes, I think so. But I afraid I haven't enough ability to solve those problems. I need to train myself first. I very appreciate you give this advice!
Re: Problems encountered in memory detection by operating sy
Posted: Thu Dec 06, 2018 4:53 pm
by no92
mallard wrote:(...)I compile pretty much all my programming projects (including my OS) with all warnings enabled and "warnings are errors" ("-Wall -Wextra -Werror" for GCC).
Unrelated and minor, but "-Wall -Wextra" does not enable all warnings (to pick one example, I find -Wshadow quite useful but not enabled by this). For a comprehensive list, see the
GCC documentation.
Source: the list of warning options I use is longer than I'd like to admit.