2015-10-17 00:03:05 +02:00
|
|
|
/*
|
|
|
|
|
# CS segment register
|
|
|
|
|
|
|
|
|
|
# ljmp
|
|
|
|
|
|
|
|
|
|
Expected outcome: "0102" get printed. Those are the 2 that CS takes in this example.
|
|
|
|
|
|
|
|
|
|
Explanation: http://stackoverflow.com/a/33177253/895245
|
|
|
|
|
|
|
|
|
|
TODO is ljmp encodable except with a constant:
|
|
|
|
|
|
|
|
|
|
- http://stackoverflow.com/questions/1685654/ljmp-syntax-in-gcc-inline-assembly
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
BEGIN
|
|
|
|
|
CLEAR
|
|
|
|
|
|
|
|
|
|
ljmp $1, $1f
|
|
|
|
|
1:
|
|
|
|
|
.skip 0x10
|
|
|
|
|
mov %cs, %ax
|
2015-10-20 21:04:49 +02:00
|
|
|
PRINT_HEX <%al>
|
2015-10-17 00:03:05 +02:00
|
|
|
|
|
|
|
|
ljmp $2, $1f
|
|
|
|
|
1:
|
|
|
|
|
.skip 0x20
|
|
|
|
|
mov %cs, %ax
|
2015-10-20 21:04:49 +02:00
|
|
|
PRINT_HEX <%al>
|
2015-10-17 00:03:05 +02:00
|
|
|
|
|
|
|
|
hlt
|