I have been modelling the Concertina II architecture, and related
ones, on that of the IBM System/360 in a number of ways.
A recent thread discussing register windows led me to think of
subroutine calling conventions. Which register windows would perhaps complicate.
When a subroutine is called on the IBM System/360, it usually starts
out by creating one base register value for itself by means of the
BALR instruction. That's basically a subroutine call that doesn't go anywhere.
Except for the one register that value is put in, exempted by the
calling convention rules, the other general registers can then be
saved in an area of data storage area located immediately after the
program code, pointed to with the aid of the base register value set
up which points just after the start of the program.
But modern microprocessors, because of the increased danger from
viruses and hackers, fix things so that the processor is allowed to
execute instructions only from memory labelled one way - and to write
data in memory labelled another way. And never the twain does meet -
except with a call to the operating system being made between when the
loader loads a program from disk into memory, and the program is
started.
So this IBM-style calling convention that I've built the architecture
around is now obsolete! Save areas have to be passed to subroutines!
I wonder if you know:
1) Successors to 360 have PC-relative addressing, so using BALR to
capture PC usually is not needed.
2) Save areas are normally allocated on the stack
3) If for some reason you want save area in fixed place you can
load its address to register. Save area does not have to be very
close to the code (but if it is far away then you need to provide
more bits in the instruction).
4) While security folks insist on separate code and data areas,
there is still a lot of code that mixes them. And arguably,
if language checks memory accesses, then separtation does not
provide extra security.
To explain this a bit more: popular
alternative to dynamically generated code is use of function
pointers or intrpretive execution. But of course, overwriting
interpretive code is as bad as overwriting native code.
Similarly, overwriting function pointers allows executing
arbitrary existing code and programs frequently have enough
capabilities that the word "existing" is not a serious
limitation to determined attacker.
AFAICS biggest trouble is due to caches: writes go to data cache,
code is fetched from instruction cache and at least L1 caches
are separate. So there is synchronization overhead, but that
should be managable.
On Sun, 8 Nov 2026 15:55:42 -0000 (UTC), antispam@fricas.org (Waldek
Hebisch) wrote:
I wonder if you know:
1) Successors to 360 have PC-relative addressing, so using BALR to
capture PC usually is not needed.
Concertina II has PC-relative addressing, but it still also uses base registers for most addressing. A subroutine call with a base-relative destination address can be used in place of a BALR instruction to
capture an address value.
2) Save areas are normally allocated on the stack
I know that's how most PCs work. The 360 did not have a stack at all
in the old days. Of course, a stack can be implemented even without an explicit stack pointer. And I presumed this was what the successors to
the 360 might do; define one register as the one in which a pointer to
the save area is passed.
3) If for some reason you want save area in fixed place you can
load its address to register. Save area does not have to be very
close to the code (but if it is far away then you need to provide
more bits in the instruction).
Huh? Can't I just use a different base register if they're far away?
4) While security folks insist on separate code and data areas,
there is still a lot of code that mixes them. And arguably,
if language checks memory accesses, then separtation does not
provide extra security.
That argument is fallacious, since a software barrier has the obvious potential of being bypassed if a way to sneak in machine code can be
found.
To explain this a bit more: popular
alternative to dynamically generated code is use of function
pointers or intrpretive execution. But of course, overwriting
interpretive code is as bad as overwriting native code.
It's _almost_ as bad, since, of course, the interpreter can impose
additional limits that the hardware instruction set does not impose.
--- Synchronet 3.22a-Linux NewsLink 1.2Similarly, overwriting function pointers allows executing
arbitrary existing code and programs frequently have enough
capabilities that the word "existing" is not a serious
limitation to determined attacker.
AFAICS biggest trouble is due to caches: writes go to data cache,
code is fetched from instruction cache and at least L1 caches
are separate. So there is synchronization overhead, but that
should be managable.
Machines that separate code and data are still perfectly able to use techniques like just-in-time compilation; the same technique is used
as is needed for such a simple thing as loading a program from the
disk. Make an OS call to flip the usage of the memory area involved.
Separating code and data is an obstacle to naively coding the way
people used to on a 360; I wasn't claiming that it was a crippling
obstacle to such a commonly used technique.
John Savard
On Sun, 8 Nov 2026 15:55:42 -0000 (UTC), antispam@fricas.org (Waldek
Hebisch) wrote:
I wonder if you know:
1) Successors to 360 have PC-relative addressing, so using BALR to
capture PC usually is not needed.
Concertina II has PC-relative addressing, but it still also uses base >registers for most addressing. A subroutine call with a base-relative >destination address can be used in place of a BALR instruction to
capture an address value.
2) Save areas are normally allocated on the stack
I know that's how most PCs work. The 360 did not have a stack at all
in the old days. Of course, a stack can be implemented even without an >explicit stack pointer. And I presumed this was what the successors to
the 360 might do; define one register as the one in which a pointer to
the save area is passed.
On Sun, 8 Nov 2026 15:55:42 -0000 (UTC), antispam@fricas.org (Waldek
Hebisch) wrote:
I wonder if you know:
1) Successors to 360 have PC-relative addressing, so using BALR to
capture PC usually is not needed.
Concertina II has PC-relative addressing, but it still also uses base registers for most addressing. A subroutine call with a base-relative destination address can be used in place of a BALR instruction to
capture an address value.
2) Save areas are normally allocated on the stack
I know that's how most PCs work. The 360 did not have a stack at all
in the old days. Of course, a stack can be implemented even without an explicit stack pointer. And I presumed this was what the successors to
the 360 might do; define one register as the one in which a pointer to
the save area is passed.
3) If for some reason you want save area in fixed place you can
load its address to register. Save area does not have to be very
close to the code (but if it is far away then you need to provide
more bits in the instruction).
Huh? Can't I just use a different base register if they're far away?
4) While security folks insist on separate code and data areas,
there is still a lot of code that mixes them. And arguably,
if language checks memory accesses, then separtation does not
provide extra security.
That argument is fallacious, since a software barrier has the obvious potential of being bypassed if a way to sneak in machine code can be
found.
To explain this a bit more: popular
alternative to dynamically generated code is use of function
pointers or intrpretive execution. But of course, overwriting
interpretive code is as bad as overwriting native code.
It's _almost_ as bad, since, of course, the interpreter can impose
additional limits that the hardware instruction set does not impose.
Similarly, overwriting function pointers allows executing
arbitrary existing code and programs frequently have enough
capabilities that the word "existing" is not a serious
limitation to determined attacker.
AFAICS biggest trouble is due to caches: writes go to data cache,
code is fetched from instruction cache and at least L1 caches
are separate. So there is synchronization overhead, but that
should be managable.
Machines that separate code and data are still perfectly able to use techniques like just-in-time compilation; the same technique is used
as is needed for such a simple thing as loading a program from the
disk. Make an OS call to flip the usage of the memory area involved.
Separating code and data is an obstacle to naively coding the way--
people used to on a 360; I wasn't claiming that it was a crippling
obstacle to such a commonly used technique.
John Savard
IIUC you are trying to add decent support for constants to
your architecture, in such case need to extra will vanish
On Sun, 8 Nov 2026 22:12:45 -0000 (UTC), antispam@fricas.org (Waldek
Hebisch) wrote:
IIUC you are trying to add decent support for constants to
your architecture, in such case need to extra will vanish
Yes; since I agree with Mitch Alsup that putting constants as
immediates within the instruction stream has a huge performance
advantage over doing a separate fetch from memory, I felt that this
was needed.
And you're right - the loader can just relocate any immediate defined
as being the value of an address.
That's still put in a base register, though, so it's still true that a subroutine can't normally preserve all the registers of its caller.
Which is not a disaster, since the calling convention can reserve a
register for that purpose.
What _would_ be intolerable would be if this limitation also meant
that it was impossible to write an interrupt service routine on such
an architecture. One way to solve that problem is to have a "Store
Multiple Absolute" instruction with a 64-bit absolute address. The
other is to have the interrupt process itself save at least one
general register in addition to the PSW.
John Savard--- Synchronet 3.22a-Linux NewsLink 1.2
quadibloc@invalid.com (John Savard) posted:
What _would_ be intolerable would be if this limitation also meant
that it was impossible to write an interrupt service routine on such
an architecture. One way to solve that problem is to have a "Store
Multiple Absolute" instruction with a 64-bit absolute address. The
That is effectively what I have done with Thread-State (5 cache lines
holding Program status line, and the RF). A machine CR points at T-S,
HW <conceptually> LDs T-S and stores T-S when needed {although other
-|Arch may provide banks of pre-loaded T-Ss}.
other is to have the interrupt process itself save at least one
general register in addition to the PSW.
Let HW do it and remain re-entrant and interruptible even in the ISR.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 76 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 54:48:38 |
| Calls: | 1,265 |
| Calls today: | 1 |
| Files: | 1,362 |
| D/L today: |
3 files (2,684K bytes) |
| Messages: | 285,582 |