mirror of
https://github.com/ps5-linux/ps5-linux-loader.git
synced 2026-05-09 00:24:16 +00:00
cleaning + notifications + autosleep
This commit is contained in:
@@ -55,7 +55,7 @@ __attribute__((section(".entry_point"))) uint32_t main(uint64_t add1,
|
||||
// Reconfigure IOMMU calling the HV
|
||||
int ret = ((uint64_t(*)(uint64_t, uint64_t, uint64_t, uint64_t,
|
||||
int *))args_ptr->fun_hv_iommu_set_buffers)(
|
||||
iommu_cb2_pa, iommu_cb3_pa, iommu_eb_pa, &unk, &n_devices);
|
||||
iommu_cb2_pa, iommu_cb3_pa, iommu_eb_pa, (uint64_t) &unk, &n_devices);
|
||||
|
||||
if (ret != 0) {
|
||||
putc_uart(args_ptr->dmap_base, 'I');
|
||||
@@ -126,7 +126,7 @@ __attribute__((section(".entry_point"))) uint32_t main(uint64_t add1,
|
||||
// Re-do this to force a VMEXIT without HV injecting faults
|
||||
((uint64_t(*)(uint64_t, uint64_t, uint64_t, uint64_t,
|
||||
int *))args_ptr->fun_hv_iommu_set_buffers)(
|
||||
iommu_cb2_pa, iommu_cb3_pa, iommu_eb_pa, &unk, &n_devices);
|
||||
iommu_cb2_pa, iommu_cb3_pa, iommu_eb_pa, (uint64_t) &unk, &n_devices);
|
||||
((uint64_t(*)(void))args_ptr->fun_hv_iommu_wait_completion)();
|
||||
|
||||
putc_uart(args_ptr->dmap_base, 'B');
|
||||
@@ -195,7 +195,7 @@ void halt(void) { __asm__ __volatile__("hlt"); }
|
||||
|
||||
// Submit a single 16-byte command and wait for completion
|
||||
__attribute__((noinline, optimize("O0"))) void
|
||||
iommu_submit_cmd(shellcode_kernel_args *args_ptr, uint64_t *cmd) {
|
||||
iommu_submit_cmd(volatile shellcode_kernel_args *args_ptr, uint64_t *cmd) {
|
||||
// Read the offset of current tail of command list
|
||||
uint64_t curr_tail = *(
|
||||
(uint64_t *)args_ptr->iommu_mmio_va +
|
||||
@@ -206,7 +206,7 @@ iommu_submit_cmd(shellcode_kernel_args *args_ptr, uint64_t *cmd) {
|
||||
|
||||
// We write the command in the current empty entry
|
||||
uint64_t *cmd_buffer =
|
||||
args_ptr->iommu_cb2_va + curr_tail / 8; // Downscale the size of the ptr
|
||||
(uint64_t *)args_ptr->iommu_cb2_va + curr_tail / 8; // Downscale the size of the ptr
|
||||
// Copy 0x10 bytes (CMD Size)
|
||||
cmd_buffer[0] = cmd[0];
|
||||
cmd_buffer[1] = cmd[1];
|
||||
@@ -224,7 +224,7 @@ iommu_submit_cmd(shellcode_kernel_args *args_ptr, uint64_t *cmd) {
|
||||
|
||||
// Write 8 bytes to a physical address using IOMMU completion wait store
|
||||
__attribute__((noinline, optimize("O0"))) void
|
||||
iommu_write8_pa(shellcode_kernel_args *args_ptr, uint64_t pa, uint64_t val) {
|
||||
iommu_write8_pa(volatile shellcode_kernel_args *args_ptr, uint64_t pa, uint64_t val) {
|
||||
uint32_t cmd[4] = {0};
|
||||
cmd[0] = (uint32_t)(pa & 0xFFFFFFF8) | 0x05;
|
||||
cmd[1] = ((uint32_t)(pa >> 32) & 0xFFFFF) | 0x10000000;
|
||||
@@ -234,7 +234,7 @@ iommu_write8_pa(shellcode_kernel_args *args_ptr, uint64_t pa, uint64_t val) {
|
||||
}
|
||||
|
||||
__attribute__((noinline, optimize("O0"))) void
|
||||
patch_vmcb(shellcode_kernel_args *args_ptr) {
|
||||
patch_vmcb(volatile shellcode_kernel_args *args_ptr) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
uint64_t pa = args_ptr->vmcb[i];
|
||||
// args_ptr->fun_printf("Patching core: %02d VMCB_PA: 0x%016lx\n", i,
|
||||
@@ -281,16 +281,17 @@ __attribute__((noinline, optimize("O0"))) int tmr_disable(uint64_t dmap) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void init_global_pointers(shellcode_kernel_args *args_ptr) {
|
||||
void init_global_pointers(volatile shellcode_kernel_args *args_ptr) {
|
||||
|
||||
memcpy(&args, args_ptr, sizeof(args));
|
||||
memcpy(&args, (void *)args_ptr, sizeof(args));
|
||||
|
||||
printf = args.fun_printf;
|
||||
smp_rendezvous = args.fun_smp_rendezvous;
|
||||
smp_no_rendevous_barrier = args.fun_smp_no_rendevous_barrier;
|
||||
printf = (void (*)(const char *, ...)) args.fun_printf;
|
||||
smp_rendezvous = (void (*)(void (*)(void), void (*)(void),
|
||||
void (*)(void), void *)) args.fun_smp_rendezvous;
|
||||
smp_no_rendevous_barrier = (void (*)(void)) args.fun_smp_no_rendevous_barrier;
|
||||
|
||||
transmitter_control = args.fun_transmitter_control;
|
||||
mp3_initialize = args.fun_mp3_initialize;
|
||||
mp3_invoke = args.fun_mp3_invoke;
|
||||
transmitter_control = (int (*) (int, void*)) args.fun_transmitter_control;
|
||||
mp3_initialize = (int (*) (int)) args.fun_mp3_initialize;
|
||||
mp3_invoke = (int (*) (int, void*, void*)) args.fun_mp3_invoke;
|
||||
g_vbios = args.g_vbios;
|
||||
}
|
||||
Reference in New Issue
Block a user