OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 17, 2024 10:12 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re:Strange Behaviour in C
PostPosted: Mon Nov 18, 2002 9:30 am 
Well, I worked out the problem, but I dont know why it is a problem, I have two boot loaders, one is a two stage loader (this causes an error), the other one is a single stage loader (this one works), when I boot with the 2 stage loader I do not get exceptions or anything like that, the variables will just not increment (GDTs are identical in both), but when I use the single stage loader everything runs perfect.

This is very weird!! :o


Top
  
 
 Post subject: Re:Strange Behaviour in C
PostPosted: Mon Nov 18, 2002 8:53 pm 
From what I learned in class, and on my own, if you icrement a pointer *foo++; you are actually changing the memory address it is pointing to by the bit value of the primitive on which the pointer is based. So, a char pointer should increment 8-bits.


Top
  
 
 Post subject: Re:Strange Behaviour in C
PostPosted: Tue Nov 19, 2002 2:47 am 
try:
Code:
*(++video)


it's just an idea, but may work.


Top
  
 
 Post subject: Re:Strange Behaviour in C
PostPosted: Tue Nov 19, 2002 2:53 am 
Perhaps the compiled code is assuming something about the stack and hasn't be initialised properly?

- Nick


Top
  
 
 Post subject: Re:Strange Behaviour in C
PostPosted: Tue Nov 19, 2002 5:00 am 
Perhaps you are right Nick, in the two stage loader I define a segment specifcally for the stack, and the base is not zero.

But in the signle stage loader, my data segment is used for the stack, and it is zero based.

I will try this and let you know.

Thanks.


Top
  
 
 Post subject: Re:Strange Behaviour in C
PostPosted: Tue Nov 19, 2002 5:04 am 
Well that didn't take long, and guess what, Nick is now a genius in my book, because he was spot on the money.

Good stuff, that saved me alot of bug searching.

:) :D ;D :D :) :D ;D :D :)

Thanks Nick, and everyone else who tried to help me.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 64 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group