Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

I *____knew* I had some reason for not logging you off... If I could just remember what it was.


computers / comp.os.vms / New PHP kits available (and a programming question)

SubjectAuthor
* New PHP kits available (and a programming question)Mark Berryman
+- Re: New PHP kits available (and a programming question)abrsvc
+* Re: New PHP kits available (and a programming question)John Reagan
|`- Re: New PHP kits available (and a programming question)Mark Berryman
+- Re: New PHP kits available (and a programming question)John Reagan
+- Re: New PHP kits available (and a programming question)John Reagan
+- Re: New PHP kits available (and a programming question)Arne Vajhøj
`- Re: New PHP kits available (and a programming question)Arne Vajhøj

1
New PHP kits available (and a programming question)

<u8hg8b$2jcj5$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=28738&group=comp.os.vms#28738

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mar...@theberrymans.com (Mark Berryman)
Newsgroups: comp.os.vms
Subject: New PHP kits available (and a programming question)
Date: Mon, 10 Jul 2023 11:47:53 -0600
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <u8hg8b$2jcj5$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 10 Jul 2023 17:47:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ada9e9f70f8613b3c9b336ec71caf805";
logging-data="2732645"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/irGGWX6vjMrcH1jHNf3RUe7WM89d68k0="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.13.0
Cancel-Lock: sha1:HpMuuo2dfhTcqEP9c/dIvB41kBM=
Content-Language: en-US
 by: Mark Berryman - Mon, 10 Jul 2023 17:47 UTC

I have made some new ports of PHP available as follows:

PHP 8.0.29
https://theberrymans.com/php_kits/php_axp_8_0_29.zip
https://theberrymans.com/php_kits/php_i64_8_0_29.zip
https://theberrymans.com/php_kits/php_x86_8_0_29.zip

PHP 8.1.20
https://theberrymans.com/php_kits/php_x86_8_1_20.zip

PHP 8.1 and later implement a new feature named fibers. It is
advertised as allowing a program running in a single thread to run
multiple threads. In reality, it simply allows one to create co-routines.

In order to implement this feature, PHP needs to be able to save and
restore execution context, as well as the ability to jump to a saved PC
location. PHP uses the boost library to implement this and the boost
library provides code in x86 assembly for the save/restore functions. I
had planned to implement similar functionality for Alpha and Integrity
using Macro32, only to discover that Macro32 doesn't provide access to
the floating point registers.

So, I'd to like to request an informal poll. How many folks would like
to have a version of PHP later than 8.0 for their Alpha or Integrity
systems?

While I'm waiting for the answers, if anyone knows how I can
save/restore execution context and jump to a saved PC location, I would
appreciate any hints. I had hoped to use the various *INVO* functions
for this but, while I have found routines that will save the current
context, I haven't found any that will load the contents of an INVO
block back into the registers.

Also, what languages have access to all of the registers?

Mark Berryman

Re: New PHP kits available (and a programming question)

<36ac4e49-d061-4b54-a229-3a2d8b125704n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=28741&group=comp.os.vms#28741

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:622a:152:b0:403:b382:6767 with SMTP id v18-20020a05622a015200b00403b3826767mr5085qtw.13.1689019946950;
Mon, 10 Jul 2023 13:12:26 -0700 (PDT)
X-Received: by 2002:a63:3f08:0:b0:52c:999a:fce2 with SMTP id
m8-20020a633f08000000b0052c999afce2mr9282393pga.10.1689019946638; Mon, 10 Jul
2023 13:12:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!glou.org!news.glou.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Mon, 10 Jul 2023 13:12:26 -0700 (PDT)
In-Reply-To: <u8hg8b$2jcj5$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:190:8200:f230:85bf:671d:e110:6d64;
posting-account=Ysq9BAoAAACGX1EcMMPkdNg4YcTg0TxG
NNTP-Posting-Host: 2601:190:8200:f230:85bf:671d:e110:6d64
References: <u8hg8b$2jcj5$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <36ac4e49-d061-4b54-a229-3a2d8b125704n@googlegroups.com>
Subject: Re: New PHP kits available (and a programming question)
From: dansabrs...@yahoo.com (abrsvc)
Injection-Date: Mon, 10 Jul 2023 20:12:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: abrsvc - Mon, 10 Jul 2023 20:12 UTC

