Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added db for 3.65/3.67 #300

Closed
wants to merge 1 commit into from
Closed

Conversation

TheOfficialFloW
Copy link
Member

We need to have a way to specify 3.65/3.67 NIDs. Maybe use *_367_stub.a?

@CelesteBlue-dev
Copy link
Contributor

CelesteBlue-dev commented Mar 5, 2018

Have the NIDs of 3.60 functions changed on 3.65/3.67 or are there only some new functions ?
EDIT: from studying 3.65 kernel modules I've understood that:

  • when some function name doesn't change but it's function NID changes, the library NID changes,
  • when NID of a library changes, usually all the functions NIDs of the library change,
    I haven't seen new functions yet.

d3m3vilurr added a commit to d3m3vilurr/vita-toolchain that referenced this pull request Mar 5, 2018
if filled `firmware` in the root and this value isn't `3.60`,
will attach postfix before `_stub.a`

eg;
pass to
```
firmware: 3.67
```
all generated libs will end with `_367_stub.a` like `libSceCpuForKernel_367_stub.a`

Related vitasdk/vita-headers#300
@xerpi
Copy link
Contributor

xerpi commented Jun 29, 2018

An improved proposal based on yours:
Let's imagine foo_stub.a exports the function bar.
By using weak symbols we make foo_368_stub.a export bar as a weak symbol alias and export bar_368 regularly.
So if you link with both foo_stub.a and foo_368_stub.a, calling bar will call the regular version, and bar_368 will call the foo_368_stub.a one.
If you link only with foo_368_stub.a, barwill be aliased to bar_368.

@CelesteBlue-dev
Copy link
Contributor

@xerpi do you mean you are proposing to call ksceMemcpy_368(); when compiling for 3.68 ?

@xerpi
Copy link
Contributor

xerpi commented Jun 29, 2018

@CelesteBlue-dev that would be necessary only if you want to call the 368 version of ksceMemcpy and you are linking with both stubs.
If you only link with *_368_stub.a, thanks to the alias, calling ksceMemcpy would also be possible.

@CelesteBlue-dev
Copy link
Contributor

@xerpi I think the easiest way is to edit vita-elf-create or such to add --version argument.
When -v 368, it will link sceMemcpy_stub_368.a.
By default, to keep compatibility, when version is not specified it will link 360 stubs.

@xerpi
Copy link
Contributor

xerpi commented Jun 29, 2018

@CelesteBlue-dev but you don't even need to touch vita-elf-create for that, only your Makefile.

@CelesteBlue-dev
Copy link
Contributor

yes but with my way, you would only have to do make 368 or make 365 or make (by default 360).
Now I see what you mean :

if (is_368())
     func_368()
else
     func()

but so which libs do you import ? 360 stubs or 368 stubs ?

@xerpi
Copy link
Contributor

xerpi commented Jun 29, 2018

My 'way' isn't different than yours but only an improvement that also allows you to be able to choose what function to call at runtime.

@CelesteBlue-dev
Copy link
Contributor

@xerpi sorry I don't understand how a skprx can be loaded if it imports 368 and 360 stubs.
it will forcibly return SCE_KERNEL_ERROR_NO_LIB...

@xerpi
Copy link
Contributor

xerpi commented Jun 29, 2018

Hmm so if an SKPRX imports an invalid library it returns an error when loading it? I thought it would just leave the stubs uninitialized.

@TheOfficialFloW
Copy link
Member Author

I don't think it will work either, since you'll end up with two libraries with the same name but different library nid. Maybe it works if we declare it as weak import, can somebody test?

@CelesteBlue-dev
Copy link
Contributor

CelesteBlue-dev commented Jun 29, 2018

@xerpi I tried loading a skprx that imported 360 NIDs on my 365 PSVita using your kernel loader and it returns an error :
SCE_KERNEL_ERROR_MODULEMGR_NO_LIB | 0x8002d003 | C1-2712-2
or
SCE_KERNEL_ERROR_MODULEMGR_OLD_LIB | 0x8002d013 | C1-2728-9
or maybe also :
SCE_KERNEL_ERROR_MODULEMGR_INVALID_LIB | 0x8002d009 | C1-2718-8
SCE_KERNEL_ERROR_MODULEMGR_INVALID_STUB | 0x8002d00a | C1-2719-9
SCE_KERNEL_ERROR_MODULEMGR_NO_FUNC_NID | 0x8002d00b | C1-2720-1
SCE_KERNEL_ERROR_MODULEMGR_NO_VAR_NID | 0x8002d00c | C1-2721-2
EDIT : it was NOT weak imports. So try weak, it may work as theflow says.

@xerpi
Copy link
Contributor

xerpi commented Jun 29, 2018

Yeah maybe weak imports might do the trick. My thought was that the Vita's dynamic loader would skip unknown libraries intead of erroring.

@d3m3vilurr
Copy link
Contributor

replaced #592

@d3m3vilurr d3m3vilurr closed this Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants