Re: Segments

Liste des GroupesRevenir à c arch 
Sujet : Re: Segments
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.arch
Date : 23. Jan 2025, 10:52:32
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250123115232.0000242e@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Thu, 23 Jan 2025 01:00:49 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:

Michael S <already5chosen@yahoo.com> writes:
On Wed, 22 Jan 2025 22:44:45 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:
 
mitchalsup@aol.com (MitchAlsup1) writes: 
On Wed, 22 Jan 2025 20:00:30 +0000, Scott Lurndal wrote:
  
mitchalsup@aol.com (MitchAlsup1) writes:   
On Wed, 22 Jan 2025 14:58:04 +0000, Scott Lurndal wrote:   
(MitchAlsup1)   
  
On a Linux machine, you can find the last envp[*] entry and
subtract SP from it.   
>
I would discourage programmers from relying on that for any
reason whatsoever.   The aux vectors are pushed before the
envp entries.   
>
This brings into question what is "on" the stack ?? to be
included in the measurement of stack size.
>
Only user data ??
Data that is present when control arrives ??
Could <equivalent> CRT0 store SP at arrival ??
>
I think we have an illdefined measurement !!   
>
Everything between the base address of the stack
and the limit address of the stack.  The kernel exec(2)
family system calls will allocate the initial
stack region (with guard pages to handle extension)
and populate it with the AUX, ENVP and ARG vectors
before invoking the CRT in usermode.   
>
So, how does one find the base (highest address on the stack) ??
in a way that works on every system capable of running C-code ??
 
 
It's not something that a programmer generally would need, or want
to do. 
 
However, if the OS they're using has a guard page to prevent
stack underflow, one could write a subroutine which accesses
page-aligned addresses towards the beginning of the stack
region (anti the direction of growth) until a
SIGSEGV is delivered.
 
>
Not every system capable of running C supports signals. I would
think that those that support signals are not even majority. 
 
Linux and MAC can't touch windows in terms of volume - but I'd
argue that in the universe of programmers, they're close to
if not equal to windows.  The vast vast majority of windows
users don't have a compiler.  Those that do are working at
a higher level where the knowlege of the stack base address
would not be a useful value to know.
 

I did not have "big" computers in mind. In fact, if we only look at
"big" things then Android dwarfs anything else. And while Android is not
POSIX complaint, it is probably similar enough for your method to work.

I had in mind smaller things.
All but one of very many embedded environments that I touched in
last 3 decades had no signals. The exceptional one was running
Linux.

Unix (bsd/sysv) and linux support the ucontex argument
on the signal handler which provides processor state so
the signal handler can recover from the fault in whatever
fashion makes sense then transfer control to a known
starting point (either siglongjmp or by manipulating the
return context provided to the signal handler). This is
clearly going to be processor and implementation specific.
 
Yes, Windows is an abberation.   I offered a solution, not
"the" solution. I haven't seen any valid reason for a program[*]
to need to know the base address of the process stack; if there
were a need, the implementation would provide.   I believe windows
does have a functional equivalent to SIGSEGV, no?  A quick search
shows "EXCEPTION_ACCESS_VIOLATION" for windows.
>

But then one would have to use SEH which is not the same as signals.
Although a specific case of SIGSEGV is the one where the SEH and
signals happen to be rather similar.
I can try it one day, but not today.

[*] Leaving aside the rare system utility or diagnostic
    utility or library (e.g. valgrind, et alia may find
    that a useful datum).



