Need a list of x86 RAM Locations

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.
Saustin
Posts: 10
Joined: Sat Mar 21, 2009 8:07 pm

Need a list of x86 RAM Locations

Post by Saustin »

I'm planning to program my own OS.

I'm just a noob.
I know C, and it is a HUGE challenge to program a operating system with nothing but simple procedures, and no includes.

Anyways, does anyone have a list of ram locations?
For example:
0xb8000 = VIdeo ram.


That's the only one I know of =/.
Thanks.
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Need a list of x86 RAM Locations

Post by JohnnyTheDon »

Most of them aren't fixed. You need to use ACPI or something similar to detect devices and their associated memory areas. The only exception AFAIK is legacy (ISA) devices that have fixed I/O port numbers for the most part.

And the locations you are looking for aren't RAM, they're memory mapped I/O areas.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Need a list of x86 RAM Locations

Post by bewing »

The best place to start looking is in our wiki.
x86 memory map
Saustin
Posts: 10
Joined: Sat Mar 21, 2009 8:07 pm

Re: Need a list of x86 RAM Locations

Post by Saustin »

Bewing, thanks that isn' what I wanted, but it will certainly help later on.

Johnny, how would I go about.. Say, going about grabbing input, or status and data from the I\O buses?
I just want to make a simple operating system..
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Need a list of x86 RAM Locations

Post by JohnnyTheDon »

Depends what kind of input, status, and data. If you're staying simple, you may want to just stick with legacy ISA devices (keyboard, mouse, etc.). They're covered on the wiki.
Saustin
Posts: 10
Joined: Sat Mar 21, 2009 8:07 pm

Re: Need a list of x86 RAM Locations

Post by Saustin »

http://wiki.osdev.org/ISA
I looked at the following article, and the DMA & IRQ articles, but by input I ment keyboard input..
Do you have any examples?
Like I said, I just started this so PLEASE Make it broken down as much as possible.
Thanks alot!
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Need a list of x86 RAM Locations

Post by JohnnyTheDon »

From the wiki: PS2 Keyboard.

Don't worry that it says PS2 keyboard, most (maybe all?) chipsets emulate USB keyboards as PS2 keyboards.
Saustin
Posts: 10
Joined: Sat Mar 21, 2009 8:07 pm

Re: Need a list of x86 RAM Locations

Post by Saustin »

kernel.c:(.text+0x6f): undefined reference to `inb'

Yeah...
Little help, please.

Code: Select all

void kmain( void* mbd, unsigned int magic )
{
	unsigned char *videoram = (unsigned char *) 0xb8000;
	clearscreen();
	videoram[0] = KeyboardIsr();
       //YES - I know that I would need to add a loop for videoram, but I'm just testing atm.
	
}

void clearscreen()
{
	int clearint;
	unsigned char *videoram = (unsigned char *) 0xb8000;
	for( clearint = 0; clearint < 4000; clearint++ ) {
		videoram[clearint] = 32;
		clearint++;
		videoram[clearint] = 66;
	}
}

void haltcpu()
{
	asm( "hlt" ); //Halts CPU!
}

void KeyboardIsr()
{
	int new_scan_code = inb(0x60);
	//outportb(0x20, 0x20);
	return new_scan_code;
}
On second thought, if you don't mind helping me out, give me your FaceBook, MSN or Yahoo, if you have any and you don't mind helping out a poor old newbie.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Need a list of x86 RAM Locations

Post by Troy Martin »

Saustin wrote:FaceBook
Hurk!

You need to write an inb and an outb function. Use inline assembly. There's an example on the wiki. Search.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Need a list of x86 RAM Locations

Post by JohnnyTheDon »

A few things...

You haven't written inb. You need to write it. You can find an inb implementation on the wiki.

You can't call the ISR and put the return value in video memory like that. You need to remap the Programmable Interrupt Controler, setup a Global Descriptor Table, setup an Interrupt Descriptor Table, and put the ISR address in the proper address in the IDT. The ISR can't return anything, it must take actions itself to display something on the screen. IIRC you could poll the keyboard instead of using interrupts, but this uses up all of the CPU.

EDIT:
Troy, what was the point of the facebook rebuke? Weren't you recently aspiring to be a mod?
<ot ignore=true>
Facebook has its issues, but anything big and corporate will. Myspace is much worse, it practices blatant link censorship and is owned by News Corp. These are the same wonderful people who bring you Fox, the TV network that is fair and balanced (for republicans).
</ot>
Saustin
Posts: 10
Joined: Sat Mar 21, 2009 8:07 pm

Re: Need a list of x86 RAM Locations

Post by Saustin »

Heh, yes I know facebook sucks.
Anyways..
JohnnyTheDon wrote:A few things...

You haven't written inb. You need to write it. You can find an inb implementation on the wiki.

You can't call the ISR and put the return value in video memory like that. You need to remap the Programmable Interrupt Controler, setup a Global Descriptor Table, setup an Interrupt Descriptor Table, and put the ISR address in the proper address in the IDT. The ISR can't return anything, it must take actions itself to display something on the screen. IIRC you could poll the keyboard instead of using interrupts, but this uses up all of the CPU.

EDIT:
Troy, what was the point of the facebook rebuke? Weren't you recently aspiring to be a mod?
<ot ignore=true>
Facebook has its issues, but anything big and corporate will. Myspace is much worse, it practices blatant link censorship and is owned by News Corp. These are the same wonderful people who bring you Fox, the TV network that is fair and balanced (for republicans).
</ot>
Yes, MySpace sucks.

Like I said, I'm keeping this simple as possible.
INB.. Inb.. let me find that on the wiki real quick..
I love you, google.
"site wiki.osdev.org inb"

I found this:
http://wiki.osdev.org/Inline_Assembly/Examples#INx

One second, I'll try it and post.

Okay, I ran..


I typed random stuff, like "A", "B" etc, and all I got was random *** things on the ASCII chart.
//NOOB :Is that what interupts are for?

Where can I find these maps, and how do I implement them?
Last edited by Saustin on Sat Mar 21, 2009 11:15 pm, edited 1 time in total.
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Need a list of x86 RAM Locations

Post by JohnnyTheDon »

Saustin wrote:Like I said, I'm keeping this simple as possible.
It isn't a matter of simplicity, I'm pretty sure it just plain won't work. If the keyboard controller has no key to give you, it won't print the key on the screen. Also, the value you get from the controller is a scan code, not an ASCII key. You need to do the translation before you print anything on the screen.
Saustin
Posts: 10
Joined: Sat Mar 21, 2009 8:07 pm

Re: Need a list of x86 RAM Locations

Post by Saustin »

I know about interrupts. Basically, if I would be anoob and want to rape my processor [like I am now!], all I'm doing is while(1)'ing until it's declared a non null value.
So then I'd do a loop which would compare the scan code to a map?
Also, where can I get a map?

--PLEASE don't give me this: "http://wiki.osdev.org/GDT_Tutorial" I don't understand a bit!
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Need a list of x86 RAM Locations

Post by JohnnyTheDon »

Saustin
Posts: 10
Joined: Sat Mar 21, 2009 8:07 pm

Re: Need a list of x86 RAM Locations

Post by Saustin »

Ah! I feel like such a moron..

So, is it just a case of comparing the hex numbers...
Or is it a case of calculating? #-o

Do you mind giving me your contact info, please?
Private message me if you want to.
Post Reply