mirror of
https://github.com/ps5-linux/ps5-linux-loader.git
synced 2026-05-09 00:24:16 +00:00
clean up
This commit is contained in:
8
Makefile
8
Makefile
@@ -10,31 +10,23 @@ BIN := bin/ps5-linux-loader.elf
|
|||||||
SRC := $(wildcard source/*.c)
|
SRC := $(wildcard source/*.c)
|
||||||
OBJS := $(SRC:.c=.o)
|
OBJS := $(SRC:.c=.o)
|
||||||
|
|
||||||
# Agregamos los headers de los shellcodes a los CFLAGS para que los encuentre en source/main.c
|
|
||||||
CFLAGS := -std=c23 -Wall -Iinclude -Ishellcode_hypervisor -Ishellcode_kernel
|
CFLAGS := -std=c23 -Wall -Iinclude -Ishellcode_hypervisor -Ishellcode_kernel
|
||||||
LDFLAGS :=
|
LDFLAGS :=
|
||||||
|
|
||||||
# Rutas de los headers generados
|
|
||||||
SC_HV_H := shellcode_hypervisor/shellcode_hypervisor.h
|
SC_HV_H := shellcode_hypervisor/shellcode_hypervisor.h
|
||||||
SC_K_H := shellcode_kernel/shellcode_kernel.h
|
SC_K_H := shellcode_kernel/shellcode_kernel.h
|
||||||
|
|
||||||
# 1. Regla principal: Construir los shellcodes antes que los objetos del main
|
|
||||||
all: $(SC_HV_H) $(SC_K_H) $(BIN)
|
all: $(SC_HV_H) $(SC_K_H) $(BIN)
|
||||||
|
|
||||||
# 2. Reglas para disparar el Make en las subcarpetas
|
|
||||||
# Usamos .PHONY de forma indirecta o forzamos la entrada a la carpeta
|
|
||||||
$(SC_HV_H):
|
$(SC_HV_H):
|
||||||
$(MAKE) -C shellcode_hypervisor
|
$(MAKE) -C shellcode_hypervisor
|
||||||
|
|
||||||
$(SC_K_H):
|
$(SC_K_H):
|
||||||
$(MAKE) -C shellcode_kernel
|
$(MAKE) -C shellcode_kernel
|
||||||
|
|
||||||
# 3. Los objetos dependen de que los headers de los shellcodes existan
|
|
||||||
# Si main.c hace #include "shellcode_hypervisor.h", necesita estos targets
|
|
||||||
$(OBJS): %.o: %.c
|
$(OBJS): %.o: %.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
# 4. Link final
|
|
||||||
$(BIN): $(OBJS)
|
$(BIN): $(OBJS)
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(OBJS) $(LDFLAGS) -o $@
|
$(CC) $(OBJS) $(LDFLAGS) -o $@
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ void boot_linux(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void entry(void) {
|
void entry(void) {
|
||||||
|
|
||||||
disable_intr();
|
disable_intr();
|
||||||
|
|
||||||
// Set global interrupt flag.
|
// Set global interrupt flag.
|
||||||
@@ -145,9 +144,7 @@ void entry(void) {
|
|||||||
|
|
||||||
// Clean up mtrr.
|
// Clean up mtrr.
|
||||||
wrmsr(MSR_MTRR4kBase + 0, 0);
|
wrmsr(MSR_MTRR4kBase + 0, 0);
|
||||||
|
|
||||||
wrmsr(MSR_MTRR4kBase + 1, 0);
|
wrmsr(MSR_MTRR4kBase + 1, 0);
|
||||||
|
|
||||||
wrmsr(MSR_MTRRVarBase + 7 * 2 + 1, 0);
|
wrmsr(MSR_MTRRVarBase + 7 * 2 + 1, 0);
|
||||||
|
|
||||||
atomic_add_32(&exited_cpus, 1);
|
atomic_add_32(&exited_cpus, 1);
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
#define VM_CR_R_INIT (1ULL << 1) // Bit 1: Intercept INIT
|
#define VM_CR_R_INIT (1ULL << 1) // Bit 1: Intercept INIT
|
||||||
|
|
||||||
// // MTRRs (Memory Type Range Registers)
|
// // MTRRs (Memory Type Range Registers)
|
||||||
#define MSR_MTRR4kBase 0x00000268 // MSR_MTRRfix4K_C0000 (primer registro 4k)
|
#define MSR_MTRR4kBase 0x00000268
|
||||||
#define MSR_MTRRVarBase 0x00000200 // MTRR variable base (MSR_MTRRphysBase0)
|
#define MSR_MTRRVarBase 0x00000200
|
||||||
|
|
||||||
#define VRAM_BASE (0x470000000 - info.vram_size)
|
#define VRAM_BASE (0x470000000 - info.vram_size)
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2026 Andy Nguyen
|
|
||||||
*
|
|
||||||
* This software may be modified and distributed under the terms
|
|
||||||
* of the MIT license. See the LICENSE file for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __LINUX_H__
|
#ifndef __LINUX_H__
|
||||||
#define __LINUX_H__
|
#define __LINUX_H__
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user