Skip to content

psp::sys::sceGuCheckList panics #195

@4yman-0

Description

@4yman-0
//! This panics

#![no_std]
#![no_main]

use psp::{Align16, module, sys};

static mut GE_LIST: Align16<[u8; 0x10000]> = Align16([0; 0x10000]);

module!("panic", 0, 1);

fn psp_main() {
	unsafe {
		use sys::*;
		sceGuInit();
		sceGuStart(GuContextType::Direct, (&raw mut GE_LIST.0).cast());
		sceGuFinish();
		sceGuSync(GuSyncMode::Finish, GuSyncBehavior::Wait);
	}
	let size = unsafe { sys::sceGuCheckList() };
	psp::dprintln!("GU list bytes used: {size}");
}

Panic message:

panicked at PSP_REGISTRY_SOURCE/psp-0.3.12/src/sys/gu.rs:1853:21: unsafe precondition(s) violated: ptr::sub requires that the address calculation does not overflow

This indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety
  • Tested on PPSSPP with "Ignore bad memory access" disabled, not tested on real PSP.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions