delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/06/02:34:51

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: unused registers, realloc
Date: Sun, 3 Aug 1997 10:27:20 +0100
Organization: None
Distribution: world
Message-ID: <rRqZABA47E5zEwZ0@talula.demon.co.uk>
References: <m0wulJh-0003DjC AT fwd03 DOT btx DOT dtag DOT de>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 25
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Georg Kolling writes:
>1. How can i prevent GCC from using a certain segment register? 
>   Or doesnt it use all segment registers? (Well, cs for code, ds for data,
>   ss for stack, fs for _far stuff... es and gs seem to be unused!)

%cs, %ds, %es, and %ss are used by gcc generated code, and should
therefore be left alone (obviously you could change them within an asm
routine of your own, but be sure to put them back when you are done).
Some library functions use %gs, but %fs is free for whatever you want to
do with it, eg. you can _farsetsel() in your setup code, and as long as
you don't change it later, it will stay set to that value.

>2. Does realloc always return the same pointer if i try to shrink a previously
>   allocated chunk of memory?

I'm not sure about the gcc malloc implementation, but I have in the past
used compilers that did move the block around (it took me forever to
work out why my code suddenly stopped working when I changed compiler!).
It's probably not a good plan to assume that it will stay in the same
place...


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


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