| 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 | /* |
| 3 | * Copyright (C) 2022 Paul Cercueil <paul@crapouillou.net> |
| 4 | */ |
| 5 | |
| 6 | #ifndef __LIGHTREC_MEM_H__ |
| 7 | #define __LIGHTREC_MEM_H__ |
| 8 | |
| 9 | #ifdef LIGHTREC |
| 10 | |
| 11 | #ifdef HW_WUP /* WiiU */ |
| 12 | # define WUP_RWX_MEM_BASE 0x00802000 |
| 13 | # define WUP_RWX_MEM_END 0x01000000 |
| 14 | # define CODE_BUFFER_SIZE_DFT (WUP_RWX_MEM_END - WUP_RWX_MEM_BASE) |
| 15 | #else |
| 16 | # define CODE_BUFFER_SIZE_DFT (8 * 1024 * 1024) |
| 17 | #endif |
| 18 | |
| 19 | #ifndef CODE_BUFFER_SIZE |
| 20 | #define CODE_BUFFER_SIZE CODE_BUFFER_SIZE_DFT |
| 21 | #endif |
| 22 | |
| 23 | extern void *code_buffer; |
| 24 | |
| 25 | int lightrec_init_mmap(void); |
| 26 | void lightrec_free_mmap(void); |
| 27 | |
| 28 | #else /* if !LIGHTREC */ |
| 29 | |
| 30 | #define lightrec_init_mmap() -1 /* should not be called */ |
| 31 | #define lightrec_free_mmap() |
| 32 | |
| 33 | #undef LIGHTREC_CUSTOM_MAP |
| 34 | #define LIGHTREC_CUSTOM_MAP 0 |
| 35 | |
| 36 | #endif |
| 37 | |
| 38 | #endif /* __LIGHTREC_MEM_H__ */ |