negative used blocks with vmware in demo 11

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
vijaymohan
Posts:9
Joined:Fri Sep 18, 2009 6:23 am
negative used blocks with vmware in demo 11

Post by vijaymohan » Tue Oct 06, 2009 8:21 am

Image

is this the problem with vmware ?

code can be browsed at
http://code.google.com/p/zygote/source/ ... ngr_phys.c
http://code.google.com/p/zygote/source/ ... l/kernel.c

i did't modify much in the demo code.

oib111
Posts:38
Joined:Sat Aug 29, 2009 6:44 am

Re: negative used blocks with vmware in demo 11

Post by oib111 » Tue Oct 06, 2009 8:54 pm

I think the problem may be in display.c, change:

Code: Select all

case 'i': {
   c = va_arg (args, int);
   char str[32]={0};
   itoa_s (c, 10, str);
   Puts (str);
   i++;            // go to next character
   break;
}
to

Code: Select all

case 'i': {
   c = va_arg (args, int);
   char str[32]={0};
   itoa (c, 10, str);
   Puts (str);
   i++;            // go to next character
   break;
}

vijaymohan
Posts:9
Joined:Fri Sep 18, 2009 6:23 am

Re: negative used blocks with vmware in demo 11

Post by vijaymohan » Wed Oct 07, 2009 6:04 am

Thanks for the reply.

Changing itos_s to itos will print a large integer value. In my case c = va_arg (args, int); is already a negative value.


Image

Andyhhp
Moderator
Posts:387
Joined:Tue Oct 23, 2007 10:05 am
Location:127.0.0.1
Contact:

Re: negative used blocks with vmware in demo 11

Post by Andyhhp » Fri Oct 09, 2009 6:58 am

the problem is because you are using unsigned integers, but are using a signed conversion routine.

Because of twos complients, if the hightest bit is set, it either means its (effectivly) negative for a signed number, or is just another bit for an unsigned integer.

The conversion routines need to take this into account, so you need 2 different conversion routines.

~Andrew
Image

vijaymohan
Posts:9
Joined:Fri Sep 18, 2009 6:23 am

Re: negative used blocks with vmware in demo 11

Post by vijaymohan » Fri Oct 09, 2009 4:25 pm

Hey Andy,

My problem here is the initialized memory is less than the sum of available memories of the regions. That is the reason why i am getting negative used blocks. my question is, is this the problem specific to vmware or bug in my code.

Andyhhp
Moderator
Posts:387
Joined:Tue Oct 23, 2007 10:05 am
Location:127.0.0.1
Contact:

Re: negative used blocks with vmware in demo 11

Post by Andyhhp » Sat Oct 10, 2009 9:00 am

I guess I misunderstood your problem?

How are you calculating the "initialized memory" ?

From the memory map (which you still have a bug printing the last 4 entries - refer to my previous post to help), you will be able to use all of each avaliable memory region.

Therefore, i would probably say that that is a bug in your code

~Andrew
Image

vijaymohan
Posts:9
Joined:Fri Sep 18, 2009 6:23 am

Re: negative used blocks with vmware in demo 11

Post by vijaymohan » Tue Oct 13, 2009 6:41 am

hi andy, i searched you're previous posts for help on this issue, i did't find one. could you please point me to the link or explain how to correct the problem.

vijaymohan
Posts:9
Joined:Fri Sep 18, 2009 6:23 am

Re: negative used blocks with vmware in demo 11

Post by vijaymohan » Thu Oct 15, 2009 5:21 pm

any help guys ? i am stuck at this.

User avatar
djsilence
Posts:30
Joined:Sun Feb 15, 2009 8:49 pm
Location:Kyiv, Ukraine
Contact:

Re: negative used blocks with vmware in demo 11

Post by djsilence » Wed Nov 04, 2009 2:38 pm

man, the problem could be in you printf. see, itoas function returns signed numbers, you may change it (or create copy of that) just for unsigned values. I had the same problem when number of blocks was negative, but solving of that problem is changing printf function and some changes in memory based function.

Daniel.
Thinking of great - thinking of little, thinking of little - thinking of great.

pswin
Posts:15
Joined:Mon Jun 22, 2009 5:33 pm

Re: negative used blocks with vmware in demo 11

Post by pswin » Sun Nov 22, 2009 7:54 am

djsilence wrote:man, the problem could be in you printf. see, itoas function returns signed numbers, you may change it (or create copy of that) just for unsigned values. I had the same problem when number of blocks was negative, but solving of that problem is changing printf function and some changes in memory based function.

Daniel.

problem is not in the printf function. in bochs it work correctly but not in the vmware

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Re: negative used blocks with vmware in demo 11

Post by Mike » Sat Nov 28, 2009 1:46 pm

Hello,

That alone does not mean anything and has to do with hardware portability (that is, if it works on one machine but runs differently on another). Seeing how it is based off of a chapter, please test the memory management chapter in VMWare and post the results here - it might be a portability bug with VMWare. djsilence is correct here - the issue can actually be a number of things.

Your software shares alot of code from the series. Please keep in mind that, while the code in the demo can be used, it is only meant for demonstration purposes and was never designed to be used in production software.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

pswin
Posts:15
Joined:Mon Jun 22, 2009 5:33 pm

Re: negative used blocks with vmware in demo 11

Post by pswin » Fri Dec 04, 2009 11:20 am

i found problem:

vmware return wrong amount of memory, it's always 2MB less than real memory, for ex:

64MB --> returned 62MB
Attachments
mem_problem.png
mem_problem.png (13.22KiB)Viewed 30237 times

Post Reply