Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2000-12

(no subject)

13 messages · 11 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Renke de Boer

Hi,

I'm programming in Turbo Pascal for Dos for about 2 years. But I have some problems with allocating memory. I have read there's almost no problem with allocating memory in FreePascal by using a Dos-Extender (windows like). But how can I do this? Can someone send a example or some explanation?

Thank you in advance...
_____________________________________________________________________________________ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com

Unknown author
to Renke de Boer
Renke de Boer wrote 6 lines
Hi, I'm programming in Turbo Pascal for Dos for about 2 years. But I have some problems with allocating memory. I have read there's almost no problem with allocating memory in FreePascal by using a Dos-Extender (windows like). But how can I do this? Can someone send a example or some explanation?
Normally, you don't need anything special;
the executables created by FPC have the extender built-in.

Michael.

Tobias Hermann
to Renke de Boer: I'm programming in Turbo Pascal for Dos for about 2 years. But I have some problems with…

Free Pascal producec 32 Bit code, no more 16 bit. The Cpu gets switched to protected mode, no more real mode --> do no more the old 640 kb or 1 MB memory model with XMS or EMS for accessing memory > 1MB.

The memory is adressed with one 32 bit pointer, no more segment:offset things. The only thing like this are the selectors. Can someone explain this? I don't know how this works excactly -> 1x 32 Bit pointer or 2 either (for selector:offset??)

You can allocate memory blocks nealry as you want, no more 64k limitations. You can create very big arrays, all no problem!

Bye,
Tobi

Earlier message 28 lines
----- Original Message ----- From: Renke de Boer To: Sent: Saturday, December 02, 2000 8:48 PM Subject: [fpc-pascal](no subject) > Hi, > > I'm programming in Turbo Pascal for Dos for about 2 years. But I have some > problems with allocating memory. I have read there's almost no problem with > allocating memory in FreePascal by using a Dos-Extender (windows like). But > how can I do this? Can someone send a example or some explanation? > > Thank you in advance... > ____________________________________________________________________________ _________ > Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com > > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal >
Kuba Ober
to Tobias Hermann
The memory is adressed with one 32 bit pointer, no more segment:offset things. The only thing like this are the selectors. Can someone explain this? I don't know how this works excactly -> 1x 32 Bit pointer or 2 either (for selector:offset??)

The pointer is offset and selector taken together. An offset by itself means nothing, a selector by itself means nothing as well. A selector is used to give the offset a meaning, and only together shall they be used, for there's no use when they are 'part, only sigsegv :-)

Take that l-i-t-e-r-a-l-l-y if you don't otherwise want to delve into i386 specs. Selectors are 16 bit only on all architectures which use selectors, as there is hardly need for more than 65535 selectors. Offsets are 32 bit on 32 bit machines.

Kuba

Tobias Hermann
to Kuba Ober

So in 32 bit architecture a pointer is only a 32 bit offset, isn't it? Adressed from 0 to XXXX Bytes...

But how does the OS and the CPU handle the "protected" memory blocks? In 16 bit with selectors, the selectors were a value to an table that stored data of the blocks, how they were protected, if its a code segment or a data segment, etc. etc.
how is this done in 32 bit?

Or have I misunderstood something?

Tobi

Earlier message 23 lines
----- Original Message ----- From: Kuba Ober To: Sent: Saturday, December 02, 2000 10:59 PM Subject: Re: [fpc-pascal](no subject) > > The pointer is offset and selector taken together. An offset by itself means > nothing, a selector by itself means nothing as well. A selector is used to > give the offset a meaning, and only together shall they be used, for there's > no use when they are 'part, only sigsegv :-) > > Take that l-i-t-e-r-a-l-l-y if you don't otherwise want to delve into i386 > specs. Selectors are 16 bit only on all architectures which use selectors, as > there is hardly need for more than 65535 selectors. Offsets are 32 bit on 32 > bit machines. > > Kuba
Carlo Kok
to Tobias Hermann

----- Original Message -----

Earlier message 65 lines
From: "Tobias Hermann" To: Sent: Sunday, December 03, 2000 1:46 AM Subject: Re: [fpc-pascal](no subject) > So in 32 bit architecture a pointer is only a 32 bit offset, isn't it? > Adressed from 0 to XXXX Bytes... Yes. > > But how does the OS and the CPU handle the "protected" memory blocks? In 16 > bit with selectors, the selectors were a value to an table that stored data > of the blocks, how they were protected, if its a code segment or a data > segment, etc. etc. > how is this done in 32 bit? The DPMI host handles all the memory tables and where wat is stored. This is not of a Free Pascal programmers concern. You can use GetMem, FreeMem, Reallocmen, New, Dispose etc for creating and removing variables. If you really want to know how this is done, you should have a look at the linux source. > > Or have I misunderstood something? > > Tobi > > ----- Original Message ----- > From: Kuba Ober > To: > Sent: Saturday, December 02, 2000 10:59 PM > Subject: Re: [fpc-pascal](no subject) > > > > > > The pointer is offset and selector taken together. An offset by itself > means > > nothing, a selector by itself means nothing as well. A selector is used to > > give the offset a meaning, and only together shall they be used, for > there's > > no use when they are 'part, only sigsegv :-) > > > > Take that l-i-t-e-r-a-l-l-y if you don't otherwise want to delve into i386 > > specs. Selectors are 16 bit only on all architectures which use selectors, > as > > there is hardly need for more than 65535 selectors. Offsets are 32 bit on > 32 > > bit machines. > > > > Kuba > > > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal >
Thomas Schatzl
to Tobias Hermann: So in 32 bit architecture a pointer is only a 32 bit offset, isn't it? Adressed from 0 to…

Hello,

