~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/skiboot/test/hello_world/hello_kernel/hello_kernel.S

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2013-2014 IBM Corp.
 
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
 
12
 * implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
/*
 
18
        hello_kernel.S!
 
19
        ---------------
 
20
 
 
21
        Because skiboot has its own stack, we don't even need that!
 
22
        All we need to do is make an OPAL call to write to the console.
 
23
 
 
24
*/
 
25
 
 
26
        . = 0x0
 
27
        .globl _start
 
28
_start:
 
29
/*
 
30
 * Save some values passed in from skiboot into registers that are
 
31
 * non-volatile over OPAL calls.
 
32
 *   r8 is the OPAL base
 
33
 *   r9 is the OPAL entry point point
 
34
 */
 
35
        mr      %r13, %r8
 
36
        mr      %r14, %r9
 
37
 
 
38
        bl      here
 
39
here:   mflr    %r8 /* work out where we are running */
 
40
 
 
41
        li      %r0, 1 /* OPAL_CONSOLE_WRITE */
 
42
        li      %r3, 0 /* terminal 0 */
 
43
        addi    %r4, %r8, len - here /* ptr to length of string */
 
44
        addi    %r5, %r8, str - here /* ptr to string start */
 
45
        mr      %r2, %r13
 
46
        mtctr   %r14
 
47
        bctrl
 
48
 
 
49
        li      %r0, 5 /* OPAL_CEC_POWER_DOWN */
 
50
        li      %r3, 0 /* normal shutdown */
 
51
        mr      %r2, %r13
 
52
        mtctr   %r14
 
53
        bctrl
 
54
 
 
55
        /* We shouldn't get here but if we do, just wait here */
 
56
        b       .
 
57
 
 
58
len:
 
59
        .long 0x00
 
60
        .long (strend - str)
 
61
str:
 
62
        .string "Hello World!\n"
 
63
strend: