Compare commits

...

7 commits

Author SHA1 Message Date
Deleted user
d920f25cbc
Merge cd6d129540 into 027e209073 2024-09-02 20:49:11 +02:00
Michael Scire
027e209073 kern/ldr: enable the use of relr for relocations 2024-09-01 22:27:48 -07:00
Michael Scire
423a05a1e9 meso: fix sign-comparison warn on svc/interrupt flag compare 2024-09-01 16:27:01 -07:00
Ammako
cd6d129540
Delete feature_request.md 2021-08-09 20:10:42 +00:00
Ammako
700d811cb7
Create feature_request.yaml 2021-08-09 20:10:35 +00:00
Ammako
37a910802f
Delete bug_report.md 2021-08-09 20:10:19 +00:00
Ammako
0d4377b43b
Create bug_report.yaml 2021-08-09 20:10:13 +00:00
11 changed files with 130 additions and 121 deletions

View file

@ -1,58 +0,0 @@
---
name: Bug Report
about: Something doesn't work correctly in Atmosphère.
#assignees:
---
## Bug Report
[ If any section does not apply, replace its contents with "N/A". ]</br>
[ Lines between [ ] (square brackets) should be removed before posting. ]</br>
[ * ]</br>
[ Note: If the bug or crash you encountered is related to; ]</br>
[ - software used to make "backups", ]</br>
[ - software explicitly distributed for piracy, etc ]</br>
[ then contributors will not provide support for your issue and your issue will be closed. ]</br>
### What's the issue you encountered?
[ Describe the issue in detail and what you were doing beforehand. ]</br>
[ Did you make any changes related to Atmosphère itself? ]</br>
[ If so, make sure to include details relating to what exactly you changed. ]</br>
### How can the issue be reproduced?
[ * ]</br>
[ Include a detailed step by step process for recreating your issue. ]</br>
### Crash Report
[ Crash reports can be found under ``/atmosphere/crash_reports``. ]</br>
[ If your issue caused Atmosphère to crash, include the crash report(s) by creating a [gist](https://gist.github.com/) and pasting the link here. ]</br>
[ If you don't include a crash report in instances of crash related issues, we will ask you one to provide one. ]</br>
### System Firmware Version
X.X.X</br>
[ Replace X's with system firmware version at time of crash. ]</br>
[ You can find your firmware version in the Settings -> System, under "System Update". ]</br>
[ If it says "Update Pending", you can clear the pending update by rebooting to Maintenance Mode. ]</br>
### Environment?
- What bootloader (fusèe, hekate, etc) was Atmosphère launched by:
- Official release or unofficial build:
- [ Official release version x.x.x (or) unofficial build ]
- [ If using an unofficial build, include details on where/how you acquired the build. ]
- [ Ex: Self-compilation ]
- [ Ex: Kosmos' distribution of Atmosphère ]
- Do you have additional kips or sysmodules you're loading:
- Homebrew software installed: [ * ]
- EmuMMC or SysNAND:
- [ If using an EmuMMC, include whether it's partition-based or file-based. ]
### Additional context?
- Additional info about your environment:
- [ Any other information relevant to your issue. ]

67
.github/ISSUE_TEMPLATE/bug_report.yaml vendored Normal file
View file

@ -0,0 +1,67 @@
name: Bug Report
description: Something doesn't work correctly in Atmosphère.
title: "[BUG] "
body:
- type: markdown
attributes:
value: |
Note: If the bug or crash you encountered is related to
- software used to make "backups"
- software explicitly distributed for piracy, etc.
then contributors will not provide support for your issue and your issue will be closed.
- type: textarea
attributes:
label: What's the issue you encountered?
description: |
Describe the issue in detail and what you were doing beforehand.
Did you make any changes related to Atmosphère itself?
If so, make sure to include details relating to what exactly you changed.
validations:
required: true
- type: textarea
attributes:
label: How can the issue be reproduced?
description: Include a detailed step by step process for recreating your issue.
validations:
required: true
- type: textarea
attributes:
label: Crash Report
description: |
Crash reports can be found under ``/atmosphere/crash_reports``.
- If your issue caused Atmosphère to crash, include the crash report(s) by creating a [gist](https://gist.github.com/) and pasting the link here.
- If you don't include a crash report in instances of crash related issues, we will ask you one to provide one.
validations:
required: false
- type: textarea
attributes:
label: System Firmware Version
description: |
Replace X's with system firmware version at time of crash.
You can find your firmware version in the Settings -> System, under "System Update".
If it says "Update Pending", you can clear the pending update by rebooting to Maintenance Mode.
placeholder: X.X.X
validations:
required: true
- type: textarea
attributes:
label: Environment?
value: |
- What bootloader (fusée, hekate, etc) was Atmosphère launched by:
- Official release or unofficial build:
- If using an unofficial build, include details on where/how you acquired the build:
- Do you have additional kips or sysmodules you're loading:
- Homebrew software installed:
- EmuMMC or SysMMC:
- If using an EmuMMC, include whether it's partition-based or file-based:
validations:
required: true
- type: textarea
attributes:
label: Additional context?
value: |
- Additional info about your environment:
- Any other information relevant to your issue:
validations:
required: false

View file

@ -1,48 +0,0 @@
---
name: Feature Request
about: Suggest a new feature for Atmosphère.
#assignees:
---
## Feature Request
[ If any section does not apply, replace its contents with "N/A". ]</br>
[ If you do not have the information needed for a section, replace its contents with "Unknown". ]</br>
[ Lines between [ ] (square brackets) are to be removed before posting. ]
[ Please search for existing [feature requests](https://github.com/Atmosphere-NX/Atmosphere/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22features%2Ffeature-request%22) before you make your own request. ]</br>
[ Duplicate requests will be marked as such and you will be referred to the original request. ]
### What feature are you suggesting?
#### Overview:
- [ Include the basic, high-level concepts for this feature here. ]</br>
#### Smaller Details:
- [ These may include specific methods of implementation etc. ]</br>
#### Nature of Request:
[ Remove all that do not apply to your request. ]
- Addition
- [ Ex: Addition of certain original features or features from other community projects. ]
- [ If you are suggesting porting features or including features from other projects, include what license they are distributed under and what, if any libraries those project use. ]
- Change
- Removal
- [Ex: Removal of certain features or implementation due to a specific issue/bug or because of low quality code, etc.]
### What component do you feel this would best fit within?
- [Fusée](https://github.com/Atmosphere-NX/Atmosphere#components)</br>
- Atmosphère's custom bootloader.</br>
- [Exosphère](https://github.com/Atmosphere-NX/Atmosphere#components)</br>
- Fully-featured custom secure monitor.</br>
- [Stratosphère](https://github.com/Atmosphere-NX/Atmosphere#components)</br>
- Custom system modules.</br>
- [**Thermosphère**](https://github.com/Atmosphere-NX/Atmosphere#components)</br>
- Atmosphère's emuNAND implementation.</br>
- [**Troposphère**](https://github.com/Atmosphere-NX/Atmosphere#components)</br>
- Application-level patches to the Horizon OS.</br>
[ Note: **Bolded components are not implemented** or are still at the prototyping phase. ]
### Why would this feature be useful?
[ If this is a feature for an end-user, how does it benefit the end-user? ]</br>
[ If this feature is for developers, what does it add to Atmosphère that did not already exist? ]</br>

View file

@ -0,0 +1,44 @@
name: Feature Request
description: Suggest a new feature for Atmosphère.
title: "[FEATURE REQUEST] "
body:
- type: markdown
attributes:
value: |
Please search for [existing feature requests](https://github.com/Atmosphere-NX/Atmosphere/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22features%2Ffeature-request%22) before you make your own request.
Duplicate requests will be marked as such, and you will be referred to the original request.
- type: textarea
attributes:
label: What feature are you suggesting?
description: Include the basic concepts for this feature here.
validations:
required: true
- type: textarea
attributes:
label: Smaller details
description: These may include specific methods of implementation, etc.
validations:
required: false
- type: textarea
attributes:
label: Nature of the request
description: |
Is this request an addition, a change, or a removal?
If you are suggesting porting features or including features from other projects, include what license they are distributed under, and what (if any) libraries those projects use.
validations:
required: true
- type: textarea
attributes:
label: What component do you feel this would best fit within?
description: See [here](https://github.com/Atmosphere-NX/Atmosphere#components) for more information.
validations:
required: true
- type: textarea
attributes:
label: Why would this feature be useful?
description: |
- If this is a feature for an end-user, how does it benefit the end-user?
- If this feature is for developers, what does it add to Atmosphère that did not already exist?
validations:
required: true

View file

@ -192,7 +192,7 @@ namespace ams::kern {
u32 m_program_type; u32 m_program_type;
private: private:
constexpr bool SetSvcAllowed(u32 id) { constexpr bool SetSvcAllowed(u32 id) {
if (AMS_LIKELY(id < m_svc_access_flags.GetCount())) { if (AMS_LIKELY(id < static_cast<u32>(m_svc_access_flags.GetCount()))) {
m_svc_access_flags[id] = true; m_svc_access_flags[id] = true;
return true; return true;
} else { } else {
@ -201,7 +201,7 @@ namespace ams::kern {
} }
constexpr bool SetInterruptPermitted(u32 id) { constexpr bool SetInterruptPermitted(u32 id) {
if (AMS_LIKELY(id < m_irq_access_flags.GetCount())) { if (AMS_LIKELY(id < static_cast<u32>(m_irq_access_flags.GetCount()))) {
m_irq_access_flags[id] = true; m_irq_access_flags[id] = true;
return true; return true;
} else { } else {

View file

@ -14,6 +14,7 @@ SECTIONS
/* =========== CODE section =========== */ /* =========== CODE section =========== */
PROVIDE(__start__ = 0x0); PROVIDE(__start__ = 0x0);
. = __start__; . = __start__;
__bin_start__ = .;
__code_start = . ; __code_start = . ;
.start : .start :
@ -159,6 +160,7 @@ SECTIONS
__bss_start__ = .; __bss_start__ = .;
.rela.dyn : { *(.rela.*) } :data .rela.dyn : { *(.rela.*) } :data
.relr.dyn : { *(.relr.*) } :data
.bss ADDR(.rela.dyn) (NOLOAD) : { .bss ADDR(.rela.dyn) (NOLOAD) : {
*(.dynbss) *(.dynbss)
@ -169,6 +171,7 @@ SECTIONS
__bss_end__ = .; __bss_end__ = .;
__bin_end__ = .;
__end__ = ABSOLUTE(.); __end__ = ABSOLUTE(.);
/* ================== /* ==================

View file

@ -1,7 +1,7 @@
%rename link old_link %rename link old_link
*link: *link:
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /kernel.ld) -pie --gc-sections -z text -z nodynamic-undefined-weak -nostdlib %(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /kernel.ld) -pie --gc-sections -z text -z nodynamic-undefined-weak -z pack-relative-relocs -nostdlib
*startfile: *startfile:
crti%O%s crtbegin%O%s crti%O%s crtbegin%O%s

View file

@ -15,8 +15,8 @@
*/ */
#include <mesosphere.hpp> #include <mesosphere.hpp>
extern "C" void _start(); extern "C" void __bin_start__();
extern "C" void __end__(); extern "C" void __bin_end__();
namespace ams::kern { namespace ams::kern {
@ -264,8 +264,8 @@ namespace ams::kern::init {
KMemoryLayout::GetPhysicalMemoryRegionTree().InsertDirectly(KernelPhysicalAddressSpaceBase, KernelPhysicalAddressSpaceBase + KernelPhysicalAddressSpaceSize - 1); KMemoryLayout::GetPhysicalMemoryRegionTree().InsertDirectly(KernelPhysicalAddressSpaceBase, KernelPhysicalAddressSpaceBase + KernelPhysicalAddressSpaceSize - 1);
/* Save start and end for ease of use. */ /* Save start and end for ease of use. */
const uintptr_t code_start_virt_addr = reinterpret_cast<uintptr_t>(_start); const uintptr_t code_start_virt_addr = reinterpret_cast<uintptr_t>(__bin_start__);
const uintptr_t code_end_virt_addr = reinterpret_cast<uintptr_t>(__end__); const uintptr_t code_end_virt_addr = reinterpret_cast<uintptr_t>(__bin_end__);
/* Setup the containing kernel region. */ /* Setup the containing kernel region. */
constexpr size_t KernelRegionSize = 1_GB; constexpr size_t KernelRegionSize = 1_GB;

View file

@ -12,6 +12,7 @@ SECTIONS
/* =========== CODE section =========== */ /* =========== CODE section =========== */
PROVIDE(__start__ = 0x0); PROVIDE(__start__ = 0x0);
. = __start__; . = __start__;
__bin_start__ = .;
__code_start = . ; __code_start = . ;
.crt0 : .crt0 :
@ -74,9 +75,8 @@ SECTIONS
.gnu_extab : ONLY_IF_RO { *(.gnu_extab*) } : rodata .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) } : rodata
.dynamic : { *(.dynamic) } :krnlldr :dyn .dynamic : { *(.dynamic) } :krnlldr :dyn
.dynsym : { *(.dynsym) } :krnlldr
.dynstr : { *(.dynstr) } :krnlldr
.rela.dyn : { *(.rela.*) } :krnlldr .rela.dyn : { *(.rela.*) } :krnlldr
.relr.dyn : { *(.relr.*) } :krnlldr
.hash : { *(.hash) } :krnlldr .hash : { *(.hash) } :krnlldr
.gnu.hash : { *(.gnu.hash) } :krnlldr .gnu.hash : { *(.gnu.hash) } :krnlldr
.gnu.version : { *(.gnu.version) } :krnlldr .gnu.version : { *(.gnu.version) } :krnlldr
@ -159,6 +159,7 @@ SECTIONS
} :krnlldr } :krnlldr
__bss_end__ = .; __bss_end__ = .;
__bin_end__ = .;
__end__ = ABSOLUTE(.) ; __end__ = ABSOLUTE(.) ;
/* ================== /* ==================
@ -166,7 +167,7 @@ SECTIONS
================== */ ================== */
/* Discard sections that difficult post-processing */ /* Discard sections that difficult post-processing */
/DISCARD/ : { *(.group .comment .note .interp) } /DISCARD/ : { *(.group .comment .note .interp .dynsym .dynstr) }
/* Stabs debugging sections. */ /* Stabs debugging sections. */
.stab 0 : { *(.stab) } .stab 0 : { *(.stab) }

View file

@ -1,7 +1,7 @@
%rename link old_link %rename link old_link
*link: *link:
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /kernel_ldr.ld) -pie --gc-sections -z text -z nodynamic-undefined-weak -nostdlib %(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /kernel_ldr.ld) -pie --gc-sections -z text -z nodynamic-undefined-weak -z pack-relative-relocs -nostdlib
*startfile: *startfile:
crti%O%s crtbegin%O%s crti%O%s crtbegin%O%s

View file

@ -19,8 +19,8 @@
/* Necessary for calculating kernelldr size/base for initial identity mapping */ /* Necessary for calculating kernelldr size/base for initial identity mapping */
extern "C" { extern "C" {
extern const u8 __start__[]; extern const u8 __bin_start__[];
extern const u8 __end__[]; extern const u8 __bin_end__[];
} }
@ -88,8 +88,8 @@ namespace ams::kern::init::loader {
/* Map in an RWX identity mapping for ourselves. */ /* Map in an RWX identity mapping for ourselves. */
constexpr PageTableEntry KernelLdrRWXIdentityAttribute(PageTableEntry::Permission_KernelRWX, PageTableEntry::PageAttribute_NormalMemory, PageTableEntry::Shareable_InnerShareable, PageTableEntry::MappingFlag_Mapped); constexpr PageTableEntry KernelLdrRWXIdentityAttribute(PageTableEntry::Permission_KernelRWX, PageTableEntry::PageAttribute_NormalMemory, PageTableEntry::Shareable_InnerShareable, PageTableEntry::MappingFlag_Mapped);
const uintptr_t kernel_ldr_base = util::AlignDown(reinterpret_cast<uintptr_t>(__start__), PageSize); const uintptr_t kernel_ldr_base = util::AlignDown(reinterpret_cast<uintptr_t>(__bin_start__), PageSize);
const uintptr_t kernel_ldr_size = util::AlignUp(reinterpret_cast<uintptr_t>(__end__), PageSize) - kernel_ldr_base; const uintptr_t kernel_ldr_size = util::AlignUp(reinterpret_cast<uintptr_t>(__bin_end__), PageSize) - kernel_ldr_base;
init_pt.Map(kernel_ldr_base, kernel_ldr_size, kernel_ldr_base, KernelRWXIdentityAttribute, allocator, 0); init_pt.Map(kernel_ldr_base, kernel_ldr_size, kernel_ldr_base, KernelRWXIdentityAttribute, allocator, 0);
/* Map in the page table region as RW- for ourselves. */ /* Map in the page table region as RW- for ourselves. */