mirror of
https://github.com/ps5-linux/ps5-linux-loader.git
synced 2026-05-09 00:24:16 +00:00
Compare commits
2 Commits
2497034be9
...
65961996d7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65961996d7 | ||
|
|
354e996485 |
@@ -1,10 +1,10 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
static uint64_t alloc_page(void);
|
uint64_t alloc_page(void);
|
||||||
static void install_page(uintptr_t pml4, vm_offset_t va, vm_paddr_t pa,
|
void install_page(uintptr_t pml4, vm_offset_t va, vm_paddr_t pa,
|
||||||
int bits);
|
int bits);
|
||||||
void pte_store(uintptr_t ptep, uint64_t pte);
|
void pte_store(uintptr_t ptep, uint64_t pte);
|
||||||
static int read_file(const char *path, void *buf, size_t bufsize);
|
int read_file(const char *path, void *buf, size_t bufsize);
|
||||||
static void trim_newline(char *s);
|
void trim_newline(char *s);
|
||||||
int fetch_linux(struct linux_info *info);
|
int fetch_linux(struct linux_info *info);
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ int stage5_remove_xotext(void) {
|
|||||||
uint64_t start =
|
uint64_t start =
|
||||||
ktext - 0xF0000; // Include first pages where fun stuff is located
|
ktext - 0xF0000; // Include first pages where fun stuff is located
|
||||||
uint64_t end = kdata;
|
uint64_t end = kdata;
|
||||||
int n = 0;
|
int n __attribute__((unused)) = 0;
|
||||||
|
|
||||||
for (uint64_t a = start; a < end; a += 0x1000) {
|
for (uint64_t a = start; a < end; a += 0x1000) {
|
||||||
page_chain_set_rw(a);
|
page_chain_set_rw(a);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#define MINI_SYSCORE_PID 1
|
#define MINI_SYSCORE_PID 1
|
||||||
|
|
||||||
static uint64_t alloc_page(void) {
|
uint64_t alloc_page(void) {
|
||||||
|
|
||||||
void *page = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE,
|
void *page = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE,
|
||||||
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||||
@@ -30,7 +30,7 @@ static uint64_t alloc_page(void) {
|
|||||||
return va_to_pa_user((uintptr_t)page);
|
return va_to_pa_user((uintptr_t)page);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void install_page(uintptr_t pml4, vm_offset_t va, vm_paddr_t pa,
|
void install_page(uintptr_t pml4, vm_offset_t va, vm_paddr_t pa,
|
||||||
int bits) {
|
int bits) {
|
||||||
uint64_t entry;
|
uint64_t entry;
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ long find_and_get_size_of_file(const char *filename, char *found_path) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int find_and_read_file(const char *filename, void *buf, size_t bufsize) {
|
int find_and_read_file(const char *filename, void *buf, size_t bufsize) {
|
||||||
char full_path[256];
|
char full_path[256];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ static int find_and_read_file(const char *filename, void *buf, size_t bufsize) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_file(const char *path, void *buf, size_t bufsize) {
|
int read_file(const char *path, void *buf, size_t bufsize) {
|
||||||
int fd = open(path, O_RDONLY);
|
int fd = open(path, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return fd;
|
return fd;
|
||||||
@@ -128,7 +128,7 @@ static int read_file(const char *path, void *buf, size_t bufsize) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void trim_newline(char *s) {
|
void trim_newline(char *s) {
|
||||||
while (*s != '\0') {
|
while (*s != '\0') {
|
||||||
if (*s == '\r' || *s == '\n') {
|
if (*s == '\r' || *s == '\n') {
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ offset_list off_0403 = {
|
|||||||
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
||||||
.HV_VCPU_STRIDE = 0x320,
|
.HV_VCPU_STRIDE = 0x320,
|
||||||
.HV_VCPU_VMCB_PTR = 0x08,
|
.HV_VCPU_VMCB_PTR = 0x08,
|
||||||
.KERNEL_CODE_CAVE = 0x0043000,
|
.KERNEL_CODE_CAVE = 0x500,
|
||||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||||
.IOMMU_SOFTC = 0x33C7680,
|
.IOMMU_SOFTC = 0x33C7680,
|
||||||
.VMSPACE_VM_VMID = 0x1E4,
|
.VMSPACE_VM_VMID = 0x1E4,
|
||||||
|
|||||||
@@ -225,8 +225,8 @@ void notify(const char *fmt, ...) {
|
|||||||
vsnprintf(buffer, sizeof(buffer), fmt, args);
|
vsnprintf(buffer, sizeof(buffer), fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
notify_internal(buffer);
|
notify_internal((uint8_t *)buffer);
|
||||||
printf(buffer);
|
printf("%s", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void notify_internal(uint8_t *msg) {
|
void notify_internal(uint8_t *msg) {
|
||||||
@@ -236,7 +236,7 @@ void notify_internal(uint8_t *msg) {
|
|||||||
} req;
|
} req;
|
||||||
bzero(&req, sizeof(req));
|
bzero(&req, sizeof(req));
|
||||||
uint64_t len =
|
uint64_t len =
|
||||||
strlen(msg) < (sizeof(req.msg) - 1) ? strlen(msg) : (sizeof(req.msg) - 1);
|
strlen((const char *)msg) < (sizeof(req.msg) - 1) ? strlen((const char *)msg) : (sizeof(req.msg) - 1);
|
||||||
memcpy(req.msg, msg, len);
|
memcpy(req.msg, msg, len);
|
||||||
sceKernelSendNotificationRequest(0, &req, sizeof(req), 0);
|
sceKernelSendNotificationRequest(0, &req, sizeof(req), 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user