So in 32 bit architecture a pointer is only a 32 bit offset, isn't it? Adressed from 0 to XXXX Bytes... But how does the OS and the CPU handle the "protected" memory blocks? In

16

bit with selectors, the selectors were a value to an table that stored

data

of the blocks, how they were protected, if its a code segment or a data segment, etc. etc. how is this done in 32 bit?

It is the same here. Basically the only thing that changed is that the length entry of this block can now be 20 bits. (This allows memory block lengths of 1 MB with byte granularity). To get up to 4 GB addressable memory space there's an additional special bit in the descriptor (= table data block where selector points to) which toggles between byte and 4kb granularity. With that enabled you can get full 32 bit sized memory chunks. (2^20 * 2^12 = 2^32).

A 'real' pointer in DPMI protected mode needs 48 bits to a distinctive memory location then - 16 bits selector value (using the segment registers) and a 32 bit offset into it. Also called 'far pointer' btw. In application programming you have rarely need for changing the memory selector; so a standard pointer used is reduced to the offset into the default (= ds) selector, always assuming ds as the selector part of the fully qualified 48 bit address.

Note that DPMI is not a 'flat' environment, e.g. the default segment registers don't point to a selector which describes _all_ memory beginning from physical memory address 0.

You could describe it in this way (based on your example):

So in 32 bit architecture a pointer is only a 32 bit offset, isn't it? Adressed from 0 to XXXX Bytes beginning from the descriptors' base address for the descriptors' length bytes...
Every access beyond automatically gives a SIGSEGV (abbreviation for SIGnal SEGment Violation I think) - just like it does in '286 protected mode. (RTE 216, GPF or any other abbreviation you prefer)

I hope this clears that issue for you
Thomas

Show quoted text 15 lines
Or have I misunderstood something? Tobi ----- Original Message ----- From: Kuba Ober To: Sent: Saturday, December 02, 2000 10:59 PM Subject: Re: [fpc-pascal](no subject) > > The pointer is offset and selector taken together. An offset by itself means > nothing, a selector by itself means nothing as well. A selector is used

to

Show quoted text 5 lines
> give the offset a meaning, and only together shall they be used, for there's > no use when they are 'part, only sigsegv :-) > > Take that l-i-t-e-r-a-l-l-y if you don't otherwise want to delve into

i386

> specs. Selectors are 16 bit only on all architectures which use

selectors,

as > there is hardly need for more than 65535 selectors. Offsets are 32 bit

on

32 > bit machines. > > Kuba
Marco van de Voort
to Tobias Hermann: So in 32 bit architecture a pointer is only a 32 bit offset, isn't it? Adressed from 0 to…
So in 32 bit architecture a pointer is only a 32 bit offset, isn't it? Adressed from 0 to XXXX Bytes...

A pointer INSIDE the application, and only if all selectors are the same ((cs?=)ds=es=ss)

If dsss then

type xx=^char; {32-bit pointer}

var s : char;
	y : xx;
begin
  ;
end.

For outside the application you need 48-bit pointers (not in the language, all 48-bit access should go through the OS)

Show quoted text 5 lines
But how does the OS and the CPU handle the "protected" memory blocks? In 16 bit with selectors, the selectors were a value to an table that stored data of the blocks, how they were protected, if its a code segment or a data segment, etc. etc. how is this done in 32 bit?

Same, only the protection is more definite, and there are some more attributes.

Marco van de Voort ( or )

Kuba Ober
to Tobias Hermann: So in 32 bit architecture a pointer is only a 32 bit offset, isn't it? Adressed from 0 to…
So in 32 bit architecture a pointer is only a 32 bit offset, isn't it? Adressed from 0 to XXXX Bytes...

Nope, as I said, it's selector AND offset taken together. You need both.

Show quoted text 6 lines
But how does the OS and the CPU handle the "protected" memory blocks? In 16 bit with selectors, the selectors were a value to an table that stored data of the blocks, how they were protected, if its a code segment or a data segment, etc. etc. how is this done in 32 bit?

The selector is still there ;-).
Kuba

Mattias Gaertner
to Kuba Ober

Hi all,

the developer version seems to becoming better than the Delphi compiler. :) But I'm missing one thing: "array of" - Dynamic arrays. When will this be availabe in a stable release?

Mattias

Florian Klaempfl
to Mattias Gaertner
you wrote 5 lines
Hi all, the developer version seems to becoming better than the Delphi compiler. :) But I'm missing one thing: "array of" - Dynamic arrays. When will this be availabe in a stable release?

It will be never in the 1.0.x branch because the
compiler changes are too big and they would make
the stable branch probably instable :).

So it will be available when 1.1.x becomes the stable branch, but this will take some time. I can't tell you a date just consider the delay of Linux 2.4 :)

Javier Morquecho Morquecho
to Florian Klaempfl

Hi you all...

I have been looking for information about Postgres Unit, but at http://www.freepascal.org/ I can't find something, where can I found documentation about this issue ??...

Thanks in advance...

Ing. Morquecho Morquecho
Cedetel
Desarrollo de proyectos comerciales
Tel : 177-10-87
Cel : 177-00-87
e-mail :
e-movil :
Home Cedetel : http://www.cedetel.com.mx

"#define QUESTION ((bb) || !(bb)) // Shakespeare"

Michael Van Canneyt
to Javier Morquecho Morquecho
Javier Morquecho Morquecho wrote 5 lines
Hi you all... I have been looking for information about Postgres Unit, but at http://www.freepascal.org/ I can't find something, where can I found documentation about this issue ??...

The postgres unit is included in the standard distribution. There is unfortunately no documentation for it, but the unit is a straight translation of the postgres C headers.

Any documentation on the C api should be enough for the pascal unit as well.

Michael.