[PR #47] [MERGED] run_main_entry: Rewrite in asm for stack setup #1240

Closed
opened 2026-02-27 21:11:46 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/47
Author: @skmp
Created: 10/2/2023
Status: Merged
Merged: 10/2/2023
Merged by: @georgemoralis

Base: mainHead: skmp/setup-stack


📝 Commits (1)

  • 5094d30 run_main_entry: Rewrite in asm for stack setup

📊 Changes

1 file changed (+22 additions, -2 deletions)

View changed files

📝 src/Core/PS4/Linker.cpp (+22 -2)

📄 Description

Overview

  • Fixes OpenOrbis loading that depends on rsp pointing to the argument structure, in addition to rdi.
  • Has been tested with videout sample and doesn't break it
  • I've tried to keep the code non-windows specific

Refence for rsp usage by OpenOrbis:
github.com/OpenOrbis/musl@779f95174b/arch/x86_64/crt_arch.h

Notes

as red_prig also mentioned, there are other elements in the stack, containing at least

  • the argv contents
  • the the argv pointer table
  • the envp contents
  • the envp pointer table
  • auxv (or equivelant in freebsd)
  • maybe other stuff

So this is partial

Follow up

  • This should be cross referenced with freebsd (9/9.1?) elf loader, and/or with a dump from a real console to make sure the stack is setup correctly.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/47 **Author:** [@skmp](https://github.com/skmp) **Created:** 10/2/2023 **Status:** ✅ Merged **Merged:** 10/2/2023 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `skmp/setup-stack` --- ### 📝 Commits (1) - [`5094d30`](https://github.com/shadps4-emu/shadPS4/commit/5094d3044c0c7ac1348fd95f21fd9ef14abd0e65) run_main_entry: Rewrite in asm for stack setup ### 📊 Changes **1 file changed** (+22 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/Core/PS4/Linker.cpp` (+22 -2) </details> ### 📄 Description ### Overview - Fixes OpenOrbis loading that depends on rsp pointing to the argument structure, in addition to rdi. - Has been tested with videout sample and doesn't break it - I've tried to keep the code non-windows specific Refence for rsp usage by OpenOrbis: https://github.com/OpenOrbis/musl/blob/779f95174b44d39e6a8a788b36289cf4768944a9/arch/x86_64/crt_arch.h ### Notes as red_prig also mentioned, there are other elements in the stack, containing at least - the argv contents - the the argv pointer table - the envp contents - the envp pointer table - auxv (or equivelant in freebsd) - maybe other stuff So this is partial ### Follow up - This should be cross referenced with freebsd (9/9.1?) elf loader, and/or with a dump from a real console to make sure the stack is setup correctly. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:11:46 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#1240
No description provided.