universalisos/kernel/linker.ld
Fábio Coutada b8af1e6ec2 feat(universalisos): Add comprehensive agent system and context monitoring
## Agent System
- **Plan Maintainer Agent**: Manages session context and verifies todo lists
- **Aurelio Agent**: Imports Claude Code sessions and syncs to backend

## Universalisos Kernel Run Skill
- **Build & Launch**: Automated kernel build and QEMU execution
- **Driver Script**: Test automation with output validation
- **Fixed Issues**: Section directive errors, exception handlers, stack symbols

## Context Monitoring System
- **Measurement**: Real-time token counting and usage tracking
- **Continuous Monitoring**: Background compaction to prevent data loss
- **Automatic Compaction**: Preserves important context to memory
- **Alert System**: Desktop notifications for threshold events
- **Historical Tracking**: Usage trends and optimization recommendations

## Kernel Enhancements
- **Fixed boot.S**: Corrected section directives and stack symbol naming
- **Exception Handlers**: Added C stubs for ARM exception handling
- **RISC-V Support**: Added boot and exception handling for RISC-V
- **Core Components**: IPC, scheduler, heap manager, safety framework

## Integration
- **Aurelio Backend**: PortugalFuturista MCP synchronization
- **Memory System**: Context preservation before compaction
- **Automated Testing**: Driver scripts for all components

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-07 15:44:26 +01:00

164 lines
No EOL
3 KiB
Text

/*
* Universalisos Linker Script
* PikeOS 5.0 Feature Parity - Memory Layout Definition
*
* Defines memory regions for ARM and RISC-V architectures
* with proper alignment and section placement for safety-critical systems.
*/
/*
* Entry point
*/
ENTRY(kernel_main)
/*
* Memory regions for QEMU virt machine
*/
MEMORY
{
/* QEMU virt machine memory layout */
RAM (rwxai) : ORIGIN = 0x40000000, LENGTH = 128M
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 64M
}
/*
* Stack sizes
*/
__stack_size = 0x4000; /* 16KB stack */
__irq_stack_size = 0x1000; /* 4KB IRQ stack */
__fiq_stack_size = 0x1000; /* 4KB FIQ stack */
__system_stack_size = 0x2000; /* 8KB system stack */
/*
* Heap configuration
*/
__heap_start = 0x60000000;
__heap_end = 0x60800000; /* 8MB heap */
__heap_size = __heap_end - __heap_start;
/*
* Section definitions
*/
SECTIONS
{
/*
* Exception vector table (must be at offset 0x00000000)
*/
.vectors : {
. = ALIGN(4);
KEEP(*(.text.vectors))
. = ALIGN(4);
} > FLASH
/*
* Code and read-only data
*/
.text : {
. = ALIGN(4);
*(.text)
*(.text*)
*(.rodata)
*(.rodata*)
. = ALIGN(4);
} > RAM AT> FLASH
/*
* Constructor and destructor tables
*/
.ctors : {
. = ALIGN(4);
__ctor_start = .;
KEEP(*(.ctors))
KEEP(*(SORT(.ctors.*)))
__ctor_end = .;
. = ALIGN(4);
} > RAM
.dtors : {
. = ALIGN(4);
__dtor_start = .;
KEEP(*(.dtors))
KEEP(*(SORT(.dtors.*)))
__dtor_end = .;
. = ALIGN(4);
} > RAM
/*
* Exception vectors (data section)
*/
.data : {
. = ALIGN(4);
*(.data)
*(.data*)
. = ALIGN(4);
} > RAM
/*
* BSS section (zero-initialized data)
*/
.bss : {
. = ALIGN(4);
__bss_start = .;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end = .;
} > RAM
/*
* Stack definitions
*/
.stack : {
. = ALIGN(16);
. = . + __stack_size;
__stack_top = .;
} > RAM
.irq_stack : {
. = ALIGN(16);
. = . + __irq_stack_size;
__irq_stack_top = .;
} > RAM
.fiq_stack : {
. = ALIGN(16);
. = . + __fiq_stack_size;
__fiq_stack_top = .;
} > RAM
.system_stack : {
. = ALIGN(16);
. = . + __system_stack_size;
__system_stack_top = .;
} > RAM
/*
* Heap definition
*/
.heap : {
. = ALIGN(8);
__heap_start = .;
. = . + __heap_size;
__heap_end = .;
. = ALIGN(8);
} > RAM
/*
* Debug sections
*/
/DISCARD/ : {
*(.comment)
*(.ARM.attributes)
*(.note.*)
}
/*
* Stack protection (optional for safety)
*/
.stack_protector : {
. = ALIGN(8);
__stack_chk_guard = .;
. = . + 8;
} > RAM
}