This commit is contained in:
Andy Nguyen
2026-04-27 10:04:31 +02:00
parent abee7fe14b
commit 6f182dc44d
4 changed files with 2 additions and 20 deletions

View File

@@ -10,31 +10,23 @@ BIN := bin/ps5-linux-loader.elf
SRC := $(wildcard source/*.c)
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
LDFLAGS :=
# Rutas de los headers generados
SC_HV_H := shellcode_hypervisor/shellcode_hypervisor.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)
# 2. Reglas para disparar el Make en las subcarpetas
# Usamos .PHONY de forma indirecta o forzamos la entrada a la carpeta
$(SC_HV_H):
$(MAKE) -C shellcode_hypervisor
$(SC_K_H):
$(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
$(CC) $(CFLAGS) -c -o $@ $<
# 4. Link final
$(BIN): $(OBJS)
@mkdir -p $(dir $@)
$(CC) $(OBJS) $(LDFLAGS) -o $@

View File

@@ -131,7 +131,6 @@ void boot_linux(void) {
}
void entry(void) {
disable_intr();
// Set global interrupt flag.
@@ -145,9 +144,7 @@ void entry(void) {
// Clean up mtrr.
wrmsr(MSR_MTRR4kBase + 0, 0);
wrmsr(MSR_MTRR4kBase + 1, 0);
wrmsr(MSR_MTRRVarBase + 7 * 2 + 1, 0);
atomic_add_32(&exited_cpus, 1);

View File

@@ -7,8 +7,8 @@
#define VM_CR_R_INIT (1ULL << 1) // Bit 1: Intercept INIT
// // MTRRs (Memory Type Range Registers)
#define MSR_MTRR4kBase 0x00000268 // MSR_MTRRfix4K_C0000 (primer registro 4k)
#define MSR_MTRRVarBase 0x00000200 // MTRR variable base (MSR_MTRRphysBase0)
#define MSR_MTRR4kBase 0x00000268
#define MSR_MTRRVarBase 0x00000200
#define VRAM_BASE (0x470000000 - info.vram_size)

View File

@@ -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__
#define __LINUX_H__