delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/23/06:54:06

Message-ID: <3680D9ED.E5E31769@gmx.de>
Date: Wed, 23 Dec 1998 12:54:21 +0100
From: Christian Hofrichter <ChristianHofrichter AT gmx DOT de>
X-Mailer: Mozilla 4.5 [de]C-CCK-MCD QXW03201 (Win95; I)
X-Accept-Language: de,en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: automatic register allocation && traceback
Reply-To: djgpp AT delorie DOT com

I have modified the code a little bit. Now it looks something like this.

I have tested if the selector is valid (via _farpeekb) and it is. I
could write to the framebuffer without problems.
Concerning to the answer of Shawn Hargreaves, I now use these switches
to store the values in specific registers.
As there is no switch to load a value into the ds or es-register I have
to use the q-switch what should not be a problem, shouldn't it ?
If this is a problem how can I load a value to those registers without
using those switches ?
Although that are only 9 simple instructions, I can't figure out where
the bug is. But it seems that the counter register (cx) does not have
the correct values, because sometimes when it doesn't crash (this
happens if I only execute this code onetime) it writes to much bytes to
the screen.

What if I want to save, let's say the es-register in ax ? How can I make
sure that those registers, I want to use, are not used by gcc temporarly
?
As I have to load the selector into es, I have to load it temporarly via
%0 (there is no special switch to do that). But what if gcc stores this
selector temporarly into ax or another one and I want to uses this
register ? So how can I make sure that those registers, I want to use,
are not used by gcc temporarly ?


asm("pushw %%es\n\t"
    "movw  %0,%%es\n\t"
    "movl  %%ecx,%%ebx\n\t"
    "shr   $2,%%ecx\n\t"
    "and   $3,%%ebx\n\t"
    "rep\n\t"
            "movsl\n\t"
    "movb  %%ebx,%%ecx\n\t"
    "rep\n\t"
            "movsb\n\t"
    "popw %%es":
                   :"c"((unsigned short)width),
"D"(address),"S"(buffer),"q"((unsigned short)vesa_framebuffer)
                   :"%ecx","%esi","%edi","%ebx");



And this is the traceback I got.

Exiting due to signal SIGSEGV
Page fault at eip=000041a6, error=0004
eax=00000000 ebx=00000102 ecx=022fc23d edx=00000000 esi=000f0000
edi=0008fff8
ebp=00055498 esp=0005547a program=E:\DJGPP\FILES\VESA.EXE
cs: sel=00f7  base=82e4a000  limit=ffcdbfff
ds: sel=00ff  base=82e4a000  limit=ffcdbfff
es: sel=012f  base=c5d39000  limit=003fffff
fs: sel=012f  base=c5d39000  limit=003fffff
gs: sel=010f  base=00000000  limit=ffffffff
ss: sel=00ff  base=82e4a000  limit=ffcdbfff

Call frame traceback EIPs:
  0x000041a6
  0x00004fde
  0x00005f6e



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019