On Monday, July 10, 2023 at 1:47:58 PM UTC-4, Mark Berryman wrote:
> I have made some new ports of PHP available as follows:
>
> PHP 8.0.29
> https://theberrymans.com/php_kits/php_axp_8_0_29.zip
> https://theberrymans.com/php_kits/php_i64_8_0_29.zip
> https://theberrymans.com/php_kits/php_x86_8_0_29.zip
>
> PHP 8.1.20
> https://theberrymans.com/php_kits/php_x86_8_1_20.zip
>
> PHP 8.1 and later implement a new feature named fibers. It is
> advertised as allowing a program running in a single thread to run
> multiple threads. In reality, it simply allows one to create co-routines.
>
> In order to implement this feature, PHP needs to be able to save and
> restore execution context, as well as the ability to jump to a saved PC
> location. PHP uses the boost library to implement this and the boost
> library provides code in x86 assembly for the save/restore functions. I
> had planned to implement similar functionality for Alpha and Integrity
> using Macro32, only to discover that Macro32 doesn't provide access to
> the floating point registers.
>
> So, I'd to like to request an informal poll. How many folks would like
> to have a version of PHP later than 8.0 for their Alpha or Integrity
> systems?
>
> While I'm waiting for the answers, if anyone knows how I can
> save/restore execution context and jump to a saved PC location, I would
> appreciate any hints. I had hoped to use the various *INVO* functions
> for this but, while I have found routines that will save the current
> context, I haven't found any that will load the contents of an INVO
> block back into the registers.
>
> Also, what languages have access to all of the registers?
>
> Mark Berryman

You may need to resort a module written using Alpha assembly. I recall having a routine to save context a long time ago. I am not at home at the momenet so it may take a few days to locate this. If I find it, I will post here.

Dan

Re: New PHP kits available (and a programming question)

<f9cdf39e-565e-40c2-b21c-9b89ada24cadn@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=28742&group=comp.os.vms#28742

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ac8:5b4b:0:b0:403:394c:bf29 with SMTP id n11-20020ac85b4b000000b00403394cbf29mr51823qtw.2.1689020443493;
Mon, 10 Jul 2023 13:20:43 -0700 (PDT)
X-Received: by 2002:a63:344a:0:b0:543:b015:600b with SMTP id
b71-20020a63344a000000b00543b015600bmr9284172pga.8.1689020442887; Mon, 10 Jul
2023 13:20:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!glou.org!news.glou.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Mon, 10 Jul 2023 13:20:42 -0700 (PDT)
In-Reply-To: <u8hg8b$2jcj5$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:6010:d203:ebee:f914:be38:8bee:9763;
posting-account=M3IgSwoAAADJd6EnOmsrCCfB6_OyTOkv
NNTP-Posting-Host: 2603:6010:d203:ebee:f914:be38:8bee:9763
References: <u8hg8b$2jcj5$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f9cdf39e-565e-40c2-b21c-9b89ada24cadn@googlegroups.com>
Subject: Re: New PHP kits available (and a programming question)
From: xyzzy1...@gmail.com (John Reagan)
Injection-Date: Mon, 10 Jul 2023 20:20:43 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: John Reagan - Mon, 10 Jul 2023 20:20 UTC

