cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/21/20:38:28

Date: Sat, 21 Mar 1998 17:36:16 -0800 (PST)
Message-Id: <199803220136.RAA16736@adit.ap.net>
Mime-Version: 1.0
To: sandmann AT clio DOT rice DOT edu (Charles Sandmann), cssl AT geocities DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Can the text section be made read-only?
Cc: djgpp-workers AT delorie DOT com

--=====================_890530417==_
Content-Type: text/plain; charset="us-ascii"

At 09:58  3/21/1998 -0600, Charles Sandmann wrote:

>But the core issue on all of this is moving the writable variables
>in exceptn.s out of the text section... there is no way to 
>implement it without doing that first.

Is that as simple as just adding `.data' before them and `.text' after? It
looks like it is (the code that locks them doesn't seem to care where they
are), but I'm not sure.

How about the variable in `crt0.s': `_what_size_app_thinks_it_is'? I blindly
submitted a patch to move that into .data some time ago, and I think it
ended up in the alpha. Does it need to be locked? I can't tell from the source.

Other than that, can we just do something like this in, say, crt1.c?

extern int etext asm("etext");

void __djgpp_protect_text_section(void)
{
   __djgpp_set_page_attributes((void *)0, ((unsigned)&etext) & ~4096, 1);
}

and then call it if the appropriate crt0 flag is set? Will `text' always be
the first section, and will it always start at virtual address 0?

I suppose this will cause some minimal code bloat, by forcing
`__djgpp_set_page_attributes' to be linked, but AFAICT it's only about 2-300
bytes.

--=====================_890530417==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="EXCEPTN.DIF"

*** src/libc/go32/exceptn.s~	Sun Dec 10 20:36:18 1995
--- src/libc/go32/exceptn.s	Sat Mar 21 17:04:28 1998
***************
*** 240,245 ****
--- 240,246 ----
  	movsl					/* Copy structure to stack */
  	jmp	*%edx				/* A "return" */
  
+ 	.data
  	.align	4		/* We will touch this; it must be locked */
  	.global ___djgpp_hw_lock_start
  ___djgpp_hw_lock_start:
***************
*** 267,272 ****
--- 268,274 ----
  	.global	___djgpp_ds_alias
  ___djgpp_ds_alias:		.word	0	/* used in dpmi/api/d0303.s (alloc rmcb) */
  
+ 	.text
  	.align 4
  	.global	___djgpp_npx_hdlr
  ___djgpp_npx_hdlr:

--=====================_890530417==_
Content-Type: text/plain; charset="us-ascii"


Nate Eldredge
eldredge AT ap DOT net



--=====================_890530417==_--

- Raw text -


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