Page 2 of 2

Re: How to start?

Posted: Wed Aug 06, 2008 4:30 am
by naiksidd_85
I use VMWare Work station 6.0.

If you see my previous posts i was too working on PCI and faced similar issue but when the code is written in ASM the problem was solved dont know why and yes VMWare behaves differently you may even face issue if you try to write a fdd driver code.

it initialises things differently

Re: How to start?

Posted: Wed Aug 06, 2008 6:27 am
by Adek336
faced similar issue but when the code is written in ASM the problem was solved dont know why
and yes VMWare behaves differently you may even face issue if you try to write a fdd driver code.

it initialises things differently
I bet VMWare PCI emulation behaves differently than hw PCI only for buggy code :mrgreen:
And I bet you have some problems with your C code for PCI handling. The behaviour for programming the hardware wrong is very often defined to be "unspecified", so that means there may be no standard for what is to happen, when a buggy routine talks to the PCI; so it can differ between stations.
return inportl(0xCFC);
This seem to dfifer from the wiki's example: wiki makes some bit shifting http://wiki.osdev.org/PCI
tmp = (unsigned short)((sysInLong (0xCFC) >> ((offset & 2) * 8 )) & 0xffff);
PCI_Device_t* pci_readdevice(int bus, int dev, int func)
{
PCI_Device_t* ret;
ret->VendorID = (short) (pci_read(bus,dev,func,0)&0x0000FFFF);
You forgot to initialise ret.

Re: How to start?

Posted: Wed Aug 06, 2008 6:55 am
by eddyb
my return is long, the return in the wiki is short.
what do you mean to initialize?

ps: still having the vs2008 problem with no other output that echo's.

Re: How to start?

Posted: Wed Aug 06, 2008 9:08 am
by Adek336
ret is a pointer. Later in the code you showed, you write the memory ret points at. However, you do not know what it points at. It may point at data that should not be overwritten, like your program's code or the stack. To be sure it is legal to write (and read) the memory pointed by ret, you must initialise it, that is, assigning a proper value to it like


ret = new pci_device_t;

What is vs2008 ? What is the problem: what should it do and what does it do?

Re: How to start?

Posted: Wed Aug 06, 2008 9:55 am
by eddyb
new from where. C doesn't accept it.
ok, doesnt matter, i'll do it later. i am now focused on memory management. I have some problems with it(I'm following jamesM tutorial), cause it doesn't fault when i do the fault test(reading from an unpaged address).

vs2008 means Visual Studio 2008. I use a makefile project and there is a tool, nmake for custom build command.
the output windows shows only the output of the command echo. it should shows all(gcc, ld, nasm output, etc)

Re: How to start?

Posted: Wed Aug 06, 2008 10:19 pm
by eddyb
problems again. memory management is the hardest problem.
i'm getting page fault on this line:

Code: Select all

memset(to_ret.array, 0, max_size*sizeof(type_t));
from the function place_ordered_array

if jamesM can tell me why and how i can implement the memory management on my system, is welcome.
this is causing me headcaches... :x

PS: can you recomend another memory management ideea?

Re: How to start?

Posted: Wed Aug 06, 2008 11:41 pm
by naiksidd_85
I bet VMWare PCI emulation behaves differently than hw PCI only for buggy code :mrgreen:
i agree but i was saying i faced the issue and resolved it by using asm I never did say it is problem with VMWare

Re: How to start?

Posted: Tue Aug 12, 2008 5:27 am
by eddyb
have you know a very very simple memory manager code(I mean very basic paging and very basic mem alloc).
I'm so noob even the forum search is too hard to use properly(I mean to find what i want).
i haven't found any topic that could help me. If you can, thank you. Even if it is a very simple code, i'll improve later.
Anyway, my code is so buggy, it restarts before starts :) .
Thanks for helping a poor noob....

EDIT: sorry for my english

Re: How to start?

Posted: Thu Aug 14, 2008 11:39 am
by Combuster
Then practice google skills first :(

There are too many examples of this (in and out of the forum) that it couldn't be that you can't find any.