On Monday, July 10, 2023 at 1:47:58 PM UTC-4, Mark Berryman wrote:
> I have made some new ports of PHP available as follows:
>
> PHP 8.0.29
> https://theberrymans.com/php_kits/php_axp_8_0_29.zip
> https://theberrymans.com/php_kits/php_i64_8_0_29.zip
> https://theberrymans.com/php_kits/php_x86_8_0_29.zip
>
> PHP 8.1.20
> https://theberrymans.com/php_kits/php_x86_8_1_20.zip
>
> PHP 8.1 and later implement a new feature named fibers. It is
> advertised as allowing a program running in a single thread to run
> multiple threads. In reality, it simply allows one to create co-routines.
>
> In order to implement this feature, PHP needs to be able to save and
> restore execution context, as well as the ability to jump to a saved PC
> location. PHP uses the boost library to implement this and the boost
> library provides code in x86 assembly for the save/restore functions. I
> had planned to implement similar functionality for Alpha and Integrity
> using Macro32, only to discover that Macro32 doesn't provide access to
> the floating point registers.
>
> So, I'd to like to request an informal poll. How many folks would like
> to have a version of PHP later than 8.0 for their Alpha or Integrity
> systems?
>
> While I'm waiting for the answers, if anyone knows how I can
> save/restore execution context and jump to a saved PC location, I would
> appreciate any hints. I had hoped to use the various *INVO* functions
> for this but, while I have found routines that will save the current
> context, I haven't found any that will load the contents of an INVO
> block back into the registers.
>
> Also, what languages have access to all of the registers?
>
> Mark Berryman
Look at SYS$GOTO_UNWIND_64. It should be able to put all the registers back and jump to a PC.

The trick is "which PC". Pascal uses it for non-local GOTOs and C uses it for setjmp()/longjmp().
It takes an invo-handle and a target-PC. The target-PC needs to be a routine or a label that the
optimizer treats special (not to optimize things across it).

For C, setjmp() saves a bunch of stuff from the ICB, longjmp() actually uses a special
routine inside the CRTL as the target for the SYS$GOTO_UNWIND_64 call. It gets passed
the jmp-buf which has the actual destination back in setjmp(). It restores some registers
and does an indirect jmp back to the saved pc inside the jmp-buf.

Re: New PHP kits available (and a programming question)

<d01bfe6e-8df9-4bb3-9cb0-7263ee683057n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=28743&group=comp.os.vms#28743

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:622a:180b:b0:401:e279:6967 with SMTP id t11-20020a05622a180b00b00401e2796967mr77224qtc.3.1689020500959;
Mon, 10 Jul 2023 13:21:40 -0700 (PDT)
X-Received: by 2002:a17:903:41c3:b0:1b7:f24c:3ba3 with SMTP id
u3-20020a17090341c300b001b7f24c3ba3mr12272152ple.13.1689020500569; Mon, 10
Jul 2023 13:21:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Mon, 10 Jul 2023 13:21:39 -0700 (PDT)
In-Reply-To: <u8hg8b$2jcj5$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:6010:d203:ebee:f914:be38:8bee:9763;
posting-account=M3IgSwoAAADJd6EnOmsrCCfB6_OyTOkv
NNTP-Posting-Host: 2603:6010:d203:ebee:f914:be38:8bee:9763
References: <u8hg8b$2jcj5$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d01bfe6e-8df9-4bb3-9cb0-7263ee683057n@googlegroups.com>
Subject: Re: New PHP kits available (and a programming question)
From: xyzzy1...@gmail.com (John Reagan)
Injection-Date: Mon, 10 Jul 2023 20:21:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3027
 by: John Reagan - Mon, 10 Jul 2023 20:21 UTC

On Monday, July 10, 2023 at 1:47:58 PM UTC-4, Mark Berryman wrote:
> I have made some new ports of PHP available as follows:
>
> PHP 8.0.29
> https://theberrymans.com/php_kits/php_axp_8_0_29.zip
> https://theberrymans.com/php_kits/php_i64_8_0_29.zip
> https://theberrymans.com/php_kits/php_x86_8_0_29.zip
>
> PHP 8.1.20
> https://theberrymans.com/php_kits/php_x86_8_1_20.zip
>
> PHP 8.1 and later implement a new feature named fibers. It is
> advertised as allowing a program running in a single thread to run
> multiple threads. In reality, it simply allows one to create co-routines.
>
> In order to implement this feature, PHP needs to be able to save and
> restore execution context, as well as the ability to jump to a saved PC
> location. PHP uses the boost library to implement this and the boost
> library provides code in x86 assembly for the save/restore functions. I
> had planned to implement similar functionality for Alpha and Integrity
> using Macro32, only to discover that Macro32 doesn't provide access to
> the floating point registers.
>
> So, I'd to like to request an informal poll. How many folks would like
> to have a version of PHP later than 8.0 for their Alpha or Integrity
> systems?
>
> While I'm waiting for the answers, if anyone knows how I can
> save/restore execution context and jump to a saved PC location, I would
> appreciate any hints. I had hoped to use the various *INVO* functions
> for this but, while I have found routines that will save the current
> context, I haven't found any that will load the contents of an INVO
> block back into the registers.
>
> Also, what languages have access to all of the registers?
>
> Mark Berryman

Re: New PHP kits available (and a programming question)

<6fbc03f3-159a-492e-80a9-c53fe094f786n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=28744&group=comp.os.vms#28744

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ac8:5cc8:0:b0:403:a6f7:aa16 with SMTP id s8-20020ac85cc8000000b00403a6f7aa16mr23713qta.10.1689020564357;
Mon, 10 Jul 2023 13:22:44 -0700 (PDT)
X-Received: by 2002:a05:6a00:9a8:b0:682:24c1:2951 with SMTP id
u40-20020a056a0009a800b0068224c12951mr18682834pfg.0.1689020564032; Mon, 10
Jul 2023 13:22:44 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Mon, 10 Jul 2023 13:22:43 -0700 (PDT)
In-Reply-To: <u8hg8b$2jcj5$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:6010:d203:ebee:f914:be38:8bee:9763;
posting-account=M3IgSwoAAADJd6EnOmsrCCfB6_OyTOkv
NNTP-Posting-Host: 2603:6010:d203:ebee:f914:be38:8bee:9763
References: <u8hg8b$2jcj5$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6fbc03f3-159a-492e-80a9-c53fe094f786n@googlegroups.com>
Subject: Re: New PHP kits available (and a programming question)
From: xyzzy1...@gmail.com (John Reagan)
Injection-Date: Mon, 10 Jul 2023 20:22:44 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3189
 by: John Reagan - Mon, 10 Jul 2023 20:22 UTC

On Monday, July 10, 2023 at 1:47:58 PM UTC-4, Mark Berryman wrote:
> I have made some new ports of PHP available as follows:
>
> PHP 8.0.29
> https://theberrymans.com/php_kits/php_axp_8_0_29.zip
> https://theberrymans.com/php_kits/php_i64_8_0_29.zip
> https://theberrymans.com/php_kits/php_x86_8_0_29.zip
>
> PHP 8.1.20
> https://theberrymans.com/php_kits/php_x86_8_1_20.zip
>
> PHP 8.1 and later implement a new feature named fibers. It is
> advertised as allowing a program running in a single thread to run
> multiple threads. In reality, it simply allows one to create co-routines.
>
> In order to implement this feature, PHP needs to be able to save and
> restore execution context, as well as the ability to jump to a saved PC
> location. PHP uses the boost library to implement this and the boost
> library provides code in x86 assembly for the save/restore functions. I
> had planned to implement similar functionality for Alpha and Integrity
> using Macro32, only to discover that Macro32 doesn't provide access to
> the floating point registers.
>
> So, I'd to like to request an informal poll. How many folks would like
> to have a version of PHP later than 8.0 for their Alpha or Integrity
> systems?
>
> While I'm waiting for the answers, if anyone knows how I can
> save/restore execution context and jump to a saved PC location, I would
> appreciate any hints. I had hoped to use the various *INVO* functions
> for this but, while I have found routines that will save the current
> context, I haven't found any that will load the contents of an INVO
> block back into the registers.
>
> Also, what languages have access to all of the registers?
>
> Mark Berryman
As Dan said, there will be some assembly involved. For C, we don't optimize any floating point across setjmp()
so longjmp() doesn't have to put anything back.

Re: New PHP kits available (and a programming question)

<u8i5hi$2lmj5$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=28745&group=comp.os.vms#28745

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: New PHP kits available (and a programming question)
Date: Mon, 10 Jul 2023 19:51:16 -0400
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <u8i5hi$2lmj5$1@dont-email.me>
References: <u8hg8b$2jcj5$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 10 Jul 2023 23:51:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1746f06484338f92b1cb323c2fe48fb2";
logging-data="2808421"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/xQHpB6eSO6Z3r0NgHDKO1ae0Rv3L8QeU="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:Cs3aXx6i1qZE+WKbpEYaIN+Jufc=
Content-Language: en-US
In-Reply-To: <u8hg8b$2jcj5$1@dont-email.me>
 by: Arne Vajhøj - Mon, 10 Jul 2023 23:51 UTC

On 7/10/2023 1:47 PM, Mark Berryman wrote:
> I have made some new ports of PHP available as follows:
>
> PHP 8.0.29
> https://theberrymans.com/php_kits/php_axp_8_0_29.zip
> https://theberrymans.com/php_kits/php_i64_8_0_29.zip
> https://theberrymans.com/php_kits/php_x86_8_0_29.zip
>
> PHP 8.1.20
> https://theberrymans.com/php_kits/php_x86_8_1_20.zip

Thanks.

> PHP 8.1 and later implement a new feature named fibers.  It is
> advertised as allowing a program running in a single thread to run
> multiple threads.  In reality, it simply allows one to create co-routines.

Fibers are a known concept.

https://en.wikipedia.org/wiki/Fiber_(computer_science)

Besides Boost they are also part of Windows:

https://learn.microsoft.com/en-us/windows/win32/procthread/fibers

> In order to implement this feature, PHP needs to be able to save and
> restore execution context, as well as the ability to jump to a saved PC
> location.  PHP uses the boost library to implement this and the boost
> library provides code in x86 assembly for the save/restore functions.  I
> had planned to implement similar functionality for Alpha and Integrity
> using Macro32, only to discover that Macro32 doesn't provide access to
> the floating point registers.

It would be nice if VMS had Boost!

> So, I'd to like to request an informal poll.  How many folks would like
> to have a version of PHP later than 8.0 for their Alpha or Integrity
> systems?

I am for. Not because I really need it (I do little PHP), but
because I want VMS on all platforms to have as much software
as possible available.

> While I'm waiting for the answers, if anyone knows how I can
> save/restore execution context and jump to a saved PC location, I would
> appreciate any hints.  I had hoped to use the various *INVO* functions
> for this but, while I have found routines that will save the current
> context, I haven't found any that will load the contents of an INVO
> block back into the registers.
>
> Also, what languages have access to all of the registers?

Native assembler and languages that allow inline assembler??

Arne

Re: New PHP kits available (and a programming question)

<u8i61j$2lmj5$3@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=28747&group=comp.os.vms#28747

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: New PHP kits available (and a programming question)
Date: Mon, 10 Jul 2023 19:59:49 -0400
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <u8i61j$2lmj5$3@dont-email.me>
References: <u8hg8b$2jcj5$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 10 Jul 2023 23:59:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1746f06484338f92b1cb323c2fe48fb2";
logging-data="2808421"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+DApmdkmIHmul6yonHeZBYpBWmtWYVL8w="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:7G1V6g0i0/HdvyI84bkXM5xNA0w=
Content-Language: en-US
In-Reply-To: <u8hg8b$2jcj5$1@dont-email.me>
 by: Arne Vajhøj - Mon, 10 Jul 2023 23:59 UTC

On 7/10/2023 1:47 PM, Mark Berryman wrote:
> PHP 8.1 and later implement a new feature named fibers.  It is
> advertised as allowing a program running in a single thread to run
> multiple threads.  In reality, it simply allows one to create co-routines.
>
> In order to implement this feature, PHP needs to be able to save and
> restore execution context, as well as the ability to jump to a saved PC
> location.  PHP uses the boost library to implement this and the boost
> library provides code in x86 assembly for the save/restore functions.  I
> had planned to implement similar functionality for Alpha and Integrity
> using Macro32, only to discover that Macro32 doesn't provide access to
> the floating point registers.

> While I'm waiting for the answers, if anyone knows how I can
> save/restore execution context and jump to a saved PC location, I would
> appreciate any hints.  I had hoped to use the various *INVO* functions
> for this but, while I have found routines that will save the current
> context, I haven't found any that will load the contents of an INVO
> block back into the registers.

I have never used EXE$KP_* but in a recent thread I think it
was agreed that they were really a coroutine implementation.
So obvious question: could they be used to implement this?

Arne

Re: New PHP kits available (and a programming question)

<u8pbgr$3n0gb$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=28791&group=comp.os.vms#28791

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mar...@theberrymans.com (Mark Berryman)
Newsgroups: comp.os.vms
Subject: Re: New PHP kits available (and a programming question)
Date: Thu, 13 Jul 2023 11:16:10 -0600
Organization: A noiseless patient Spider
Lines: 328
Message-ID: <u8pbgr$3n0gb$1@dont-email.me>
References: <u8hg8b$2jcj5$1@dont-email.me>
<f9cdf39e-565e-40c2-b21c-9b89ada24cadn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 13 Jul 2023 17:16:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e10be56800b192cd0b644f6bc473d68c";
logging-data="3899915"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dhGCdx9Exn0Hp7X28cnea6aiUlBy9m+0="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.13.0
Cancel-Lock: sha1:KAouytIwQzTgezj8AnzI0iWIjrU=
In-Reply-To: <f9cdf39e-565e-40c2-b21c-9b89ada24cadn@googlegroups.com>
Content-Language: en-US
 by: Mark Berryman - Thu, 13 Jul 2023 17:16 UTC

On 7/10/23 2:20 PM, John Reagan wrote:
> On Monday, July 10, 2023 at 1:47:58 PM UTC-4, Mark Berryman wrote:
>> .
>> .
>> .
>> While I'm waiting for the answers, if anyone knows how I can
>> save/restore execution context and jump to a saved PC location, I would
>> appreciate any hints. I had hoped to use the various *INVO* functions
>> for this but, while I have found routines that will save the current
>> context, I haven't found any that will load the contents of an INVO
>> block back into the registers.
>>
>> Also, what languages have access to all of the registers?
>>
>> Mark Berryman
> Look at SYS$GOTO_UNWIND_64. It should be able to put all the registers back and jump to a PC.
>
> The trick is "which PC". Pascal uses it for non-local GOTOs and C uses it for setjmp()/longjmp().
> It takes an invo-handle and a target-PC. The target-PC needs to be a routine or a label that the
> optimizer treats special (not to optimize things across it).
>
> For C, setjmp() saves a bunch of stuff from the ICB, longjmp() actually uses a special
> routine inside the CRTL as the target for the SYS$GOTO_UNWIND_64 call. It gets passed
> the jmp-buf which has the actual destination back in setjmp(). It restores some registers
> and does an indirect jmp back to the saved pc inside the jmp-buf.

It looks like SYS$GOTO_UNWIND_64 will do the trick. Sadly, I have to
admit that I got lost trying to understand what the boost code does vs.
what VMS wants (especially in regards to register usage). I am asking
for help in this regard.

There are two functions involved here. They are defined as follows:

extern void *make_fcontext(void *sp, size_t size, void
(*fn)(boost_context_data));

extern ZEND_INDIRECT_RETURN boost_context_data jump_fcontext(void *to,
zend_fiber_transfer *transfer);

typedef struct {
void *handle;
zend_fiber_transfer *transfer;
} boost_context_data;

typedef struct _zend_fiber_transfer {
/* Fiber that will be switched to / has resumed us. */
zend_fiber_context *context;

/* Value to that should be send to (or was received from) a
fiber. */
zval value;

/* Bitmask of flags defined in enum zend_fiber_transfer_flag. */
uint8_t flags;
} zend_fiber_transfer;

struct _zend_fiber_context {
/* Pointer to boost.context or ucontext_t data. */
void *handle;

/* Pointer that identifies the fiber type. */
void *kind;

/* Entrypoint function of the fiber. */
zend_fiber_coroutine function;

/* Assigned C stack. */
zend_fiber_stack *stack;

/* Fiber status. */
zend_fiber_status status;

/* Reserved for extensions */
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
};

typedef struct _zend_fiber_context zend_fiber_context;

And these are the two routines.

-----------------------------------------------------------
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/

/****************************************************************************************
*
*
*
----------------------------------------------------------------------------------
*
* | 0 | 1 | 2 | 3 | 4 | 5 | 6
| 7 | *
*
----------------------------------------------------------------------------------
*
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 |
0x18 | 0x1c | *
*
----------------------------------------------------------------------------------
*
* | fc_mxcsr|fc_x87_cw| R12 | R13 |
R14 | *
*
----------------------------------------------------------------------------------
*
*
----------------------------------------------------------------------------------
*
* | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | *
*
----------------------------------------------------------------------------------
*
* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 |
0x38 | 0x3c | *
*
----------------------------------------------------------------------------------
*
* | R15 | RBX | RBP |
RIP | *
*
----------------------------------------------------------------------------------
*
*
*
****************************************************************************************/

# if defined __CET__
# include <cet.h>
# else
# define _CET_ENDBR
# endif
..file "make_x86_64_sysv_elf_gas.S"
..text
..globl make_fcontext
..type make_fcontext,@function
..align 16
make_fcontext:
/* first arg of make_fcontext() == top of context-stack */
movq %rdi, %rax

/* shift address in RAX to lower 16 byte boundary */
andq $-16, %rax

/* reserve space for context-data on context-stack */
/* on context-function entry: (RSP -0x8) % 16 == 0 */
leaq -0x40(%rax), %rax

/* third arg of make_fcontext() == address of context-function */
/* stored in RBX */
movq %rdx, 0x28(%rax)

/* save MMX control- and status-word */
stmxcsr (%rax)
/* save x87 control-word */
fnstcw 0x4(%rax)

/* compute abs address of label trampoline */
leaq trampoline(%rip), %rcx
/* save address of trampoline as return-address for context-function */
/* will be entered after calling jump_fcontext() first time */
movq %rcx, 0x38(%rax)

/* compute abs address of label finish */
leaq finish(%rip), %rcx
/* save address of finish as return-address for context-function */
/* will be entered after context-function returns */
movq %rcx, 0x30(%rax)

ret /* return pointer to context-data */

trampoline:
/* store return address on stack */
/* fix stack alignment */
push %rbp
/* jump to context-function */
jmp *%rbx

finish:
/* exit code is zero */
xorq %rdi, %rdi
/* exit application */
/* call _exit@PLT */
hlt
..size make_fcontext,.-make_fcontext

/* Mark that we don't need executable stack. */
..section .note.GNU-stack,"",%progbits

------------------------------------------------------------

/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/

/****************************************************************************************
*
*
*
----------------------------------------------------------------------------------
*
* | 0 | 1 | 2 | 3 | 4 | 5 | 6
| 7 | *
*
----------------------------------------------------------------------------------
*
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 |
0x18 | 0x1c | *
*
----------------------------------------------------------------------------------
*
* | fc_mxcsr|fc_x87_cw| R12 | R13 |
R14 | *
*
----------------------------------------------------------------------------------
*
*
----------------------------------------------------------------------------------
*
* | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | *
*
----------------------------------------------------------------------------------
*
* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 |
0x38 | 0x3c | *
*
----------------------------------------------------------------------------------
*
* | R15 | RBX | RBP |
RIP | *
*
----------------------------------------------------------------------------------
*
*
*
****************************************************************************************/

# if defined __CET__
# include <cet.h>
# else
# define _CET_ENDBR
# endif
..file "jump_x86_64_sysv_elf_gas.S"
..text
..globl jump_fcontext
..type jump_fcontext,@function
..align 16
jump_fcontext:
leaq -0x38(%rsp), %rsp /* prepare stack */

#if !defined(BOOST_USE_TSX)
stmxcsr (%rsp) /* save MMX control- and status-word */
fnstcw 0x4(%rsp) /* save x87 control-word */
#endif

movq %r12, 0x8(%rsp) /* save R12 */
movq %r13, 0x10(%rsp) /* save R13 */
movq %r14, 0x18(%rsp) /* save R14 */
movq %r15, 0x20(%rsp) /* save R15 */
movq %rbx, 0x28(%rsp) /* save RBX */
movq %rbp, 0x30(%rsp) /* save RBP */


Click here to read the complete article
1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor