version: Update to 4.08, update year to 2014
[syslinux/sherbszt.git] / core / bcopy32.inc
blobab601452be9eee5e69927a6613a7f73dcdd4314a
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.
12 ;; -----------------------------------------------------------------------
15 ;; bcopy32.inc
17 ;; 32-bit bcopy routine for real mode
21 ; 32-bit bcopy routine for real mode
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.
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."
31                 bits 16
32                 section .text16
35 ; bcopy:
36 ;       32-bit copy, overlap safe
38 ; Inputs:
39 ;       ESI     - source pointer (-1 means do bzero rather than bcopy)
40 ;       EDI     - target pointer
41 ;       ECX     - byte count
43 ; Outputs:
44 ;       ESI     - first byte after source (garbage if ESI == -1 on entry)
45 ;       EDI     - first byte after target
47 bcopy:          jecxz .ret
48                 pm_call pm_bcopy
49                 add edi,ecx
50                 add esi,ecx
51 .ret:           ret
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)
62 ;     If src == -1: then the memory pointed to by (dst, len) is bzeroed;
63 ;                   this is handled inside the bcopy routine.
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)
68 ;     (*) dst, src, and len are four bytes each
70 shuffle_and_boot_raw:
71                 mov bx,pm_shuffle
72                 jmp enter_pm
75 ; The 32-bit copy and shuffle code is "special", so it is in its own file
77 %include "bcopyxx.inc"