You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

librm.S 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. /*
  2. * librm: a library for interfacing to real-mode code
  3. *
  4. * Michael Brown <mbrown@fensystems.co.uk>
  5. *
  6. */
  7. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
  8. /* Drag in local definitions */
  9. #include "librm.h"
  10. /* For switches to/from protected mode */
  11. #define CR0_PE 1
  12. /* Size of various C data structures */
  13. #define SIZEOF_I386_SEG_REGS 12
  14. #define SIZEOF_I386_REGS 32
  15. #define SIZEOF_REAL_MODE_REGS ( SIZEOF_I386_SEG_REGS + SIZEOF_I386_REGS )
  16. #define SIZEOF_I386_FLAGS 4
  17. #define SIZEOF_I386_ALL_REGS ( SIZEOF_REAL_MODE_REGS + SIZEOF_I386_FLAGS )
  18. .arch i386
  19. /****************************************************************************
  20. * Global descriptor table
  21. *
  22. * Call init_librm to set up the GDT before attempting to use any
  23. * protected-mode code.
  24. *
  25. * NOTE: This must be located before prot_to_real, otherwise gas
  26. * throws a "can't handle non absolute segment in `ljmp'" error due to
  27. * not knowing the value of REAL_CS when the ljmp is encountered.
  28. *
  29. * Note also that putting ".word gdt_end - gdt - 1" directly into
  30. * gdt_limit, rather than going via gdt_length, will also produce the
  31. * "non absolute segment" error. This is most probably a bug in gas.
  32. ****************************************************************************
  33. */
  34. .section ".data16", "aw", @progbits
  35. .align 16
  36. gdt:
  37. gdtr: /* The first GDT entry is unused, the GDTR can fit here. */
  38. gdt_limit: .word gdt_length - 1
  39. gdt_base: .long 0
  40. .word 0 /* padding */
  41. .org gdt + VIRTUAL_CS, 0
  42. virtual_cs: /* 32 bit protected mode code segment, virtual addresses */
  43. .word 0xffff, 0
  44. .byte 0, 0x9f, 0xcf, 0
  45. .org gdt + VIRTUAL_DS, 0
  46. virtual_ds: /* 32 bit protected mode data segment, virtual addresses */
  47. .word 0xffff, 0
  48. .byte 0, 0x93, 0xcf, 0
  49. .org gdt + PHYSICAL_CS, 0
  50. physical_cs: /* 32 bit protected mode code segment, physical addresses */
  51. .word 0xffff, 0
  52. .byte 0, 0x9f, 0xcf, 0
  53. .org gdt + PHYSICAL_DS, 0
  54. physical_ds: /* 32 bit protected mode data segment, physical addresses */
  55. .word 0xffff, 0
  56. .byte 0, 0x93, 0xcf, 0
  57. .org gdt + REAL_CS, 0
  58. real_cs: /* 16 bit real mode code segment */
  59. .word 0xffff, 0
  60. .byte 0, 0x9b, 0x00, 0
  61. .org gdt + REAL_DS
  62. real_ds: /* 16 bit real mode data segment */
  63. .word 0xffff, ( REAL_DS << 4 )
  64. .byte 0, 0x93, 0x00, 0
  65. gdt_end:
  66. .equ gdt_length, gdt_end - gdt
  67. /****************************************************************************
  68. * init_librm (real-mode far call, 16-bit real-mode far return address)
  69. *
  70. * Initialise the GDT ready for transitions to protected mode.
  71. *
  72. * Parameters:
  73. * %cs : .text16 segment
  74. * %ds : .data16 segment
  75. * %edi : Physical base of protected-mode code (virt_offset)
  76. ****************************************************************************
  77. */
  78. .section ".text16", "ax", @progbits
  79. .code16
  80. .globl init_librm
  81. init_librm:
  82. /* Preserve registers */
  83. pushl %eax
  84. pushl %ebx
  85. /* Store virt_offset and set up virtual_cs and virtual_ds segments */
  86. movl %edi, %eax
  87. movw $virtual_cs, %bx
  88. call set_seg_base
  89. movw $virtual_ds, %bx
  90. call set_seg_base
  91. movl %edi, rm_virt_offset
  92. /* Negate virt_offset */
  93. negl %edi
  94. /* Store rm_cs and text16, set up real_cs segment */
  95. xorl %eax, %eax
  96. movw %cs, %ax
  97. movw %ax, %cs:rm_cs
  98. shll $4, %eax
  99. movw $real_cs, %bx
  100. call set_seg_base
  101. addr32 leal (%eax, %edi), %ebx
  102. movl %ebx, rm_text16
  103. /* Store rm_ds and data16 */
  104. xorl %eax, %eax
  105. movw %ds, %ax
  106. movw %ax, %cs:rm_ds
  107. shll $4, %eax
  108. addr32 leal (%eax, %edi), %ebx
  109. movl %ebx, rm_data16
  110. /* Set GDT base */
  111. movl %eax, gdt_base
  112. addl $gdt, gdt_base
  113. /* Initialise IDT */
  114. pushl $init_idt
  115. pushw %cs
  116. call prot_call
  117. popl %eax /* discard */
  118. /* Restore registers */
  119. negl %edi
  120. popl %ebx
  121. popl %eax
  122. lret
  123. .section ".text16", "ax", @progbits
  124. .code16
  125. set_seg_base:
  126. 1: movw %ax, 2(%bx)
  127. rorl $16, %eax
  128. movb %al, 4(%bx)
  129. movb %ah, 7(%bx)
  130. roll $16, %eax
  131. ret
  132. /****************************************************************************
  133. * real_to_prot (real-mode near call, 32-bit virtual return address)
  134. *
  135. * Switch from 16-bit real-mode to 32-bit protected mode with virtual
  136. * addresses. The real-mode %ss:sp is stored in rm_ss and rm_sp, and
  137. * the protected-mode %esp is restored from the saved pm_esp.
  138. * Interrupts are disabled. All other registers may be destroyed.
  139. *
  140. * The return address for this function should be a 32-bit virtual
  141. * address.
  142. *
  143. * Parameters:
  144. * %ecx : number of bytes to move from RM stack to PM stack
  145. *
  146. ****************************************************************************
  147. */
  148. .section ".text16", "ax", @progbits
  149. .code16
  150. real_to_prot:
  151. /* Enable A20 line */
  152. call enable_a20
  153. /* A failure at this point is fatal, and there's nothing we
  154. * can do about it other than lock the machine to make the
  155. * problem immediately visible.
  156. */
  157. 1: jc 1b
  158. /* Make sure we have our data segment available */
  159. movw %cs:rm_ds, %ax
  160. movw %ax, %ds
  161. /* Add virt_offset, text16 and data16 to stack to be
  162. * copied, and also copy the return address.
  163. */
  164. pushl rm_virt_offset
  165. pushl rm_text16
  166. pushl rm_data16
  167. addw $16, %cx /* %ecx must be less than 64kB anyway */
  168. /* Real-mode %ss:%sp => %ebp:%edx and virtual address => %esi */
  169. xorl %ebp, %ebp
  170. movw %ss, %bp
  171. movzwl %sp, %edx
  172. movl %ebp, %eax
  173. shll $4, %eax
  174. addr32 leal (%eax,%edx), %esi
  175. subl rm_virt_offset, %esi
  176. /* Load protected-mode global descriptor table */
  177. data32 lgdt gdtr
  178. /* Zero segment registers. This wastes around 12 cycles on
  179. * real hardware, but saves a substantial number of emulated
  180. * instructions under KVM.
  181. */
  182. xorw %ax, %ax
  183. movw %ax, %ds
  184. movw %ax, %es
  185. movw %ax, %fs
  186. movw %ax, %gs
  187. movw %ax, %ss
  188. /* Switch to protected mode */
  189. cli
  190. movl %cr0, %eax
  191. orb $CR0_PE, %al
  192. movl %eax, %cr0
  193. data32 ljmp $VIRTUAL_CS, $r2p_pmode
  194. .section ".text", "ax", @progbits
  195. .code32
  196. r2p_pmode:
  197. /* Set up protected-mode data segments and stack pointer */
  198. movw $VIRTUAL_DS, %ax
  199. movw %ax, %ds
  200. movw %ax, %es
  201. movw %ax, %fs
  202. movw %ax, %gs
  203. movw %ax, %ss
  204. movl pm_esp, %esp
  205. /* Load protected-mode interrupt descriptor table */
  206. lidt idtr
  207. /* Record real-mode %ss:sp (after removal of data) */
  208. movw %bp, rm_ss
  209. addl %ecx, %edx
  210. movw %dx, rm_sp
  211. /* Move data from RM stack to PM stack */
  212. subl %ecx, %esp
  213. movl %esp, %edi
  214. rep movsb
  215. /* Publish virt_offset, text16 and data16 for PM code to use */
  216. popl data16
  217. popl text16
  218. popl virt_offset
  219. /* Return to virtual address */
  220. ret
  221. /****************************************************************************
  222. * prot_to_real (protected-mode near call, 32-bit real-mode return address)
  223. *
  224. * Switch from 32-bit protected mode with virtual addresses to 16-bit
  225. * real mode. The protected-mode %esp is stored in pm_esp and the
  226. * real-mode %ss:sp is restored from the saved rm_ss and rm_sp. The
  227. * high word of the real-mode %esp is set to zero. All real-mode data
  228. * segment registers are loaded from the saved rm_ds. Interrupts are
  229. * *not* enabled, since we want to be able to use prot_to_real in an
  230. * ISR. All other registers may be destroyed.
  231. *
  232. * The return address for this function should be a 32-bit (sic)
  233. * real-mode offset within .code16.
  234. *
  235. * Parameters:
  236. * %ecx : number of bytes to move from PM stack to RM stack
  237. * %esi : real-mode global and interrupt descriptor table registers
  238. *
  239. ****************************************************************************
  240. */
  241. .section ".text", "ax", @progbits
  242. .code32
  243. prot_to_real:
  244. /* Copy real-mode global descriptor table register to RM code segment */
  245. movl text16, %edi
  246. leal rm_gdtr(%edi), %edi
  247. movsw
  248. movsl
  249. /* Load real-mode interrupt descriptor table register */
  250. lidt (%esi)
  251. /* Add return address to data to be moved to RM stack */
  252. addl $4, %ecx
  253. /* Real-mode %ss:sp => %ebp:edx and virtual address => %edi */
  254. movzwl rm_ss, %ebp
  255. movzwl rm_sp, %edx
  256. subl %ecx, %edx
  257. movl %ebp, %eax
  258. shll $4, %eax
  259. leal (%eax,%edx), %edi
  260. subl virt_offset, %edi
  261. /* Move data from PM stack to RM stack */
  262. movl %esp, %esi
  263. rep movsb
  264. /* Record protected-mode %esp (after removal of data) */
  265. movl %esi, pm_esp
  266. /* Load real-mode segment limits */
  267. movw $REAL_DS, %ax
  268. movw %ax, %ds
  269. movw %ax, %es
  270. movw %ax, %fs
  271. movw %ax, %gs
  272. movw %ax, %ss
  273. ljmp $REAL_CS, $p2r_rmode
  274. .section ".text16", "ax", @progbits
  275. .code16
  276. p2r_rmode:
  277. /* Load real-mode GDT */
  278. data32 lgdt %cs:rm_gdtr
  279. /* Switch to real mode */
  280. movl %cr0, %eax
  281. andb $0!CR0_PE, %al
  282. movl %eax, %cr0
  283. p2r_ljmp_rm_cs:
  284. ljmp $0, $1f
  285. 1:
  286. /* Set up real-mode data segments and stack pointer */
  287. movw %cs:rm_ds, %ax
  288. movw %ax, %ds
  289. movw %ax, %es
  290. movw %ax, %fs
  291. movw %ax, %gs
  292. movw %bp, %ss
  293. movl %edx, %esp
  294. /* Return to real-mode address */
  295. data32 ret
  296. /* Real-mode code and data segments. Assigned by the call to
  297. * init_librm. rm_cs doubles as the segment part of the jump
  298. * instruction used by prot_to_real. Both are located in
  299. * .text16 rather than .data16: rm_cs since it forms part of
  300. * the jump instruction within the code segment, and rm_ds
  301. * since real-mode code needs to be able to locate the data
  302. * segment with no other reference available.
  303. */
  304. .globl rm_cs
  305. .equ rm_cs, ( p2r_ljmp_rm_cs + 3 )
  306. .section ".text16.data", "aw", @progbits
  307. .globl rm_ds
  308. rm_ds: .word 0
  309. /* Real-mode global and interrupt descriptor table registers */
  310. .section ".text16.data", "aw", @progbits
  311. rm_gdtr:
  312. .word 0 /* Limit */
  313. .long 0 /* Base */
  314. /****************************************************************************
  315. * prot_call (real-mode far call, 16-bit real-mode far return address)
  316. *
  317. * Call a specific C function in the protected-mode code. The
  318. * prototype of the C function must be
  319. * void function ( struct i386_all_regs *ix86 );
  320. * ix86 will point to a struct containing the real-mode registers
  321. * at entry to prot_call.
  322. *
  323. * All registers will be preserved across prot_call(), unless the C
  324. * function explicitly overwrites values in ix86. Interrupt status
  325. * and GDT will also be preserved. Gate A20 will be enabled.
  326. *
  327. * Note that prot_call() does not rely on the real-mode stack
  328. * remaining intact in order to return, since everything relevant is
  329. * copied to the protected-mode stack for the duration of the call.
  330. * In particular, this means that a real-mode prefix can make a call
  331. * to main() which will return correctly even if the prefix's stack
  332. * gets vapourised during the Etherboot run. (The prefix cannot rely
  333. * on anything else on the stack being preserved, so should move any
  334. * critical data to registers before calling main()).
  335. *
  336. * Parameters:
  337. * function : virtual address of protected-mode function to call
  338. *
  339. * Example usage:
  340. * pushl $pxe_api_call
  341. * call prot_call
  342. * addw $4, %sp
  343. * to call in to the C function
  344. * void pxe_api_call ( struct i386_all_regs *ix86 );
  345. ****************************************************************************
  346. */
  347. #define PC_OFFSET_GDT ( 0 )
  348. #define PC_OFFSET_IDT ( PC_OFFSET_GDT + 6 )
  349. #define PC_OFFSET_IX86 ( PC_OFFSET_IDT + 6 )
  350. #define PC_OFFSET_RETADDR ( PC_OFFSET_IX86 + SIZEOF_I386_ALL_REGS )
  351. #define PC_OFFSET_FUNCTION ( PC_OFFSET_RETADDR + 4 )
  352. #define PC_OFFSET_END ( PC_OFFSET_FUNCTION + 4 )
  353. .section ".text16", "ax", @progbits
  354. .code16
  355. .globl prot_call
  356. prot_call:
  357. /* Preserve registers, flags and GDT on external RM stack */
  358. pushfl
  359. pushal
  360. pushw %gs
  361. pushw %fs
  362. pushw %es
  363. pushw %ds
  364. pushw %ss
  365. pushw %cs
  366. subw $PC_OFFSET_IX86, %sp
  367. movw %sp, %bp
  368. sidt PC_OFFSET_IDT(%bp)
  369. sgdt PC_OFFSET_GDT(%bp)
  370. /* For sanity's sake, clear the direction flag as soon as possible */
  371. cld
  372. /* Switch to protected mode and move register dump to PM stack */
  373. movl $PC_OFFSET_END, %ecx
  374. pushl $pc_pmode
  375. jmp real_to_prot
  376. .section ".text", "ax", @progbits
  377. .code32
  378. pc_pmode:
  379. /* Call function */
  380. leal PC_OFFSET_IX86(%esp), %eax
  381. pushl %eax
  382. call *(PC_OFFSET_FUNCTION+4)(%esp)
  383. popl %eax /* discard */
  384. /* Switch to real mode and move register dump back to RM stack */
  385. movl $PC_OFFSET_END, %ecx
  386. movl %esp, %esi
  387. pushl $pc_rmode
  388. jmp prot_to_real
  389. .section ".text16", "ax", @progbits
  390. .code16
  391. pc_rmode:
  392. /* Restore registers and flags and return */
  393. addw $( PC_OFFSET_IX86 + 4 /* also skip %cs and %ss */ ), %sp
  394. popw %ds
  395. popw %es
  396. popw %fs
  397. popw %gs
  398. popal
  399. /* popal skips %esp. We therefore want to do "movl -20(%sp),
  400. * %esp", but -20(%sp) is not a valid 80386 expression.
  401. * Fortunately, prot_to_real() zeroes the high word of %esp, so
  402. * we can just use -20(%esp) instead.
  403. */
  404. addr32 movl -20(%esp), %esp
  405. popfl
  406. lret
  407. /****************************************************************************
  408. * real_call (protected-mode near call, 32-bit virtual return address)
  409. *
  410. * Call a real-mode function from protected-mode code.
  411. *
  412. * The non-segment register values will be passed directly to the
  413. * real-mode code. The segment registers will be set as per
  414. * prot_to_real. The non-segment register values set by the real-mode
  415. * function will be passed back to the protected-mode caller. A
  416. * result of this is that this routine cannot be called directly from
  417. * C code, since it clobbers registers that the C ABI expects the
  418. * callee to preserve.
  419. *
  420. * librm.h defines a convenient macro REAL_CODE() for using real_call.
  421. * See librm.h and realmode.h for details and examples.
  422. *
  423. * Parameters:
  424. * (32-bit) near pointer to real-mode function to call
  425. *
  426. * Returns: none
  427. ****************************************************************************
  428. */
  429. #define RC_OFFSET_PRESERVE_REGS ( 0 )
  430. #define RC_OFFSET_RETADDR ( RC_OFFSET_PRESERVE_REGS + SIZEOF_I386_REGS )
  431. #define RC_OFFSET_FUNCTION ( RC_OFFSET_RETADDR + 4 )
  432. #define RC_OFFSET_END ( RC_OFFSET_FUNCTION + 4 )
  433. .section ".text", "ax", @progbits
  434. .code32
  435. .globl real_call
  436. real_call:
  437. /* Create register dump and function pointer copy on PM stack */
  438. pushal
  439. pushl RC_OFFSET_FUNCTION(%esp)
  440. /* Switch to real mode and move register dump to RM stack */
  441. movl $( RC_OFFSET_RETADDR + 4 /* function pointer copy */ ), %ecx
  442. pushl $rc_rmode
  443. movl $rm_default_gdtr_idtr, %esi
  444. jmp prot_to_real
  445. .section ".text16", "ax", @progbits
  446. .code16
  447. rc_rmode:
  448. /* Call real-mode function */
  449. popl rc_function
  450. popal
  451. call *rc_function
  452. pushal
  453. /* For sanity's sake, clear the direction flag as soon as possible */
  454. cld
  455. /* Switch to protected mode and move register dump back to PM stack */
  456. movl $RC_OFFSET_RETADDR, %ecx
  457. pushl $rc_pmode
  458. jmp real_to_prot
  459. .section ".text", "ax", @progbits
  460. .code32
  461. rc_pmode:
  462. /* Restore registers and return */
  463. popal
  464. ret
  465. /* Function vector, used because "call xx(%sp)" is not a valid
  466. * 16-bit expression.
  467. */
  468. .section ".data16", "aw", @progbits
  469. rc_function: .word 0, 0
  470. /* Default real-mode global and interrupt descriptor table registers */
  471. .section ".data", "aw", @progbits
  472. rm_default_gdtr_idtr:
  473. .word 0 /* Global descriptor table limit */
  474. .long 0 /* Global descriptor table base */
  475. .word 0x03ff /* Interrupt descriptor table limit */
  476. .long 0 /* Interrupt descriptor table base */
  477. /****************************************************************************
  478. * flatten_real_mode (real-mode near call)
  479. *
  480. * Switch to flat real mode
  481. *
  482. ****************************************************************************
  483. */
  484. .section ".text16", "ax", @progbits
  485. .code16
  486. .globl flatten_real_mode
  487. flatten_real_mode:
  488. /* Modify GDT to use flat real mode */
  489. movb $0x8f, real_cs + 6
  490. movb $0x8f, real_ds + 6
  491. /* Call dummy protected-mode function */
  492. pushl $flatten_dummy
  493. pushw %cs
  494. call prot_call
  495. addw $4, %sp
  496. /* Restore GDT */
  497. movb $0x00, real_cs + 6
  498. movb $0x00, real_ds + 6
  499. /* Return */
  500. ret
  501. .section ".text", "ax", @progbits
  502. .code32
  503. flatten_dummy:
  504. ret
  505. /****************************************************************************
  506. * Interrupt wrapper
  507. *
  508. * Used by the protected-mode interrupt vectors to call the
  509. * interrupt() function.
  510. *
  511. * May be entered with either physical or virtual stack segment.
  512. ****************************************************************************
  513. */
  514. .globl interrupt_wrapper
  515. interrupt_wrapper:
  516. /* Preserve segment registers and original %esp */
  517. pushl %ds
  518. pushl %es
  519. pushl %fs
  520. pushl %gs
  521. pushl %ss
  522. pushl %esp
  523. /* Switch to virtual addressing */
  524. call _intr_to_virt
  525. /* Expand IRQ number to whole %eax register */
  526. movzbl %al, %eax
  527. /* Call interrupt handler */
  528. call interrupt
  529. /* Restore original stack and segment registers */
  530. lss (%esp), %esp
  531. popl %ss
  532. popl %gs
  533. popl %fs
  534. popl %es
  535. popl %ds
  536. /* Restore registers and return */
  537. popal
  538. iret
  539. /****************************************************************************
  540. * Stored real-mode and protected-mode stack pointers
  541. *
  542. * The real-mode stack pointer is stored here whenever real_to_prot
  543. * is called and restored whenever prot_to_real is called. The
  544. * converse happens for the protected-mode stack pointer.
  545. *
  546. * Despite initial appearances this scheme is, in fact re-entrant,
  547. * because program flow dictates that we always return via the point
  548. * we left by. For example:
  549. * PXE API call entry
  550. * 1 real => prot
  551. * ...
  552. * Print a text string
  553. * ...
  554. * 2 prot => real
  555. * INT 10
  556. * 3 real => prot
  557. * ...
  558. * ...
  559. * 4 prot => real
  560. * PXE API call exit
  561. *
  562. * At point 1, the RM mode stack value, say RPXE, is stored in
  563. * rm_ss,sp. We want this value to still be present in rm_ss,sp when
  564. * we reach point 4.
  565. *
  566. * At point 2, the RM stack value is restored from RPXE. At point 3,
  567. * the RM stack value is again stored in rm_ss,sp. This *does*
  568. * overwrite the RPXE that we have stored there, but it's the same
  569. * value, since the code between points 2 and 3 has managed to return
  570. * to us.
  571. ****************************************************************************
  572. */
  573. .section ".data", "aw", @progbits
  574. .globl rm_sp
  575. rm_sp: .word 0
  576. .globl rm_ss
  577. rm_ss: .word 0
  578. pm_esp: .long _estack
  579. /****************************************************************************
  580. * Virtual address offsets
  581. *
  582. * These are used by the protected-mode code to map between virtual
  583. * and physical addresses, and to access variables in the .text16 or
  584. * .data16 segments.
  585. ****************************************************************************
  586. */
  587. /* Internal copies, created by init_librm (which runs in real mode) */
  588. .section ".data16", "aw", @progbits
  589. rm_virt_offset: .long 0
  590. rm_text16: .long 0
  591. rm_data16: .long 0
  592. /* Externally-visible copies, created by real_to_prot */
  593. .section ".data", "aw", @progbits
  594. .globl virt_offset
  595. virt_offset: .long 0
  596. .globl text16
  597. text16: .long 0
  598. .globl data16
  599. data16: .long 0