Skip to content

LLGO Compiler Support for ARM Cortex-M SVCall System Calls #18

@luoliwoshang

Description

@luoliwoshang

LLGO Compiler Support for ARM Cortex-M SVCall System Calls

Summary

LLGO compiler needs to implement support for ARM Cortex-M SVCall (Supervisor Call) system calls to enable full compatibility with TinyGo's embedded device packages.

Background

During the migration of TinyGo device packages to goplus/lib/emb, we discovered that ARM SVCall functions (SVCall0, SVCall1, SVCall2, SVCall3, SVCall4) are implemented as compiler intrinsics in TinyGo but are missing function bodies when compiled with LLGO.

Current Status

The ARM SVCall functions in emb/device/arm/arm.go currently have placeholder implementations:

// Run the following system call (SVCall) with 0 arguments.
func SVCall0(num uintptr) uintptr {
    // TODO(zzy): implement system call (SVCall) functionality for ARM Cortex-M
    // TinyGo compiler implementation: tinygo/compiler/inlineasm.go emitSV64Call function
    panic("TODO: SVCall0")
    return 0
}

// Similar for SVCall1, SVCall2, SVCall3, SVCall4...

TinyGo Reference Implementation

TinyGo implements these functions as compiler intrinsics in:

  • File: tinygo/compiler/inlineasm.go
  • Function: emitSV64Call
  • Mechanism: Generates inline ARM assembly for supervisor calls

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions