From b84b0f0e41f88178b1cd3f7d13681edf56f2e553 Mon Sep 17 00:00:00 2001 From: Putta Khunchalee Date: Sun, 12 Jan 2025 21:00:34 +0700 Subject: [PATCH] Implements uk_flags for keg_small_init (#1242) --- README.md | 12 +++++++++++- kernel/src/uma/keg.rs | 19 ++++++++++++++++++- kernel/src/uma/mod.rs | 4 ++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fd585600e..0f17d3bc7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![CI](https://github.com/obhq/obliteration/actions/workflows/main.yml/badge.svg)](https://github.com/obhq/obliteration/actions/workflows/main.yml) [![Zulip](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://obkrnl.zulipchat.com) -Obliteration is a free and open-source PlayStation 4 kernel rewritten in Rust. Our goal is to run the PlayStation 4 system software on Windows, Linux and macOS using a custom made virtualization stack optimized specifically for Obliteration. **The project is under development and cannot run any games yet**. The reason it take so long is because we decided to go with the correct path without stubbing as much as possible. +Obliteration is a free and open-source PlayStation 4 kernel rewritten in Rust. Our goal is not running on the PlayStation 4 but to run the dumped PlayStation 4 system software on Windows, Linux and macOS using a custom made virtualization stack optimized specifically for Obliteration. This project started as a hard-fork from [Kyty](https://github.com/InoriRus/Kyty). Then we decided to rewrite the whole project from scratch by using Kyty and [Uplift](https://github.com/idc/uplift) as a reference to help us getting started with the project. @@ -19,6 +19,16 @@ So we want to take this opportunity to go beyond a PlayStation 4 emulator since The project logo and icon was designed by [VocalFan](https://github.com/VocalFan). +## Status + +Currently we cannot run any games yet. The reason it take so long is because we try to implement things without stubbing as much as possible. + +## Key features + +- Cross-platform with native binary for each platform. +- On-demand memory allocation instead of pre-allocated 8 GB at startup. +- Near-native performance by using [Windows Hypervisor Platform](https://learn.microsoft.com/en-us/virtualization/api/#windows-hypervisor-platform), [KVM](https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine) or [Hypervisor Framework](https://developer.apple.com/documentation/hypervisor) directly with custom made virtual devices for optimized MMIO. + ## Get a daily build Please note that we cannot run any games yet as stated on the above. But if you want to try or help on testing you can download binaries from the latest commits [here](https://github.com/obhq/obliteration/actions/workflows/main.yml). You **MUST** sign in to GitHub otherwise you will not be able to download files. diff --git a/kernel/src/uma/keg.rs b/kernel/src/uma/keg.rs index 32c23bbcb..50e86b27b 100644 --- a/kernel/src/uma/keg.rs +++ b/kernel/src/uma/keg.rs @@ -45,8 +45,25 @@ impl UmaKeg { if (size.get() + (min.size() - off)) > (PAGE_SIZE.get() - min.size()) { todo!() } else { - todo!() + // TODO: Set uk_ppera, uk_ipers and uk_rsize. + if !flags.has(UmaFlags::Internal) { + flags |= UmaFlags::Offpage; + + if !flags.has(UmaFlags::VToSlab) { + flags |= UmaFlags::Hash; + } + } } } + + if flags.has(UmaFlags::Offpage) { + if flags.has(UmaFlags::RefCnt) { + // TODO: Set uk_slabzone to slabrefzone. + } else { + // TODO: Set uk_slabzone to slabzone. + } + } + + todo!() } } diff --git a/kernel/src/uma/mod.rs b/kernel/src/uma/mod.rs index 350641225..09cd81f7d 100644 --- a/kernel/src/uma/mod.rs +++ b/kernel/src/uma/mod.rs @@ -49,10 +49,14 @@ impl Uma { pub enum UmaFlags { /// `UMA_ZONE_ZINIT`. ZInit = 0x2, + /// `UMA_ZONE_OFFPAGE`. + Offpage = 0x8, /// `UMA_ZONE_MALLOC`. Malloc = 0x10, /// `UMA_ZONE_VM`. Vm = 0x80, + /// `UMA_ZONE_HASH`. + Hash = 0x100, /// `UMA_ZONE_SECONDARY`. Secondary = 0x200, /// `UMA_ZONE_REFCNT`.