~ubuntu-branches/ubuntu/trusty/grub2/trusty-updates

« back to all changes in this revision

Viewing changes to grub-core/tests/boot/kbsd.init-x86_64.S

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-02-08 11:39:26 UTC
  • mfrom: (17.6.26 experimental)
  • mto: (17.6.27 experimental)
  • mto: This revision was merged to the branch mainline in revision 104.
  • Revision ID: james.westby@ubuntu.com-20110208113926-clfs90haboyk9zip
Tags: 1.99~rc1-2
* Merge 1.98+20100804-13 and 1.98+20100804-14, updating translations:
  - Kazakh (Baurzhan Muftakhidinov / Timur Birsh).
* mkconfig_skip_dmcrypt.patch: Refer to GRUB_PRELOAD_MODULES rather than
  suggesting people write a /etc/grub.d/01_modules script (thanks, Jordan
  Uggla).
* Handle empty dir passed to grub_find_root_device_from_mountinfo; fixes
  grub-mkrelpath on btrfs subvolumes (LP: #712029).
* Add rootflags=subvol=<name> if / is on a btrfs subvolume (LP: #712029).
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  GRUB  --  GRand Unified Bootloader
 
3
 *  Copyright (C) 2010  Free Software Foundation, Inc.
 
4
 *
 
5
 *  GRUB is free software: you can redistribute it and/or modify
 
6
 *  it under the terms of the GNU General Public License as published by
 
7
 *  the Free Software Foundation, either version 3 of the License, or
 
8
 *  (at your option) any later version.
 
9
 *
 
10
 *  GRUB is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#define MODE_RDRW 2
 
20
#define FLAGS_NONE 0
 
21
#define SYSCALL_OPEN 5
 
22
#define SYSCALL_WRITE 4
 
23
#ifdef TARGET_NETBSD
 
24
#define SYSCALL_RESET 208
 
25
#elif defined (TARGET_OPENBSD)
 
26
#define SYSCALL_RESET 55
 
27
#else
 
28
#error unknown target
 
29
#endif
 
30
#define SYSCALL_EXIT 1
 
31
#define SYSCALL_ARCH 165
 
32
#define SYSCALL_INT 0x80
 
33
#define SYSCALL_ARCH_IOPL       2
 
34
 
 
35
#define RESET_NOSYNC 0x4
 
36
#define RESET_HALT 0x8
 
37
#define RESET_POWEROFF 0x800
 
38
#define SHUTDOWN_PORT 0x8900
 
39
 
 
40
        .section ".init", "ax"
 
41
        .global start,_start
 
42
start:
 
43
_start:
 
44
        /* open.  */
 
45
        movq $SYSCALL_OPEN, %rax
 
46
        leaq device, %rdi
 
47
        movq $MODE_RDRW, %rsi
 
48
        movq $FLAGS_NONE, %rdx
 
49
        syscall
 
50
        movq %rax, %rdi
 
51
 
 
52
        /* write.  */
 
53
        movq $SYSCALL_WRITE, %rax
 
54
        movq $(messageend-message), %rdx
 
55
        leaq message, %rsi
 
56
        syscall
 
57
 
 
58
        /* IOPL.  */
 
59
        movq $SYSCALL_ARCH, %rax
 
60
        movq $SYSCALL_ARCH_IOPL, %rdi
 
61
        leaq iopl_arg, %rsi
 
62
        syscall
 
63
 
 
64
        movw $SHUTDOWN_PORT, %dx
 
65
        movb $'S', %al
 
66
        outb %al, %dx
 
67
        movb $'h', %al
 
68
        outb %al, %dx
 
69
        movb $'u', %al
 
70
        outb %al, %dx
 
71
        movb $'t', %al
 
72
        outb %al, %dx
 
73
        movb $'d', %al
 
74
        outb %al, %dx
 
75
        movb $'o', %al
 
76
        outb %al, %dx
 
77
        movb $'w', %al
 
78
        outb %al, %dx
 
79
        movb $'n', %al
 
80
        outb %al, %dx
 
81
 
 
82
        /* shutdown.  */
 
83
        movq $SYSCALL_RESET, %rax
 
84
        movq $(RESET_POWEROFF|RESET_HALT|RESET_NOSYNC), %rdi
 
85
        movq $0, %rsi
 
86
        syscall
 
87
 
 
88
        /* exit (1). Shouldn't be reached.  */
 
89
        movq $SYSCALL_EXIT, %rax
 
90
        movq $1, %rdi
 
91
        syscall
 
92
        .section ".fini", "ax"
 
93
1:      jmp 1b
 
94
        .section ".text", "ax"
 
95
1:      jmp 1b
 
96
        /* This section is needed for NetBSD to identify the binary.  */
 
97
        .section ".note.netbsd.ident", "a"
 
98
        .long 0x7
 
99
        .long 0x4
 
100
        .long 0x1
 
101
        .ascii "NetBSD"
 
102
        .byte 0
 
103
        .data
 
104
device:
 
105
        .ascii "/dev/console"
 
106
        .byte 0
 
107
message:
 
108
        .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
 
109
messageend:
 
110
iopl_arg:
 
111
        .long 3