James Kanze said:
"James Kanze" <
[email protected]> wrote in message
[...]
A NON SEGMENTED MEMORY MODEL DOES NOT HAVE A TEXT
SEGMENT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
There are segments, and there are segments. Any modern linker will
understand segments, in order to give you more control of where
things are placed in memory. This has nothing to do with how the
hardware addresses things---both under Windows and under Linux, the
linker will merge several (usually all) logical segments into a
single hardware "segment".
I disagree with some of this but agree with other parts.
<Wintel specific>
A flat memory model , is mapped with a virtual segmented memory model.
The CS, DS,SS registers will be initialised to the appropriated segments.
each segment will have access privileges.
The hardware can then use segment-offset addressing.
</Wintel specific>
There's nothing Wintel specific about the segments defined by the
Sparc
assembler, and managed by the Sparc linker. The segments, in this
case,
disappear once the executable is loaded.
Yes all segments exist in the same flat memory but they have different
access priviledge in a virtual address space..
In a plain flat model there is no segments and no access priviledges.
I've yet to see an assembler/linker that didn't support some form of
segments, and most of my experience is on machines with a flat memory
model.
Its all interrelated with program format , hardware, OS etc etc.
Obviously, you didn't read what you are responding to, or you didn't
understand it.
Yes I read what you wrote re:
"Any modern linker will understand segments, in order to give you more
control of where things are placed in memory. This has nothing to do with
how the hardware addresses things"
And I disagree with you , it is related to how the hardware addresses in
most modern PC's. When a program is loaded the registers are set up to
mirror the program segments, on a windows implementation I know, I am not
saying this is the case on every implementation.
The word segment has two different technical meanings.
One refers to the hardware implementation used by Intel. The other,
older, refers to the logical organization of the generated code into
different segments, which the linker manages separately.
A segment is *not* a hardware addressing mode, or 'hardware implementation'
as you put it.
A segment is a portion , a piece , a section, find a dinosaurus.
A memory segment is therefore a piece of memory, and this is what we are
talknig about/ The memory segments we are talking about are text, code ,
data etc.
There is no need to confuse this with CPU addressing modes. Having said that
the CPU addressing mode is related to memory segments, in many cases, even
on some flat models as I explained with the wintel example. Windows uses
segment registers in application programs of 16,32 and 64-bit addressing
modes. The registers are initialised by the program loader to point to their
respective segments as defined in the program header.
You can suggest you were talking about a segment of pizza from last night ,
but the discussion here wasn't about that.
The hardware won't work without the OS and vice-versa, the two are
interelated.
I dealt with
segments long before the 8086 appeared, on machines with flat
addressing
and no memory protection.
--
Yes here is one I use today:
..NOLIST
#INCLUDE "ti83plus.inc"
#DEFINE ProgStart $9D95
..LIST
..ORG ProgStart - 2
..DB t2ByteTok, tAsmCmp
b_call(_ClrLCDFull)
LD HL, 0
LD (PenCol), HL
LD HL, msg
b_call(_PutS)
b_call(_NewLine)
RET
msg:
.DB "Output text", 0
..END
..END
There are no segments its a flat memory model, but perhaps you are confusing
this with the wintel .flat model.
But there are no TEXT or CODE segments, in the way we know them today. And
as a bonus there is also a function in there .
So that makes Leighs mega repetative statement incorrect, that...a function
only exists as machine code in a text segement .