freemyipod r147 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r146‎ | r147 | r148 >
Date:15:03, 18 August 2010
Author:theseven
Status:new
Tags:
Comment:
Some magic to make integer divisions in emBIOS apps work seamlessly
Modified paths:
  • /apps/helloworld/Makefile (modified) (history)
  • /apps/iloader/Makefile (modified) (history)
  • /apps/uninstaller-nano2g/Makefile (modified) (history)
  • /embios/trunk/arm/arm-support.S (modified) (history)
  • /embios/trunk/arm/contextswitch.S (modified) (history)
  • /embios/trunk/export/armhelpers.S (added) (history)

Diff [purge]

Index: apps/iloader/Makefile
@@ -9,7 +9,7 @@
1010 OBJCOPY := $(CROSS)objcopy
1111 UCLPACK := ucl2e10singleblk
1212
13 -CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections
 13+CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections -mcpu=arm940t
1414 LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
1515
1616 preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
@@ -18,9 +18,11 @@
1919 REVISION := $(shell svnversion .)
2020 REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
2121
 22+HELPERS := build/__embios_armhelpers.o
 23+
2224 SRC := $(call preprocesspaths,SOURCES,-I. -I..)
2325 OBJ := $(SRC:%.c=build/%.o)
24 -OBJ := $(OBJ:%.S=build/%.o)
 26+OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
2527
2628 all: $(NAME) themes
2729
@@ -74,6 +76,15 @@
7577 endif
7678 @rm -f $@.dep.tmp
7779
 80+build/__embios_%.o: $(EMBIOSDIR)/export/%.S
 81+ @echo [CC] $<
 82+ifeq ($(shell uname),WindowsNT)
 83+ @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
 84+else
 85+ @-mkdir -p $(dir $@)
 86+endif
 87+ @$(CC) -c $(CFLAGS) -o $@ $<
 88+
7889 build/version.h: version.h .svn/entries
7990 @echo [PP] $<
8091 ifeq ($(shell uname),WindowsNT)
Index: apps/uninstaller-nano2g/Makefile
@@ -9,7 +9,7 @@
1010 OBJCOPY := $(CROSS)objcopy
1111 UCLPACK := ucl2e10singleblk
1212
13 -CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections
 13+CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections -mcpu=arm940t
1414 LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
1515
1616 preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
@@ -18,9 +18,11 @@
1919 REVISION := $(shell svnversion .)
2020 REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
2121
 22+HELPERS := build/__embios_armhelpers.o
 23+
2224 SRC := $(call preprocesspaths,SOURCES,-I. -I..)
2325 OBJ := $(SRC:%.c=build/%.o)
24 -OBJ := $(OBJ:%.S=build/%.o)
 26+OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
2527
2628 all: $(NAME)
2729
@@ -74,6 +76,15 @@
7577 endif
7678 @rm -f $@.dep.tmp
7779
 80+build/__embios_%.o: $(EMBIOSDIR)/export/%.S
 81+ @echo [CC] $<
 82+ifeq ($(shell uname),WindowsNT)
 83+ @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
 84+else
 85+ @-mkdir -p $(dir $@)
 86+endif
 87+ @$(CC) -c $(CFLAGS) -o $@ $<
 88+
7889 build/version.h: version.h .svn/entries
7990 @echo [PP] $<
8091 ifeq ($(shell uname),WindowsNT)
Index: apps/helloworld/Makefile
@@ -9,7 +9,7 @@
1010 OBJCOPY := $(CROSS)objcopy
1111 UCLPACK := ucl2e10singleblk
1212
13 -CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections
 13+CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections -mcpu=arm940t
1414 LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
1515
1616 preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
@@ -18,9 +18,11 @@
1919 REVISION := $(shell svnversion .)
2020 REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
2121
 22+HELPERS := build/__embios_armhelpers.o
 23+
2224 SRC := $(call preprocesspaths,SOURCES,-I. -I..)
2325 OBJ := $(SRC:%.c=build/%.o)
24 -OBJ := $(OBJ:%.S=build/%.o)
 26+OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
2527
2628 all: $(NAME)
2729
@@ -74,6 +76,15 @@
7577 endif
7678 @rm -f $@.dep.tmp
7779
 80+build/__embios_%.o: $(EMBIOSDIR)/export/%.S
 81+ @echo [CC] $<
 82+ifeq ($(shell uname),WindowsNT)
 83+ @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
 84+else
 85+ @-mkdir -p $(dir $@)
 86+endif
 87+ @$(CC) -c $(CFLAGS) -o $@ $<
 88+
7889 build/version.h: version.h .svn/entries build
7990 @echo [PP] $<
8091 ifeq ($(shell uname),WindowsNT)
Index: embios/trunk/arm/contextswitch.S
@@ -59,6 +59,9 @@
6060 swilist_start:
6161 b panicf
6262 b get_syscall_table
 63+ b __clzsi2
 64+ b __aeabi_uidivmod
 65+ b __aeabi_idivmod
6366 swilist_end:
6467
6568 syscall_breakpoint:
Index: embios/trunk/arm/arm-support.S
@@ -673,6 +673,13 @@
674674 #endif
675675
676676 #else
 677+ .global __clzsi2
 678+ .type __clzsi2, %function
 679+
 680+__clzsi2:
 681+ clz r0, r0
 682+ bx lr
 683+
677684 #ifndef __ARM_EABI__
678685 __udivsi3:
679686 ARMV5_UDIV32_BODY r0, r1, r0, "", r2, r3, ip, __div0_wrap, 1
Index: embios/trunk/export/armhelpers.S
@@ -0,0 +1,57 @@
 2+@
 3+@
 4+@ Copyright 2010 TheSeven
 5+@
 6+@
 7+@ This file is part of emBIOS.
 8+@
 9+@ emBIOS is free software: you can redistribute it and/or
 10+@ modify it under the terms of the GNU General Public License as
 11+@ published by the Free Software Foundation, either version 2 of the
 12+@ License, or (at your option) any later version.
 13+@
 14+@ emBIOS is distributed in the hope that it will be useful,
 15+@ but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 17+@ See the GNU General Public License for more details.
 18+@
 19+@ You should have received a copy of the GNU General Public License
 20+@ along with emBIOS. If not, see <http://www.gnu.org/licenses/>.
 21+@
 22+@
 23+
 24+
 25+ .section .text.__embios_armhelpers
 26+ .global __clzsi2
 27+ .type __clzsi2, %function
 28+ .global __aeabi_uidivmod
 29+ .type __aeabi_uidivmod,%function
 30+ .global __aeabi_uidiv
 31+ .type __aeabi_uidiv,%function
 32+ .set __aeabi_uidiv,__aeabi_uidivmod
 33+ .global __aeabi_idivmod
 34+ .type __aeabi_idivmod,%function
 35+ .global __aeabi_idiv
 36+ .type __aeabi_idiv,%function
 37+ .set __aeabi_idiv,__aeabi_idivmod
 38+
 39+__clzsi2:
 40+ str lr, [sp,#-4]!
 41+ swi 3
 42+ ldr lr, [sp], #4
 43+ bx lr
 44+ .size __clzsi2, .-__clzsi2
 45+
 46+__aeabi_uidivmod:
 47+ str lr, [sp,#-4]!
 48+ swi 4
 49+ ldr lr, [sp], #4
 50+ bx lr
 51+ .size __aeabi_uidivmod, . - __aeabi_uidivmo
 52+
 53+__aeabi_idivmod:
 54+ str lr, [sp,#-4]!
 55+ swi 5
 56+ ldr lr, [sp], #4
 57+ bx lr
 58+ .size __aeabi_idivmod, . - __aeabi_idivmod