I'm on a vacation in which I spend long periods of time in a cottage, on a beautiful beach on a lake in southern Canada. One problem: I sort of go into withdrawal when I don't have an internet connection for a while (and I don't there), so I began designing the memory management portion of my os while I was there on paper, writing down questions I came up with. I've answered some of them with quick research but the others I'll post here.
1. How can I read from and write to hard disk without BIOS interrupts in asm?
2. How can process code call a kernel function? (my os uses paging. So how can a process address a function outside of it's virtual memory?)
Warning: possibly a really stupid question.
3. I have no way of testing this on the machine that I have access to now (If I did, I wouldn't ask) but as it is I really want to know now. How can I compile a C file to flat binary using GCC? Does it automatically do this?
Brodeur235
Random Assortment of Questions
-
- Member
- Posts: 86
- Joined: Sat Jun 06, 2009 11:55 am
Random Assortment of Questions
my website: http://67.11.191.209/
my software: http://67.11.191.209/software
my OS: http://67.11.191.209/software/view.php? ... Synergy_OS
my software: http://67.11.191.209/software
my OS: http://67.11.191.209/software/view.php? ... Synergy_OS
-
- Member
- Posts: 204
- Joined: Thu Apr 12, 2007 8:15 am
- Location: Michigan
Re: Random Assortment of Questions
It depends on the hardware. You are probably looking for ATA/ATAPI information.brodeur235 wrote:1. How can I read from and write to hard disk without BIOS interrupts in asm?
See System Callsbrodeur235 wrote:2. How can process code call a kernel function? (my os uses paging. So how can a process address a function outside of it's virtual memory?)
See Linker Scriptsbrodeur235 wrote:3. I have no way of testing this on the machine that I have access to now (If I did, I wouldn't ask) but as it is I really want to know now. How can I compile a C file to flat binary using GCC? Does it automatically do this?
Some people are offended by the verifiable truth; such people tend to remain blissfully unencumbered by fact.
If you are one of these people, my posts may cause considerable discomfort. Read at your own risk.
If you are one of these people, my posts may cause considerable discomfort. Read at your own risk.
-
- Member
- Posts: 86
- Joined: Sat Jun 06, 2009 11:55 am
Re: Random Assortment of Questions
My linker script isn't working. The 'ld' program doesn't recognize the -T option. Here are the sources:
begin.asm
kern.c
lkr.ld
bash script:
output:
What's the problem here?
Brodeur235
begin.asm
Code: Select all
extern _main
call _main
Code: Select all
void main()
{
for(;;) { }
}
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(begin)
Code: Select all
echo Now compiling and linking your kernel . . .
echo
echo Assembling "begin.asm" . . .
nasm begin.asm -f aout -o begin.o
echo Completed.
echo
echo Compiling "kern.c" . . .
gcc kern.c -c -o kern.o
echo Completed.
echo
echo Linking with script "lkr.ld" . . .
ld -o kernel.bin kern.o begin.o -T lkr.ld
echo Completed.
Code: Select all
Now compiling and linking your kernel . . .
Assembling begin.asm . . .
Completed.
Compiling kern.c . . .
kern.c: In function 'main':
kern.c:2: warning: return type of 'main' is not 'int'
Completed.
Linking with script lkr.ld . . .
ld: unknown flag: -T
Completed.
Brodeur235
my website: http://67.11.191.209/
my software: http://67.11.191.209/software
my OS: http://67.11.191.209/software/view.php? ... Synergy_OS
my software: http://67.11.191.209/software
my OS: http://67.11.191.209/software/view.php? ... Synergy_OS
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Random Assortment of Questions
GCC Cross-Compiler
This whole thread also defeats the smart questions rule, and the first post is nothing but couldn't-google-questions. That makes three violations in two posts.
This whole thread also defeats the smart questions rule, and the first post is nothing but couldn't-google-questions. That makes three violations in two posts.