iret return cs selector null after attempting to add graphic

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

Moderator: Moderators

Post Reply
yma
Posts: 7
Joined: Tue Dec 14, 2010 3:54 am

iret return cs selector null after attempting to add graphic

Post by yma » Tue Dec 14, 2010 4:08 am

I was working on my laptop (which i am not on right now) on an operating system project. I started with the os developement tutorial's tutorial 23 on this site. then I tried to add graphics. I switch to mode 13h before protected mode, test and everything was fine. then I modified the printing functions to use the new graphics setting, as well as adding a function to load letter formats from a file. I then tested and i got iret: return cs selector null in bochs. In addition the cpu had somehow gone to v8086 mode. after some fiddling I got it to stay in protected mode. any suggestions on whats going on?

yma
Posts: 7
Joined: Tue Dec 14, 2010 3:54 am

Re: iret return cs selector null after attempting to add graphic

Post by yma » Wed Dec 15, 2010 6:19 pm

I fixed the previous error, but now am getting check_cs(0x2e2e): not a valid code segment ! and a general protection fault. I know the area of code this is coming from, and will post code soon.

yma
Posts: 7
Joined: Tue Dec 14, 2010 3:54 am

Re: iret return cs selector null after attempting to add graphic

Post by yma » Wed Dec 15, 2010 6:24 pm

Code: Select all

unsigned char **bitmaps;

void getMaps(char* f)
{
   bitmaps = new unsigned char *[26];
   FILE file = volOpenFile(f);
   if (file.flags == FS_INVALID) {
      return;
   }
   
   //! cant display directories
   if (( file.flags & FS_DIRECTORY ) == FS_DIRECTORY) {
      return;
   }
   int k = 0;
   while (file.eof != 1)
   {
      unsigned char buffer[64];
      volReadFile (&file, buffer, 64);
      if (k < 26)
      {
         bitmaps[k] = buffer;
      }
      k++;
   }
}



theres the code that's causing the problem. please help.

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

Re: iret return cs selector null after attempting to add graphic

Post by Mike » Thu Dec 16, 2010 5:26 am

Hello,

The demos provided by the series does not implement heap management. This includes malloc and the new operators. Please let me know if you have developed your own implementation of new and delete. If not, that will be a problem.

What type of bitmap are you trying to display?
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

yma
Posts: 7
Joined: Tue Dec 14, 2010 3:54 am

Re: iret return cs selector null after attempting to add graphic

Post by yma » Fri Dec 17, 2010 7:24 am

it is just 26 8x8 character arrays, with either a dot or an x. in the print function if an x appears, it puts a pixel on the screen at the position of the cursor combined with the current position within the array.

Post Reply