Added:
wiki/AssemblyX64B.wiki
Modified:
trunk/cc/bootloader.lisp
trunk/cc/lap.lisp
trunk/cc/test-cc.lisp
trunk/cc/x86-64-syntax.lisp
wiki/SBX64Assembly.wiki
Log:
Add instruction bswap.
Modified: trunk/cc/bootloader.lisp
==============================================================================
--- trunk/cc/bootloader.lisp (original)
+++ trunk/cc/bootloader.lisp Tue Mar 3 05:23:40 2009
@@ -58,5 +58,4 @@
(db msg ("Hello World! " 13 10))
endmsg
- kernel-end
- ))
+ kernel-end))
Modified: trunk/cc/lap.lisp
==============================================================================
--- trunk/cc/lap.lisp (original)
+++ trunk/cc/lap.lisp Tue Mar 3 05:23:40 2009
@@ -189,8 +189,11 @@
((listp on)
(ecase (car on)
(+ (ecase (caddr on)
- (r (list (+ (cadr on)
- (reg->int (second
instruction)))))
+ (r (multiple-value-bind (regi rex)
+ (reg->int (second instruction))
+ (when rex (push 'b rex-set))
+ (list (+ (cadr on)
+ regi))))
(cc (list (+ (cadr on) cc-code)))))))
(t
(ecase on
Modified: trunk/cc/test-cc.lisp
==============================================================================
--- trunk/cc/test-cc.lisp (original)
+++ trunk/cc/test-cc.lisp Tue Mar 3 05:23:40 2009
@@ -212,6 +212,9 @@
(stosw)
(bits 64)
+ (bswap ebx)
+ (bswap rax)
+ (bswap r10)
(cmova ax bx)
(cmovc eax edx)
(cmove rdx r10)
@@ -230,14 +233,15 @@
"Miscellaneous instructions.")
(defparameter *misc-code*
- '(232 116 0 248 252 250 244 228 3 229 4 236 237 204 205 16 116 254
- 235 252 15 1 22 119 124 15 1 30 119 124 15 0 210 15 0 22 119 124
- 172 173 226 230 180 9 187 13 0 137 200 137 30 119 124 139 14 123
- 28 199 6 119 124 123 0 142 195 140 200 144 230 3 231 4 238 239 81
+ '(232 124 0 248 252 250 244 228 3 229 4 236 237 204 205 16 116 254
+ 235 252 15 1 22 127 124 15 1 30 127 124 15 0 210 15 0 22 127 124
+ 172 173 226 230 180 9 187 13 0 137 200 137 30 127 124 139 14 123
+ 28 199 6 127 124 123 0 142 195 140 200 144 230 3 231 4 238 239 81
14 22 30 6 90 23 31 7 243 164 243 165 243 102 165 195 249 253 251
- 170 171 102 15 71 195 15 66 194 73 15 68 210 15 130 6 0 0 0 15 5
- 15 7 119 124 72 101 108 108 111 32 87 111 114 108 100 33 32 0 0 0
- 85 170 64 226 1 0 67 104 120 0 0 0 230 130 217 250 11 0))
+ 170 171 15 203 72 15 200 73 15 202 102 15 71 195 15 66 194 73 15
+ 68 210 15 130 6 0 0 0 15 5 15 7 127 124 72 101 108 108 111 32 87
+ 111 114 108 100 33 32 0 0 0 85 170 64 226 1 0 67 104 120 0 0 0 230
+ 130 217 250 11 0))
(defparameter *address-asm*
'((org #x7c00)
Modified: trunk/cc/x86-64-syntax.lisp
==============================================================================
--- trunk/cc/x86-64-syntax.lisp (original)
+++ trunk/cc/x86-64-syntax.lisp Tue Mar 3 05:23:40 2009
@@ -90,6 +90,7 @@
`(,@(arith-syntax-1 'adc nil)
,@(arith-syntax-1 'add nil)
,@(arith-syntax-1 'and nil)
+ ((bswap r32) . (#x0f (+ #xc8 r)))
((clc) . (#xf8))
((cld) . (#xfc))
((cli) . (#xfa))
@@ -190,6 +191,7 @@
`(,@(arith-syntax-1 'adc t)
,@(arith-syntax-1 'add t)
,@(arith-syntax-1 'and t)
+ ((bswap r64) . (#x0f (+ #xc8 r)))
((cmovcc r64 (r/m64 r64 m)) . (#x0f (+ #x40 cc) /r))
,@(arith-syntax-1 'cmp t)
((dec (r/m64 r64)) . (#xff /1))
Added: wiki/AssemblyX64B.wiki
==============================================================================
--- (empty file)
+++ wiki/AssemblyX64B.wiki Tue Mar 3 05:23:40 2009
@@ -0,0 +1,11 @@
+#summary x86-64 Instruction Set B
+#labels Phase-Implementation
+#sidebar SBX64Assembly
+
+<wiki:toc max_depth="1" />
+
+= bswap: Byte Swap =
+
+|| Instruction || Opcode || 64-Bit Mode || 16/32-Bit Mode ||
Description ||
+|| bswap r32 || 0F C8+r || Valid || Valid || Reverse
byte order of r32 ||
+|| bswap r64 || 0F C8+r || Valid || ~~N.E.~~ || Reverse
byte order of r64 ||
Modified: wiki/SBX64Assembly.wiki
==============================================================================
--- wiki/SBX64Assembly.wiki (original)
+++ wiki/SBX64Assembly.wiki Tue Mar 3 05:23:40 2009
@@ -6,6 +6,7 @@
* [AssemblySpecialVariable Special Variables]
* [AssemblyX64Overview Overview of x86-64 Instructions]
* [AssemblyX64A A]
+ * [AssemblyX64B B]
* [AssemblyX64C C]
* [AssemblyX64D D]
* [AssemblyX64H H]