-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all
During the weekend train trips I managed to get serialICE 1.2 working with the XMM stack (in qemu). There were some gotchas: #1 missing SSE enable #2 missing stack setup ;) (taken from RemoteBIOS) #3 wrong LD script, the rodata section relocation did not work #4 the stack realign feature #5 missing -O2 ;) I'm attaching the modified files right now. Not so big deal hopefully. Please can someone fix the ld script in proper way? I borrowed this change from the RemoteBIOS. Btw now it has just 17KB and not nearly 60KB or so with romcc ;) With that we have 128B of stack. Thanks, Rudolf -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkrI+kAACgkQ3J9wPJqZRNWIXgCePkjokc44LHgoHqRfSCCM4Ero et0AnRb8V+x3DjTwHHW0al86ceJax7Gd =WY2S -----END PGP SIGNATURE-----
##
## SerialICE
##
## Copyright (C) 2009 coresystems GmbH
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; version 2 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
VERSION="1.2"
HOSTCC=gcc
HOSTCFLAGS= -O2 -Wall
PCREFLAGS=-I/opt/local/include -L/opt/local/lib -lpcre
CROSS=
AS=$(CROSS)as
CC=$(CROSS)gcc
OBJCOPY=$(CROSS)objcopy
NM=$(CROSS)nm
LDFLAGS=-Wa,--divide -nostdlib -nostartfiles -static -T serialice.ld
SOURCES = serialice.c chipset.c config.h serial.c types.h mainboard/*.c
all: serialice.rom
serialice.rom: serialice.elf
$(OBJCOPY) -O binary $< $@
serialice.elf: serialice.o start.o serialice.ld
$(CC) $(LDFLAGS) -o $@ serialice.o start.o
$(NM) $@ | sort -u > serialice.map
serialice.S: $(SOURCES) ./romcc
./romcc -mcpu=i386 -I. -Imainboard -DVERSION=\"$(VERSION)\" -o $@ $<
romcc: util/romcc.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $^
# #####################################################################
serialice-gcc.rom: serialice-gcc.elf
$(OBJCOPY) -O binary $< $@
serialice-gcc.elf: serialice-gcc.o start.o serialice.ld
$(CC) $(LDFLAGS) -o $@ serialice-gcc.o start.o
$(NM) $@ | sort -u > serialice-gcc.map
serialice-pre.s: $(SOURCES) ./xmmstack
$(CC) -O2 -march=i486 -mno-stackrealign -mpreferred-stack-boundary=2
-I. -Imainboard -fomit-frame-pointer -fno-stack-protector
-DVERSION=\"$(VERSION)\" -S $< -o serialice-pre.s
serialice-gcc.S: serialice-pre.s
./xmmstack -xmm serialice-pre.s
mv serialice-pre.sn.s serialice-gcc.S
# cp serialice-pre.s serialice-gcc.S
xmmstack: util/xmmstack.c
$(HOSTCC) $(HOSTCFLAGS) $(PCREFLAGS) -o $@ $^
# #####################################################################
clean:
rm -f romcc serialice.S *.o *.o.s
rm -f serialice.elf serialice.rom serialice.map
rm -f serialice-gcc.S serialice-pre.s xmmstack serialice-gcc.map
dongle: serialice.rom
dongle.py -v -c /dev/cu.usbserial-00* serialice.rom 4032K
%.o: %.S
$(CPP) -DVERSION=\"$(VERSION)\" -o [email protected] $^
$(AS) -o $@ [email protected]
/*
* SerialICE
*
* Copyright (C) 2009 coresystems GmbH
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
_ROMSIZE = (1024 * 64);
_ROMBASE = 0x100000000 - (_ROMSIZE);
SECTIONS {
. = _ROMBASE;
.rombase : {
*(.rodata.*);
*(.rodata);
*(.rom.text);
*(.rom.data);
*(.text);
*(.data);
*(.bss);
}
/*
.text . : {
. = ALIGN(16);
_main = . ;
*(.rom.text)
*(.text)
. = ALIGN(16);
}
.data . : {
. = ALIGN(16);
*(.rom.data)
*(.data)
*(.rodata)
. = ALIGN(16);
}
*/
. = 0xffffff80;
.messages . : {
*(.messages)
. = 111;
BYTE(0x00);
}
. = 0xfffffff0;
.reset . : {
*(.reset)
. = 15;
BYTE(0x00);
}
}
/*
* SerialICE
*
* Copyright (C) 2009 coresystems GmbH
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
.code32
_c_main:
/* Enable FPU registers */
movl %eax, %ebp
movl %cr0, %eax
andl $~(1 << 2), %eax
movl %eax, %cr0
movl %ebp, %eax
/* enable SSE */
movl %cr4, %eax
orl $(3<<9), %eax
movl %eax, %cr4
xorl %esp,%esp
movl $0x7f,%esp #Start address of XMM/MMX stack.
movl %esp,%dr2 #DR2 contains stack(low byte) and offset(hi byte)
jmp main
_pmode_start:
/* Set up protected mode registers */
lgdt %cs:gdt
ljmp $0x08, $1f
1:
movl %eax, %ebp
movw $0x10, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
movw %ax, %fs
movw %ax, %gs
movl %ebp, %eax
jmp _c_main
.code16
_start:
/* Go to protected mode */
cli
movl %eax, %ebp
xorl %eax, %eax
movl %eax, %cr3
movw %cs, %ax
shlw $4, %ax
movw $gdt, %bx
subw %ax, %bx
data32 lgdt %cs:(%bx)
movl %cr0, %eax
andl $0x7ffaffd1, %eax
orl $0x60000001, %eax
movl %eax, %cr0
movl %ebp, %eax
data32 ljmp $0x08, $_pmode_start
/* GDT */
.align 4
gdt:
.word gdt_size
.long gdt
.word 0
.word 0xffff, 0x0000
.byte 0x00, 0x9b, 0xcf, 0x00
.word 0xffff, 0x0000
.byte 0x00, 0x93, 0xcf, 0x00
gdt_size = (. - gdt - 1)
/* Messages */
.section ".messages"
.globl program_name
program_name:
.ascii "SerialICE v" VERSION " (" __DATE__ ")"
.byte 0x00
.globl program_copyright
program_copyright:
.string "Copyright (C) 2009 coresystems GmbH."
/* Reset Vector */
.section ".reset"
.globl reset_vector
reset_vector:
.code16
jmp _start
Makefile.sig
Description: Binary data
serialice.ld.sig
Description: Binary data
start.S.sig
Description: Binary data
-- coreboot mailing list: [email protected] http://www.coreboot.org/mailman/listinfo/coreboot