Date Sujet#  Auteur
4 Jan 25 * Re: Byte ordering138Waldek Hebisch
5 Jan 25 +- Re: Byte ordering1Terje Mathisen
5 Jan 25 `* 80286 protected mode (was: Byte ordering)136Anton Ertl
5 Jan 25  +* Re: 80286 protected mode (was: Byte ordering)2Robert Swindells
5 Jan 25  i`- Re: 80286 protected mode1Brian G. Lucas
5 Jan 25  `* Re: 80286 protected mode133Waldek Hebisch
6 Jan 25   `* Re: 80286 protected mode132George Neuner
6 Jan 25    +* Segments (was: 80286 protected mode)129Anton Ertl
6 Jan 25    i+- Re: Segments (was: 80286 protected mode)1Michael S
6 Jan 25    i+* Re: Segments126Terje Mathisen
6 Jan 25    ii+* Re: Segments2Anton Ertl
6 Jan 25    iii`- Re: Segments1MitchAlsup1
6 Jan 25    ii+* Re: Segments2MitchAlsup1
7 Jan 25    iii`- Re: Segments1Terje Mathisen
6 Jan 25    ii`* Re: Segments121Thomas Koenig
7 Jan 25    ii +* Re: Segments2MitchAlsup1
7 Jan 25    ii i`- Re: Segments1Thomas Koenig
7 Jan 25    ii `* Re: Segments118Thomas Koenig
7 Jan 25    ii  +* Re: Segments7Michael S
7 Jan 25    ii  i+- Re: Segments1Thomas Koenig
7 Jan 25    ii  i`* Re: Segments5MitchAlsup1
7 Jan 25    ii  i `* Re: Segments4Thomas Koenig
8 Jan 25    ii  i  `* Re: Segments3MitchAlsup1
8 Jan 25    ii  i   `* Re: Segments2Thomas Koenig
11 Jan 25    ii  i    `- Re: Segments1MitchAlsup1
15 Jan 25    ii  `* Re: Segments110Keith Thompson
15 Jan 25    ii   `* Re: Segments109Thomas Koenig
15 Jan 25    ii    +* Re: Segments83Michael S
15 Jan 25    ii    i`* Re: Segments82Thomas Koenig
15 Jan 25    ii    i `* Re: Segments81Michael S
15 Jan 25    ii    i  +* Re: Segments79Thomas Koenig
16 Jan 25    ii    i  i`* Re: Segments78David Brown
16 Jan 25    ii    i  i `* Re: Segments77Michael S
16 Jan 25    ii    i  i  `* Re: Segments76David Brown
16 Jan 25    ii    i  i   `* Re: Segments75Waldek Hebisch
16 Jan 25    ii    i  i    +* Re: Segments42Thomas Koenig
16 Jan 25    ii    i  i    i+* Re: Segments39MitchAlsup1
18 Jan 25    ii    i  i    ii`* Re: Stacks, was Segments38John Levine
18 Jan 25    ii    i  i    ii +* Re: Stacks, was Segments36Niklas Holsti
18 Jan 25    ii    i  i    ii i+- Re: Stacks, was Segments1John Levine
19 Jan 25    ii    i  i    ii i+* Re: Stacks, was Segments33David Brown
19 Jan 25    ii    i  i    ii ii+* Re: Stacks, was Segments30MitchAlsup1
20 Jan 25    ii    i  i    ii iii`* Re: Stacks, was Segments29Michael S
20 Jan 25    ii    i  i    ii iii `* Re: Stacks, was Segments28Waldek Hebisch
20 Jan 25    ii    i  i    ii iii  `* Re: Stacks, was Segments27MitchAlsup1
21 Jan 25    ii    i  i    ii iii   +* Re: Stacks, was Segments2Michael S
21 Jan 25    ii    i  i    ii iii   i`- Re: Stacks, was Segments1MitchAlsup1
21 Jan 25    ii    i  i    ii iii   +- Re: Stacks, was Segments1Thomas Koenig
21 Jan 25    ii    i  i    ii iii   +* Re: Stacks, was Segments2Bill Findlay
21 Jan 25    ii    i  i    ii iii   i`- Re: Stacks, was Segments1MitchAlsup1
3 Feb 25    ii    i  i    ii iii   `* Re: Stacks, was Segments21Stefan Monnier
3 Feb 25    ii    i  i    ii iii    `* Re: Stacks, was Segments20MitchAlsup1
4 Feb 25    ii    i  i    ii iii     `* Re: Stacks, was Segments19MitchAlsup1
6 Feb 25    ii    i  i    ii iii      `* Re: Stacks, was Segments18MitchAlsup1
6 Feb 25    ii    i  i    ii iii       `* Re: Stacks, was Segments17MitchAlsup1
6 Feb 25    ii    i  i    ii iii        +* Re: Stacks, was Segments15Stephen Fuld
7 Feb 25    ii    i  i    ii iii        i+* Re: Stacks, was Segments12MitchAlsup1
7 Feb 25    ii    i  i    ii iii        ii+* Re: Stacks, was Segments10MitchAlsup1
8 Feb 25    ii    i  i    ii iii        iii`* Re: Stacks, was Segments9MitchAlsup1
11 Feb 25    ii    i  i    ii iii        iii `* Re: Stacks, was Segments8MitchAlsup1
11 Feb 25    ii    i  i    ii iii        iii  `* Re: Stacks, was Segments7MitchAlsup1
12 Feb 25    ii    i  i    ii iii        iii   `* Re: Stacks, was Segments6MitchAlsup1
13 Feb 25    ii    i  i    ii iii        iii    +* Re: Stacks, was Segments2MitchAlsup1
13 Feb 25    ii    i  i    ii iii        iii    i`- Re: Stacks, was Segments1MitchAlsup1
14 Feb 25    ii    i  i    ii iii        iii    `* Re: Stacks, was Segments3MitchAlsup1
14 Feb 25    ii    i  i    ii iii        iii     `* Re: Stacks, was Segments2MitchAlsup1
16 Feb 25    ii    i  i    ii iii        iii      `- Re: Stacks, was Segments1MitchAlsup1
11 Feb 25    ii    i  i    ii iii        ii`- Re: Stacks, was Segments1Stephen Fuld
7 Feb 25    ii    i  i    ii iii        i`* Re: Stacks, was Segments2MitchAlsup1
9 Feb 25    ii    i  i    ii iii        i `- Re: Stacks, was Segments1MitchAlsup1
6 Feb 25    ii    i  i    ii iii        `- Re: Stacks, was Segments1MitchAlsup1
19 Jan 25    ii    i  i    ii ii`* Re: Stacks, was Segments2Niklas Holsti
20 Jan 25    ii    i  i    ii ii `- Re: Stacks, was Segments1David Brown
28 Jan 25    ii    i  i    ii i`- Re: Stacks, was Segments1Tim Rentsch
18 Jan 25    ii    i  i    ii `- Re: Stacks, was Segments1MitchAlsup1
16 Jan 25    ii    i  i    i+- Re: Segments1Michael S
16 Jan 25    ii    i  i    i`- Re: Segments1Waldek Hebisch
16 Jan 25    ii    i  i    `* Re: Segments32David Brown
17 Jan 25    ii    i  i     +* Re: Segments4Waldek Hebisch
17 Jan 25    ii    i  i     i+* Re: Segments2Keith Thompson
17 Jan 25    ii    i  i     ii`- Re: Segments1David Brown
17 Jan 25    ii    i  i     i`- Re: Segments1David Brown
17 Jan 25    ii    i  i     +* Re: Segments2David Brown
17 Jan 25    ii    i  i     i`- Re: Segments1Brian G. Lucas
17 Jan 25    ii    i  i     `* Re: Segments25Thomas Koenig
17 Jan 25    ii    i  i      +* Re: Segments2David Brown
17 Jan 25    ii    i  i      i`- Re: Segments1Thomas Koenig
22 Jan 25    ii    i  i      +* Re: Segments12MitchAlsup1
22 Jan 25    ii    i  i      i`* Re: Segments11MitchAlsup1
22 Jan 25    ii    i  i      i `* Re: Segments10MitchAlsup1
23 Jan 25    ii    i  i      i  +* Re: Segments8Michael S
23 Jan 25    ii    i  i      i  i+* Re: Segments5Anton Ertl
23 Jan 25    ii    i  i      i  ii+* Re: Segments3Michael S
23 Jan 25    ii    i  i      i  iii+- Re: Segments1Anton Ertl
28 Jan 25    ii    i  i      i  iii`- Re: Segments1Tim Rentsch
23 Jan 25    ii    i  i      i  ii`- Re: Segments1Keith Thompson
23 Jan 25    ii    i  i      i  i`* Re: Segments2Michael S
23 Jan 25    ii    i  i      i  i `- Re: Segments1Michael S
23 Jan 25    ii    i  i      i  `- Re: Segments1George Neuner
22 Jan 25    ii    i  i      `* Re: stack sizes, Segments10John Levine
22 Jan 25    ii    i  i       `* Re: stack sizes, Segments9Michael S
16 Jan 25    ii    i  `- Re: Segments1David Brown
15 Jan 25    ii    +* Re: Segments2Keith Thompson
16 Jan 25    ii    `* Re: Segments23Terje Mathisen
11 Jan 25    i`- Re: Segments1Andy Valencia
6 Jan 25    `* Re: what's a segment, 80286 protected mode2John Levine

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal