Author Topic: [DEV] Add ppc64le support for generator-rs - need guidance  (Read 2337 times)

tle

  • Sr. Member
  • ****
  • Posts: 463
  • Karma: +53/-0
    • View Profile
    • Trung's Personal Website
[DEV] Add ppc64le support for generator-rs - need guidance
« on: August 06, 2024, 09:48:31 pm »
Hi folks

One of main blocker of getting Cosmic Desktop compiled on ppc64le is the generator-rs package. I've lodged a ticket upstream in https://github.com/Xudong-Huang/generator-rs/issues/60

However I do not think the author would get to it. So I am thinking to give it a go myself. Can anyone give me some examples of context-switching registers of POWER ISA?

Many thanks
Faithful Linux enthusiast

My Raptor Blackbird

ClassicHasClass

  • Sr. Member
  • ****
  • Posts: 467
  • Karma: +35/-0
  • Talospace Earth Orbit
    • View Profile
    • Floodgap
Re: [DEV] Add ppc64le support for generator-rs - need guidance
« Reply #1 on: August 10, 2024, 07:52:25 pm »
If I'm reading https://github.com/Xudong-Huang/generator-rs/blob/master/src/detail/asm/asm_riscv64_c_elf.S correctly, basically what it's asking for is a function prologue to save registers. This must obey the OpenPOWER SysV ABI, so it would be something like

mflr r0
std r0,16(r1)
mfcr r0
std r0,8(r1)
stdu r1,-FRAMESIZE(r1)

and then start saving your callee-saved registers into the frame, which is basically any non-volatile GPRs and FPRs your routine might touch.

Not quite sure what it's doing with the green task routine but I only read the source cursorily.

tle

  • Sr. Member
  • ****
  • Posts: 463
  • Karma: +53/-0
    • View Profile
    • Trung's Personal Website
Re: [DEV] Add ppc64le support for generator-rs - need guidance
« Reply #2 on: August 13, 2024, 04:22:44 am »
If I'm reading https://github.com/Xudong-Huang/generator-rs/blob/master/src/detail/asm/asm_riscv64_c_elf.S correctly, basically what it's asking for is a function prologue to save registers. This must obey the OpenPOWER SysV ABI, so it would be something like

mflr r0
std r0,16(r1)
mfcr r0
std r0,8(r1)
stdu r1,-FRAMESIZE(r1)

and then start saving your callee-saved registers into the frame, which is basically any non-volatile GPRs and FPRs your routine might touch.

Not quite sure what it's doing with the green task routine but I only read the source cursorily.

From my understanding the RISV asm consists of 3 functions:

* The prefetch function is essentially a no-op function
* The bootstrap_green_task function sets up arguments and then jumps to the address contained in register s4, effectively starting a new task or function.
* The swap_registers function saves the current values of a large number of registers (both general-purpose and floating-point) to memory and then restores them from another memory location

Thanks for show me the OpenPOWER SysV ABI example, let me do a bit homework
Faithful Linux enthusiast

My Raptor Blackbird