BOCHS for QNX 8 ARM - COMPREHENSIVE ARM ALIGNMENT FIX
=====================================================

This package contains BOCHS 2.8 compiled for QNX 8 ARM with comprehensive
fixes for all ARM memory alignment issues that cause SIGBUS errors.

FIXES APPLIED:
==============

1. ✅ TIME0 PARAMETER BUG - SOLVED
   - Fixed mktime() failure on QNX causing invalid parameter ranges
   - Added parameter validation bypass for special time0 values (1, 2)

2. ✅ C++ RUNTIME LIBRARIES - INCLUDED
   - libgcc_s.so.1 and libstdc++.so.6 included in lib/ directory
   - Proper library path configuration in all scripts

3. ✅ X11 GUI CONNECTION - WORKING
   - X11 headers and libraries properly linked
   - XSDL display export working (192.168.1.107:0)

4. ✅ COMPREHENSIVE ARM ALIGNMENT FIXES - NEW!
   - system_read_qword() - Safe 8-byte memory access
   - system_read_dword() - Safe 4-byte memory access  
   - system_read_word() - Safe 2-byte memory access
   - system_write_qword() - Safe 8-byte memory writes
   - system_write_dword() - Safe 4-byte memory writes
   - system_write_word() - Safe 2-byte memory writes
   
   All functions now detect unaligned memory access and use safe
   byte-by-byte copying instead of direct pointer casting that
   causes SIGBUS errors on ARM processors.

DEPLOYMENT:
===========

1. Extract the package on your QNX device:
   unzip bochs_qnx8_comprehensive_arm_fix.zip

2. Set executable permissions:
   chmod +x *.sh

3. Run BOCHS with comprehensive ARM fixes:
   ./comprehensive_arm_fix.sh

SCRIPTS INCLUDED:
=================

- comprehensive_arm_fix.sh - Latest version with ALL fixes
- arm_fixed_bochs.sh - Previous version (partial fixes)
- safe_bochs.sh - Conservative settings version
- run_bochs.sh - Original version

TECHNICAL DETAILS:
==================

The SIGBUS errors were caused by BOCHS attempting direct pointer casting
on potentially unaligned memory addresses. ARM processors require strict
memory alignment for multi-byte operations:

- 16-bit (word) access must be 2-byte aligned
- 32-bit (dword) access must be 4-byte aligned  
- 64-bit (qword) access must be 8-byte aligned

The comprehensive fix detects unaligned access at runtime and uses safe
byte-by-byte copying with proper little-endian reconstruction instead
of direct pointer dereferencing.

This ensures BOCHS works reliably on ARM without performance penalties
for aligned access (which is the common case).

BUILD INFO:
===========

- Compiler: arm-blackberry-qnx8eabi-gcc 9.3.0
- Target: QNX 8 ARM (armle-v7)
- X11 Support: Enabled
- Configuration: Standard BOCHS 2.8 with ARM alignment patches

TROUBLESHOOTING:
================

If you still encounter issues:

1. Ensure XSDL is running on 192.168.1.107:0
2. Run directly on QNX device (not over SSH)
3. Check library path: echo $LD_LIBRARY_PATH
4. Try safe_bochs.sh for ultra-conservative settings

This version should eliminate ALL SIGBUS errors on ARM!