btxldr.S (146011) | btxldr.S (235264) |
---|---|
1/* 2 * Copyright (c) 1998 Robert Nordier 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are freely 6 * permitted provided that the above copyright notice and this 7 * paragraph and the following disclaimer are duplicated in all 8 * such forms. 9 * 10 * This software is provided "AS IS" and without any express or 11 * implied warranties, including, without limitation, the implied 12 * warranties of merchantability and fitness for a particular 13 * purpose. 14 * | 1/* 2 * Copyright (c) 1998 Robert Nordier 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are freely 6 * permitted provided that the above copyright notice and this 7 * paragraph and the following disclaimer are duplicated in all 8 * such forms. 9 * 10 * This software is provided "AS IS" and without any express or 11 * implied warranties, including, without limitation, the implied 12 * warranties of merchantability and fitness for a particular 13 * purpose. 14 * |
15 * $FreeBSD: head/sys/boot/pc98/btx/btxldr/btxldr.S 146011 2005-05-08 14:17:28Z nyan $ | 15 * $FreeBSD: head/sys/boot/pc98/btx/btxldr/btxldr.S 235264 2012-05-11 09:46:17Z avg $ |
16 */ 17 18/* 19 * Prototype BTX loader program, written in a couple of hours. The 20 * real thing should probably be more flexible, and in C. 21 */ 22 | 16 */ 17 18/* 19 * Prototype BTX loader program, written in a couple of hours. The 20 * real thing should probably be more flexible, and in C. 21 */ 22 |
23#include <bootargs.h> 24 |
|
23/* 24 * Memory locations. 25 */ 26 .set MEM_STUB,0x600 # Real mode stub 27 .set MEM_ESP,0x1000 # New stack pointer 28 .set MEM_TBL,0x5000 # BTX page tables 29 .set MEM_ENTRY,0x9010 # BTX entry point 30 .set MEM_DATA,start+0x1000 # Data segment --- 69 unchanged lines hidden (view full) --- 100 * Relocate caller's arguments. 101 */ 102#ifdef BTXLDR_VERBOSE 103 movl $m_esp,%esi # Display 104 movl %esp,%eax # caller 105 call hexout # stack 106 call putstr # pointer 107 movl $m_args,%esi # Format string | 25/* 26 * Memory locations. 27 */ 28 .set MEM_STUB,0x600 # Real mode stub 29 .set MEM_ESP,0x1000 # New stack pointer 30 .set MEM_TBL,0x5000 # BTX page tables 31 .set MEM_ENTRY,0x9010 # BTX entry point 32 .set MEM_DATA,start+0x1000 # Data segment --- 69 unchanged lines hidden (view full) --- 102 * Relocate caller's arguments. 103 */ 104#ifdef BTXLDR_VERBOSE 105 movl $m_esp,%esi # Display 106 movl %esp,%eax # caller 107 call hexout # stack 108 call putstr # pointer 109 movl $m_args,%esi # Format string |
108 leal 0x4(%esp,1),%ebx # First argument | 110 leal 0x4(%esp),%ebx # First argument |
109 movl $0x6,%ecx # Count 110start.1: movl (%ebx),%eax # Get argument and 111 addl $0x4,%ebx # bump pointer 112 call hexout # Display it 113 loop start.1 # Till done 114 call putstr # End message 115#endif | 111 movl $0x6,%ecx # Count 112start.1: movl (%ebx),%eax # Get argument and 113 addl $0x4,%ebx # bump pointer 114 call hexout # Display it 115 loop start.1 # Till done 116 call putstr # End message 117#endif |
116 movl $0x48,%ecx # Allocate space 117 subl %ecx,%ebp # for bootinfo 118 movl 0x18(%esp,1),%esi # Source: bootinfo | 118 movl BA_BOOTINFO+4(%esp),%esi # Source: bootinfo |
119 cmpl $0x0, %esi # If the bootinfo pointer 120 je start_null_bi # is null, don't copy it | 119 cmpl $0x0, %esi # If the bootinfo pointer 120 je start_null_bi # is null, don't copy it |
121 movl BI_SIZE(%esi),%ecx # Allocate space 122 subl %ecx,%ebp # for bootinfo |
|
121 movl %ebp,%edi # Destination 122 rep # Copy 123 movsb # it | 123 movl %ebp,%edi # Destination 124 rep # Copy 125 movsb # it |
124 movl %ebp,0x18(%esp,1) # Update pointer | 126 movl %ebp,BA_BOOTINFO+4(%esp) # Update pointer 127 movl %edi,%ebp # Restore base pointer |
125#ifdef BTXLDR_VERBOSE 126 movl $m_rel_bi,%esi # Display 127 movl %ebp,%eax # bootinfo 128 call hexout # relocation 129 call putstr # message 130#endif | 128#ifdef BTXLDR_VERBOSE 129 movl $m_rel_bi,%esi # Display 130 movl %ebp,%eax # bootinfo 131 call hexout # relocation 132 call putstr # message 133#endif |
131start_null_bi: movl $0x18,%ecx # Allocate space 132 subl %ecx,%ebp # for arguments 133 leal 0x4(%esp,1),%esi # Source | 134start_null_bi: movl $BOOTARGS_SIZE,%ecx # Fixed size of arguments 135 testl $KARGS_FLAGS_EXTARG, BA_BOOTFLAGS+4(%esp) # Check for extra data 136 jz start_fixed # Skip if the flag is not set 137 addl BOOTARGS_SIZE+4(%esp),%ecx # Add size of variable args 138start_fixed: subl $ARGOFF,%ebp # Place args at fixed offset 139 leal 0x4(%esp),%esi # Source |
134 movl %ebp,%edi # Destination 135 rep # Copy 136 movsb # them 137#ifdef BTXLDR_VERBOSE 138 movl $m_rel_args,%esi # Display 139 movl %ebp,%eax # argument 140 call hexout # relocation 141 call putstr # message --- 283 unchanged lines hidden --- | 140 movl %ebp,%edi # Destination 141 rep # Copy 142 movsb # them 143#ifdef BTXLDR_VERBOSE 144 movl $m_rel_args,%esi # Display 145 movl %ebp,%eax # argument 146 call hexout # relocation 147 call putstr # message --- 283 unchanged lines hidden --- |