-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Upload (FW 6.72) from GiantPluto
- Loading branch information
Showing
121 changed files
with
16,518 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
LIBPS4 := ../ps4-payload-sdk/libPS4 | ||
|
||
TEXT := 0x926200000 | ||
DATA := 0x926300000 | ||
|
||
CC := gcc | ||
AS := gcc | ||
OBJCOPY := objcopy | ||
ODIR := build | ||
SDIR := source | ||
IDIRS := -I$(LIBPS4)/include -I. -Iinclude | ||
LDIRS := -L$(LIBPS4) -L. -Llib | ||
CFLAGS := $(IDIRS) -O2 -std=c11 -fno-builtin -nostartfiles -nostdlib -Wall -masm=intel -march=btver2 -mtune=btver2 -m64 -mabi=sysv -mcmodel=large -DTEXT_ADDRESS=$(TEXT) -DDATA_ADDRESS=$(DATA) | ||
SFLAGS := -nostartfiles -nostdlib -march=btver2 -mtune=btver2 | ||
LFLAGS := $(LDIRS) -Xlinker -T $(LIBPS4)/linker.x -Wl,--build-id=none -Ttext=$(TEXT) -Tdata=$(DATA) | ||
CFILES := $(wildcard $(SDIR)/*.c) | ||
SFILES := $(wildcard $(SDIR)/*.s) | ||
OBJS := $(patsubst $(SDIR)/%.c, $(ODIR)/%.o, $(CFILES)) $(patsubst $(SDIR)/%.s, $(ODIR)/%.o, $(SFILES)) | ||
|
||
LIBS := -lPS4 | ||
|
||
TARGET = debugger.bin | ||
|
||
$(TARGET): $(ODIR) $(OBJS) | ||
$(CC) $(LIBPS4)/crt0.s $(ODIR)/*.o -o temp.t $(CFLAGS) $(LFLAGS) $(LIBS) | ||
$(OBJCOPY) -O binary temp.t $(TARGET) | ||
rm -f temp.t | ||
|
||
$(ODIR)/%.o: $(SDIR)/%.c | ||
$(CC) -c -o $@ $< $(CFLAGS) | ||
|
||
$(ODIR)/%.o: $(SDIR)/%.s | ||
$(AS) -c -o $@ $< $(SFLAGS) | ||
|
||
$(ODIR): | ||
@mkdir $@ | ||
|
||
.PHONY: clean | ||
|
||
clean: | ||
rm -f $(TARGET) $(ODIR)/*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// golden | ||
// 6/12/2018 | ||
// | ||
|
||
#ifndef _CONSOLE_H | ||
#define _CONSOLE_H | ||
|
||
#include <ps4.h> | ||
#include "protocol.h" | ||
#include "net.h" | ||
#include "debug.h" | ||
|
||
int console_reboot_handle(int fd, struct cmd_packet *packet); | ||
int console_print_handle(int fd, struct cmd_packet *packet); | ||
int console_notify_handle(int fd, struct cmd_packet *packet); | ||
int console_info_handle(int fd, struct cmd_packet *packet); | ||
|
||
int console_handle(int fd, struct cmd_packet *packet); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
// golden | ||
// 6/12/2018 | ||
// | ||
|
||
#ifndef _DEBUG_H | ||
#define _DEBUG_H | ||
|
||
#include <ps4.h> | ||
#include "protocol.h" | ||
#include "net.h" | ||
#include "ptrace.h" | ||
|
||
struct __reg64 { | ||
uint64_t r_r15; | ||
uint64_t r_r14; | ||
uint64_t r_r13; | ||
uint64_t r_r12; | ||
uint64_t r_r11; | ||
uint64_t r_r10; | ||
uint64_t r_r9; | ||
uint64_t r_r8; | ||
uint64_t r_rdi; | ||
uint64_t r_rsi; | ||
uint64_t r_rbp; | ||
uint64_t r_rbx; | ||
uint64_t r_rdx; | ||
uint64_t r_rcx; | ||
uint64_t r_rax; | ||
uint32_t r_trapno; | ||
uint16_t r_fs; | ||
uint16_t r_gs; | ||
uint32_t r_err; | ||
uint16_t r_es; | ||
uint16_t r_ds; | ||
uint64_t r_rip; | ||
uint64_t r_cs; | ||
uint64_t r_rflags; | ||
uint64_t r_rsp; | ||
uint64_t r_ss; | ||
}; | ||
|
||
/* Contents of each x87 floating point accumulator */ | ||
struct fpacc87 { | ||
uint8_t fp_bytes[10]; | ||
}; | ||
|
||
/* Contents of each SSE extended accumulator */ | ||
struct xmmacc { | ||
uint8_t xmm_bytes[16]; | ||
}; | ||
|
||
/* Contents of the upper 16 bytes of each AVX extended accumulator */ | ||
struct ymmacc { | ||
uint8_t ymm_bytes[16]; | ||
}; | ||
|
||
struct envxmm { | ||
uint16_t en_cw; /* control word (16bits) */ | ||
uint16_t en_sw; /* status word (16bits) */ | ||
uint8_t en_tw; /* tag word (8bits) */ | ||
uint8_t en_zero; | ||
uint16_t en_opcode; /* opcode last executed (11 bits ) */ | ||
uint64_t en_rip; /* floating point instruction pointer */ | ||
uint64_t en_rdp; /* floating operand pointer */ | ||
uint32_t en_mxcsr; /* SSE sontorol/status register */ | ||
uint32_t en_mxcsr_mask; /* valid bits in mxcsr */ | ||
}; | ||
|
||
struct savefpu { | ||
struct envxmm sv_env; | ||
struct { | ||
struct fpacc87 fp_acc; | ||
uint8_t fp_pad[6]; /* padding */ | ||
} sv_fp[8]; | ||
struct xmmacc sv_xmm[16]; | ||
uint8_t sv_pad[96]; | ||
} __attribute__((aligned(16))); | ||
|
||
struct xstate_hdr { | ||
uint64_t xstate_bv; | ||
uint8_t xstate_rsrv0[16]; | ||
uint8_t xstate_rsrv[40]; | ||
}; | ||
|
||
struct savefpu_xstate { | ||
struct xstate_hdr sx_hd; | ||
struct ymmacc sx_ymm[16]; | ||
}; | ||
|
||
struct savefpu_ymm { | ||
struct envxmm sv_env; | ||
struct { | ||
struct fpacc87 fp_acc; | ||
int8_t fp_pad[6]; /* padding */ | ||
} sv_fp[8]; | ||
struct xmmacc sv_xmm[16]; | ||
uint8_t sv_pad[96]; | ||
struct savefpu_xstate sv_xstate; | ||
} __attribute__((aligned(64))); | ||
|
||
struct __dbreg64 { | ||
uint64_t dr[16]; /* debug registers */ | ||
/* Index 0-3: debug address registers */ | ||
/* Index 4-5: reserved */ | ||
/* Index 6: debug status */ | ||
/* Index 7: debug control */ | ||
/* Index 8-15: reserved */ | ||
}; | ||
|
||
struct debug_interrupt_packet { | ||
uint32_t lwpid; | ||
uint32_t status; | ||
char tdname[40]; | ||
struct __reg64 reg64; | ||
struct savefpu_ymm savefpu; | ||
struct __dbreg64 dbreg64; | ||
} __attribute__((packed)); | ||
#define DEBUG_INTERRUPT_PACKET_SIZE 0x4A0 | ||
|
||
#define DBREG_DR7_DISABLE 0x00 | ||
#define DBREG_DR7_LOCAL_ENABLE 0x01 | ||
#define DBREG_DR7_GLOBAL_ENABLE 0x02 | ||
|
||
#define DBREG_DR7_LEN_1 0x00 /* 1 byte length */ | ||
#define DBREG_DR7_LEN_2 0x01 | ||
#define DBREG_DR7_LEN_4 0x03 | ||
#define DBREG_DR7_LEN_8 0x02 | ||
|
||
#define DBREG_DR7_EXEC 0x00 /* break on execute */ | ||
#define DBREG_DR7_WRONLY 0x01 /* break on write */ | ||
#define DBREG_DR7_RDWR 0x03 /* break on read or write */ | ||
|
||
#define DBREG_DR7_MASK(i) ((uint64_t)(0xf) << ((i) * 4 + 16) | 0x3 << (i) * 2) | ||
#define DBREG_DR7_SET(i, len, access, enable) ((uint64_t)((len) << 2 | (access)) << ((i) * 4 + 16) | (enable) << (i) * 2) | ||
#define DBREG_DR7_GD 0x2000 | ||
#define DBREG_DR7_ENABLED(d, i) (((d) & 0x3 << (i) * 2) != 0) | ||
#define DBREG_DR7_ACCESS(d, i) ((d) >> ((i) * 4 + 16) & 0x3) | ||
#define DBREG_DR7_LEN(d, i) ((d) >> ((i) * 4 + 18) & 0x3) | ||
|
||
#define DBREG_DRX(d,x) ((d)->dr[(x)]) /* reference dr0 - dr7 by register number */ | ||
|
||
#define DEBUG_PORT 755 | ||
|
||
extern int g_debugging; | ||
extern struct server_client *curdbgcli; | ||
extern struct debug_context *curdbgctx; | ||
|
||
int debug_attach_handle(int fd, struct cmd_packet *packet); | ||
int debug_detach_handle(int fd, struct cmd_packet *packet); | ||
int debug_breakpt_handle(int fd, struct cmd_packet *packet); | ||
int debug_watchpt_handle(int fd, struct cmd_packet *packet); | ||
int debug_threads_handle(int fd, struct cmd_packet *packet); | ||
int debug_stopthr_handle(int fd, struct cmd_packet *packet); | ||
int debug_resumethr_handle(int fd, struct cmd_packet *packet); | ||
int debug_getregs_handle(int fd, struct cmd_packet *packet); | ||
int debug_setregs_handle(int fd, struct cmd_packet *packet); | ||
int debug_getfpregs_handle(int fd, struct cmd_packet *packet); | ||
int debug_setfpregs_handle(int fd, struct cmd_packet *packet); | ||
int debug_getdbregs_handle(int fd, struct cmd_packet *packet); | ||
int debug_setdbregs_handle(int fd, struct cmd_packet *packet); | ||
int debug_stopgo_handle(int fd, struct cmd_packet *packet); | ||
int debug_thrinfo_handle(int fd, struct cmd_packet *packet); | ||
int debug_singlestep_handle(int fd, struct cmd_packet *packet); | ||
|
||
int connect_debugger(struct debug_context *dbgctx, struct sockaddr_in *client); | ||
void debug_cleanup(struct debug_context *dbgctx); | ||
|
||
int debug_handle(int fd, struct cmd_packet *packet); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
#ifndef _ERRNO_H | ||
#define _ERRNO_H | ||
|
||
#define EPERM 1 /* Operation not permitted */ | ||
#define ENOENT 2 /* No such file or directory */ | ||
#define ESRCH 3 /* No such process */ | ||
#define EINTR 4 /* Interrupted system call */ | ||
#define EIO 5 /* Input/output error */ | ||
#define ENXIO 6 /* Device not configured */ | ||
#define E2BIG 7 /* Argument list too long */ | ||
#define ENOEXEC 8 /* Exec format error */ | ||
#define EBADF 9 /* Bad file descriptor */ | ||
#define ECHILD 10 /* No child processes */ | ||
#define EDEADLK 11 /* Resource deadlock avoided */ | ||
/* 11 was EAGAIN */ | ||
#define ENOMEM 12 /* Cannot allocate memory */ | ||
#define EACCES 13 /* Permission denied */ | ||
#define EFAULT 14 /* Bad address */ | ||
#ifndef _POSIX_SOURCE | ||
#define ENOTBLK 15 /* Block device required */ | ||
#endif | ||
#define EBUSY 16 /* Device busy */ | ||
#define EEXIST 17 /* File exists */ | ||
#define EXDEV 18 /* Cross-device link */ | ||
#define ENODEV 19 /* Operation not supported by device */ | ||
#define ENOTDIR 20 /* Not a directory */ | ||
#define EISDIR 21 /* Is a directory */ | ||
#define EINVAL 22 /* Invalid argument */ | ||
#define ENFILE 23 /* Too many open files in system */ | ||
#define EMFILE 24 /* Too many open files */ | ||
#define ENOTTY 25 /* Inappropriate ioctl for device */ | ||
#ifndef _POSIX_SOURCE | ||
#define ETXTBSY 26 /* Text file busy */ | ||
#endif | ||
#define EFBIG 27 /* File too large */ | ||
#define ENOSPC 28 /* No space left on device */ | ||
#define ESPIPE 29 /* Illegal seek */ | ||
#define EROFS 30 /* Read-only filesystem */ | ||
#define EMLINK 31 /* Too many links */ | ||
#define EPIPE 32 /* Broken pipe */ | ||
|
||
/* math software */ | ||
#define EDOM 33 /* Numerical argument out of domain */ | ||
#define ERANGE 34 /* Result too large */ | ||
|
||
/* non-blocking and interrupt i/o */ | ||
#define EAGAIN 35 /* Resource temporarily unavailable */ | ||
#ifndef _POSIX_SOURCE | ||
#define EWOULDBLOCK EAGAIN /* Operation would block */ | ||
#define EINPROGRESS 36 /* Operation now in progress */ | ||
#define EALREADY 37 /* Operation already in progress */ | ||
|
||
/* ipc/network software -- argument errors */ | ||
#define ENOTSOCK 38 /* Socket operation on non-socket */ | ||
#define EDESTADDRREQ 39 /* Destination address required */ | ||
#define EMSGSIZE 40 /* Message too long */ | ||
#define EPROTOTYPE 41 /* Protocol wrong type for socket */ | ||
#define ENOPROTOOPT 42 /* Protocol not available */ | ||
#define EPROTONOSUPPORT 43 /* Protocol not supported */ | ||
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ | ||
#define EOPNOTSUPP 45 /* Operation not supported */ | ||
#define ENOTSUP EOPNOTSUPP /* Operation not supported */ | ||
#define EPFNOSUPPORT 46 /* Protocol family not supported */ | ||
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ | ||
#define EADDRINUSE 48 /* Address already in use */ | ||
#define EADDRNOTAVAIL 49 /* Can't assign requested address */ | ||
|
||
/* ipc/network software -- operational errors */ | ||
#define ENETDOWN 50 /* Network is down */ | ||
#define ENETUNREACH 51 /* Network is unreachable */ | ||
#define ENETRESET 52 /* Network dropped connection on reset */ | ||
#define ECONNABORTED 53 /* Software caused connection abort */ | ||
#define ECONNRESET 54 /* Connection reset by peer */ | ||
#define ENOBUFS 55 /* No buffer space available */ | ||
#define EISCONN 56 /* Socket is already connected */ | ||
#define ENOTCONN 57 /* Socket is not connected */ | ||
#define ESHUTDOWN 58 /* Can't send after socket shutdown */ | ||
#define ETOOMANYREFS 59 /* Too many references: can't splice */ | ||
#define ETIMEDOUT 60 /* Operation timed out */ | ||
#define ECONNREFUSED 61 /* Connection refused */ | ||
|
||
#define ELOOP 62 /* Too many levels of symbolic links */ | ||
#endif /* _POSIX_SOURCE */ | ||
#define ENAMETOOLONG 63 /* File name too long */ | ||
|
||
/* should be rearranged */ | ||
#ifndef _POSIX_SOURCE | ||
#define EHOSTDOWN 64 /* Host is down */ | ||
#define EHOSTUNREACH 65 /* No route to host */ | ||
#endif /* _POSIX_SOURCE */ | ||
#define ENOTEMPTY 66 /* Directory not empty */ | ||
|
||
/* quotas & mush */ | ||
#ifndef _POSIX_SOURCE | ||
#define EPROCLIM 67 /* Too many processes */ | ||
#define EUSERS 68 /* Too many users */ | ||
#define EDQUOT 69 /* Disc quota exceeded */ | ||
|
||
/* Network File System */ | ||
#define ESTALE 70 /* Stale NFS file handle */ | ||
#define EREMOTE 71 /* Too many levels of remote in path */ | ||
#define EBADRPC 72 /* RPC struct is bad */ | ||
#define ERPCMISMATCH 73 /* RPC version wrong */ | ||
#define EPROGUNAVAIL 74 /* RPC prog. not avail */ | ||
#define EPROGMISMATCH 75 /* Program version wrong */ | ||
#define EPROCUNAVAIL 76 /* Bad procedure for program */ | ||
#endif /* _POSIX_SOURCE */ | ||
|
||
#define ENOLCK 77 /* No locks available */ | ||
#define ENOSYS 78 /* Function not implemented */ | ||
|
||
#ifndef _POSIX_SOURCE | ||
#define EFTYPE 79 /* Inappropriate file type or format */ | ||
#define EAUTH 80 /* Authentication error */ | ||
#define ENEEDAUTH 81 /* Need authenticator */ | ||
#define EIDRM 82 /* Identifier removed */ | ||
#define ENOMSG 83 /* No message of desired type */ | ||
#define EOVERFLOW 84 /* Value too large to be stored in data type */ | ||
#define ECANCELED 85 /* Operation canceled */ | ||
#define EILSEQ 86 /* Illegal byte sequence */ | ||
#define ENOATTR 87 /* Attribute not found */ | ||
|
||
#define EDOOFUS 88 /* Programming error */ | ||
#endif /* _POSIX_SOURCE */ | ||
|
||
#define EBADMSG 89 /* Bad message */ | ||
#define EMULTIHOP 90 /* Multihop attempted */ | ||
#define ENOLINK 91 /* Link has been severed */ | ||
#define EPROTO 92 /* Protocol error */ | ||
|
||
#ifndef _POSIX_SOURCE | ||
#define ENOTCAPABLE 93 /* Capabilities insufficient */ | ||
#define ECAPMODE 94 /* Not permitted in capability mode */ | ||
#define ENOTRECOVERABLE 95 /* State not recoverable */ | ||
#define EOWNERDEAD 96 /* Previous owner died */ | ||
#endif /* _POSIX_SOURCE */ | ||
|
||
#ifndef _POSIX_SOURCE | ||
#define ELAST 96 /* Must be equal largest errno */ | ||
#endif /* _POSIX_SOURCE */ | ||
|
||
/* pseudo-errors returned inside kernel to modify return to process */ | ||
#define ERESTART (-1) /* restart syscall */ | ||
#define EJUSTRETURN (-2) /* don't modify regs, just return */ | ||
#define ENOIOCTL (-3) /* ioctl not handled by this layer */ | ||
#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */ | ||
#define ERELOOKUP (-5) /* retry the directory lookup */ | ||
|
||
#endif |
Oops, something went wrong.