• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2024 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15
16.section .text
17.globl _start
18_start:
19    // SYS_write
20    li a7, 64
21    // fd is stdout
22    li a0, 1
23    // pc-relative address of the string
241:
25    auipc a1, %pcrel_hi(hello_string)
26    addi a1, a1, %pcrel_lo(1b)
27    // string size
28    li a2, 6
29    ecall
30
31    // SYS_exit
32    li a7, 93
33    // value to return from main
34    li a0, 0
35    ecall
36
37.section .rodata
38hello_string:
39   .asciz "Hello\n"
40