[e16e8f2] | 1 | ;; ----------------------------------------------------------------------- |
---|
| 2 | ;; |
---|
| 3 | ;; Copyright 1994-2009 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 | ;; bcopy32.inc |
---|
| 16 | ;; |
---|
| 17 | ;; 32-bit bcopy routine for real mode |
---|
| 18 | ;; |
---|
| 19 | |
---|
| 20 | ; |
---|
| 21 | ; 32-bit bcopy routine for real mode |
---|
| 22 | ; |
---|
| 23 | ; We enter protected mode, set up a flat 32-bit environment, run rep movsd |
---|
| 24 | ; and then exit. IMPORTANT: This code assumes cs == 0. |
---|
| 25 | ; |
---|
| 26 | ; This code is probably excessively anal-retentive in its handling of |
---|
| 27 | ; segments, but this stuff is painful enough as it is without having to rely |
---|
| 28 | ; on everything happening "as it ought to." |
---|
| 29 | ; |
---|
| 30 | |
---|
| 31 | bits 16 |
---|
| 32 | section .text16 |
---|
| 33 | |
---|
| 34 | ; |
---|
| 35 | ; bcopy: |
---|
| 36 | ; 32-bit copy, overlap safe |
---|
| 37 | ; |
---|
| 38 | ; Inputs: |
---|
| 39 | ; ESI - source pointer (-1 means do bzero rather than bcopy) |
---|
| 40 | ; EDI - target pointer |
---|
| 41 | ; ECX - byte count |
---|
| 42 | ; |
---|
| 43 | ; Outputs: |
---|
| 44 | ; ESI - first byte after source (garbage if ESI == -1 on entry) |
---|
| 45 | ; EDI - first byte after target |
---|
| 46 | ; |
---|
| 47 | bcopy: jecxz .ret |
---|
| 48 | pm_call pm_bcopy |
---|
| 49 | add edi,ecx |
---|
| 50 | add esi,ecx |
---|
| 51 | .ret: ret |
---|
| 52 | |
---|
| 53 | ; |
---|
| 54 | ; shuffle_and_boot_raw: |
---|
| 55 | ; The new version of shuffle and boot. |
---|
| 56 | ; Inputs: |
---|
| 57 | ; ESI -> Pointer to list of (dst, src, len) pairs(*) |
---|
| 58 | ; EDI -> Pointer to safe area for list + shuffler |
---|
| 59 | ; (must not overlap this code nor the RM stack) |
---|
| 60 | ; ECX -> Byte count of list area (for initial copy) |
---|
| 61 | ; |
---|
| 62 | ; If src == -1: then the memory pointed to by (dst, len) is bzeroed; |
---|
| 63 | ; this is handled inside the bcopy routine. |
---|
| 64 | ; |
---|
| 65 | ; If len == 0: this marks the end of the list; dst indicates |
---|
| 66 | ; the entry point and src the mode (0 = pm, 1 = rm) |
---|
| 67 | ; |
---|
| 68 | ; (*) dst, src, and len are four bytes each |
---|
| 69 | ; |
---|
| 70 | shuffle_and_boot_raw: |
---|
| 71 | mov bx,pm_shuffle |
---|
| 72 | jmp enter_pm |
---|
| 73 | |
---|
| 74 | ; |
---|
| 75 | ; The 32-bit copy and shuffle code is "special", so it is in its own file |
---|
| 76 | ; |
---|
| 77 | %include "bcopyxx.inc" |
---|