Skip to content

Conversation

@google-labs-jules
Copy link

Set up the Rust workspace and crates to replace the legacy C/Asm OS.
Created mac_types, os, and kernel crates.
Implemented a mock event loop in the kernel.
Configured the build system for m68k-unknown-none-elf.
Renamed the old build script.
Added build documentation.


PR created automatically by Jules for task 970162318733461949 started by @belikh

This commit establishes the foundation for a complete rewrite of the Macintosh System 7.1 operating system in Rust. It introduces a Cargo workspace with the following components:

- `rust_src/mac_types`: A library defining standard Macintosh types (OSErr, Rect, Str255, etc.) in Rust.
- `rust_src/os`: A library crate containing stubs for core OS subsystems (MemoryMgr, StartMgr, Drivers).
- `rust_src/kernel`: The main kernel entry point (`_start`) and a `main` loop that mimics the classic `MiniFinder` event loop structure.

Build System:
- Added `.cargo/config.toml` targeting `m68k-unknown-none-elf`.
- Added `kernel.ld` for linker configuration.
- Added `BUILD_RUST.md` with instructions for building with nightly toolchain and `build-std`.
- Renamed `cross_compile.sh` to `legacy_cross_compile.sh`.

This structure allows the OS to be built as a single ELF binary for bare-metal m68k execution.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

This commit continues the Rust OS conversion by expanding the `mac_types` crate and implementing the initial Memory Manager structures in the `os` crate.

Changes:
- Expanded `rust_src/mac_types/src/lib.rs` with `Size`, `ProcPtr`, `GrowZoneProcPtr`, and `Zone` related types.
- Implemented `Zone` struct in `rust_src/os/src/memory_mgr.rs` matching the layout defined in `Interfaces/CIncludes/Memory.h`.
- Added stubs for `init_zone`, `new_handle`, `dispose_handle`, `get_zone`, and `set_zone`.
- Updated `rust_src/kernel` to initialize the mocked Memory Manager and corrected dependency links.
- Updated `BUILD_RUST.md` to reflect the progress.

This allows the kernel to compile with basic memory management types and function calls, paving the way for the actual allocator implementation.
This commit expands the Rust OS implementation by adding support for the Start Manager and Trap Dispatcher subsystems.

Changes:
- Implemented `StartMgr` data structures (`SlotDev`, `SCSIDev`, `DefStartRec`, etc.) in `rust_src/mac_types/src/start.rs`.
- Implemented stubs for `StartMgr` functions (`GetDefaultStartup`, `SetDefaultStartup`, etc.) in `rust_src/os/src/start_mgr.rs`.
- Implemented a basic `TrapTable` mock and `dispatch_trap` logic in `rust_src/os/src/trap_dispatcher.rs`.
- Updated `rust_src/mac_types/src/lib.rs` to export the new `start` module.
- Cleaned up unused variable warnings in the build.

This moves the OS conversion forward by defining the boot configuration structures and the central system call mechanism.
This commit adds the initial Rust implementation for the Gestalt Manager and Time Manager subsystems.

Changes:
- Added `rust_src/mac_types/src/gestalt.rs` with `GestaltEntry` and `SelectorFunctionProcPtr`.
- Added `rust_src/mac_types/src/timer.rs` with `TMTask` and `QElem` structures.
- Updated `rust_src/os` to include stubs for `Gestalt`, `NewGestalt`, `InsTime`, `PrimeTime`, etc.
- Exported new modules in `mac_types` and `os` libraries.
- Verified build with syntax checks.

This provides the core system configuration and scheduling primitives required for the kernel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant