Nugget
Loading...
Searching...
No Matches
pcsxhw.h
Go to the documentation of this file.
1/*
2
3MIT License
4
5Copyright (c) 2020 PCSX-Redux authors
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26
27#pragma once
28
29#include <stdint.h>
30
31static __inline__ void pcsx_putc(int c) { *((volatile char* const)0x1f802080) = c; }
32static __inline__ void pcsx_debugbreak() { *((volatile char* const)0x1f802081) = 0; }
33static __inline__ void pcsx_execSlot(uint8_t slot) { *((volatile uint8_t* const)0x1f802081) = slot; }
34static __inline__ void pcsx_exit(int code) { *((volatile int16_t* const)0x1f802082) = code; }
35static __inline__ void pcsx_message(const char* msg) { *((volatile const char** const)0x1f802084) = msg; }
36static __inline__ void pcsx_checkKernel(int enable) { *((volatile char*)0x1f802088) = enable; }
37static __inline__ int pcsx_isCheckingKernel() { return *((volatile char* const)0x1f802088) != 0; }
38static __inline__ void pcsx_initMsan() { *((volatile char* const)0x1f802089) = 0; }
39static __inline__ void pcsx_resetMsan() { *((volatile char* const)0x1f802089) = 1; }
40static __inline__ void* pcsx_msanAlloc(uint32_t size) {
41 register uint32_t a0 asm("a0") = size;
42 return *((void* volatile* const)0x1f80208c);
43}
44static __inline__ void pcsx_msanFree(void* ptr) { *((void* volatile* const)0x1f80208c) = ptr; }
45static __inline__ void* pcsx_msanRealloc(void* ptr, uint32_t size) {
46 register void* a0 asm("a0") = ptr;
47 register uint32_t a1 asm("a1") = size;
48 return *((void* volatile* const)0x1f802090);
49}
50static __inline__ void pcsx_msanSetChainPtr(void* headerAddr, void* ptrToNext, uint32_t wordCount) {
51 register void* a0 asm("a0") = ptrToNext;
52 register uint32_t a1 asm("a1") = wordCount;
53 *((void* volatile* const)0x1f802094) = headerAddr;
54}
55static __inline__ void* pcsx_msanGetChainPtr(void* headerAddr) {
56 register void* a0 asm("a0") = headerAddr;
57 return *((void* volatile* const)0x1f802094);
58}
59
60static __inline__ int pcsx_present() { return *((volatile uint32_t* const)0x1f802080) == 0x58534350; }
volatile uint32_t * ptr
Definition cop0.c:80
static int size
Definition string.h:32
static int c
Definition syscalls.h:121
void uint32_t(classId, spec)