Date: Fri, 5 Jun 2020 08:46:55 +0000 (UTC) From: Alex Richardson <arichardson@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361830 - head/lib/csu/mips Message-ID: <202006050846.0558ktdP028859@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: arichardson Date: Fri Jun 5 08:46:55 2020 New Revision: 361830 URL: https://svnweb.freebsd.org/changeset/base/361830 Log: csu: Avoid additional nops in the MIPS INIT_CALL_SEQ macro Since we had a .set reorder, the nop after the "jal" was being placed after the delay slot, resulting in two nops. While changing this code also guard the .set noreorder with .set push/pop and use $zero as the cpsetup save register since we don't need to save $gp. Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D25025 Modified: head/lib/csu/mips/crt.h Modified: head/lib/csu/mips/crt.h ============================================================================== --- head/lib/csu/mips/crt.h Fri Jun 5 08:46:50 2020 (r361829) +++ head/lib/csu/mips/crt.h Fri Jun 5 08:46:55 2020 (r361830) @@ -30,29 +30,31 @@ #define CTORS_CONSTRUCTORS #ifdef __mips_o32 #define INIT_CALL_SEQ(func) \ + ".set push \n" \ ".set noreorder \n" \ "bal 1f \n" \ "nop \n" \ "1: \n" \ ".cpload $ra \n" \ "addu $sp, $sp, -8 \n" \ - ".set reorder \n" \ ".cprestore 4 \n" \ ".local " __STRING(func) "\n" \ "jal " __STRING(func) "\n" \ "nop \n" \ - "addu $sp, $sp, 8 \n" + "addu $sp, $sp, 8 \n" \ + ".set pop\n" #else #define INIT_CALL_SEQ(func) \ + ".set push \n" \ ".set noreorder \n" \ "bal 1f \n" \ "nop \n" \ "1: \n" \ - ".set reorder \n" \ - ".cpsetup $ra, $v0, 1b \n" \ + ".cpsetup $ra, $zero, 1b \n" \ ".local " __STRING(func) "\n" \ "jal " __STRING(func) "\n" \ - "nop \n" + "nop \n" \ + ".set pop\n" #endif #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006050846.0558ktdP028859>