Path: utzoo!utgpu!water!watmath!clyde!att!alberta!calgary!radford From: radford@calgary.UUCP (Radford Neal) Newsgroups: comp.arch Subject: Re: Intel memory model (really segmented memory) Message-ID: <1623@vaxb.calgary.UUCP> Date: 22 May 88 20:56:18 GMT References: <1806@obiwan.mips.COM> <2904@omepd> <353@cf-cm.UUCP> <524@xios.XIOS.UUCP> Organization: U. of Calgary, Calgary, Ab. Lines: 55 In article <524@xios.XIOS.UUCP>, greg@xios.XIOS.UUCP (Greg Franks) writes: > The biggest win when segmenting is implemented properly, is that it > allows you to put individual items into separate segments and then use > the hardware protection mechanisms to catch illegal references. Bounds > checking can be done in parallel to program execution because explicit > 'check' instructions need not be included in the program... I don't think one necessarily gets this advantage, at least not from segments as I understand the term. One would like to get a run-time error on execution of the following program: int a[10], b[10]; int i; i = 15; ... a[i] = 0; One wouldn't want to have this just modify b[5] instead of the non-existent a[15]. I presume that you are proposing allocating the arrays a and b to different segments, and protecting all but the first ten words of each. This may work with i==15, but how about i==12345678? The address of a[i] is likely to be computed as &a[0] + i. If the segment number for a is the high-order part of &a[0], then adding i can change this to the segment number for b, and it's possible that the segment offset will also end up being valid. A scheme like this might work if the machine has addition instructions that carefully work on just the offset part of a combined segment number/offset pointer. My impression is that this is not typically considered part and parcel of "segmented memory". It may be a good idea of course. Regardless of any of this, you will need explicit check instructions if you want to detect the following Pascal error: var a: array [1..10,1..10] of integer; i, j: integer; begin i := 1; j := 11; ... a[i,j] := 0; end; The final address computed from the two subscripts is valid, but one of them is out of range, and therefore in error. You could allocate each row of the array a different segment, but that is getting to be a bit ridiculous. Radford Neal