Contents of /tags/mkinitrd-6_3_5/isolinux/macros.inc
Parent Directory | Revision Log
Revision 1133 -
(show annotations)
(download)
Thu Aug 19 09:50:43 2010 UTC (14 years, 1 month ago) by niro
Original Path: trunk/mkinitrd-magellan/isolinux/macros.inc
File size: 2600 byte(s)
Thu Aug 19 09:50:43 2010 UTC (14 years, 1 month ago) by niro
Original Path: trunk/mkinitrd-magellan/isolinux/macros.inc
File size: 2600 byte(s)
-updated to isolinux-3.86
1 | ;; ----------------------------------------------------------------------- |
2 | ;; |
3 | ;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved |
4 | ;; Copyright 2009 Intel Corporation; author: H. Peter Anvin |
5 | ;; |
6 | ;; This program is free software; you can redistribute it and/or modify |
7 | ;; it under the terms of the GNU General Public License as published by |
8 | ;; the Free Software Foundation, Inc., 53 Temple Place Ste 330, |
9 | ;; Boston MA 02111-1307, USA; either version 2 of the License, or |
10 | ;; (at your option) any later version; incorporated herein by reference. |
11 | ;; |
12 | ;; ----------------------------------------------------------------------- |
13 | |
14 | ;; |
15 | ;; macros.inc |
16 | ;; |
17 | ;; Convenient macros |
18 | ;; |
19 | |
20 | %ifndef _MACROS_INC |
21 | %define _MACROS_INC |
22 | |
23 | ; |
24 | ; Identify the module we're compiling; the "correct" should be defined |
25 | ; in the module itself to 1 |
26 | ; |
27 | %ifdef IS_SYSLINUX |
28 | %define MY_NAME 'SYSLINUX' |
29 | %else |
30 | %define IS_SYSLINUX 0 |
31 | %endif |
32 | %ifdef IS_PXELINUX |
33 | %define MY_NAME 'PXELINUX' |
34 | %else |
35 | %define IS_PXELINUX 0 |
36 | %endif |
37 | %ifdef IS_ISOLINUX |
38 | %define MY_NAME 'ISOLINUX' |
39 | %else |
40 | %define IS_ISOLINUX 0 |
41 | %endif |
42 | %ifdef IS_EXTLINUX |
43 | %define MY_NAME 'EXTLINUX' |
44 | %else |
45 | %define IS_EXTLINUX 0 |
46 | %endif |
47 | |
48 | ; |
49 | ; Macros similar to res[bwd], but which works in the code segment (after |
50 | ; section .text) or the data segment (section .data) |
51 | ; |
52 | %macro zb 1.nolist |
53 | times %1 db 0 |
54 | %endmacro |
55 | |
56 | %macro zw 1.nolist |
57 | times %1 dw 0 |
58 | %endmacro |
59 | |
60 | %macro zd 1.nolist |
61 | times %1 dd 0 |
62 | %endmacro |
63 | |
64 | ; |
65 | ; Align with zero bytes in a progbits segment |
66 | ; |
67 | %macro alignz 1.nolist |
68 | times (((%1) - (($-$$) % (%1))) % (%1)) db 0 |
69 | %endmacro |
70 | |
71 | ; |
72 | ; Macro to emit an unsigned decimal number as a string |
73 | ; |
74 | %macro asciidec 1.nolist |
75 | %ifndef DEPEND ; Not safe for "depend" |
76 | %push asciidec |
77 | %assign %$v %1 |
78 | %if %$v == 0 |
79 | db '0' |
80 | %else |
81 | %assign %$dcount 0 |
82 | %assign %$n %$v |
83 | %assign %$d 1 |
84 | %rep 20 |
85 | %if %$n != 0 |
86 | %assign %$dcount %$dcount + 1 |
87 | %assign %$n %$n / 10 |
88 | %assign %$d %$d * 10 |
89 | %endif |
90 | %endrep |
91 | %rep %$dcount |
92 | %assign %$d %$d / 10 |
93 | db ((%$v / %$d) % 10) + '0' |
94 | %endrep |
95 | %endif |
96 | %pop |
97 | %endif |
98 | %endmacro |
99 | |
100 | ; |
101 | ; Macros for network byte order of constants |
102 | ; |
103 | %define htons(x) ( ( ((x) & 0FFh) << 8 ) + ( ((x) & 0FF00h) >> 8 ) ) |
104 | %define ntohs(x) htons(x) |
105 | %define htonl(x) ( ( ((x) & 0FFh) << 24) + ( ((x) & 0FF00h) << 8 ) + ( ((x) & 0FF0000h) >> 8 ) + ( ((x) & 0FF000000h) >> 24) ) |
106 | %define ntohl(x) htonl(x) |
107 | |
108 | ; |
109 | ; ASCII |
110 | ; |
111 | CR equ 13 ; Carriage Return |
112 | LF equ 10 ; Line Feed |
113 | FF equ 12 ; Form Feed |
114 | BS equ 8 ; Backspace |
115 | |
116 | %endif ; _MACROS_INC |