7.1 _start 入口函数

7.1.1 vectors.S (arch\arm\lib)

  从上一节可以知道,uboot 的入口函数为 _start 。此 函数定义在 vectors.S (arch\arm\lib) 中。

  在此文件中,定义了异常向量表,及其操作函数。_start 开始后,直接跳入  reset 复位中执行启动。

 #include <config.h>

 /*
*************************************************************************
*
* Symbol _start is referenced elsewhere, so make it global
*
*************************************************************************
*/
/* 定义全局函数 _start,为 uboot 代码的起始函数 */
.globl _start /*
*************************************************************************
*
* Vectors have their own section so linker script can map them easily
*
*************************************************************************
*/ .section ".vectors", "ax" /*
*************************************************************************
*
* Exception vectors as described in ARM reference manuals
*
* Uses indirect branch to allow reaching handlers anywhere in memory.
*
*************************************************************************
*/ _start: #ifdef CONFIG_SYS_DV_NOR_BOOT_CFG
.word CONFIG_SYS_DV_NOR_BOOT_CFG
#endif
/* 当异常发生的时候,由硬件机制处理器自动的跳到一个固定地址去执行相关异常处理程序,而这个固定地址就是所谓的异常向量。 */
b reset /* 跳转到reset执行 0x00000000 复位异常*/
/* LDR{条件} 目的寄存器 <存储器地址> */
ldr pc, _undefined_instruction /* 未定义指令终止模式,当未定义指令执行时进入该模式,可用于支持硬件协处理器的软件仿真 */
ldr pc, _software_interrupt /* 软中断异常 */
ldr pc, _prefetch_abort /* 预取异常 */
ldr pc, _data_abort /* 数据访问终止模式,当数据或指令预取终止时进入该模式,可用于虚拟存储及存储保护 */
ldr pc, _not_used /* 未使用异常,多余的指令 */
ldr pc, _irq /* 中断模式,用于通用的中断处理 */
ldr pc, _fiq /* 快速中断模式,用于高速数据传输或通道处理 */ #ifdef CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK
/*
* Various SoCs need something special and SoC-specific up front in
* order to boot, allow them to set that in their boot0.h file and then
* use it here.
*/
#include <asm/arch/boot0.h>
ARM_SOC_BOOT0_HOOK
#endif /*
*************************************************************************
*
* Indirect vectors table
*
* Symbols referenced here must be defined somewhere else
*
*************************************************************************
*/ .globl _undefined_instruction
.globl _software_interrupt
.globl _prefetch_abort
.globl _data_abort
.globl _not_used
.globl _irq
.globl _fiq _undefined_instruction: .word undefined_instruction
_software_interrupt: .word software_interrupt
_prefetch_abort: .word prefetch_abort
_data_abort: .word data_abort
_not_used: .word not_used
_irq: .word irq
_fiq: .word fiq .balignl ,0xdeadbeef /*
*************************************************************************
*
* Interrupt handling
*
*************************************************************************
*/ /* SPL interrupt handling: just hang */ #ifdef CONFIG_SPL_BUILD /** CONFIG_SPL_BUILD 未定义,不走此分支 */ .align
undefined_instruction:
software_interrupt:
prefetch_abort:
data_abort:
not_used:
irq:
fiq: :
bl 1b /* hang and never return */ #else /* !CONFIG_SPL_BUILD */ /* IRQ stack memory (calculated at run-time) + 8 bytes */
.globl IRQ_STACK_START_IN
IRQ_STACK_START_IN:
.word 0x0badc0de #ifdef CONFIG_USE_IRQ /** CONFIG_USE_IRQ 未定义 不走 */
/* IRQ stack memory (calculated at run-time) */
.globl IRQ_STACK_START
IRQ_STACK_START:
.word 0x0badc0de /* IRQ stack memory (calculated at run-time) */
.globl FIQ_STACK_START
FIQ_STACK_START:
.word 0x0badc0de #endif /* CONFIG_USE_IRQ */ @
@ IRQ stack frame.
@
#define S_FRAME_SIZE 72 #define S_OLD_R0 68
#define S_PSR 64
#define S_PC 60
#define S_LR 56
#define S_SP 52 #define S_IP 48
#define S_FP 44
#define S_R10 40
#define S_R9 36
#define S_R8 32
#define S_R7 28
#define S_R6 24
#define S_R5 20
#define S_R4 16
#define S_R3 12
#define S_R2 8
#define S_R1 4
#define S_R0 0 #define MODE_SVC 0x13
#define I_BIT 0x80 /*
* use bad_save_user_regs for abort/prefetch/undef/swi ...
* use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling
* 发生异常中断时候保存的用户信息的寄存器设置
*/ .macro bad_save_user_regs
@ carve out a frame on current user stack
sub sp, sp, #S_FRAME_SIZE
stmia sp, {r0 - r12} @ Save user registers (now in svc mode) r0-r12
ldr r2, IRQ_STACK_START_IN
@ get values for "aborted" pc and cpsr (into parm regs)
ldmia r2, {r2 - r3}
add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack
add r5, sp, #S_SP
mov r1, lr
stmia r5, {r0 - r3} @ save sp_SVC, lr_SVC, pc, cpsr
mov r0, sp @ save current stack into r0 (param register)
.endm .macro irq_save_user_regs
sub sp, sp, #S_FRAME_SIZE
stmia sp, {r0 - r12} @ Calling r0-r12
@ !!!! R8 NEEDS to be saved !!!! a reserved stack spot would be good.
add r8, sp, #S_PC
stmdb r8, {sp, lr}^ @ Calling SP, LR
str lr, [r8, #] @ Save calling PC
mrs r6, spsr
str r6, [r8, #] @ Save CPSR
str r0, [r8, #] @ Save OLD_R0
mov r0, sp
.endm .macro irq_restore_user_regs
ldmia sp, {r0 - lr}^ @ Calling r0 - lr
mov r0, r0
ldr lr, [sp, #S_PC] @ Get PC
add sp, sp, #S_FRAME_SIZE
subs pc, lr, # @ return & move spsr_svc into cpsr
.endm .macro get_bad_stack
ldr r13, IRQ_STACK_START_IN @ setup our mode stack str lr, [r13] @ save caller lr in position of saved stack
mrs lr, spsr @ get the spsr
str lr, [r13, #] @ save spsr in position of saved stack
mov r13, #MODE_SVC @ prepare SVC-Mode
@ msr spsr_c, r13
msr spsr, r13 @ switch modes, make sure moves will execute
mov lr, pc @ capture return pc
movs pc, lr @ jump to next instruction & switch modes.
.endm .macro get_irq_stack @ setup IRQ stack
ldr sp, IRQ_STACK_START
.endm .macro get_fiq_stack @ setup FIQ stack
ldr sp, FIQ_STACK_START
.endm /*
* exception handlers
*/ .align
undefined_instruction:
get_bad_stack
bad_save_user_regs
bl do_undefined_instruction .align
software_interrupt:
get_bad_stack
bad_save_user_regs
bl do_software_interrupt .align
prefetch_abort:
get_bad_stack
bad_save_user_regs
bl do_prefetch_abort .align
data_abort:
get_bad_stack
bad_save_user_regs
bl do_data_abort .align
not_used:
get_bad_stack
bad_save_user_regs
bl do_not_used #ifdef CONFIG_USE_IRQ .align
irq:
get_irq_stack
irq_save_user_regs
bl do_irq
irq_restore_user_regs .align
fiq:
get_fiq_stack
/* someone ought to write a more effiction fiq_save_user_regs */
irq_save_user_regs
bl do_fiq
irq_restore_user_regs #else .align
irq:
get_bad_stack
bad_save_user_regs
bl do_irq .align
fiq:
get_bad_stack
bad_save_user_regs
bl do_fiq #endif /* CONFIG_USE_IRQ */ #endif /* CONFIG_SPL_BUILD */

7.1.2 start.S (arch\arm\cpu\arm920t)

  在此汇编中,主要执行  reset  函数,主要是做一些重要的硬件初始化、重定向arm启动到 ram,设置栈、跳转到第二阶段去执行启动、

 #include <asm-offsets.h>
#include <common.h>
#include <config.h> /*
*************************************************************************
*
* Startup Code (called from the ARM reset exception vector)
*
* do important init only if we don't start from memory!
* relocate armboot to ram
* setup stack
* jump to second stage
*
*************************************************************************
*/ .globl reset reset:
/*
* set the cpu to SVC32 mode
* 将 CPU 设置为管理员(SVC)模式
*/
mrs r0, cpsr /** 将状态寄存器的内容传送至通用寄存器,将 CPSR 中的内容传送至 R0 */
bic r0, r0, #0x1f /** 位清除指令 将 R0 最低 5 位清零,其余位不变 工作模式位清零 */
orr r0, r0, #0xd3 /** 工作模式位设置为“10011”(管理模式),并将中断禁止位和快中断禁止位置1
"1101 0011" 指令用于在两个操作数上进行逻辑或运算,并把结果放置到目的寄存器中 */
msr cpsr, r0 /** 将通用寄存器的内容传送至状态寄存器, 将中的内容 R0 传送至CPSR */ #if defined(CONFIG_AT91RM9200DK) || defined(CONFIG_AT91RM9200EK)
/*
* relocate exception table
*/
ldr r0, =_start
ldr r1, =0x0
mov r2, #
copyex:
subs r2, r2, #
ldr r3, [r0], #
str r3, [r1], #
bne copyex
#endif #ifdef CONFIG_S3C24X0 /** 寄存器设置 */
#if defined(CONFIG_S3C2400)
#define pWTCON 0x15300000
#define INTMSK 0x14400008 /* Interrupt-Controller base addresses */
#define CLKDIVN 0x14800014 /* clock divisor register */
#else
#define pWTCON 0x53000000 /** 看门狗定时器控制寄存器 */
#define INTMSK 0x4A000008 /** 中断屏蔽寄存器, bit 写 1 为屏蔽, 0 为开中断 */
#define INTSUBMSK 0x4A00001C /** 中断次级屏蔽寄存器, 与 INTMSK 一样 */
#define CLKDIVN 0x4C000014 /** 时钟分频控制寄存器 */
#endif /** 关闭看门狗 */
ldr r0, =pWTCON
mov r1, #0x0
str r1, [r0] /** 屏蔽所有中断 */
mov r1, #0xffffffff
ldr r0, =INTMSK
str r1, [r0]
# if defined(CONFIG_S3C2410)
ldr r1, =0x3ff
ldr r0, =INTSUBMSK
str r1, [r0]
# endif /** 时钟分频设置,FCLK 是CPU 的时钟, HCLK 是 AHB 总线外设的时钟, PCLK 是 APB 总线外设的时钟
默认的 FCLK 是 120M, FCLK:HCLK:PCLK = 1:2:4 */
ldr r0, =CLKDIVN
mov r1, #
str r1, [r0]
#endif /* CONFIG_S3C24X0 */ /*
* we do sys-critical inits only at reboot,
* not when booting from ram!
*/
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
/* CPU 关键初始化 */
bl cpu_init_crit
#endif bl _main /*------------------------------------------------------------------------------*/ .globl c_runtime_cpu_setup
c_runtime_cpu_setup: mov pc, lr /*
*************************************************************************
*
* CPU_init_critical registers
*
* setup important registers
* setup memory timing
*
*************************************************************************
*/ #ifndef CONFIG_SKIP_LOWLEVEL_INIT
cpu_init_crit: /** flush v4 I/D caches, 刷新L1 cache的icache和dcache */
mov r0, # /** 置零r0通用寄存器 */
mcr p15, , r0, c7, c7, /* flush v3/v4 cache, 向c7写入0将使ICache与DCache无效 "0"表示省略opcode_2 MCR{<cond>} p15, 0, <Rd>, <CRn>, <CRm>{,<opcode_2>} */
mcr p15, , r0, c8, c7, /* flush v4 TLB, MCR{条件} 协处理器编码,协处理器操作码1,源寄存器,目的寄存器1,目的寄存器2,协处理器操作码2 */ /** disable MMU stuff and caches, 关闭 MMU 及其 caches */
mrc p15, , r0, c1, c0,
bic r0, r0, #0x00002300 @ clear bits , : (--V- --RS)
bic r0, r0, #0x00000087 @ clear bits , : (B--- -CAM)
orr r0, r0, #0x00000002 @ set bit (A) Align
orr r0, r0, #0x00001000 @ set bit (I) I-Cache
mcr p15, , r0, c1, c0, #ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY
/*
* before relocating, we have to setup RAM timing
* because memory timing is board-dependend, you will
* find a lowlevel_init.S in your board directory.
*/
mov ip, lr /** 保存当前程序地址到 ip 寄存器 */ bl lowlevel_init /** 执行 SDRAM 初始化 */
mov lr, ip
#endif
mov pc, lr /** return */
#endif /* CONFIG_SKIP_LOWLEVEL_INIT */

7.1.3 内存控制器初始化

  lowlevel_init.S (board\samsung\jz2440)

  主要是为了初始化 SDRAM

 #include <config.h>
#include <version.h> /* some parameters for the board */ /*
*
* Taken from linux/arch/arm/boot/compressed/head-s3c2410.S
*
* Copyright (C) 2002 Samsung Electronics SW.LEE <hitchcar@sec.samsung.com>
*
*/ /** =============== BWSCON: 地址 0x48000000 总线宽度和等待控制寄存器 ================ */
#define BWSCON 0x48000000 /* DW:数据总线宽度数据定义 */
#define DW8 (0x0) /** 8 位数据总线宽度 */
#define DW16 (0x1) /** 16 位数据总线宽度 */
#define DW32 (0x2) /** 32 位数据总线宽度 */ /* WS: wait 状态 */
#define WAIT (0x1<<2) /** 开启 BANK 的 WAIT 功能 */ /* ST: 是否使用 使用 UB/LB */
#define UBLB (0x1<<3) /** BANK 使用 UB/LB */ #define B1_BWSCON (DW32) /** BANK1 的总线位宽设置 32 位 */
#define B2_BWSCON (DW16) /** BANK2 的总线位宽设置 16 位 */
#define B3_BWSCON (DW16 + WAIT + UBLB) /** BANK3 的总线位宽设置 16 位,使能 WAIT 和 UB/LB */
#define B4_BWSCON (DW16) /** BANK4 的总线位宽设置 16 位 */
#define B5_BWSCON (DW16) /** BANK5 的总线位宽设置 16 位 */
#define B6_BWSCON (DW32) /** BANK6 的总线位宽设置 32 位 */
#define B7_BWSCON (DW32) /** BANK7 的总线位宽设置 32 位 */ /** =================================== end BWSCON =============================== */ /** =============== BANK0CON: 地址 0x48000004 BANK0 控制寄存器 ===================== */
#define B0_Tacs 0x0 /* 0clk */
#define B0_Tcos 0x0 /* 0clk */
#define B0_Tacc 0x7 /* 14clk */
#define B0_Tcoh 0x0 /* 0clk */
#define B0_Tah 0x0 /* 0clk */
#define B0_Tacp 0x0
#define B0_PMC 0x0 /* normal */
/** =================================== end BANK0CON =============================== */ /** =============== BANK1CON: 地址 0x48000008 BANK1 控制寄存器 ===================== */
#define B1_Tacs 0x0 /* 0clk */
#define B1_Tcos 0x0 /* 0clk */
#define B1_Tacc 0x7 /* 14clk */
#define B1_Tcoh 0x0 /* 0clk */
#define B1_Tah 0x0 /* 0clk */
#define B1_Tacp 0x0
#define B1_PMC 0x0
/** =================================== end BANK1CON =============================== */ /** =============== BANK2CON: 地址 0x4800000C BANK2 控制寄存器 ===================== */
#define B2_Tacs 0x0
#define B2_Tcos 0x0
#define B2_Tacc 0x7
#define B2_Tcoh 0x0
#define B2_Tah 0x0
#define B2_Tacp 0x0
#define B2_PMC 0x0
/** =================================== end BANK2CON =============================== */ /** =============== BANK3CON: 地址 0x48000010 BANK3 控制寄存器 ===================== */
#define B3_Tacs 0x0 /* 0clk */
#define B3_Tcos 0x3 /* 4clk */
#define B3_Tacc 0x7 /* 14clk */
#define B3_Tcoh 0x1 /* 1clk */
#define B3_Tah 0x0 /* 0clk */
#define B3_Tacp 0x3 /* 6clk */
#define B3_PMC 0x0 /* normal */
/** =================================== end BANK3CON =============================== */ /** =============== BANK4CON: 地址 0x48000014 BANK4 控制寄存器 ===================== */
#define B4_Tacs 0x0 /* 0clk */
#define B4_Tcos 0x0 /* 0clk */
#define B4_Tacc 0x7 /* 14clk */
#define B4_Tcoh 0x0 /* 0clk */
#define B4_Tah 0x0 /* 0clk */
#define B4_Tacp 0x0
#define B4_PMC 0x0 /* normal */
/** =================================== end BANK4CON =============================== */ /** =============== BANK5CON: 地址 0x48000018 BANK5 控制寄存器 ===================== */
#define B5_Tacs 0x0 /* 0clk */
#define B5_Tcos 0x0 /* 0clk */
#define B5_Tacc 0x7 /* 14clk */
#define B5_Tcoh 0x0 /* 0clk */
#define B5_Tah 0x0 /* 0clk */
#define B5_Tacp 0x0
#define B5_PMC 0x0 /* normal */
/** =================================== end BANK5CON =============================== */ /** =============== BANK6CON: 地址 0x4800001C BANK6 控制寄存器 ===================== */
#define B6_MT 0x3 /* 配置BANK6的存器类型为 SDRAM */
#define B6_Trcd 0x1
#define B6_SCAN 0x1 /* 9bit */
/** =================================== end BANK6CON =============================== */ /** =============== BANK7CON: 地址 0x48000020 BANK7 控制寄存器 ===================== */
#define B7_MT 0x3 /* SDRAM */
#define B7_Trcd 0x1 /* RAS 到 CAS 的延迟为 3 个时钟 */
#define B7_SCAN 0x1 /* 列地址数为 9bit */
/** =================================== end BANK7CON =============================== */ /** =============== REFRESH: 地址 0x48000024 BANK7 SDRAM 刷新控制寄存器 ===================== */
#define REFEN 0x1 /* SDRAM 刷新使能 */
#define TREFMD 0x0 /* SDRAM 刷新模式为 CBR/自动刷新*/
#define Trp 0x0 /* SDRAM RAS 预充电时间 2 个时钟 */
#define Trc 0x3 /* SDRAM 半行周期时间 7 个时钟 */
#define Tchr 0x2 /* 3clk */
#define REFCNT 1113 /* SDRAM 刷新计数值, period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */
/** ======================================== end REFRESH ================================== */ .globl lowlevel_init
lowlevel_init:
/* memory control configuration */
/* make r0 relative the current location so that it */
/* reads SMRDATA out of FLASH rather than memory ! */
ldr r0, =SMRDATA /** 执行 SMRDATA 函数,对各个寄存器进行配置 */
ldr r1, =CONFIG_SYS_TEXT_BASE /** CONFIG_SYS_TEXT_BASE 为 0 */
sub r0, r0, r1
ldr r1, =BWSCON /* Bus Width Status Controller */
add r2, r0, #* /* 将SMRDATA这一块地址赋值给r2中 */
: /** 循环操作 */
ldr r3, [r0], #
str r3, [r1], #
cmp r2, r0
bne 0b /* everything is fine now */
mov pc, lr .ltorg
/* the literal pools origin */ SMRDATA:
.word (+(B1_BWSCON<<)+(B2_BWSCON<<)+(B3_BWSCON<<)+(B4_BWSCON<<)+(B5_BWSCON<<)+(B6_BWSCON<<)+(B7_BWSCON<<))
.word ((B0_Tacs<<)+(B0_Tcos<<)+(B0_Tacc<<)+(B0_Tcoh<<)+(B0_Tah<<)+(B0_Tacp<<)+(B0_PMC))
.word ((B1_Tacs<<)+(B1_Tcos<<)+(B1_Tacc<<)+(B1_Tcoh<<)+(B1_Tah<<)+(B1_Tacp<<)+(B1_PMC))
.word ((B2_Tacs<<)+(B2_Tcos<<)+(B2_Tacc<<)+(B2_Tcoh<<)+(B2_Tah<<)+(B2_Tacp<<)+(B2_PMC))
.word ((B3_Tacs<<)+(B3_Tcos<<)+(B3_Tacc<<)+(B3_Tcoh<<)+(B3_Tah<<)+(B3_Tacp<<)+(B3_PMC))
.word ((B4_Tacs<<)+(B4_Tcos<<)+(B4_Tacc<<)+(B4_Tcoh<<)+(B4_Tah<<)+(B4_Tacp<<)+(B4_PMC))
.word ((B5_Tacs<<)+(B5_Tcos<<)+(B5_Tacc<<)+(B5_Tcoh<<)+(B5_Tah<<)+(B5_Tacp<<)+(B5_PMC))
.word ((B6_MT<<)+(B6_Trcd<<)+(B6_SCAN))
.word ((B7_MT<<)+(B7_Trcd<<)+(B7_SCAN))
.word ((REFEN<<)+(TREFMD<<)+(Trp<<)+(Trc<<)+(Tchr<<)+REFCNT)
.word 0x32
.word 0x30
.word 0x30

六、uboot 代码流程分析---start.S的更多相关文章

  1. 十、uboot 代码流程分析---run_main_loop

    调用 board_init_r,传入全局 GD 和 SDRAM 中的目的地址 gd->rellocaddr void board_init_r(gd_t *new_gd, ulong dest_ ...

  2. 八、uboot 代码流程分析---board_init_f

    接着上一节,板子开始做前期初始化工作. 8.1 board_init_f Board_f.c (common) /* 板子初次初始化.boot_flags = 0 */ void board_init ...

  3. 七、uboot 代码流程分析---C环境建立

    7.1 start.S 修改 在上一节中的流程中,发现初始化的过程并没由设置看门狗,也未进行中断屏蔽 如果看门狗不禁用,会导致系统反复重启,因此需要在初始化的时候禁用看门狗:中断屏蔽保证启动过程中不出 ...

  4. 九、uboot 代码流程分析---relloc_code

    执行完 board_init_f 后,重新跳转回 _main 中执行. 9.1 relloc_code 前 9.1.1 gd 设置 在调用board_init_f()完成板卡与全局结构体变量 gd 的 ...

  5. u-boot启动流程分析(2)_板级(board)部分

    转自:http://www.wowotech.net/u-boot/boot_flow_2.html 目录: 1. 前言 2. Generic Board 3. _main 4. global dat ...

  6. [国嵌笔记][030][U-Boot工作流程分析]

    uboot工作流程分析 程序入口 1.打开顶层目录的Makefile,找到目标smdk2440_config的命令中的第三项(smdk2440) 2.进入目录board/samsung/smdk244 ...

  7. imx6 uboot启动流程分析

    参考http://blog.csdn.net/skyflying2012/article/details/25804209 这里以imx6平台为例,分析uboot启动流程对于任何程序,入口函数是在链接 ...

  8. Uboot启动流程分析(三)

    1.前言 在前面的文章Uboot启动流程分析(二)中,链接如下: https://www.cnblogs.com/Cqlismy/p/12002764.html 已经对_main函数的整个大体调用流程 ...

  9. Uboot启动流程分析(二)

    1.前言 在前面的文章Uboot启动流程分析(一)中,链接如下: https://www.cnblogs.com/Cqlismy/p/12000889.html 已经简单地分析了low_level_i ...

随机推荐

  1. FICO基础知识(一)

    GL – 总账 (General Ledger) 总帐核算的中心任务是提供外部会计及其所涉及帐户的概貌. 总账会计主要用途:根据不同的会计准则(如欧洲的 IAS, 美国的GAAP, 中国国家会计准则) ...

  2. OneZero——Review会议(2013.5.20)

    1. 时间: 2016年5月20日. 2. 成员: X 夏一鸣 * 组长 (博客:http://www.cnblogs.com/xiaym896/), G 郭又铭 (博客:http://www.cnb ...

  3. Get请求,Post请求乱码问题解决方案

    下面以两种常见的请求方式为例讲解乱码问题的解决方法. 1.Post方式请求乱码. 自从Tomcat5.x以来,Get方式和Post方式提交的请求,tomcat会采用不同的方式来处理编码. 对于Post ...

  4. Gitblit 的安装使用

    1.下载gitblit,可以网上下载,也可以在下面云盘链接取 gitblit-1.8.0  下载链接:https://pan.baidu.com/s/1x7dnbyDp1FmYjMosJbGR8w 密 ...

  5. LOJ117 有源汇有上下界最小流(上下界网络流)

    跑出可行流后从原来的汇点向原来的源点跑最大流,原图最小流=inf-maxflow.显然超源超汇的相关边对其也没有影响.原图最小流=可行流-原图新增流量,因为t向s流量增加相当于s向t流量减少.但为什么 ...

  6. JavaScript利用递归和循环实现阶乘

    [实现方法] 1.利用while循环来做,当然for循环也可以. 2.递归 [代码内容] 偷懒,直接用onkeyup事件来限制来页面的输入 循环代码: //第一种方法 while循环 oCount.o ...

  7. poj1154 【DFS】

    LETTERS Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8976   Accepted: 4017 Descripti ...

  8. 读取Properties文件以及中文乱码问题

    在java类中常见的读取Properties文件方式,是使用Properties.load(inputStream);的方式但是常常出现中文乱码问题,这就很尴尬了 public synchronize ...

  9. idea 项目打包发布

    clean install -Dmaven.test.skip=true -pl 项目名(maven为准) -am -amd

  10. 洛谷CF868F Yet Another Minimization Problem(动态规划,决策单调性,分治)

    洛谷题目传送门 貌似做所有的DP题都要先搞出暴力式子,再往正解上靠... 设\(f_{i,j}\)为前\(i\)个数分\(j\)段的最小花费,\(w_{l,r}\)为\([l,r]\)全在一段的费用. ...